Java 类javax.swing.plaf.metal.MetalTextFieldUI 实例源码

项目:openjdk-jdk10    文件:FPMethodCalledTest.java   
static void createAndShowGUI(Test test) {

        try {
            UIManager.setLookAndFeel(new MetalLookAndFeel());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        frame = new JFrame();
        frame.setSize(300, 300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JPanel panel = new JPanel(new FlowLayout());

        String text = "AAAAAAA";
        textField = test.isPasswordField()
                ? new JPasswordField(text)
                : new JTextField(text);

        textField.setUI(new MetalTextFieldUI() {

            @Override
            public View create(Element elem) {
                return test.createView(elem);
            }
        });

        panel.add(textField);
        frame.getContentPane().add(panel);
        frame.setVisible(true);
    }
项目:jdk8u_jdk    文件:FPMethodCalledTest.java   
static void createAndShowGUI(Test test) {

        try {
            UIManager.setLookAndFeel(new MetalLookAndFeel());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        frame = new JFrame();
        frame.setSize(300, 300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JPanel panel = new JPanel(new FlowLayout());

        String text = "AAAAAAA";
        textField = test.isPasswordField()
                ? new JPasswordField(text)
                : new JTextField(text);

        textField.setUI(new MetalTextFieldUI() {

            @Override
            public View create(Element elem) {
                return test.createView(elem);
            }
        });

        panel.add(textField);
        frame.getContentPane().add(panel);
        frame.setVisible(true);
    }
项目:confluence.keygen    文件:PlasticComboBoxUI.java   
private static void ensurePhantomHasPlasticUI()
/*  54:    */   {
/*  55: 99 */     TextUI ui = PHANTOM.getUI();
/*  56:100 */     Class lafClass = UIManager.getLookAndFeel().getClass();
/*  57:101 */     if ((phantomLafClass != lafClass) || (!(ui instanceof MetalTextFieldUI)))
/*  58:    */     {
/*  59:103 */       phantomLafClass = lafClass;
/*  60:104 */       PHANTOM.updateUI();
/*  61:    */     }
/*  62:    */   }
项目:IBMDataMovementTool    文件:PlasticComboBoxUI.java   
/**
 * Ensures that the phantom text field has a Plastic text field UI.
 */
private static void ensurePhantomHasPlasticUI() {
    TextUI ui = PHANTOM.getUI();
    Class lafClass = UIManager.getLookAndFeel().getClass();
    if (   (phantomLafClass != lafClass)
        || !(ui instanceof MetalTextFieldUI)) {
        phantomLafClass = lafClass;
        PHANTOM.updateUI();
    }
}