Im stuck with this problem that should be an easy one to solve, even for me but I cant figure it out. Need someone to take a look at the code and maybe slap my face because I cant make this out....lol.
I whant the background in ths JLabel to be white and not the default grey. Ive tried the method setBackground() but that doesn´t made the trick. Please help this out for me.
The code:
----------------------------------------------------------
//Class that creates an AboutLabel.
public class AboutLabel extends JFrame {
private JLabel label;
public AboutLabel ()
{
super( "J.E.R.C" );
Container c = getContentPane();
c.setLayout (new FlowLayout () );
label = new JLabel();
label.setText( "J.E.R.C version 1.0" );
Icon JERC = new ImageIcon("JERC.gif"
setIconImage(new ImageIcon("ikon.gif".getImage());
label.setIcon(JERC);
label.setHorizontalTextPosition (SwingConstants.CENTER);
label.setVerticalTextPosition (SwingConstants.BOTTOM);
label.setOpaque(true);
label.setIconTextGap(10);
c.add ( label );
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension screen = tk.getScreenSize();
int screenHeight = (int)screen.getHeight();
int screenWidth = (int)screen.getWidth();
setBounds((screenWidth/2) - this.getWidth()/2, (screenHeight/2) - this.getHeight()/2, 150, 150);
//setBackground ( Color.white );????Dont work!!
setResizable(false);
setVisible(true);
}
}
-----------------------------------------------------------
Any help would be very appreciated...
Thx Peter.
I whant the background in ths JLabel to be white and not the default grey. Ive tried the method setBackground() but that doesn´t made the trick. Please help this out for me.
The code:
----------------------------------------------------------
//Class that creates an AboutLabel.
public class AboutLabel extends JFrame {
private JLabel label;
public AboutLabel ()
{
super( "J.E.R.C" );
Container c = getContentPane();
c.setLayout (new FlowLayout () );
label = new JLabel();
label.setText( "J.E.R.C version 1.0" );
Icon JERC = new ImageIcon("JERC.gif"
setIconImage(new ImageIcon("ikon.gif".getImage());
label.setIcon(JERC);
label.setHorizontalTextPosition (SwingConstants.CENTER);
label.setVerticalTextPosition (SwingConstants.BOTTOM);
label.setOpaque(true);
label.setIconTextGap(10);
c.add ( label );
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension screen = tk.getScreenSize();
int screenHeight = (int)screen.getHeight();
int screenWidth = (int)screen.getWidth();
setBounds((screenWidth/2) - this.getWidth()/2, (screenHeight/2) - this.getHeight()/2, 150, 150);
//setBackground ( Color.white );????Dont work!!
setResizable(false);
setVisible(true);
}
}
-----------------------------------------------------------
Any help would be very appreciated...
Thx Peter.