Re: JFrame from JPanel
- From: Brandon McCombs <none@xxxxxxxx>
- Date: Wed, 21 Mar 2007 23:28:46 -0400
RedGrittyBrick wrote:
petoeter wrote: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?
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
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.
.
- Follow-Ups:
- Re: JFrame from JPanel
- From: RedGrittyBrick
- Re: JFrame from JPanel
- References:
- JFrame from JPanel
- From: petoeter
- Re: JFrame from JPanel
- From: RedGrittyBrick
- JFrame from JPanel
- Prev by Date: Re: How to print a JTextArea?
- Next by Date: Re: JTable calls setValueAt with index out of bounds
- Previous by thread: Re: JFrame from JPanel
- Next by thread: Re: JFrame from JPanel
- Index(es):
Relevant Pages
|