How can I display an image as the background of griffon application?
-
14-06-2021 - |
Question
I was trying using the CSSBuilder plugin but it seems that it does not support the CSS background image property.
I have been searching in google and it seems you can add background image to a swing panel by subclassing the panel. But I am pretty new to Swing and I do not know how to do it. I would like to know if there is an easier way to accomplish this with griffon.
Thanks in advanced.
Solution
Here's one possible to solution:
- install the javatips plugin, i.e, griffon install-plugin javatips
- Use the backgroundPanel() node
Here's a barebones example
package sample
import javax.imageio.ImageIO
application(title: 'Sample',
preferredSize: [320, 330],
pack: true) {
backgroundPanel(image: ImageIO.read(app.getResourceAsURL('griffon-icon-256x256.png')))
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow