The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > javax.swing  [141 examples] > JToolBar  [4 examples]

e819. Highlighting Buttons in a JToolbar Container While Under the Cursor

By default, a button in a toolbar does not change its appearance when the cursor is over the button. However, if the toolbar is in rollover mode, the buttons will highlight while under a cursor.
    // Create a horizontal toolbar
    JToolBar toolbar = new JToolBar();
    
    // Get current rollover mode
    boolean b = toolbar.isRollover();
    
    // Enable rollover mode
    toolbar.setRollover(true);

 Related Examples
e816. Creating a JToolbar Container
e817. Determining When a Floatable JToolBar Container Changes Orientation
e818. Preventing a JToolbar Container from Floating

See also: Actions    JButton    JCheckBox    JComboBox    JDesktop and JInternalFrame    JFrame, JWindow, JDialog    JLabel    JList    JProgressBar    JRadioButton    JScrollPane    JSlider    JSpinner    JSplitPane    JTabbedPane    Keystrokes and Input Maps    Layout    Look and Feel    Menus    Progress Monitor    The Screen    Tool Tips    UI Default Values   


© 2002 Addison-Wesley.