So I have a code and my problem is toggling visibility of JPanel with JButton. Here are my Packages - Classes:
start - Main
panels - Panels
labels - Labels
I am creating the button in package labels class Labels with this
public static JButton ScriptDLBotton(JPanel navPanel) {
JButton contactsButton = new JButton("Show");
contactsButton.setVisible(true);
contactsButton.setBounds(250,82,70, 20);
navPanel.add(contactsButton);
return contactsButton;
}
I am calling it from start.Main with this
JButton ScriptDLbutton = Labels.ScriptDLBotton(AppsPanel)
And I want when I press the button it go to package panels class Panels and change
public static JPanel createAppDiscriptionPanel(JFrame frame) {
JPanel navDiscPanel = new JPanel ();
navDiscPanel.setVisible(false);
navDiscPanel.setBounds(350,100,640, 380);
navDiscPanel.setBackground(Color.yellow);
navDiscPanel.setLayout(null);
frame.add(navDiscPanel);
return navDiscPanel;}
from visible false to true. Thx in advance for any help.