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.
jMenuItemsロールオーバー イベントの背景色を変更したい:
jMenuItems
今は青ですが、白にしたいのですが、どうすればいいですか?(netbeans GUI を使用)
次のようなものを使用できます。
UIManager.put("MenuItem.selectionBackground", Color.WHITE);
問題は、これにより、JMenuに追加されたものも含め、すべてのメニュー項目の色が変更されることです。
変更するメニュー項目を制御するには、デフォルトを置き換えるカスタムMenuItemUIを作成する必要があります。次に、カスタム選択の背景色を使用するようにコードを変更する必要があります。