Results 1 to 2 of 2
  1. #1
    Hasan is offline Member
    Join Date
    May 2007
    Rep Power

    Default Simplest way to read and display a jpeg image

    What is the simplest way to read and display a jpeg image in Java?

  2. #2
    Valeriano is offline Member
    Join Date
    May 2007
    Rep Power


    Java Code:
    import javax.swing.JFrame ;
    class JpgMini {
        public static void main(String [] args) {
            JFrame f = new JFrame(args[0]);
            f.getContentPane().add(new javax.swing.JLabel(new javax.swing.ImageIcon(args[0])));
    There are a lot better ways to read and display images, but start with something that works and look through the java.awt. and javax.swing classes for ways to improve it.

Similar Threads

  1. can display image in JFrame?
    By xCLARAx in forum AWT / Swing
    Replies: 14
    Last Post: 04-03-2009, 07:02 PM
  2. how to display uploaded jpeg in jsp(its urgent)
    By shaktish in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 02-17-2009, 02:52 PM
  3. How to display image ?
    By Birkoff in forum AWT / Swing
    Replies: 7
    Last Post: 06-09-2008, 07:58 AM
  4. how to display image in jsp page(Struts)
    By rama6262 in forum Advanced Java
    Replies: 1
    Last Post: 12-21-2007, 07:50 AM
  5. How to display an image in JApplet
    By fred in forum Java Applets
    Replies: 1
    Last Post: 07-24-2007, 02:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts