It's my first post here, trynna be quick. I have a small JFrame window with JLabel with image as a background to said JFrame. JFrame also has 2 JButtons. To this point it worked well, until I decided to add JComboBox. Result of this action is now when I run my JFrame it shows blank, no background image from JLabel, no ComboBox visible, JButtons are shown tho. When I resize even a little this window, JLabel background image appears and everything is fine but it should be without resizing. What am I missing here? I'm very fresh with swing and am doing "game" for my java class project. Here is screenshots and code:
public class View_Startup extends JFrame {
JLabel lBackground;
JButton bStart,bExit;
JComboBox cbResolutions;
ImageIcon iBackground,iStart,iExit;
Image icon;
String resolutions[] = {"1280x720 HD","1366x768 WXGA","1600x900HD+","1920x1080 fullHD"};
public View_Startup() {
iBackground = new ImageIcon("xdddddddddd/resolution_background.jpg");
iStart = new ImageIcon("xddddddddddd/iStart2.png");
iExit = new ImageIcon("xdddddddddd/iExit2.png");
this.setSize(656,399);
this.setTitle("xddddddddd");
this.icon = Toolkit.getDefaultToolkit().getImage("C:xdddddddddd\\images.jpg");
this.setIconImage(icon);
this.setVisible(true);
this.setLayout(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice defaultScreen = ge.getDefaultScreenDevice();
Rectangle rect = defaultScreen.getDefaultConfiguration().getBounds();
int x=(int) rect.getMaxX();
int y=(int) rect.getMaxY();
this.setLocation(x/2-328,y/2-199);
bStart = new JButton(iStart);
bStart.setBounds(490,240,150,50);
bStart.setOpaque(false);
bStart.setContentAreaFilled(false);
//bStart.setBorderPainted(false);
add(bStart);
bExit = new JButton(iExit);
bExit.setBounds(490,300,150,50);
bExit.setOpaque(false);
bExit.setContentAreaFilled(false);
//bExit.setBorderPainted(false);
add(bExit);
cbResolutions = new JComboBox(resolutions);
cbResolutions.setBounds(490,180,150,50);
add(cbResolutions);
lBackground = new JLabel(iBackground);
lBackground.setBounds(0,0,640,360);
add(lBackground);
}
}