Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
JToolBarをコンポーネントに追加すると、それをドラッグして外に出すことができ、親コンポーネントもそこにある間に新しいフローティングウィンドウが作成されます。JToolBarに、親を非表示にしてこのフローティングウィンドウを自動的に表示させるにはどうすればよいですか?
javax.swing.plaf.basic.BasicToolBarUI をオーバーライドして、その親をコンテナー (JDialog、JFrame) のインスタンスに設定できます。これにより、デフォルトでフローティング ツールバーが作成されます。
以下のように BasicToolbarUI を設定できます。
ui = new BasicToolBarUI(); toolBar = new JToolBar(); toolBar.setUI(ui);