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 4 of 4

Thread: gui

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default gui

    import javax.swing.*;
    import java.awt.event.*;
    public class Simplegui implements ActionListener
    {
    public static void main(String args[])
    {
    Simplegui gui=new Simplegui();
    gui.go();
    }
    public void go()
    {
    JFrame frame=new JFrame();
    JButton button=new JButton("save");
    button.addActionListener(this);
    frame.getContentPane().add(button);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
    frame.setSize(1000,600);
    frame.setVisible(true);
    }

    public void actionPerformed(ActionEvent event)
    {
    button.setText("press");
    }

    }


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,267
    Thanks
    176
    Thanked 821 Times in 764 Posts
    Blog Entries
    5

    Default Re: gui

    The thread is marked as solved....is your problem solved? Do you have a question?

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: gui no my problem is what is wrong with this code

    [QUOTE=662vipin;126607]import javax.swing.*;
    import java.awt.event.*;
    public class Simplegui implements ActionListener
    {
    public static void main(String args[])
    {
    Simplegui gui=new Simplegui();
    gui.go();
    }
    public void go()
    {
    JFrame frame=new JFrame();
    JButton button=new JButton("save");
    button.addActionListener(this);
    frame.getContentPane().add(button);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
    frame.setSize(1000,600);
    frame.setVisible(true);
    }

    public void actionPerformed(ActionEvent event)
    {
    button.setText("press");
    }

    }[/QUOTEmy problem is what is wrong with this code

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,267
    Thanks
    176
    Thanked 821 Times in 764 Posts
    Blog Entries
    5

    Default Re: gui

    my problem is what is wrong with this code
    I recommend that you go first: does it compile? Are there exceptions? Does it behave and it not, how?

Similar Threads

  1. [SOLVED] I need help with gui.
    By Emperor_Xyn in forum Java Theory & Questions
    Replies: 7
    Last Post: December 19th, 2011, 06:18 PM
  2. Replies: 3
    Last Post: January 31st, 2010, 11:24 PM
  3. GUI help
    By ravjot28 in forum AWT / Java Swing
    Replies: 1
    Last Post: January 31st, 2010, 09:19 PM