Results 1 to 1 of 1
  1. #1
    sudmitra is offline Member
    Join Date
    Sep 2009
    Posts
    1
    Rep Power
    0

    Question How to set Image in Panel ?

    Plz find my code below. I want to set an image as a logo at the top left corner of the Panel. what's the code syntax for doing so ? Plz help...

    package java2.GUI;
    import java.awt.* ;

    public class ComplexLayoutExample
    {
    private Frame f ;
    private Panel p ;
    private Button bw, bc ;
    private Button bfile, bhelp ;

    public ComplexLayoutExample()
    {
    f = new Frame("GUI Example #3");
    bw = new Button("West");
    bc = new Button("Work space Region");
    bfile = new Button ("File");
    bhelp = new Button ("Help");
    }

    public void launchFrame()
    {
    f.add(bw, BorderLayout.WEST);
    f.add(bc, BorderLayout.CENTER);
    p = new Panel();
    p.add(bfile);
    p.add(bhelp);
    f.add(p, BorderLayout.NORTH);
    f.pack();
    p.setBackground(Color.YELLOW);
    f.setVisible(true);
    }

    public static void main(String args[])
    {
    ComplexLayoutExample gui = new ComplexLayoutExample();
    gui.launchFrame();
    }

    }
    Last edited by sudmitra; 09-14-2009 at 08:04 PM.

Similar Threads

  1. panel resizing
    By simo_mon in forum AWT / Swing
    Replies: 1
    Last Post: 08-15-2009, 02:09 PM
  2. How to output to panel as a .gif
    By Teh Brian in forum New To Java
    Replies: 1
    Last Post: 03-13-2009, 05:26 PM
  3. add image on panel
    By samiksha.goel in forum AWT / Swing
    Replies: 4
    Last Post: 08-02-2008, 07:38 PM
  4. Replies: 0
    Last Post: 01-08-2008, 05:29 PM
  5. Help with drag from panel
    By fernando in forum AWT / Swing
    Replies: 2
    Last Post: 08-07-2007, 10:19 PM

Posting Permissions

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