You are on page 1of 1

frame.

setResizable(false); // Prevent the frame from being resized

ImageIcon name = new ImageIcon("image name or path"); // create an image icon


frame.setIconImage(name.getImage()); //change frame icon

frame.setContentPane.setBackground(Color.anycolor); //change th BG color ( but need


to import java.awt.Color)
= . = . = (new Color(color)); //color can be a
hexadecimale(0x123456) value or a rgb (255,255,255)
value

frame.pack(); // it will adjust the frame with the size of it's components ( if u
add label to a frame, the frame will take
the size of this label)

--------------------------------------------------------------

label.setIcon(icon); // add an icon to the label

label.setHorizontalTextPosition(JLabel.CENTER or .LEFT or .RIGHT); // move the text


to the c or l or r of the image icon
label.setVerticalTextPosition // same as horizontal . just we have
CENTER,TOP,BOTTOM

label.setForeground(new Color(hexa or rgb) or Color.color); // change the color of


a label
label.setFont(new Font("fonts",Font.style,size)); // this will change the font and
the style (italique or bold ...) or the
size of a label

label.setIconTextGap(nbr); // change the distance between icon and text ( nbr


should be an integer(+or-))

label.setVerticalAlignment(JLabel.TOP) // change label position (c or t of b)


label.setHorizontalAlignment(JLabel.LEFT) // change label(icon + txt) position (c
or l of r)

You might also like