Refine search
this.ghostText = ghostText; this.ghostColor = Color.LIGHT_GRAY; textfield.addFocusListener(this); registerListeners(); updateState(); GhostText ghostText = new GhostText(textField, "Please enter some text here..."); textField.setPreferredSize(new Dimension(300, 24)); panel.add(textField); panel.add(button); frame.add(panel); frame.pack(); frame.setVisible(true);
tc.setCellEditor(new SpinnerEditor()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(table); frame.pack(); frame.setVisible(true); editor = ((JSpinner.DefaultEditor)spinner.getEditor()); textField = editor.getTextField(); textField.addFocusListener( new FocusListener() { public void focusGained( FocusEvent fe ) { System.err.println("Got focus");
this.addFocusListener(this); this.addActionListener(this); setToolTipText(target.toString()); p.add(linkLabelFile); p.add(linkLabelWeb); labelConstrain.add( linkLabelConstrain, BorderLayout.EAST ); p.add(labelConstrain);
JTextField tf1 = new JTextField(6); tf1.setName("tf1"); p.add(tf1); JTextField tf2 = new JTextField(6); tf2.setName("tf2"); p.add(tf2); FocusListener fl = new FocusListener() tf1.addFocusListener(fl); tf2.addFocusListener(fl); JPanel contentPane = new JPanel(); contentPane.add(p); JFrame f = new JFrame(); f.setContentPane(contentPane);
c[k].addFocusListener(fl); jf.getContentPane().setLayout(new FlowLayout()); cjb.addFocusListener(new example_jSpinner1_focusAdapter(cjb)); jf.getContentPane().add(cjb,null); jf.getContentPane().add(jp,null); jf.pack();
public static void main( String[] args ) { final JFrame frame = new JFrame( "Test" ); frame.addFocusListener( new FocusListener() { private boolean gained = false; @Override frame.add( new JLabel( "testlabel" ) );
txtNo.addFocusListener(new CustomFocusListener(txtNo)); add(txtNo); txtNo2.addFocusListener(new CustomFocusListener(txtNo2)); add(txtNo2); txtNo3.addFocusListener(new CustomFocusListener(txtNo3)); add(txtNo3); add(new JButton("Do Something"));
textFieldA.setText("Field A"); textFieldA.setFocusable(true); textFieldA.addFocusListener(this); this.add(textFieldA); textFieldB.addFocusListener(this); this.add(textFieldB); this.add(buttonA);
JTextField component3 = new JTextField(20); MyFocusListener l = new MyFocusListener(); component.addFocusListener(l); component1.addFocusListener(l); component2.addFocusListener(l); component3.addFocusListener(l); JFrame f = new JFrame(); f.setLayout(new FlowLayout()); f.add(component1); f.add(component); f.add(component2); f.add(component3); f.pack();
add("Center",tablePane_); addFocusListener(new SerializationListener(this)); //@B0A addFocusListener(new SerializationListener(model_, table_)); //@B0A
add(button,BorderLayout.WEST); JTextField field = new JTextField(5); field.addFocusListener(new FocusListener() { add(field,BorderLayout.EAST);
lblToFocus.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { frame.getContentPane().add(lblToFocus, BorderLayout.PAGE_START); frame.getContentPane().add(btnFocus, BorderLayout.CENTER);
final JTextField tfield2 = new JTextField(10); tfield2.setText("default text"); tfield2.addFocusListener(new FocusListener() contentPane.add(tfield); contentPane.add(tfield2);
field1.addFocusListener(highlighter); field2.addFocusListener(highlighter); gbc.insets = new Insets(4, 4, 4, 4); gbc.gridwidth = gbc.REMAINDER; frame.add(field1, gbc); frame.add(field2, gbc); frame.pack(); frame.setLocationRelativeTo(null);
textField.setName(name); textField.setInputVerifier(inputVerifier); textField.addFocusListener(focusListener); panel.add(new JLabel(name)); panel.add(textField);
super(text); addFocusListener(new FocusAdapter() { f.add(tf, BorderLayout.CENTER); f.add(ftf, BorderLayout.SOUTH);
f1.addFocusListener(getFocusListener()); add(f1,BorderLayout.SOUTH); add(new JTextField(5),BorderLayout.NORTH);
JButton b = new JButton("Button"); final JPanel p = new JPanel(); p.add(b); p.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent ev) { p.requestFocus(); f.getContentPane().add(p); f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
button.addFocusListener( fa ); add( button ); textField.addFocusListener( fa ); add( textField ); checkBox.addFocusListener( fa ); add( checkBox );
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); add(new JScrollPane(new JDynamicTextArea())); add(new JTextField(10)); addFocusListener(this);