JToolBar: setFloatable(boolean b) : JToolBar « javax.swing « Java by API






JToolBar: setFloatable(boolean b)

  
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JToolBar;

public class Main {

  public static void main(String[] a) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JToolBar toolBar = new JToolBar("Still draggable");

    toolBar.setFloatable(false);
    toolBar.setRollover(true);

    toolBar.add(new JButton("New"));
    toolBar.addSeparator();
    toolBar.add(new JButton("Open"));

    frame.add(toolBar, "North");

    frame.setSize(300, 200);
    frame.setVisible(true);
  }

}

   
    
  








Related examples in the same category

1.JToolBar: add(JComponent com)
2.JToolBar: addPropertyChangeListener(PropertyChangeListener listener)
3.JToolBar: addSeparator()
4.JToolBar: getOrientation()
5.JToolBar: isFloatable()
6.JToolBar: setRollover(boolean v)