DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2005
    Posts
    3

    loading and displaying picture

    Need source code that how i load picture and display it without using applet.plz provide me the source code.

  2. #2
    Join Date
    May 2005
    Posts
    9

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links