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.
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
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 [:.
New window so that I can link other forms the same way
CCNA looking for an opportunity
Here's an example of using event triggers
fM represents the instance of the class that contains the frame.Code:class FormActionListener implements ActionListener { Form fM = new Form(); public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("New Form")) { fM.nFrame(); } } }
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 [:.
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.
---