B4J Question Application ICON

tcgoh

Active Member
Licensed User
Longtime User
Hi,

I searched and looked into all folders but was unable to find a setting for ICON.

How to set a ICON for the distributed application? Or it will only be the standard ICON?

Thanks
JAR.JPG
 

stevel05

Expert
Licensed User
Longtime User
You can set the icon to appear in the Title bar of the running app, and also in the running apps bar (win 8 at least) but not in the file folders with this code.

B4X:
Sub SetUpWindow(Title As String,IconDir As String,IconFile As String)

    Dim Image1 As Image
    MainForm.Title = Title
    MainForm.SetFormStyle("DECORATED")
   
    'Get image for icon
    Image1.Initialize(IconDir,IconFile)
    'Use JavaObject to get the Node we need
    Dim JO As JavaObject = MainForm.RootPane
    JO =JO.RunMethod("getScene",Null)
    JO = JO.RunMethod("getWindow",Null)
    'Get the current Icon List for the node
    Dim SIcons As List = JO.RunMethod("getIcons",Null)
    'Add icon to Stage/Window
    SIcons.Add(Image1)
End Sub
 
Upvote 0

mrossen

Active Member
Licensed User
Longtime User
On Windows 8.1 it also appears in the running apps bar at the bottom with :

B4X:
MainForm.Icon = fx.LoadImage(File.DirAssets, "icon.jpg")

Mogens
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Thanks, I missed MainForm.Icon :(
 
Upvote 0

tcgoh

Active Member
Licensed User
Longtime User
Hi Erel and Steve,

Thanks for the quick reply. I'm actually looking to convert Jar file to dmg for Mac.
I'll google for it. Maybe "Jar bundler" for Mac is why I'm looking for.

Thanks again
 
Upvote 0
Top