JGoodiesを使用している場合、JButtonの色を変更する方法WindowsLookAndFeel
?色を変更した後、ボタンはクリックされたときに何らかの視覚的な表示が残るはずです。色グラジェントとクリックアニメーションはJGoodiesと同じである必要はありません。JGoodiesのJButtonの色を変更するWindowsLookAndFeel
setBackground()
とsetForeground()
を使用するだけで、ボタンの概要とボタンのテキストの色を変更します。
import com.jgoodies.looks.windows.WindowsLookAndFeel;
...
public class Test {
public static void main(String[] args) throws UnsupportedLookAndFeelException {
UIManager.setLookAndFeel(new WindowsLookAndFeel());
JFrame frame = new JFrame();
frame.setSize(50, 100);
JButton button = new JButton("Button");
button.setBackground(Color.GREEN);
button.setForeground(Color.RED);
button.setOpaque(true);
frame.add(button);
frame.setVisible(true);
}
}
私だけではなく、ボタンの全領域の色を設定したいと思いますアウトライン。
com.jgoodies.looks.windows.WindowsBorders#getButtonBorder()
でも色を変更しようとしましたが、これは効果がないようです。
どのWindowsのバージョンを使用していますか? – Vovka
私はWindows 8を使用しています –