i got this code :
JFrame frame = new JFrame("FilesComparator");
frame.setVisible(true);
frame.setSize(1000, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation(dim.width / 2 - frame.getSize().width / 2, dim.height
/ 2 - frame.getSize().height / 2);
JButton buttonStart;
JButton buttonCancel;
pane.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
buttonStart = new JButton("Start");
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
c.anchor = GridBagConstraints.PAGE_END;
buttonStart.addActionListener(new ActionStart());
pane.add(buttonStart, c);
buttonCancel = new JButton("Cancel");
c.fill = GridBagConstraints.HORIZONTAL;
c.weighty = 15.0;
c.anchor = GridBagConstraints.PAGE_END;
buttonCancel.addActionListener(new ActionCancel());
pane.add(buttonCancel, c);
}}
All works good . But when i want to add an image background ( image.jpeg) its never work. I think it's because of this layout. So my question is , how to set a background image to my frame ?
Thx for help