I want to post the image that I posted inside JLabel. Here is my code:
public Main() { setLayout (new FlowLayout()); image = new ImageIcon(getClass().getResource("title.gif")); image1 = new JLabel(image); image1.setAlignmentX(400); image1.setAlignmentY(400); add(image1); }
Displays the image but the lines
image1.setAlignmentX(400); image1.setAlignmentY(400);
Do not do anything. I am new to Java, any help is appreciated.
(I would appreciate an example.)
source share