Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: adding background image to a frame???

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    4
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default adding background image to a frame???

    hi,
    pls help me with adding background image to this code...i tried many ways im unsuccessful...pls help me urgent!!!

    code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;

    public class updateid implements ActionListener,FocusListener
    {

    private JFrame f;
    private JLabel l1,l2;
    private JTextField tf1;
    private JButton b1,b2;

    public updateid()
    {

    f=new JFrame("UPDATE EMPLOYEE");
    l1=new JLabel("Update Employee");
    l2=new JLabel("Enter Employee ID");
    tf1=new JTextField();
    b1=new JButton("Submit");
    b2=new JButton("Back");
    }

    public void launchframe()
    {

    f.setLayout(null);

    f.add(l1);
    f.add(l2);
    f.add(tf1);
    f.add(b1);
    f.add(b2);

    l1.setBounds(550,200,150,25);
    l2.setBounds(500,250,150,25);
    tf1.setBounds(650,250,75,25);
    b1.setBounds(500,300,75,25);
    b1.addActionListener(this);
    b2.setBounds(600,300,75,25);
    b2.addActionListener(this);
    f.setSize(2000,2000);
    f.setVisible(true);

    }

    public void actionPerformed(ActionEvent e)
    {
    if(e.getSource()==b1)
    {
    updateemp ue=new updateemp();
    ue.launchframe();
    f.setVisible(false);
    }

    if(e.getSource()==b2)
    {
    adminfunc af=new adminfunc();
    af.launchframe();
    f.setVisible(false);
    }
    }

    public void focusLost(FocusEvent fe)
    {}
    public void focusGained(FocusEvent fe1)
    {}

    public static void main(String args[])
    {
    updateid ui=new updateid();
    ui.launchframe();
    }
    }


    thanks in advance


  2. #2
    Member snowguy13's Avatar
    Join Date
    Nov 2011
    Location
    In Hyrule enjoying a chat with Demise and Ganondorf
    Posts
    339
    My Mood
    Happy
    Thanks
    31
    Thanked 48 Times in 42 Posts

    Default Re: adding background image to a frame???

    Have you tried a nice Google search?
    Use highlight tags to help others help you!

    [highlight=Java]Your prettily formatted code goes here[/highlight]

    Using these tags makes your code formatted, and helps everyone answer your questions more easily!




    Wanna hear something funny?

    Me too.

Similar Threads

  1. adding background image to a frame???
    By overdriveboy in forum AWT / Java Swing
    Replies: 0
    Last Post: May 13th, 2012, 01:23 PM
  2. Adding components to my GUI over a background image
    By derekxec in forum AWT / Java Swing
    Replies: 12
    Last Post: August 23rd, 2011, 03:01 PM
  3. Need help adding background image (noob here)
    By OpX316 in forum AWT / Java Swing
    Replies: 18
    Last Post: July 7th, 2011, 09:10 AM
  4. Adding JButtons to Frame
    By iKlaush in forum What's Wrong With My Code?
    Replies: 5
    Last Post: June 12th, 2011, 10:52 AM
  5. Background image on GUI
    By OBLITERATOR in forum AWT / Java Swing
    Replies: 3
    Last Post: March 5th, 2010, 12:10 PM

Tags for this Thread