Results 1 to 5 of 5

Thread: Java GUI

  1. #1
    Join Date
    Dec 2007
    Posts
    151
    Rep Power
    0

    Default Java GUI

    Can someone assist me in opening a new form(already created) when an event is trigged?.... Click a button on a form to open another form.
    CCNA looking for an opportunity

  2. #2
    Join Date
    Nov 2002
    Posts
    5,713
    Rep Power
    0

    Default

    Do you want the new form to open in a new window or the existing panel\frame?
    Last edited by Ropy; Dec 4, 2009 at 03:53 PM.
    .:] ^ [:.
    .:] Game IDs: xfire_ropy | BC:BC2_ropy | BC: 2142_ropy29 | BF3_ | steam_ropy09 | LoL_ropy09 | Origin_ropy29 [:.

  3. #3
    Join Date
    Dec 2007
    Posts
    151
    Rep Power
    0

    Default

    New window so that I can link other forms the same way
    CCNA looking for an opportunity

  4. #4
    Join Date
    Nov 2002
    Posts
    5,713
    Rep Power
    0

    Default

    Here's an example of using event triggers

    Code:
    class FormActionListener implements ActionListener {
        Form fM = new Form();
      
        public void actionPerformed(ActionEvent e) {
            if(e.getActionCommand().equals("New Form")) {
                fM.nFrame();
            }
        }
    }
    fM represents the instance of the class that contains the frame.
    nForm represents the form method in the Form class.
    New Form represents the name of the button that you want to call the new form.

    I'm a bit rusty on java but I think the following should work. It if doesn't, remove the quote from around the New Form making that line...

    Code:
    if(e.getActionCommand().equals("New Form"))
    .:] ^ [:.
    .:] Game IDs: xfire_ropy | BC:BC2_ropy | BC: 2142_ropy29 | BF3_ | steam_ropy09 | LoL_ropy09 | Origin_ropy29 [:.

  5. #5
    Join Date
    May 2006
    Posts
    666
    Rep Power
    0

    Default

    THis might just come in handy..tryna get something exactly like this to work and he darn button click event just wont happen and open the frame i wanted it to -.-




    EDIT:

    so i used this

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    new NewJFrame().setVisible(true); this.setVisible(false);
    }
    Last edited by BoneZ; Dec 21, 2009 at 12: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
  •