Display java JPanel in a JFrame?

You have not added any components to the mainFrame's content pane in the main method. The only time a panel gets added is in this ActionListener.

You have not added any components to the mainFrame's content pane in the main method. The only time a panel gets added is in this ActionListener: open. AddActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AssignToTransientPanel((JPanel) new NewAlbum()); Container content = mainFrame.getContentPane(); content.removeAll(); content.

Add(transientPanel); content.validate(); content.repaint(); } }); This is only getting called when "Open" is clicked as you have, I assume accidentally, added the ActionListener to the open JMenuItem rather than the newAlbum JMenuItem. To add content on startup you need to add something like this before the mainFrame. SetVisible(true) line: mainFrame.

Add(new NewAlbum()); BTW, the convention is for all methods in Java source code to start with a lower case letter. AssignToTransientPanel would be a better name for your method.

Russ, thank you for the second set of eyes. I was truly laughing out loud when I read your response. I feel quite dumb, but that's the new mistakes one makes when programming in a new environment.

– Andrew Falanga Mar 19 at 19:25 1 Andrew, you'll want to "accept" Russ's answer if his post answers your original question. – Hovercraft Full Of Eels Mar 19 at 21:41 oh, thanks. I'll do that now.

– Andrew Falanga Mar 19 at 23:24.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions