I want to set a specific location to a JToolBar when I launch the Application. Is there any way to set the floating location of a JToolBar on a specific Point on the screen?
I have this code as example which will create a Toolbar and tries to set it floating at Point(300,200), but instead it displays it (floating) at location (0,0).
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JToolBar toolbar = new JToolBar();
toolbar.add(new JButton("button 1"));
toolbar.add(new JButton("button 2"));
Container contentPane = frame.getContentPane();
contentPane.add(toolbar, BorderLayout.NORTH);
((BasicToolBarUI) toolbar.getUI()).setFloating(true, new Point(300, 200));
frame.setSize(350, 150);
frame.setVisible(true);
}
Thank you