List of usage examples for javax.swing JLabel isVisible
@Transient public boolean isVisible()
From source file:CheckMenuItem.java
public static void main(String[] args) { final JLabel statusbar = new JLabel(" Statusbar"); JMenuBar menubar = new JMenuBar(); JMenu file = new JMenu("File"); file.setMnemonic(KeyEvent.VK_F); JMenu view = new JMenu("View"); view.setMnemonic(KeyEvent.VK_V); JCheckBoxMenuItem sbar = new JCheckBoxMenuItem("Show StatuBar"); sbar.setState(true);/*from w ww .ja v a 2s.c o m*/ sbar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (statusbar.isVisible()) { statusbar.setVisible(false); } else { statusbar.setVisible(true); } } }); view.add(sbar); menubar.add(file); menubar.add(view); JFrame f = new JFrame(); f.setJMenuBar(menubar); statusbar.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); f.add(statusbar, BorderLayout.SOUTH); f.setSize(360, 250); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }