use of javax.swing.plaf.metal.MetalLookAndFeel in project intellij-community by JetBrains.
the class DarculaLaf method getDefaults.
@Override
public UIDefaults getDefaults() {
try {
final Method superMethod = BasicLookAndFeel.class.getDeclaredMethod("getDefaults");
superMethod.setAccessible(true);
final UIDefaults metalDefaults = (UIDefaults) superMethod.invoke(new MetalLookAndFeel());
final UIDefaults defaults = (UIDefaults) superMethod.invoke(base);
if (SystemInfo.isLinux) {
if (!Registry.is("darcula.use.native.fonts.on.linux")) {
Font font = findFont("DejaVu Sans");
if (font != null) {
for (Object key : defaults.keySet()) {
if (key instanceof String && ((String) key).endsWith(".font")) {
defaults.put(key, new FontUIResource(font.deriveFont(13f)));
}
}
}
} else if (Arrays.asList("CN", "JP", "KR", "TW").contains(Locale.getDefault().getCountry())) {
for (Object key : defaults.keySet()) {
if (key instanceof String && ((String) key).endsWith(".font")) {
final Font font = defaults.getFont(key);
if (font != null) {
defaults.put(key, new FontUIResource("Dialog", font.getStyle(), font.getSize()));
}
}
}
}
}
LafManagerImpl.initInputMapDefaults(defaults);
initIdeaDefaults(defaults);
patchStyledEditorKit(defaults);
patchComboBox(metalDefaults, defaults);
defaults.remove("Spinner.arrowButtonBorder");
defaults.put("Spinner.arrowButtonSize", JBUI.size(16, 5).asUIResource());
MetalLookAndFeel.setCurrentTheme(createMetalTheme());
if (SystemInfo.isWindows && Registry.is("ide.win.frame.decoration")) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
if (SystemInfo.isLinux && JBUI.isUsrHiDPI()) {
applySystemFonts(defaults);
}
defaults.put("EditorPane.font", defaults.getFont("TextField.font"));
if (SystemInfo.isMacOSYosemite) {
installMacOSXFonts(defaults);
}
return defaults;
} catch (Exception e) {
log(e);
}
return super.getDefaults();
}
use of javax.swing.plaf.metal.MetalLookAndFeel in project adempiere by adempiere.
the class PLAFEditor method setLFSelection.
// dynInit
/**
* Set Picks From Environment
*/
private void setLFSelection() {
m_setting = true;
// Search for PLAF
ValueNamePair plaf = null;
LookAndFeel lookFeel = UIManager.getLookAndFeel();
String look = lookFeel.getClass().getName();
for (int i = 0; i < AdempierePLAF.getPLAFs().length; i++) {
ValueNamePair vp = AdempierePLAF.getPLAFs()[i];
if (vp.getValue().equals(look)) {
plaf = vp;
break;
}
}
if (plaf != null)
lfField.setSelectedItem(plaf);
// Search for Theme
MetalTheme metalTheme = null;
ValueNamePair theme = null;
boolean metal = UIManager.getLookAndFeel() instanceof MetalLookAndFeel;
themeField.setModel(new DefaultComboBoxModel(AdempierePLAF.getThemes()));
if (metal) {
theme = null;
AppContext context = AppContext.getAppContext();
metalTheme = (MetalTheme) context.get("currentMetalTheme");
if (metalTheme != null) {
String lookTheme = metalTheme.getName();
for (int i = 0; i < AdempierePLAF.getThemes().length; i++) {
ValueNamePair vp = AdempierePLAF.getThemes()[i];
if (vp.getName().equals(lookTheme)) {
theme = vp;
break;
}
}
}
if (theme != null)
themeField.setSelectedItem(theme);
}
m_setting = false;
log.info(lookFeel + " - " + metalTheme);
}
use of javax.swing.plaf.metal.MetalLookAndFeel in project jdk8u_jdk by JetBrains.
the class TestDialog method main.
// Not sure about what happens if multiple of this test are
// instantiated in the same VM. Being static (and using
// static vars), it aint gonna work. Not worrying about
// it for now.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new MetalLookAndFeel());
mainThread = Thread.currentThread();
try {
init();
} catch (TestPassedException e) {
// interepret this return as a pass
return;
}
// called pass() or fail()
try {
Thread.sleep(sleepTime);
//Timed out, so fail the test
throw new RuntimeException("Timed out after " + sleepTime / 1000 + " seconds");
} catch (InterruptedException e) {
// so that the harness gets it and deals with it.
if (!testGeneratedInterrupt)
throw e;
//reset flag in case hit this code more than once for some reason (just safety)
testGeneratedInterrupt = false;
if (theTestPassed == false) {
throw new RuntimeException(failureMessage);
}
}
}
use of javax.swing.plaf.metal.MetalLookAndFeel in project jdk8u_jdk by JetBrains.
the class bug7123767 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new MetalLookAndFeel());
setUp();
testToolTip();
TestFactory.uninstall();
if (frame != null) {
frame.dispose();
}
}
use of javax.swing.plaf.metal.MetalLookAndFeel in project jdk8u_jdk by JetBrains.
the class bug6777378 method main.
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
Robot robot = new Robot();
robot.setAutoDelay(20);
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(new MetalLookAndFeel());
} catch (Exception e) {
e.printStackTrace();
}
JTable table = new JTable(new AbstractTableModel() {
public int getRowCount() {
return 10;
}
public int getColumnCount() {
return 10;
}
public Object getValueAt(int rowIndex, int columnIndex) {
return "" + rowIndex + " " + columnIndex;
}
});
header = new JTableHeader(table.getColumnModel());
header.setToolTipText("hello");
frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(header);
frame.setSize(300, 300);
frame.setVisible(true);
}
});
toolkit.realSync();
Point point = header.getLocationOnScreen();
robot.mouseMove(point.x + 20, point.y + 50);
robot.mouseMove(point.x + 30, point.y + 50);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
Aggregations