コンボボックスでsetEnabled()を使用すると(falseに設定されている)、テキストの色を黒で灰色ではないように変更する方法がわかります。私がソフトウェアを開発している人、そして私自身は、読むのが難しいと感じています。テキストカラーにアクセスする方法は見つけられません。代わりにsetEditable()を使用してテキストの色をグレーではなく、SWTのコンボボックスに使用できるsetEditable()メソッドはありませんでしたので、テキストコンポーネントを簡単に修正できました。さらに明確にするJava SWTコンボボックスのsetEnabled()がfalseのときにテキストの色を変更する
、私はテキストの絵を見つけることができない...代わりに、それは以下の継承されたメソッドを使用して、
public void setEnabled (boolean enabled) {
checkWidget();
/*
* Feature in Windows. If the receiver has focus, disabling
* the receiver causes no window to have focus. The fix is
* to assign focus to the first ancestor window that takes
* focus. If no window will take focus, set focus to the
* desktop.
*/
Control control = null;
boolean fixFocus = false;
if (!enabled) {
if (display.focusEvent != SWT.FocusOut) {
control = display.getFocusControl();
fixFocus = isFocusAncestor (control);
}
}
enableWidget (enabled);
if (fixFocus) fixFocus (control);
}
を私はメソッドをオーバーライドすることを試みたが、それは私の方法を使用することはありませんUIManager.put( "ComboBox.disabledText"、Color.black);のようなものになります。この場合、私は少し混乱しています。私は、UIManager を持っているSwingに少し慣れています。 SWTに相当するものがあれば分かりません。