-
loading and displaying picture
Need source code that how i load picture and display it without using applet.plz provide me the source code.
-
ok,
I'm guessing you're using standard GUI then,
I just recently found a nice code to fill a label (or any other componnent) with a picture:
lblPic = new JLabel();
lblPic.setIcon( new ImageIcon("c:\\img.gif") );
lblPic.setHorizontalAlignment(JLabel.CENTER);
lblPic.setVerticalAlignment(JLabel.CENTER);
lblPic.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLoweredBevelBorder(),
BorderFactory.createEmptyBorder(5,5,5,5)));
mainpanel.add(lblPic);
you just need to change the path at the 2nd lineto your picture, and replace the 'mainpanel' to whatever container you want to picture to be in.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks