Sergio del Amo
Sergio del Amo

Reputation: 78106

How can I display an image as the background of griffon application?

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.

Upvotes: 0

Views: 148

Answers (1)

Andres Almiray
Andres Almiray

Reputation: 3281

Here's one possible to solution:

  1. install the javatips plugin, i.e, griffon install-plugin javatips
  2. 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')))
}

Upvotes: 1

Related Questions