use of com.intellij.ide.ui.laf.darcula.DarculaLaf in project intellij-community by JetBrains.
the class DarculaTest method main.
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(new DarculaLaf());
} catch (UnsupportedLookAndFeelException ignored) {
}
final JFrame frame = new JFrame("Darcula Demo");
frame.setSize(900, 500);
final DarculaTest form = new DarculaTest();
final JPanel root = form.myRoot;
frame.setContentPane(root);
frame.getRootPane().setDefaultButton(form.myDefaultButton);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
@Override
public void eventDispatched(AWTEvent event) {
if (event instanceof KeyEvent && event.getID() == KeyEvent.KEY_PRESSED && ((KeyEvent) event).getKeyCode() == KeyEvent.VK_F1) {
new ShowUIDefaultsAction().actionPerformed(null);
}
}
}, AWTEvent.KEY_EVENT_MASK);
SwingUtilities.invokeLater(() -> frame.setVisible(true));
}
use of com.intellij.ide.ui.laf.darcula.DarculaLaf in project android by JetBrains.
the class VisualTestsDialog method setDarculaMode.
private void setDarculaMode(boolean isDarcula) {
try {
if (isDarcula) {
UIManager.setLookAndFeel(new DarculaLaf());
} else {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
JBColor.setDark(isDarcula);
resetTabs();
setUpdateMode(updateCheckbox.isSelected());
setDebugMode(debugCheckbox.isSelected());
} catch (Exception ignored) {
}
}
use of com.intellij.ide.ui.laf.darcula.DarculaLaf in project intellij-community by JetBrains.
the class LafManagerImpl method setCurrentLookAndFeel.
/**
* Sets current LAF. The method doesn't update component hierarchy.
*/
@Override
public void setCurrentLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo) {
if (findLaf(lookAndFeelInfo.getClassName()) == null) {
LOG.error("unknown LookAndFeel : " + lookAndFeelInfo);
return;
}
// Set L&F
if (IdeaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) {
// that is IDEA default LAF
IdeaLaf laf = new IdeaLaf();
MetalLookAndFeel.setCurrentTheme(new IdeaBlueMetalTheme());
try {
UIManager.setLookAndFeel(laf);
} catch (Exception e) {
Messages.showMessageDialog(IdeBundle.message("error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
return;
}
} else if (DarculaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) {
DarculaLaf laf = new DarculaLaf();
try {
UIManager.setLookAndFeel(laf);
JBColor.setDark(true);
IconLoader.setUseDarkIcons(true);
} catch (Exception e) {
Messages.showMessageDialog(IdeBundle.message("error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
return;
}
} else {
// non default LAF
try {
LookAndFeel laf = ((LookAndFeel) Class.forName(lookAndFeelInfo.getClassName()).newInstance());
if (laf instanceof MetalLookAndFeel) {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
}
UIManager.setLookAndFeel(laf);
} catch (Exception e) {
Messages.showMessageDialog(IdeBundle.message("error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
return;
}
}
myCurrentLaf = ObjectUtils.chooseNotNull(findLaf(lookAndFeelInfo.getClassName()), lookAndFeelInfo);
checkLookAndFeel(lookAndFeelInfo, false);
}
Aggregations