0

//create the images folder and past all images into that u want to display...

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;


class my 

{
    public static void main(String args[])
    {
        JFrame f=new JFrame("Web layout...");

 ImageIcon pic1 = new ImageIcon ("images/3d.png");
 ImageIcon pic2 = new ImageIcon ("images/aim.png");
 ImageIcon pic3 = new ImageIcon ("images/aim2.png");
 ImageIcon pic4 = new ImageIcon ("images/aim3.png");

 ImageIcon pic5 = new ImageIcon ("images/ark.png");
 ImageIcon pic6 = new ImageIcon ("images/amor.png");



//declare my jlabels...........

JLabel label1, label2, label3, label4,label6, label5;

// Set up first subpanel
JPanel subPanel1 = new JPanel();
subPanel1.setPreferredSize (new Dimension(400, 400));
subPanel1.setBackground (Color.cyan);
label1 = new JLabel ("3d", pic1, SwingConstants.CENTER);
label2 = new JLabel ("aim",pic2, SwingConstants.LEFT);
label3 = new JLabel ("aim2", pic3, SwingConstants.CENTER);
label4 = new JLabel ("aim3", pic4, SwingConstants.LEFT);
label5 = new JLabel ("ark", pic5, SwingConstants.CENTER);
label6 = new JLabel ("amor", pic6, SwingConstants.LEFT);

subPanel1.add (label1);
subPanel1.add (label2);

subPanel1.add (label3);

subPanel1.add (label4);

subPanel1.add (label5);

subPanel1.add (label6);



f.setSize(500,500);

f.setVisible(true);  
f.add(subPanel1);
System.out.println("Success.....");
}
}

Edited by Nick Evan: Fixed formatting

3
Contributors
2
Replies
8
Views
5 Years
Discussion Span
Last Post by JamesCherrill
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.