Hey you, may try following coding my best way of java project implementation.
import javax.swing.*;
import java.awt.event.*;
public class ChangeButtonLabel{
JButton button;
JDialog dispay;
MainMenu myDispay;
public static void main(String[] args){
ChangeButtonLabel cl = new ChangeButtonLabel();
}
public ChangeButtonLabel(){
JFrame frame = new JFrame("Change JButton Lebel");
dispay=new JDialog();
button = new JButton("Click Me");
myDispay=new MainMenu(); button.addActionListener(new MyAction());
frame.add(button);
dispay.add(myDispay);
frame.setSize(400, 400);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public class MyAction implements ActionListener{
public void actionPerformed(ActionEvent e)
{
dispay.setSize(300, 300);
dispay.setVisible(true);
}
}
}
if you have any suggestion most WELCOME