javax.swing.plaf.metal.MetalTextFieldUI Java Examples

The following examples show how to use javax.swing.plaf.metal.MetalTextFieldUI. 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: FPMethodCalledTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
 
Example #2
Source File: FPMethodCalledTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
    }