import javax.swing.*;
import java.awt.*;
public class test6 {
public static void main(String[] args) {
JFrame frame = new JFrame("Button Hide Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300, 200);
JButton button = new JButton("Click Me");
JButton hideButton = new JButton("Hide Button");
hideButton.addActionListener(e -> {
button.setVisible(false);
});
JButton showButton = new JButton("Show Button");
showButton.addActionListener(e -> {
button.setVisible(true);
});
JPanel panel = new JPanel();
panel.add(button);
panel.add(hideButton);
panel.add(showButton);
frame.add(panel, BorderLayout.CENTER);
frame.setVisible(true);
}
}