List of usage examples for javax.swing JButton isVisible
@Transient public boolean isVisible()
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame(); Container contentPane = frame.getContentPane(); ComponentListener comp = new ComponentListener() { public void componentHidden(ComponentEvent e) { dump("Hidden", e); }/*from w ww.j a v a 2 s . c o m*/ public void componentMoved(ComponentEvent e) { dump("Moved", e); } public void componentResized(ComponentEvent e) { dump("Resized", e); } public void componentShown(ComponentEvent e) { dump("Shown", e); } private void dump(String type, ComponentEvent e) { System.out.println(e.getComponent().getName() + " : " + type); } }; JButton left = new JButton("Left"); left.setName("Left"); left.addComponentListener(comp); final JButton right = new JButton("Right"); right.setName("Right"); right.addComponentListener(comp); ActionListener action = new ActionListener() { public void actionPerformed(ActionEvent e) { right.setVisible(!right.isVisible()); } }; left.addActionListener(action); JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, left, right); contentPane.add(pane, BorderLayout.CENTER); frame.setSize(300, 200); frame.show(); }