Search in sources :

Example 1 with SynthLookAndFeel

use of javax.swing.plaf.synth.SynthLookAndFeel in project jdk8u_jdk by JetBrains.

the class bug7032791 method main.

public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());
    Object value = "Test value";
    JTable table = new JTable(1, 1);
    TableCellRenderer renderer = table.getDefaultRenderer(Object.class);
    renderer.getTableCellRendererComponent(null, value, true, true, 0, 0);
    System.out.println("OK");
}
Also used : TableCellRenderer(javax.swing.table.TableCellRenderer) SynthLookAndFeel(javax.swing.plaf.synth.SynthLookAndFeel)

Example 2 with SynthLookAndFeel

use of javax.swing.plaf.synth.SynthLookAndFeel in project jdk8u_jdk by JetBrains.

the class bug7158712 method main.

public static void main(String[] args) throws Exception {
    Robot robot = new Robot();
    robot.setAutoDelay(500);
    SynthLookAndFeel laf = new SynthLookAndFeel();
    laf.load(new ByteArrayInputStream(SYNTH_XML.getBytes("UTF8")), bug7158712.class);
    UIManager.setLookAndFeel(laf);
    EventQueue.invokeAndWait(new Runnable() {

        public void run() {
            comboBox = new JComboBox<>(new String[] { "Very Looooooooooooooooooooong Text Item 1", "Item 2" });
            JFrame frame = new JFrame();
            frame.add(comboBox, BorderLayout.NORTH);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(new Dimension(400, 300));
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
    Point comboBoxLocation = Util.invokeOnEDT(new Callable<Point>() {

        @Override
        public Point call() throws Exception {
            return comboBox.getLocationOnScreen();
        }
    });
    robot.mouseMove(comboBoxLocation.x, comboBoxLocation.y);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    SwingUtilities.invokeAndWait(new Runnable() {

        @Override
        public void run() {
            BasicComboPopup popup = (BasicComboPopup) comboBox.getAccessibleContext().getAccessibleChild(0);
            Point popupPoint = popup.getLocationOnScreen();
            Point comboBoxPoint = comboBox.getLocationOnScreen();
            if (comboBoxPoint.x - 5 != popupPoint.x || comboBoxPoint.y + comboBox.getHeight() - 5 != popupPoint.y) {
                throw new RuntimeException("Invalid popup coordinates. Popup location: " + popupPoint + ", comboBox location: " + comboBoxPoint);
            }
            System.out.println("Test bug7158712 passed");
        }
    });
}
Also used : SynthLookAndFeel(javax.swing.plaf.synth.SynthLookAndFeel) SunToolkit(sun.awt.SunToolkit) ByteArrayInputStream(java.io.ByteArrayInputStream) BasicComboPopup(javax.swing.plaf.basic.BasicComboPopup)

Example 3 with SynthLookAndFeel

use of javax.swing.plaf.synth.SynthLookAndFeel in project jdk8u_jdk by JetBrains.

the class Test6933784 method main.

public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());
    checkImages();
    UIManager.setLookAndFeel(new NimbusLookAndFeel());
    checkImages();
}
Also used : SynthLookAndFeel(javax.swing.plaf.synth.SynthLookAndFeel) NimbusLookAndFeel(javax.swing.plaf.nimbus.NimbusLookAndFeel)

Example 4 with SynthLookAndFeel

use of javax.swing.plaf.synth.SynthLookAndFeel in project jdk8u_jdk by JetBrains.

the class SynthTest method main.

public static void main(String[] args) throws Exception {
    SynthLookAndFeel laf = new SynthLookAndFeel();
    InputStream in = SynthTest.class.getResourceAsStream("synthconfig.xml");
    laf.load(in, SynthTest.class);
    UIManager.setLookAndFeel(laf);
    if (!Color.RED.equals(new JButton().getForeground())) {
        throw new RuntimeException("The wrong foreground color!");
    }
}
Also used : InputStream(java.io.InputStream) SynthLookAndFeel(javax.swing.plaf.synth.SynthLookAndFeel)

Example 5 with SynthLookAndFeel

use of javax.swing.plaf.synth.SynthLookAndFeel in project jdk8u_jdk by JetBrains.

the class bug6913768 method main.

public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());
    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            JFrame frame = new JFrame();
            JTable table = new JTable(new Object[][] { { "1", "2" }, { "3", "4" } }, new Object[] { "col1", "col2" });
            frame.getContentPane().add(new JScrollPane(table));
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 200);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
}
Also used : SynthLookAndFeel(javax.swing.plaf.synth.SynthLookAndFeel)

Aggregations

SynthLookAndFeel (javax.swing.plaf.synth.SynthLookAndFeel)9 BufferedImage (java.awt.image.BufferedImage)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 Method (java.lang.reflect.Method)1 BasicComboPopup (javax.swing.plaf.basic.BasicComboPopup)1 BasicTabbedPaneUI (javax.swing.plaf.basic.BasicTabbedPaneUI)1 NimbusLookAndFeel (javax.swing.plaf.nimbus.NimbusLookAndFeel)1 SynthContext (javax.swing.plaf.synth.SynthContext)1 SynthScrollBarUI (javax.swing.plaf.synth.SynthScrollBarUI)1 SynthSliderUI (javax.swing.plaf.synth.SynthSliderUI)1 TableCellRenderer (javax.swing.table.TableCellRenderer)1 SunToolkit (sun.awt.SunToolkit)1