This is e real newbie problem.
I created a JPanel :
public class P1 extends JPanel implements ActionListener {
some code
}
On a different file, but in the same dir, I have a JFrame:
public class F1 {
JFrame ditframe = new JFrame {
some code
}
I try to start the JFrame from the JPanel somewhere under:
public void actionPerformed(Action Event e) {
.....
}
How d I call the JFrame?
Thanks,
> This is e real newbie problem.
> I created a JPanel :
[quoted text clipped - 17 lines]
>
> How d I call the JFrame?
Probably by making ditframe an instance variable, providing a method in
F1 that does "ditframe.setVisible(true);", then calling that method from
P1 after instantiating F1.
If that doesn't make any sense to you then read this
http://mindprod.com/jgloss/sscce.html
Brandon McCombs - 22 Mar 2007 04:28 GMT
>> This is e real newbie problem.
>> I created a JPanel :
[quoted text clipped - 24 lines]
> If that doesn't make any sense to you then read this
> http://mindprod.com/jgloss/sscce.html
Or if he extended JFrame with F1 like he extended JPanel with P1 then he
wouldn't have to have a separate method to make F1 visible and he
wouldn't need to create his own JFrame within F1 either.
RedGrittyBrick - 22 Mar 2007 20:43 GMT
>>> This is e real newbie problem.
>>> I created a JPanel :
[quoted text clipped - 28 lines]
> wouldn't have to have a separate method to make F1 visible and he
> wouldn't need to create his own JFrame within F1 either.
That would make more sense. I assumed petoeter had some good reason for
wanting to "start the JFrame" from within the JPanel's ActionListener.
In retrospect that seems unlikely.