CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 1999
    Posts
    1

    java Swing Interface



    I am coding my project in Swing and have a set of .java files with all the various interface screens i.e. main menu etc using JFrames.


    I need to link these together i.e. Press a button on the Main menu screen which then goes to the password screen etc.


    I have an idea that i need to put a call to the class I want to dispay in the actionperformed method of the class I am using but although the code passwordscreen.show(); compiples it does nothing!


    What am I missing out?





  2. #2
    Join Date
    Jan 1999
    Posts
    1

    Re: java Swing Interface



    For the Login Button on the Main Menu Add a ActionListener( Class which implements ActionListener

    Interface) by calling addActionListener method of the button. Then in the

    actionPerformed method of the ActionListener Class add the code passwordscreen.show(), better would be

    passwordscreen.setVisible(true)


    E.g



    Button loginBtn = new Button("Login"

    .....

    .....

    loginBtn.addActionListener(new LoginHandler());

    .....


    class LoginHandler implements ActionListener

    {

    public void actionPerformed(ActionEvent evt)

    {

    passwordscreen.setVisible(true);

    }

    }



    Note: To handle events the above way, you should using java 1.1 and not java 1.0








Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured