Search in sources :

Example 1 with MetalButtonUI

use of javax.swing.plaf.metal.MetalButtonUI in project azure-tools-for-java by Microsoft.

the class SurveyPopUpDialog method renderUiByTheme.

private void renderUiByTheme() {
    // Use default ui setting for mac
    if (SystemUtils.IS_OS_MAC) {
        return;
    }
    final UIManager.LookAndFeelInfo theme = LafManager.getInstance().getCurrentLookAndFeel();
    if (StringUtils.containsIgnoreCase(theme.getName(), "light")) {
        setPanelBackGroundColor(contentPane, JBColor.WHITE);
        final ButtonUI buttonUI = new MetalButtonUI();
        giveFeedbackButton.setUI(buttonUI);
        giveFeedbackButton.setForeground(Gray._255);
        giveFeedbackButton.setBackground(new Color(0, 114, 198));
        notNowButton.setUI(buttonUI);
        notNowButton.setForeground(Gray._255);
        notNowButton.setBackground(Gray._105);
        buttonOnHoverColor = JBColor.LIGHT_GRAY;
    } else {
        setPanelBackGroundColor(contentPane, null);
        final ButtonUI buttonUI = new JButton().getUI();
        giveFeedbackButton.setForeground(null);
        giveFeedbackButton.setBackground(null);
        giveFeedbackButton.setUI(buttonUI);
        notNowButton.setForeground(null);
        notNowButton.setBackground(null);
        notNowButton.setUI(buttonUI);
        buttonOnHoverColor = JBColor.WHITE;
    }
    giveFeedbackButton.setBorderPainted(false);
    setButtonHoverListener(giveFeedbackButton);
    notNowButton.setBorderPainted(false);
    setButtonHoverListener(notNowButton);
}
Also used : JBColor(com.intellij.ui.JBColor) ButtonUI(javax.swing.plaf.ButtonUI) MetalButtonUI(javax.swing.plaf.metal.MetalButtonUI) MetalButtonUI(javax.swing.plaf.metal.MetalButtonUI)

Aggregations

JBColor (com.intellij.ui.JBColor)1 ButtonUI (javax.swing.plaf.ButtonUI)1 MetalButtonUI (javax.swing.plaf.metal.MetalButtonUI)1