Results 1 to 2 of 2

Thread: jframe

  1. #1
    amith is offline Member
    Join Date
    May 2008
    Posts
    24
    Rep Power
    0

    Default jframe

    F:\a\a\res\
    contains all the5 .png files of different color names red blue ............
    and i just written a program
    import javax.swing.*;
    import java.awt.*;
    class q
    {
    public void static void main(String args[])
    {
    JFrame w=new JFrame();
    Container c=getContentpane();
    //iam loding image form res folder
    Image r=getImage(getCodeBase(),"red.png");
    c.add(r);
    w.add(c);
    }
    }
    it is giving me error and it is not showing my images in the jframe
    plz tell me how to add images in a jframe but dont make complicated it with buffered io or image.io plz tell me in a simple manner tell me in a simple manner in a jframe or jpanel or swings and also i just want 4 out 5 images to placed in random order whenever i execute the application

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Lots of errors I can see in your code.

    main method definition is wrong.

    Java Code:
    public static void main(String[] args) {
      // Content of the method
    }

Similar Threads

  1. how to use JFrame in JSP ??
    By priyanka sharma in forum JavaServer Pages (JSP) and JSTL
    Replies: 8
    Last Post: 04-06-2011, 04:51 AM
  2. JFrame maximizing
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-12-2008, 11:19 AM
  3. JFrame problem
    By vassil_zorev in forum AWT / Swing
    Replies: 1
    Last Post: 01-25-2008, 02:53 AM
  4. JFrame (Hello World)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-14-2007, 06:27 PM
  5. Help with JFrame
    By Albert in forum AWT / Swing
    Replies: 2
    Last Post: 07-04-2007, 04:44 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
  •