문제

When you add a JToolBar to a component, you can drag it out and it create a new floating window while the parent component is also there. How can I make JToolBar show this floating window automatically with the parent invisible?

도움이 되었습니까?

해결책

You can override javax.swing.plaf.basic.BasicToolBarUI and set its parent to the instance of a container (JDialog, JFrame). This should create a floating toolbar by default.

You can set the BasicToolbarUI like below:

ui = new BasicToolBarUI();
toolBar = new JToolBar();
toolBar.setUI(ui);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top