View Single Post
  #4 (permalink)  
Old 07-23-2007, 09:13 PM
mirage_87 mirage_87 is offline
Member
 
Join Date: Jul 2007
Posts: 8
mirage_87 is on a distinguished road
Code:
import javax.swing.*; public class trial extends javax.swing.JFrame{ public trial() { a = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); a.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Sunset.jpg")); add(a); pack(); } public static void main(String args[]){ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new trial().setVisible(true); } }); } private javax.swing.JLabel a; }

try this out.......this would add the image to yr frame...
you can look at group layout if u wanna set the position of the image and size

Last edited by levent : 07-26-2007 at 09:21 PM. Reason: Code is placed inside [code] tag.
Reply With Quote