javax.swing.plaf.synth.SynthLookAndFeel Java Examples

The following examples show how to use javax.swing.plaf.synth.SynthLookAndFeel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: bug7143614.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example #2
Source File: bug6913768.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
        }
    });
}
 
Example #3
Source File: bug6924059.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            new JScrollBar().setUI(new SynthScrollBarUI() {
                protected void configureScrollBarColors() {
                    super.configureScrollBarColors();
                    isMethodCalled = true;
                }
            });

            if (!isMethodCalled) {
                throw new RuntimeException("The configureScrollBarColors was not called");
            }
        }
    });
}
 
Example #4
Source File: bug7143614.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example #5
Source File: bug6918861.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            HackedSynthSliderUI ui = new HackedSynthSliderUI(slider);

            slider.setUI(ui);

            if (ui.counter != 111) {
                throw new RuntimeException("Some installers of SynthSliderUI weren't invoked");
            }

            slider.setUI(null);

            if (ui.counter != 0) {
                throw new RuntimeException("Some uninstallers of SynthSliderUI weren't invoked");
            }
        }
    });
}
 
Example #6
Source File: bug6918861.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            HackedSynthSliderUI ui = new HackedSynthSliderUI(slider);

            slider.setUI(ui);

            if (ui.counter != 111) {
                throw new RuntimeException("Some installers of SynthSliderUI weren't invoked");
            }

            slider.setUI(null);

            if (ui.counter != 0) {
                throw new RuntimeException("Some uninstallers of SynthSliderUI weren't invoked");
            }
        }
    });
}
 
Example #7
Source File: bug6923305.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            slider.setUI(new SynthSliderUI(slider) {
                @Override
                protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) {
                    throw new RuntimeException("Test failed: the SynthSliderUI.paintTrack was invoked");
                }
            });

            slider.setPaintTrack(false);
            slider.setSize(slider.getPreferredSize());

            BufferedImage bufferedImage = new BufferedImage(slider.getWidth(), slider.getHeight(),
                    BufferedImage.TYPE_INT_ARGB);

            slider.paint(bufferedImage.getGraphics());
        }
    });
}
 
Example #8
Source File: bug6923305.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            slider.setUI(new SynthSliderUI(slider) {
                @Override
                protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) {
                    throw new RuntimeException("Test failed: the SynthSliderUI.paintTrack was invoked");
                }
            });

            slider.setPaintTrack(false);
            slider.setSize(slider.getPreferredSize());

            BufferedImage bufferedImage = new BufferedImage(slider.getWidth(), slider.getHeight(),
                    BufferedImage.TYPE_INT_ARGB);

            slider.paint(bufferedImage.getGraphics());
        }
    });
}
 
Example #9
Source File: bug6913768.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
        }
    });
}
 
Example #10
Source File: bug6918861.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            HackedSynthSliderUI ui = new HackedSynthSliderUI(slider);

            slider.setUI(ui);

            if (ui.counter != 111) {
                throw new RuntimeException("Some installers of SynthSliderUI weren't invoked");
            }

            slider.setUI(null);

            if (ui.counter != 0) {
                throw new RuntimeException("Some uninstallers of SynthSliderUI weren't invoked");
            }
        }
    });
}
 
Example #11
Source File: bug6923305.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            slider.setUI(new SynthSliderUI(slider) {
                @Override
                protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) {
                    throw new RuntimeException("Test failed: the SynthSliderUI.paintTrack was invoked");
                }
            });

            slider.setPaintTrack(false);
            slider.setSize(slider.getPreferredSize());

            BufferedImage bufferedImage = new BufferedImage(slider.getWidth(), slider.getHeight(),
                    BufferedImage.TYPE_INT_ARGB);

            slider.paint(bufferedImage.getGraphics());
        }
    });
}
 
Example #12
Source File: bug6924059.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            new JScrollBar().setUI(new SynthScrollBarUI() {
                protected void configureScrollBarColors() {
                    super.configureScrollBarColors();
                    isMethodCalled = true;
                }
            });

            if (!isMethodCalled) {
                throw new RuntimeException("The configureScrollBarColors was not called");
            }
        }
    });
}
 
Example #13
Source File: bug6923305.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            slider.setUI(new SynthSliderUI(slider) {
                @Override
                protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) {
                    throw new RuntimeException("Test failed: the SynthSliderUI.paintTrack was invoked");
                }
            });

            slider.setPaintTrack(false);
            slider.setSize(slider.getPreferredSize());

            BufferedImage bufferedImage = new BufferedImage(slider.getWidth(), slider.getHeight(),
                    BufferedImage.TYPE_INT_ARGB);

            slider.paint(bufferedImage.getGraphics());
        }
    });
}
 
Example #14
Source File: bug6923305.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            slider.setUI(new SynthSliderUI(slider) {
                @Override
                protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) {
                    throw new RuntimeException("Test failed: the SynthSliderUI.paintTrack was invoked");
                }
            });

            slider.setPaintTrack(false);
            slider.setSize(slider.getPreferredSize());

            BufferedImage bufferedImage = new BufferedImage(slider.getWidth(), slider.getHeight(),
                    BufferedImage.TYPE_INT_ARGB);

            slider.paint(bufferedImage.getGraphics());
        }
    });
}
 
Example #15
Source File: bug6913768.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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);
        }
    });
}
 
Example #16
Source File: bug7143614.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example #17
Source File: bug6913768.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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);
        }
    });
}
 
Example #18
Source File: bug7143614.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example #19
Source File: bug6918861.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            HackedSynthSliderUI ui = new HackedSynthSliderUI(slider);

            slider.setUI(ui);

            if (ui.counter != 111) {
                throw new RuntimeException("Some installers of SynthSliderUI weren't invoked");
            }

            slider.setUI(null);

            if (ui.counter != 0) {
                throw new RuntimeException("Some uninstallers of SynthSliderUI weren't invoked");
            }
        }
    });
}
 
Example #20
Source File: bug8040328.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    SynthLookAndFeel lookAndFeel = new SynthLookAndFeel();
    lookAndFeel.load(new ByteArrayInputStream(synthXml.getBytes("UTF8")),
            bug8040328.class);
    UIManager.setLookAndFeel(lookAndFeel);
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            final JFrame frame = new JFrame();
            try {
                frame.setUndecorated(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setVisible(true);
                test(frame);
            } finally {
                frame.dispose();
            }
        }
    });
    System.out.println("ok");
}
 
Example #21
Source File: bug6923305.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            slider.setUI(new SynthSliderUI(slider) {
                @Override
                protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) {
                    throw new RuntimeException("Test failed: the SynthSliderUI.paintTrack was invoked");
                }
            });

            slider.setPaintTrack(false);
            slider.setSize(slider.getPreferredSize());

            BufferedImage bufferedImage = new BufferedImage(slider.getWidth(), slider.getHeight(),
                    BufferedImage.TYPE_INT_ARGB);

            slider.paint(bufferedImage.getGraphics());
        }
    });
}
 
Example #22
Source File: bug6913768.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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);
        }
    });
}
 
Example #23
Source File: bug6923305.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            slider.setUI(new SynthSliderUI(slider) {
                @Override
                protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) {
                    throw new RuntimeException("Test failed: the SynthSliderUI.paintTrack was invoked");
                }
            });

            slider.setPaintTrack(false);
            slider.setSize(slider.getPreferredSize());

            BufferedImage bufferedImage = new BufferedImage(slider.getWidth(), slider.getHeight(),
                    BufferedImage.TYPE_INT_ARGB);

            slider.paint(bufferedImage.getGraphics());
        }
    });
}
 
Example #24
Source File: bug7143614.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example #25
Source File: bug6918861.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            JSlider slider = new JSlider();

            HackedSynthSliderUI ui = new HackedSynthSliderUI(slider);

            slider.setUI(ui);

            if (ui.counter != 111) {
                throw new RuntimeException("Some installers of SynthSliderUI weren't invoked");
            }

            slider.setUI(null);

            if (ui.counter != 0) {
                throw new RuntimeException("Some uninstallers of SynthSliderUI weren't invoked");
            }
        }
    });
}
 
Example #26
Source File: bug6924059.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            new JScrollBar().setUI(new SynthScrollBarUI() {
                protected void configureScrollBarColors() {
                    super.configureScrollBarColors();
                    isMethodCalled = true;
                }
            });

            if (!isMethodCalled) {
                throw new RuntimeException("The configureScrollBarColors was not called");
            }
        }
    });
}
 
Example #27
Source File: bug6924059.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            new JScrollBar().setUI(new SynthScrollBarUI() {
                protected void configureScrollBarColors() {
                    super.configureScrollBarColors();
                    isMethodCalled = true;
                }
            });

            if (!isMethodCalled) {
                throw new RuntimeException("The configureScrollBarColors was not called");
            }
        }
    });
}
 
Example #28
Source File: bug6913768.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
        }
    });
}
 
Example #29
Source File: bug7143614.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void validate() throws Exception {
    Method getSelectedUIMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUI");

    getSelectedUIMethod.setAccessible(true);

    Method getSelectedUIStateMethod = SynthLookAndFeel.class.getDeclaredMethod("getSelectedUIState");

    getSelectedUIStateMethod.setAccessible(true);

    if (getSelectedUIMethod.invoke(null) != componentUI) {
        throw new RuntimeException("getSelectedUI returns invalid value");
    }
    if (((Integer) getSelectedUIStateMethod.invoke(null)).intValue() !=
            (SynthConstants.SELECTED | SynthConstants.FOCUSED)) {
        throw new RuntimeException("getSelectedUIState returns invalid value");
    }

}
 
Example #30
Source File: bug6924059.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            new JScrollBar().setUI(new SynthScrollBarUI() {
                protected void configureScrollBarColors() {
                    super.configureScrollBarColors();
                    isMethodCalled = true;
                }
            });

            if (!isMethodCalled) {
                throw new RuntimeException("The configureScrollBarColors was not called");
            }
        }
    });
}