Results 1 to 2 of 2
  1. #1
    LeonLanford is offline Member
    Join Date
    Oct 2009
    Posts
    29
    Rep Power
    0

    Default JTextPane focus problem

    Hi.. I'm really confused why I can't make my JTextPane focused :(

    I have a jframe with JTabbedPane inside it, inside the JTabbedPane is a JPanel, inside the JPanel is JTextPane included with JScrollpane.

    I want to make the JTextPane focused when the window opened, now it focused on the JTabbedPane.

    I've tried these

    Java Code:
    	TextPane.setFocusable(true);
            TextPane.requestFocusInWindow();
            TextPane.setFocusCycleRoot(true);
            TextPane.setFocusTraversalPolicyProvider(true);
            TextPane.grabFocus();
            TextPane.setCaretPosition(0);
            TextPane.setText("test");
    I even tried to turn off the focusable of JTabbedPane to false.
    Still I can't make the JTextPane focused.
    I also already tried to move the code above before the JFrame.setvisibile(true)

    Anyone can help? :(

  2. #2
    LeonLanford is offline Member
    Join Date
    Oct 2009
    Posts
    29
    Rep Power
    0

    Default

    ok I found the solution, I must pack the the jframe to make the request focus working..

Similar Threads

  1. Replies: 1
    Last Post: 06-07-2010, 07:10 AM
  2. JTextpane
    By Mash in forum AWT / Swing
    Replies: 1
    Last Post: 04-15-2010, 06:36 PM
  3. Problem in adding new JTextPane at Runtime
    By png in forum AWT / Swing
    Replies: 13
    Last Post: 12-14-2009, 12:14 PM
  4. AWT Focus Problem using idk 1.6.0
    By javakash in forum AWT / Swing
    Replies: 2
    Last Post: 09-05-2009, 02:00 AM
  5. Clipboard and jTextPane
    By Gudradain in forum AWT / Swing
    Replies: 11
    Last Post: 01-04-2009, 11:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •