requestFocus « Focus « Java Swing Q&A





1. call transferFocus or requestFocus?    stackoverflow.com

in my application i get a component to focus , it could be a jpanel , and is could be a jbutton or a user custom made component how can i ...

2. requestFocus() is not working??    coderanch.com

3. RequestFocus()    coderanch.com

4. how to use method requestFocus()    coderanch.com

Hi, look at this: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; class TextTestFrame extends JFrame { private JTextField hourField; private JTextField minuteField; public static void main(String[] args) { JFrame frame = new TextTestFrame(); } public TextTestFrame() { this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); }}); JPanel p = new JPanel(); hourField = new JTextField("12", 3); minuteField = new ...

5. different behaviour of requestFocus in jdk1.3 and jdk1.4    coderanch.com

hi, I'm developing an application that contains a JTable and a few of its columns contain. JTextField. On jdk 1.4 if you click on one cell to start an edit and then click on another cell to start an edit the second edit does not begin and likewise the problem occurs alternatively. This is because the focus alternates between the JTable ...

6. different behaviour of requestFocus in jdk1.3 and jdk1.4    coderanch.com

hi, I'm developing an application that contains a JTable and a few of its columns contain. JTextField. On jdk 1.4 if you click on one cell to start an edit and then click on another cell to start an edit the second edit does not begin and likewise the problem occurs alternatively. This is because the focus alternates between the JTable ...

7. requestFocus() problems    coderanch.com

What are the possible reasons that may cause requestFocus() not to work in linux when is works in windows? I have a screen that does some edit checking for required fields, if the field is required and it is blank I popup a dialog and position the cursor on the field. This works on %100 of my fields in windows, in ...

8. requestFocus question (not too urgent but I am curious)    coderanch.com

I would like to put the focus on my "input" textField after the user clicks the "discard" button (RightAction) Right now, this is what I have: public void rightAction() { // Reset display labels and store array to empty strings for(r=0;r<10;r=r+1) { storage[r]=""; display[r].setText(""); } //reset count to 0 count = 0; // Display an updated status message status(); } public ...

9. 1.3 - 1.4 requestFocus() incompatibility    coderanch.com

Hi, The focus model changed significantly between 1.3 and 1.4 Java versions. One problem I am currently having is that I can no longer call requestFocus() on a Component that is not a "focusable" one. In 1.3 even if a Component was not focusable, you could force the focus by calling requestFocus(). Now this method checks the Component for focusability by ...





10. RequestFocus doesn't work?    coderanch.com

private void initNorthLayout() { JPanel searchPanel = new JPanel(); searchPanel.setLayout(new BorderLayout()); searchPanel.setBorder(new TitledBorder( Constants.LABEL_SEARCHCRITERIA)); JPanel relationalOperator = new JPanel(); GridLayout gLayout = new GridLayout(2, 5,2,2); gLayout.setHgap(20); relationalOperator.setLayout(gLayout); //create the Combobox operatorBox = new JComboBox(new String[] {"AND", "OR"}); operatorBox.setForeground(Color.black); operatorBox.setBackground(Color.white); operatorBox.setToolTipText("Select relational operator"); operatorBox.setSelectedItem("And"); relationalOperator.add( UIUtils.createJLabel(Constants.LABEL_RELATIONALOPERATOR, UIUtils.DIMENSION_TEXT, false)); relationalOperator.add(operatorBox); relationalOperator.add(new JLabel()); relationalOperator.add(new JLabel()); relationalOperator.add(new JLabel()); relationalOperator.add(UIUtils.createJLabel(Constants.LABEL_NAME, UIUtils.DIMENSION_TEXT,false)); //create the JTextField JTextField criteria_name ...

11. jdk 1.4 requestFocus issue    coderanch.com

Hi, there: We upgraded our GUI application from jdk1.3.2 to jdk 1.4.2. Some codes to call requestFocus() that worked fine in jdk1.3.2 seems not work with 1.4.2. I have a complicated function, at the end of function I called ComponentA.requestFocus() which I want to set focus to ComponentA. However in jdk1.4.2 it always set the focus to the first component in ...

12. requestFocus is not working    coderanch.com

13. requestFocus() is not working across applications    coderanch.com

What's wrong with this code? I get focusLost() events all right, and when I requestFocus(), I get focusGained().. except it is NOT gained, my caret is still in Notepad! How do I get my caret out of there? public class Test { //----------------------------------------------------------------- public static void main(String[] args) { final JDialog dialog = new JDialog((JFrame) null, "Hello!"); final JTextField f = ...