private JLabel label1, label2;
public WindowsBox() {
super("Testing Label");
Container container = getContentPane();
container.setLayout(new FlowLayout());
label1 = new JLabel("Label with text");
label1.setToolTipText("This is label1");
label1.setHorizontalAlignment(SwingConstants.CENTER);
container.add(label1);
Icon icon = new ImageIcon("http://www.nfcrumors.com/wp-content/uploads/2011/07/hi-256-4-0d7facef5753bf69b74de8ccb0144f2cf94062fa.png");
label2 = new JLabel("Label with Text and Icon", icon, SwingConstants.LEFT);
label2.setToolTipText("This is Label2");
container.add(label2);
setSize(275, 180);
setVisible(true);
}
This is the output i get:
---------------------------------------- Testing Labels ---------------------------------------- Label with text Label with Text and Icon ----------------------------------------
I want "Label with Text and Icon" below.

New Topic/Question
This topic is locked



MultiQuote








|