当前位置: 首页>>代码示例>>Java>>正文


Java SynthLookAndFeel.load方法代码示例

本文整理汇总了Java中javax.swing.plaf.synth.SynthLookAndFeel.load方法的典型用法代码示例。如果您正苦于以下问题:Java SynthLookAndFeel.load方法的具体用法?Java SynthLookAndFeel.load怎么用?Java SynthLookAndFeel.load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.plaf.synth.SynthLookAndFeel的用法示例。


在下文中一共展示了SynthLookAndFeel.load方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
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");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:bug8040328.java

示例2: SynthTableColors

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
public SynthTableColors() throws Exception {
    setTitle(System.getProperty("java.version"));
    InputStream is = new ByteArrayInputStream(synthXml.getBytes("UTF8"));
    SynthLookAndFeel laf = new SynthLookAndFeel();
    laf.load(is, SynthTableColors.class);
    UIManager.setLookAndFeel(laf);

    JTable table = new JTable();
    configureTable(table);

    JXTable xtable = new JXTable();
    configureTable(xtable);
    add(createTab(table, xtable));
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    pack();
    setLocationRelativeTo(null);
    setVisible(true);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:19,代码来源:SynthTableColors.java

示例3: main

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
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!");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:SynthTest.java

示例4: SynthPanelPainterTest

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
public SynthPanelPainterTest() throws Exception
  {
    InputStream is = new ByteArrayInputStream(synthXml.getBytes("UTF8"));
    SynthLookAndFeel laf = new SynthLookAndFeel();
    laf.load(is, SynthPanelPainterTest.class);
    UIManager.setLookAndFeel(laf);    

    setLayout(new BoxLayout(getContentPane(), BoxLayout.LINE_AXIS));

    JPanel p = new JPanel(new BorderLayout());
//    p.setBorder(new LineBorder(Color.GREEN));
    p.add(new JLabel("in core panel"));
    add(p);    
    
    JXPanel xp = new JXPanel(new BorderLayout());
    
    JLabel label = new JLabel("happily living in x panel");
    label.setForeground(Color.GREEN);
    label.setHorizontalAlignment(JLabel.CENTER);
    xp.add(label);
    xp.setBackgroundPainter(new ImagePainter(XTestUtils.loadDefaultImage()));
//    xp.setBorder(new LineBorder(Color.RED));
    add(xp);    
    
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(new Dimension(600, 400));
    setLocationRelativeTo(null);
    setVisible(true);      
  }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:30,代码来源:SynthPanelPainterTest.java

示例5: setSynthLookAndFeel

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private void setSynthLookAndFeel() {
    SynthLookAndFeel laf = new SynthLookAndFeel();
    try {
        laf.load(this.getClass().getClassLoader().getResourceAsStream("laf.xml"), SwingMonitor.class);
        UIManager.setLookAndFeel(laf);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:swift-lang,项目名称:swift-k,代码行数:11,代码来源:SwingMonitor.java

示例6: initLookAndFeel

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private static void initLookAndFeel() 
{
    SynthLookAndFeel lookAndFeel = new SynthLookAndFeel();
    
    try 
    {
        lookAndFeel.load(RootWindow.class.getResourceAsStream(LAF_FILE), RootWindow.class);
        UIManager.setLookAndFeel(lookAndFeel);
    } 
    catch (Exception e) 
    {
        e.printStackTrace();
    }        
}
 
开发者ID:jwfwessels,项目名称:AFK,代码行数:15,代码来源:Main.java

示例7: main

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
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");
        }
    });
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:58,代码来源:bug7158712.java

示例8: main

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
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);
        }
    });

    robot.waitForIdle();

    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");
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:58,代码来源:bug7158712.java

示例9: SynthCheckBoxPainterTest

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
public SynthCheckBoxPainterTest() throws Exception
  {
    InputStream is = new ByteArrayInputStream(synthXml.getBytes("UTF8"));
    SynthLookAndFeel laf = new SynthLookAndFeel();
    laf.load(is, SynthCheckBoxPainterTest.class);
    UIManager.setLookAndFeel(laf); 
    // optional: background image to check fix for 1513- swingx
    // support fully transparent renderers
    JXPanel panel = new JXPanel(new BorderLayout());
    panel.setBackgroundPainter(new ImagePainter(XTestUtils.loadDefaultImage("moon.jpg")));
    setContentPane(panel);
    

    JXTable table = new JXTable(new MyTableModel(100));
    // optional: forcing a semi-transparent background onto an otherwise opaque 
    // renderingComponent
//    DefaultTableRenderer renderer = (DefaultTableRenderer) table.getDefaultRenderer(Boolean.class);
//    ComponentProvider provider = renderer.getComponentProvider();
//    provider.getDefaultVisuals().setBackground(PaintUtils.setAlpha(Color.BLUE, 100));
    // apply striping
    table.addHighlighter(HighlighterFactory.createSimpleStriping(Color.YELLOW));
    // apply swingx painter
    table.addHighlighter(new PainterHighlighter(HighlightPredicate.ROLLOVER_ROW, 
            new MattePainter(PaintUtils.setAlpha(Color.RED, 100))));
//            new BusyPainter()));
    add(new JScrollPane(table));    


    // optional: background image to check fix for 1513- swingx
    // support fully transparent renderers
    // set transparent
//    ((DefaultTableRenderer) table.getDefaultRenderer(Boolean.class))
//        .getComponentProvider().getRendererComponent(null).setOpaque(false);
//    table.setOpaque(false);
//    ((JComponent) table.getParent()).setOpaque(false);
//    ((JComponent) table.getParent().getParent()).setOpaque(false);


    add(new JCheckBox("Regular CheckBox"), BorderLayout.SOUTH);
    
    setTitle("Synth table (transparent/update) rollover " + System.getProperty("java.version"));
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(new Dimension(600, 400));
    setLocationRelativeTo(null);
    setVisible(true);      
  }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:47,代码来源:SynthCheckBoxPainterTest.java


注:本文中的javax.swing.plaf.synth.SynthLookAndFeel.load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。