loading and displaying picture


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: loading and displaying picture

  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.

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center