| Author |
Using Swing
|
Karis Brown
Ranch Hand
Joined: Nov 13, 2003
Posts: 33
|
|
Why does does a JPanel work in a main public class but not in the subclass?
|
So Cold & So Outa Control
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
|
Moving this to the Swing / JFC / AWT forum...
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
Nathan Pruett
Bartender
Joined: Oct 18, 2000
Posts: 4121
|
|
It would help if you said why it didn't "work"... I'm assuming that you mean that the components you're adding to the JPanel inner class aren't showing up. This is because you put them in a method called "init()" in the inner class. Only applets automatically call their init() method. You'll have to either change the inner class's init() method to a constructor, or call init() on the sClass instance after you create it.
|
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
|
 |
 |
|
|
subject: Using Swing
|
|
|