JTextArea should get focus...

Hi everybody,
I want to accomplish a relatively easy task: when I click on a JButton the text area in my frame should get focus, i.e.: there should be a blinking cursor in the text area and the user should be able to start typing in it right away. However, the text area refuses to get the focus. This is my code:
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
public class TextAreaFocus implements ActionListener
   private static JTextArea text = new JTextArea();
   private static JButton btn = new JButton("Click me");
   public static void main(String[] args)
      // Init the JTextArea.
      text.setText("testje");
      text.setRows(10);
      text.setColumns(50);
      text.setFocusable(true);
      // Create the JPanel for the components.
      JPanel panel = new JPanel(new GridLayout(2, 1));
      panel.add(btn);
      panel.add(text);
      // Create a JFrame to show it all.
      JFrame frame = new JFrame("Testing JTextArea focus");
      frame.add(panel);
      frame.pack();
      frame.setVisible(true);
   public void actionPerformed(ActionEvent e)
      // When the button is clicked the cursor should be placed in the text area.
      // text.requestFocus();
      text.requestFocusInWindow();
}I guess I am doing / forgetting something really trivial, however I just don't see it.
Best regards,
Jethro

You are right, what i huge mistake! I made this program however, to demonstrate the problem. In my original program (much more complicated that the example off course) requestFocus() does not do the trick. Tomorrow I will try and see if I can give a more complete example which comes closer to the original program.

Similar Messages

  • Text box should get focus

    Hi,
              In my jsp page I have a form witho two text fields i.e input type="text"
              These two text fields get the values from scanning. Since scanning
              generates an event enter(it is going to submit the form), so after I scan
              the first value to the first text box, the second text box should get focus
              and after the ticket is scanned to the 2nd text box it should submit the
              form and the focus should return to the
              2nd text box and not the first one.
              Thanks
              Madhu
              

    I got it working
              Thanks
              Madhu
              m holur <[email protected]> wrote in message
              news:3c1f42c7$[email protected]..
              > Hi,
              >
              > It needs a java script, I am having onsumbit focus should be on the
              second
              > text box, but it is not working. I need to know what java script I should
              > use?
              >
              > Thanks
              > Madhu
              > Nils Winkler <[email protected]> wrote in message
              > news:[email protected]..
              > > This sounds like you need to use JavaScript...
              > >
              > > Nils
              > >
              > > m holur wrote:
              > > >
              > > > Hi,
              > > >
              > > > In my jsp page I have a form witho two text fields i.e input
              > type="text"
              > > > These two text fields get the values from scanning. Since scanning
              > > > generates an event enter(it is going to submit the form), so after I
              > scan
              > > > the first value to the first text box, the second text box should get
              > focus
              > > > and after the ticket is scanned to the 2nd text box it should submit
              the
              > > > form and the focus should return to the
              > > > 2nd text box and not the first one.
              > > >
              > > > Thanks
              > > > Madhu
              > >
              > > --
              > > ============================
              > > [email protected]
              >
              >
              

  • JTextField and JTextArea don't get focus occuasionally

    I am developing a Java Swing Applet. At edit mode, JComboBox, JCheckBox, JRadioBox, and JButton work fine, but JTextField and JTextArea can't get focus occuasionally while I click them.
    Anyone has idea?
    Thanks

    Thank you Himanshu,
    but that's not exactly what my issue is. This link describes the undesired effect of ending up outisde of the player window and in the browser.
    My problem is kind of the opposite. When I launch the page in the html file I cannot use the tab key to get to any of the controls in the captivate window. I'm stuck in the browser unless I click on the captivate window. That is not acceptable if we want it accessible without using a mouse. I found a way to make it work for chrome like I stated above, but not in FF. Do you have any ideas for this?
    Thanks!
    Monique

  • Can't get focus in JTabbedPane

    I have several tabs in a JTabbedPane. Each tabb is hotkeyed to "1","2","3", etc. The left and right arrows keys are remapped in this way:
    mainTabbPane.registerKeyboardAction (PrintHi, KeyStroke.getKeyStroke (KeyEvent.VK_LEFT, 0), JComponent.WHEN_FOCUSED);
    And I have an AbstractAction like this:
    AbstractAction PrintHi = new AbstractAction ()
    public void actionPerformed (ActionEvent e)
    System.out.print ("Hi");
    The problem is this. On each tabb I have several JTables, JLabels, JTextAreas and other stuff showing information. When I select/edit something, like a JTable, the arrow hotkeys stop function. It seems to me as the last selected JTable still has the focus and won't let it go. So when I press arrow keys, the arrow keys is directed into the JTable instead? Dont know if it so, but that is the impression I get.
    The weird thing is, the hotkeys for the different tabs works. If I press ALT + 1, the first tabb pops up. But the JTable is still selected. And the arrow keys is directed into the JTable.
    Anyone has pointers and hints?

    Ok, I apologize for not having explained my question completely. This is exactly what I am trying to do:
    When I press the arrow keys, they will print out a message. After I go to the 3rd panel and choose a combobox, I go back to the first panel and the arrow keys suddenly stop working. Why???
    (It is as if the 1st tabbpane has lost the focus, and cant get it. The focus is stuck on the JComboBox. When I switch back to 1st panel from comboboxpanel, I want the 1st panel to get focus, and hence the arrow keys will work again. When I choose the 3rd panel the arrow keys can stop work, that is ok. The important thing is that when I switch back to the first panel, the arrow key must work again. In an ideal world, the arrow keys are tied to panel 1 and panel 2. Hence, when I switch to panel 3, the arrow keys will stop work. When I choose panel 1 again, the arrow keys must work.)
    Sorry for making it difficult for you to help me. I really appreciate your effort. The thing is, I am starting a software company and am supposed to deliver the first version tomorrow monday. And everything works ok, except this CENSORED hot keys. Making me really stressed. Well, anyway I have specified the question better now. I really hope you can point me in the right direction on how to solve this problem.
    Is there a way for the shown panel to get focus? When I switch to panel 1, it gets the focus? Or should I try to tie the arrow keys to panel 1? Or should I tell the combobox to not respond to arrow keys? Which way to go?
    Please execute the program and see if it is only me having a problem?
    package test;
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyEvent;
    import javax.swing.AbstractAction;
    import javax.swing.JComboBox;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;
    import javax.swing.JTable;
    import javax.swing.KeyStroke;
    public class SSCCEE extends JFrame {
         private static final long serialVersionUID = 1L;
         JTabbedPane tabbpane = null;
         public static void main(String args[]) {
              new SSCCEE();
         public SSCCEE() {
              tabbpane = new JTabbedPane();
              tabbpane.insertTab("tabb 1", null, new MyTablePane(), "tooltip1", 0);
              tabbpane.setMnemonicAt(0, KeyEvent.VK_1);
              tabbpane.insertTab("tabb 2", null, new MyTablePane(), "tooltip2", 1);
              tabbpane.setMnemonicAt(1, KeyEvent.VK_2);
              tabbpane.insertTab("tabb 3", null, new MyComboboxPane(), "tooltip3", 2);
              tabbpane.setMnemonicAt(2, KeyEvent.VK_3);
              this.add(tabbpane);
              setHotKeys();
              this.pack();
              this.setVisible(true);
         private void setHotKeys() {
              AbstractAction PrintHi = new AbstractAction() {
                   private static final long serialVersionUID = 1L;
                   public void actionPerformed(ActionEvent e) {
                        System.out.print("Hi ");
              AbstractAction PrintHo = new AbstractAction() {
                   private static final long serialVersionUID = 1L;
                   public void actionPerformed(ActionEvent e) {
                        System.out.print("Ho ");
              tabbpane.registerKeyboardAction(PrintHi, KeyStroke.getKeyStroke(
                        KeyEvent.VK_LEFT, 0), JComponent.WHEN_FOCUSED);
              tabbpane.registerKeyboardAction(PrintHo, KeyStroke.getKeyStroke(
                        KeyEvent.VK_RIGHT, 0), JComponent.WHEN_FOCUSED);
    class MyComboboxPane extends JPanel {
         private static final long serialVersionUID = 1L;
         private JComboBox aCombobox = null;
         MyComboboxPane() {
              aCombobox = new JComboBox();
              aCombobox.addItem("Meow");
              aCombobox.addItem("Voff");
              this.add(aCombobox);
              aCombobox.addActionListener(new java.awt.event.ActionListener() {
                   public void actionPerformed(java.awt.event.ActionEvent e) {
                        JComboBox cb = (JComboBox) e.getSource();
                        System.out.println((String) cb.getSelectedItem());
    class MyTablePane extends JPanel {
         private static final long serialVersionUID = 1L;
         private JTable aTable = null;
         MyTablePane() {
              aTable = new JTable(
                        new String[][] { { "This", "is", "cell 13" },
                                  { "a", "Test", "cell 23" },
                                  { "cell 31", "cell 32", "cell 33" } }, new String[] {
                                  "Col 1", "Col 2", "Col 3" });
              this.add(aTable);
    }

  • Avoid window getting focus after pressing a mouse button on it

    I want that a window does not get focus although I press a mouse button on it, in Windows XP.
    I have search in Microsoft help and this fact is controlled by the Operating System itself. The notification that is sent after the user presses a mouse button is WM_MOUSEACTIVATE notification. The return value of this notification indicates the behaviour of the window after the mouse down, existing 4 options: MA_ACTIVATE, MA_ACTIVATEANDEAT; MA_NOACTIVATE & MA_NOACTIVATEANDEAT. The default is the first one, but I want to change the behaviour of the window to be the the third one: MA_NOACTIVATE, that does not activate the window, and does not discard the mouse message. The function that performs this is DefWindowProc according to the MSDN Help content.
    Any help about doing this in Labview? Is there any special function in Labview that allows setting this behaviour to a window or should I use a Windows dll? In that case how can be programmed? Has anyone done it before? I'm working with Labview 8.6.1, and I haven't found anything about this. Any help will be very useful.
    Thank you very much in advance.
    David Fernández

    It is the front panel window of a VI which I don't want to get focus. I have tried to achive this with property nodes, but the problem I think that cannot be solved in this way, because is the Operative System that gives the focus to the window when pressing a mouse button before Labview does anything. You can release the focus once the window have taken it with the Front Panel window focus property node, but what I really want is to keep the focus on the old window.
    My idea is that the VI act as a background of my application, so never can be over the rest of the windows. Some of them are floating but others are standard and I don't want to use modal windows, so I cannot solve this with the Window Appearance options.
    I have also tried to discard the mouse down in the Mouse Down? event, but I doesn't work, the window continues getting the focus although does not carry on any action.
    Any suggestion?
    Thank you for your interest
    David F

  • Focusable JTextArea not gaining focus.

    I am creating a JTextArea and want to give it the focus when it's created. THis happens twice in the program, and the first time it works, the second time the JTextArea is created but doesn't get the focus until I click on it.
    In both cases the code is called from the Swing event queue (see the output below). In both cases the class which creates the jTextArea is the same (an extension of JPanel), and is added to a new tab in a tabbed pane.
    Because I know that you need to make sure that the component's been created before it gets focus, the code to create it and give it focus is:
    private javax.swing.JTextArea jtaInfo;
    // Class constructor for outer class
      public PanelInfo(String s, boolean editable ) {
        initComponents();  // this is the NetBeans call which creates jtaInfo and a few buttons
        jtaInfo.setText(s);
        jtaInfo.setEditable(editable);
        setVisible(true);
        selectTextBox();
      public void selectTextBox() {
        UtilFunctions.tcaProgramInfoMessage("selectTextBox thread="+Thread.currentThread().getName());
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            UtilFunctions.tcaProgramInfoMessage("Runnable thread="+Thread.currentThread().getName());
            UtilFunctions.tcaProgramInfoMessage("Info frame focusable: "+jtaInfo.isFocusable());
            if (!jtaInfo.requestFocusInWindow()) {
              UtilFunctions.tcaProgramInfoMessage("Failed to give info pane focus");
      }The UtilFunctions.tcaProgramInfoMessage call produces output with a timestamp.
    The output is:
    Sat Nov 11 11:25:38 GMT 2006: selectTextBox thread=AWT-EventQueue-0
    Sat Nov 11 11:25:38 GMT 2006: Runnable thread=AWT-EventQueue-0
    Sat Nov 11 11:25:38 GMT 2006: Info frame focusable: true
    Sat Nov 11 11:25:44 GMT 2006: selectTextBox thread=AWT-EventQueue-0
    Sat Nov 11 11:25:44 GMT 2006: Runnable thread=AWT-EventQueue-0
    Sat Nov 11 11:25:44 GMT 2006: Info frame focusable: true
    Sat Nov 11 11:25:44 GMT 2006: Failed to give info pane focus
    So it seems that the threads are OK, and the area is focusable, but I can't work out why one succeeds and the other fails. The program's too huge to post here - I may be able to cut it down to size. But is there anything obvious that I might be doing wrong?

    Because I know that you need to make sure that the component's been created before it gets focus,Actually the parent frame or dialog must be "realized" (maybe thats what you mean by "created") before a component can receive focus. This basically means that you've done a pack() or setVisible(true) on the frame. Using setVisible(true) on the actual component does nothing since by default all JComponents are visible.
    The program's too huge to post here - I may be able to cut it down to sizeI fail to see why its so difficult to create a short demo program showing the problem. The code you posted doesn't help because we don't know the context of how the code is executed.
    Below is a simple demo that shows an incorrect version and a correct version in 10 lines of code. So if this code doesn't help solve the problem you will now need to wait hours again until you post a version of your code that does demonstrate the problem. Whereas if you had spent 5-10 minutes to create a demo that doesn't work I may have been able to help you out right now.
    Simplify your problems and the answer will also be simpler.
    import java.awt.*;
    import javax.swing.*;
    public class FocusTest
         public static void main(String[] args)
              JTextField textField1 = new JTextField("One");
              JTextField textField2 = new JTextField("Two");
              JTextField textField3 = new JTextField("Three");
              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              frame.getContentPane().add(textField1, BorderLayout.NORTH);
              frame.getContentPane().add(textField2, BorderLayout.CENTER);
              frame.getContentPane().add(textField3, BorderLayout.SOUTH);
              // This doesn't work
              textField3.requestFocusInWindow();
              frame.pack();
              // This does work
    //          textField3.requestFocusInWindow();
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
    }

  • JTextArea not gaining focus

    I have a tabbed pane consisting of 2 JPanels. Each panel has a text area (within a scrollpane) on both.
    All I want is for the text area to gain focus when its tab has been clicked.
    I've tried adding a changelistener to the tabbedpane:
            tabbedPane.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    if (tabbedPane.getSelectedIndex() == 0) {
                        textArea1.requestFocus();
                    else {
                        textArea2.requestFocus();
            });but the textareas don't get focus. They do when I press <TAB> but this isn't much use.
    Does anyone have any ideas how I can get the textareas to gain focus?

    import javax.swing.*;
    import javax.swing.event.ChangeListener;
    import javax.swing.event.ChangeEvent;
    import java.awt.*;
    public class TestFocusTabbedPane extends JTabbedPane {
         private JTextArea theFirstTextArea;
         private JTextArea theSecondTextArea;
         public TestFocusTabbedPane() {
              super();
              JPanel tabPanel = new JPanel(new BorderLayout());
              tabPanel.add(new JButton("just for test"), BorderLayout.NORTH);
              theFirstTextArea = new JTextArea();
              theFirstTextArea.setFocusable(true);
              tabPanel.add(new JScrollPane(theFirstTextArea), BorderLayout.CENTER);
              addTab("first", tabPanel);
              tabPanel = new JPanel(new BorderLayout());
              tabPanel.add(new JButton("just for test"), BorderLayout.NORTH);
              theSecondTextArea = new JTextArea();
              theSecondTextArea.setFocusable(true);
              tabPanel.add(new JScrollPane(theSecondTextArea), BorderLayout.CENTER);
              addTab("second", tabPanel);
              addChangeListener(new ChangeListener() {
                   public void stateChanged(ChangeEvent e) {
                        int index = getSelectedIndex();
                        if (index == 0) {
                             theFirstTextArea.requestFocus();
                        } else {
                             theSecondTextArea.requestFocus();
         public static void main(String[] args) {
              final JFrame frame = new JFrame(TestPressedButton.class.getName());
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.getContentPane().add(new TestFocusTabbedPane());
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        frame.pack();
                        frame.show();
    }This seems to work. I added the JButton just to show that it doesn't get the focus

  • How to prevent Cell from getting focus when I click on a cell in JTable

    Hi,
    I have a new problem which I did not have when using jdk1.3. I have a non editable JTable. Now whenever I select a row the row gets highlighted - which is ok but at the same time the cell on which I click ( to select the row ) also gets focus.
    Previously I used to extend JTable and override the isManagingFocus method to return false. But now it doesnt seem to work
    What should
    Thanks
    --J                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Well, I'm still using JDK1.3 and I don't get the behaviour you describe.
    When isManagingFocus is true then using the tab key will cause focus to move from cell to cell within the JTable and focus will never leave the JTable.
    When isManagingFocus is false then using the tab key will cause focus to move the the JTable to the next component on the JFrame.
    In both cases once focus is on the JTable an individual cell is always highlighted to indicate it has focus.
    The question is if your program only cares which row has been selected, why do you care if an individual cells appears to have focus?

  • Can't get focused a JTextField within a JTable cell

    I have a table and I placed a cell editor with a JText field on it for all cell editing,
    I want to do things when the focus is lost or gained and my app works fine when a cell is double clicked or f2 is pressed, but when a cell is selected (without double clicking) and just begin typing it produces no focus gained event.
    I tried by calling grabFocus method of that jTextField within the overriden prepareEditor method of the JTable but it doesn't get focus (doesn't even gains and loses it :s )
    Does anyone have an idea of how to force this component to grab focus?
    Thanks

    Hai,
    dont add the FocusListener to the EditorComponent.
    Try to use the JTable Functions - like this:
    import javax.swing.event.ChangeEvent;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.EventObject;
    import javax.swing.*;
    public class Test extends JFrame
         JTable table;
         JTextArea text;
         JScrollPane scroll;
         JTextField cellTextField;
         Test()
              DefaultTableModel model = new DefaultTableModel();
              cellTextField = new JTextField();
              text = new JTextArea();
              text.setEditable(false);
              scroll = new JScrollPane();
              scroll.setViewportView(text);
              table = new JTable(model){
                   @Override
                   public Component prepareEditor(TableCellEditor editor, int row, int column) {
                        text.append("Better use this to Start Edit!\n");
                        return super.prepareEditor(editor, row, column);
                   @Override
                   public void editingStopped(ChangeEvent e) {
                        text.append("Better use this to Stop Edit!\n");
                        super.editingStopped(e);
              model.addColumn("Column 1");
              model.addColumn("Column 2");          
              model.addRow(new String [] {"Cell 1", "Cell 2"});
              table.setCellSelectionEnabled( true );
              table.getColumnModel().getColumn(0).setCellEditor( new DefaultCellEditor(cellTextField));
              table.getColumnModel().getColumn(1).setCellEditor( new DefaultCellEditor(cellTextField));
              getContentPane().setLayout(new BorderLayout());
              getContentPane().add(table, BorderLayout.NORTH);
              getContentPane().add(scroll, BorderLayout.CENTER);
              setSize(300, 300);
              setVisible(true);
              setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
         public static void main(String[] args)
              new Test();
    }

  • Getting focus on JTextField?

    I made a chat with a JApplet. In my chat i have a JTextField where users can write messages. I want to have focus on this JTextfield all the time, the user should not be allowed to get focus somewhere else. How can I do that? I tried requestFocus(); but its not making any differants. I use gridbaglayout and this is how I create my JTextfield:
    beskedFelt = new JTextField(10);
    c.insets = new Insets(10,0,0,0);
    c.gridx = 1;
    c.gridy = 2;
    gridbag.setConstraints(beskedFelt, c);
    contentPane.add(beskedFelt);
    beskedFelt.setEditable(true);
    beskedFelt.addActionListener(this);
    beskedFelt.requestFocus();
    thx for your time....

    yesss it worked:
    beskedFelt = new JTextField(10);
    EventQueue.invokeLater(new Runnable() {
    public void run() {
    beskedFelt.requestFocus();
    c.insets = new Insets(10,0,0,0);
    c.gridx = 1;
    c.gridy = 2;
    gridbag.setConstraints(beskedFelt, c);
    contentPane.add(beskedFelt);
    beskedFelt.setEditable(true);
    beskedFelt.addFocusListener(this);
    beskedFelt.addActionListener(this);
    public void focusGained(java.awt.event.FocusEvent fe)
    public void focusLost(java.awt.event.FocusEvent fe)
              Object source = fe.getSource();
              if ( source == beskedFelt)
    beskedFelt.requestFocus();
    thx a lot ppl....

  • How to make a JScrollPane not getting Focus?

    How to make a JScrollPane not getting Focus?
    When i tab out from a textfield inside a scroll pane focus is going to ScrollPane .And if i press tab once more then only focus is going to other textField which is outside the scrollpane.
    For me when i press tab from a text field inside a scrollPane ,i should go to textfield out side the scroll pane.
    satish

    Hi,
    I've the same problem, that I have to double click on tab
    to step from a textfield with a scrollpane to the next textfield in my panel.
    I tried to implement a FocusListener on my JScrollPane, but without success.
    Can you tell me in detail how to implement this listener ?
    Kind regards
    Andy Kanzlers

  • Toolbar icons are not getting focus

    The buttons on the toolbar are not getting focus when I move the mouse over the buttons. I am facing this problem if I use JRE 1.5.0_15 but it is working fine in JRE 1.6.0_6.
    But I need solution in JRE1.5.0_15.
    Can anybody please help me out is there any work around in JRE 1.5.0_15.
    Regards
    Venkat

    I found the solution, We need to change
    some coding style by giving conditions for particular version , foe example we should make changes in color initialisation. Insteatof color.red , use [RGB,1,0,0] and many.........

  • JSpinner getting focus?

    I'm trying something that I thought should be simple, but it doesn't seem to work.
    I would like to be notified when a spinner gets focus, so I added a FocusListener to the JSpinner involved. The FocusGained and FocusLost methods in the FocusListener were not invoked when I tabbed through the spinner, nor when I clicked on its text field. The spinner is focusable and enabled.
    Then I thought that maybe I had to monitor the editor instead, so I tried adding the FocusListener to the JSpinner's editor. No luck there either.
    I think I must be missing something elementary. If what I tried should have worked, I'll post the code here so that someone can point out my error.
    Thanks
    Jon

    Hi,
    you don't want to be informed when the JSpinner gets the focus (by default the JSpinner is not focusable), but when the text field gets the focus. So you have to add your FocusListener like this:
    JSpinner js = new JSpinner();
    ((JSpinner.DefaultEditor)js.getEditor()).getTextField().addFocusListener(new MyFocusListener());You should not make the JSpinner focusable 'cause then the user has to type the tab-key twice to enter the JSpinner's text field.
    Andre

  • N97 customers should get a discount on LUMIA

    Hi All,
    Wonder how many of us N97 users out there.
    I personally think, because we were badly let down by NOKIA's N97 both in terms of software and after care we should get some sort of discount on new windows phone.
    I pre-ordered my N97 a month before on a £45 contract for 18months .. now God knows how I have spent that time.
    I swore that after the experience I will never buy a Nokia again and do everything in my power to dissuade others.
    So, Nokia if you are reading and you care, please right what you have wronged. give us some sort of discount on windows phone or at least let us try it out for a month to change our opinion of you.
    Looking forward to what other have to say...
    Cheerio
    failsafe_ade

    I too will never recommend a Nokia device after many years of using nothing but Nokia.
    My N97 is going to be retired this weekend after way too many GPS problems, a badly scratched camera lens (even after getting their "factory fix" for this problem!), and now too many spontaneous reboots.  The rebooting problem in the AT&T network is well-documented and is part of the reason why they are no longer carrying Nokia 3G phones.  Something about the switching in the network causes Nokia 3G phones to reboot on-their-own frequently--interrupting calls and running down the battery.
    Even looking at Nokia's new Lumia series--the VALUE that you get compared to other manufacturers is non-competitive.  Nokia prices themselves out of the market at sometimes TWICE the cost of comparable handsets in the upper end.
    What bothers me the most about the initial reviews of the Lumia is that the main selling point was the word "pretty".  Nokia's own promotional video doesn't really show the phone in action--instead you see a big composite picture wall with moving shots--they MUST be trying to hide how disappointing the phone really is.
    I just wished that I'd recognized the lack of real value in the N97 when most of the reviews focused on the "flip up revealing" keyboard and not on speed, features, reliability, etc.

  • JDesktop automatically get focus

    I have a JDesktop with many different classes of JInternalFrames. when the user clicks a JButton in frame#1 and then wants to click a JButton in frame#2, the user must obtain focus on frame#2 and then only after obtaining focus can the user click the jbutton in that frame. basically, unless the user has been "working" in this particular frame, the first time he does something he must "double click"
    What is my solution around this? here is what i want:
    if a user clicks any X,Y point on the JDesktop and that X,Y point happens to be the location of a JInternalFrame, then it would be the same as if the user already had focus to the frame and clicked that area.
    I tried to do some code like this for the JDesktop:
    public class myFrame extends JFrame {
    JDesktopPane myDesktop;
    myFrame() {
    myDesktop = new JDesktopPane();
    getContentPane().add(myDesktop, BorderLayout.Center)
    this.addMouseMotionListener(new DesktopListener(this));
    private class DesktopListener implements MouseMotionListener {
    JFrame parent;
    public DesktopListener(JFrame frame) {
    parent = frame;
    public void mouseDragged(MouseEvent e) {}
    public void mouseMoved(MouseEvent e) {
    // OKAY HERE IS WHERE I AM STUCK
    Okay, i am stuck on what to do with mouseMoved() of the motionlistener. i know i can e.getX() and e.getY(), but how do to:
    1) determine if that coordinate is actually a JInternalFrame
    2) give the JInternalFrame focus at that coordinate focus
    and 3) is this the best solution to do what i am trying to accomplish? i am trying to avoid forcing the user to obtain frame focus when clicking components in a frame. i dont necessary want to bring the JInternalFrame to the front, i just want to avoid having to click to get focus
    thanks

    I implemented your approach, which definitely makes good sense. i ran into two problems:
    1) it only fires the event when the mouse is on the border. if i move the mouse slowly into the internalframe, the event will probably fire. but if i move quickly into the frame, then it never fires. if i put the mouse on the border and stay there for a second, it will always fire.
    2) it brings the internalframe to the front. if the internalframe is covered by another frame, i would prefer that it doesnt come to the front, but just gets the focus.
    any ideas?
    Maybe you should try a different approach:
    try adding a MouseMotionListener to the internalframes
    which will do this.
    //jdp is an instance of JDesktopPane
    MouseMotionAdapter  mma=new MouseMotionAdapter()
    public void mouseMoved(MouseEvent me)
    JInternalFrame
    rnalFrame jif=(JInternalFrame)me.getSource();
    jdp.getDesktopManager().activateFrame(jif);
    JInternalFrame jif=new JInternalFrame("whatever");
    jif.addMouseMotionListener(mma);I belive it should work well.
    p.s.
    what do you mean
    (parent.getContentPane().getComponentAt(e.getX(),e.getY
    ))); did not work?
    if you do not want my approach check what does that
    function return to you.

Maybe you are looking for