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); }
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: */ }
/** * 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(); } }