Results 1 to 3 of 3
- 10-14-2010, 05:48 AM #1
How to post multiple image in frame?
can you please help me about this...i just want to post a picture inside the frame
that looks good with a proper spacing or grid...
thank you...
:o
here's the code:
Java Code:import java.awt.GridLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JFrame; import javax.swing.ImageIcon; public class irish extends JPanel { JLabel label1, label2, label3,label4,label5,label6,label7,label8,label9; public irish() { ImageIcon icon = new ImageIcon("f.jpg", ""); setLayout(new GridLayout(3,1)); //3 rows, 1 column label1 = new JLabel("f", icon, JLabel.CENTER); //Set the position of the text, relative to the icon: label1.setVerticalTextPosition(JLabel.BOTTOM); label1.setHorizontalTextPosition(JLabel.CENTER); label3 = new JLabel(icon); ImageIcon icons = new ImageIcon("i.jpg", ""); setLayout(new GridLayout(3,1)); //3 rows, 1 column label2 = new JLabel("i", icons, JLabel.LEFT); //Set the position of the text, relative to the icon: label2.setVerticalTextPosition(JLabel.BOTTOM); label2.setHorizontalTextPosition(JLabel.CENTER); label3 = new JLabel(icons); ImageIcon iconse = new ImageIcon("5.jpg", ""); setLayout(new GridLayout(3,1)); //3 rows, 1 column label4 = new JLabel("5", iconse, JLabel.CENTER); //Set the position of the text, relative to the icon: label4.setVerticalTextPosition(JLabel.BOTTOM); label4.setHorizontalTextPosition(JLabel.CENTER); label3 = new JLabel(iconse); ImageIcon iconsed = new ImageIcon("6.jpg", ""); setLayout(new GridLayout(3,1)); //3 rows, 1 column label5 = new JLabel("6", iconsed, JLabel.CENTER); //Set the position of the text, relative to the icon: label5.setVerticalTextPosition(JLabel.BOTTOM); label5.setHorizontalTextPosition(JLabel.CENTER); label3 = new JLabel(iconsed); ImageIcon iconi = new ImageIcon("7.jpg", ""); setLayout(new GridLayout(3,1)); //3 rows, 1 column label6 = new JLabel("7", iconi, JLabel.CENTER); //Set the position of the text, relative to the icon: label6.setVerticalTextPosition(JLabel.BOTTOM); label6.setHorizontalTextPosition(JLabel.CENTER); label3 = new JLabel(iconi); ImageIcon iconic = new ImageIcon("me.jpg", ""); setLayout(new GridLayout(3,1)); //3 rows, 1 column label7 = new JLabel("me", iconic, JLabel.CENTER); //Set the position of the text, relative to the icon: label7.setVerticalTextPosition(JLabel.BOTTOM); label7.setHorizontalTextPosition(JLabel.CENTER); ImageIcon iconico = new ImageIcon("02.jpg", ""); setLayout(new GridLayout(3,1)); //3 rows, 1 column label8 = new JLabel("02", iconico, JLabel.CENTER); //Set the position of the text, relative to the icon: label8.setVerticalTextPosition(JLabel.BOTTOM); label8.setHorizontalTextPosition(JLabel.CENTER); label3 = new JLabel(iconico); ImageIcon iconicon = new ImageIcon("d.jpg", ""); setLayout(new GridLayout(3,1)); //3 rows, 1 column label9 = new JLabel("d", iconicon, JLabel.CENTER); //Set the position of the text, relative to the icon: label9.setVerticalTextPosition(JLabel.BOTTOM); label9.setHorizontalTextPosition(JLabel.CENTER); label3 = new JLabel(iconicon); //Add labels to the JBufferedPane. add(label1); add(label2); add(label3); add(label4); add(label5); add(label6); add(label7); add(label8); add(label9); } public static void main(String[] args) { /* * Create a window. Use JFrame since this window will include * lightweight components. */ JFrame frame = new JFrame("IRISH ALBUM"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setContentPane(new irish()); frame.pack(); frame.setSize(1050, 2000); frame.setVisible(true); } }
im sorry for my mistake sir...Last edited by Miwrath; 10-15-2010 at 06:19 AM.
-
????
This "question" is so vague and general as to be completely unanswerable. Please ask specific questions regarding problems in your code. I strongly suggest you read How to Ask Smart Questions to learn how to ask an answerable question.
- 10-14-2010, 07:43 AM #3
In what way is this a new question? What was the problem in continuing in your earlier thread?
How to put multiple image in java?
db
Similar Threads
-
how to set an image to a frame in swing?
By vrk in forum AWT / SwingReplies: 2Last Post: 10-20-2009, 02:52 PM -
Adding multiple images to frame
By 435.mahesh in forum AWT / SwingReplies: 1Last Post: 04-24-2009, 08:31 PM -
how i can put image in background of frame??
By ahmed13 in forum NetBeansReplies: 4Last Post: 01-15-2009, 05:47 PM -
Problem in adding Multiple Panels at the Specific positon on frame
By SANDY_INDIA in forum AWT / SwingReplies: 7Last Post: 07-09-2008, 12:06 AM -
Converting multiple banded image into single banded image... Image enhancement
By archanajathan in forum Advanced JavaReplies: 0Last Post: 01-08-2008, 05:29 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks