The Java Developers Almanac 1.4


Order this book from Amazon.

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

e818. Preventing a JToolbar Container from Floating

By default, a toolbar can float, that is, it can be dragged to a different edge in its container or it can be moved into a top-level window.
    // Create a horizontal toolbar
    JToolBar toolbar = new JToolBar();
    
    // Get current floatability
    boolean b = toolbar.isFloatable();
    
    // Disable floatability
    toolbar.setFloatable(false);

 Related Examples
e816. Creating a JToolbar Container
e817. Determining When a Floatable JToolBar Container Changes Orientation
e819. Highlighting Buttons in a JToolbar Container While Under the Cursor

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.