use of javax.swing.plaf.basic.BasicLookAndFeel in project jdk8u_jdk by JetBrains.
the class Test6984643 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new BasicLookAndFeel() {
public String getName() {
return "A name";
}
public String getID() {
return "An id";
}
public String getDescription() {
return "A description";
}
public boolean isNativeLookAndFeel() {
return false;
}
public boolean isSupportedLookAndFeel() {
return true;
}
});
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new JFileChooser();
}
});
}
use of javax.swing.plaf.basic.BasicLookAndFeel in project intellij-community by JetBrains.
the class BegMenuItemUI method doClick.
/** Copied from BasicMenuItemUI */
private void doClick(MenuSelectionManager msm, MouseEvent e) {
// Auditory cue
if (!isInternalFrameSystemMenu()) {
@NonNls ActionMap map = menuItem.getActionMap();
if (map != null) {
Action audioAction = map.get(getPropertyPrefix() + ".commandSound");
if (audioAction != null) {
// pass off firing the Action to a utility method
BasicLookAndFeel lf = (BasicLookAndFeel) UIManager.getLookAndFeel();
// it's imposible to mormally invoke it.
try {
Method playSoundMethod = BasicLookAndFeel.class.getDeclaredMethod(PLAY_SOUND_METHOD, new Class[] { Action.class });
playSoundMethod.setAccessible(true);
playSoundMethod.invoke(lf, new Object[] { audioAction });
} catch (Exception ignored) {
}
}
}
}
// Visual feedback
if (msm == null) {
msm = MenuSelectionManager.defaultManager();
}
msm.clearSelectedPath();
((ActionMenuItem) menuItem).fireActionPerformed(new ActionEvent(menuItem, ActionEvent.ACTION_PERFORMED, null, e.getWhen(), e.getModifiers()));
}
use of javax.swing.plaf.basic.BasicLookAndFeel in project jdk8u_jdk by JetBrains.
the class bug4885629 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new BasicLookAndFeel() {
public boolean isSupportedLookAndFeel() {
return true;
}
public boolean isNativeLookAndFeel() {
return false;
}
public String getDescription() {
return "Foo";
}
public String getID() {
return "FooID";
}
public String getName() {
return "FooName";
}
});
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame();
JComponent a = new JPanel();
a.setBackground(Color.white);
a.setMinimumSize(new Dimension(10, 10));
JComponent b = new JPanel();
b.setBackground(Color.white);
b.setMinimumSize(new Dimension(10, 10));
sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, a, b);
sp.setPreferredSize(new Dimension(20, 20));
sp.setBackground(BGCOLOR);
Border bo = new BasicBorders.SplitPaneBorder(lightHighlight, Color.red);
Border ibo = new EmptyBorder(0, 0, 0, 0);
sp.setBorder(bo);
sp.setMinimumSize(new Dimension(200, 200));
((BasicSplitPaneUI) sp.getUI()).getDivider().setBorder(ibo);
frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().setBackground(darkShadow);
frame.getContentPane().add(sp);
frame.setSize(200, 200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
});
((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
final Robot robot = new Robot();
robot.delay(1000);
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
Rectangle rect = ((BasicSplitPaneUI) sp.getUI()).getDivider().getBounds();
Point p = rect.getLocation();
SwingUtilities.convertPointToScreen(p, sp);
for (int i = 0; i < rect.width; i++) {
if (!BGCOLOR.equals(robot.getPixelColor(p.x + i, p.y + rect.height - 1))) {
throw new Error("The divider's area has incorrect color.");
}
}
}
});
}
Aggregations