I am trying to set the application icon for a simple scala swing application. I set the MainFrame.iconImage
but that seems to have no effect. The application's icon in the windows taskbar and the window frame is still the java logo.
Here is the test code I am using.
package uiTest
import swing._
import swing.event._
import Swing._
import javax.swing._
object HelloWorld extends SimpleSwingApplication {
def top = new MainFrame {
title = "Hello World"
preferredSize = new Dimension(200, 200)
iconImage = toolkit.getImage("/Logo.png") // does nothing.
println(iconImage.getWidth(peer)) // -1
contents = new BoxPanel(Orientation.Vertical) {
contents += new Label {
// successfully displays my logo so no resource issues.
icon = new ImageIcon(getClass.getResource("/Logo.png"))
}
}
}
}
My only idea left is that Frame.iconImage
has nothing to do with the application icon. In that case, where do I set the application icon? An then what does Frame.iconImage
do then?
This question indicated that it was not possbile on OSX. Is that the same on Windows?