K. Tsang wrote:Welcome to the Ranch
Thanks
K. Tsang wrote:I see you created "frame" twice in the constructor. The 2nd one (the one returned by createFrame()) will be the frame your app is using.
You mean?
If you remove the first one and run the app you'l get a null pointer exception.
K. Tsang wrote:For the panel, I see you passed in "this" to it, which in your case is the main window frame. Then in the createUserPanel() line 28 you add(...) but to what? I think it should be
This did not work. But in the MyApplication class I had a getFrame. I eventually used
But this did not pan out.
Actually to display a user name and personnel number in the UserInfoPanel. That part I omitted. Later on I might use info obtained from the login screen to get this data.
K. Tsang wrote:Looking at your code, the following can make it more easy to maintain and understand.
* the MyApplication class can "extends JFrame" rather than creating it inside.
* menu bar and its menus/menu items can be separate out to its own class
* each of the smaller panels can also be separate out into its own class
* for buttons, the action listeners again can be separate out = 2 ways a) implements ActionListener or b) extends javax.swing.AbstractAction
Hope this helps.
Alas. No luck yet. I will pick up your suggestion later when I have my Frame displaying what it should.
Let me philosophize a bit. In MyApplication's constructor I state
Than the creation of the UserInfoPanel should be enough to get it shown in the JFrame (
& "puls hair out"). But, no. That did not work either.
Thanks for the feedback.