Results 1 to 7 of 7
  1. #1
    ismailsaleh is offline Member
    Join Date
    Jan 2008
    Posts
    8
    Rep Power
    0

    Default add JToolTip on focus gained forJTextField

    Hiiii,
    how can i show a tooltip when focus gained on jtextField.

    thnx

  2. #2
    teracomp is offline Member
    Join Date
    Jan 2008
    Posts
    3
    Rep Power
    0

  3. #3
    ismailsaleh is offline Member
    Join Date
    Jan 2008
    Posts
    8
    Rep Power
    0

    Default thnx

    thnx man, but what i need is when i set focus to text field it takes a time to display the tooltip and i want describe the case for u:
    i have a jtextfield when i set focus into it i want to show tooltip thta shows a description about it and i don't want to disappear that tooltip until the focus lost from the jtextfield .

    thnx

  4. #4
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    You can make up a JWindow and add a label with your text to it. Set the background of the JWindows contentPane to
    UIManager.getColor("ToolTip.background").
    Add a FocusListener to the textField. On focusGained you can set the location of the tooltip relative to the textField with
    Point p = ((JTextField)e.getSource()).getLocation();
    from inside the method. Show the JWindow. Set it not-visible in focusLost.

  5. #5
    ismailsaleh is offline Member
    Join Date
    Jan 2008
    Posts
    8
    Rep Power
    0

    Default thnx

    thank u for ur .
    help its works fine now, thnx

  6. #6
    roshithmca is offline Member
    Join Date
    Feb 2008
    Posts
    9
    Rep Power
    0

    Default

    how to create tooltip over a sphere in java 3d....??

    if anyboby know...

    Roshith.

  7. #7
    roshithmca is offline Member
    Join Date
    Feb 2008
    Posts
    9
    Rep Power
    0

    Default

    Quote Originally Posted by ismailsaleh View Post
    Hiiii,
    how can i show a tooltip when focus gained on jtextField.

    thnx
    JTextField nam = new JTextField();
    nam.setToolTipText("Tollllll");

    Roshith

Similar Threads

  1. set focus to the textfield
    By paty in forum New To Java
    Replies: 2
    Last Post: 07-09-2010, 08:28 AM
  2. how to focus to another JTextfield?
    By birdofprey in forum AWT / Swing
    Replies: 2
    Last Post: 04-09-2008, 01:08 PM
  3. JTable Focus Traversal
    By helios_lie in forum AWT / Swing
    Replies: 1
    Last Post: 12-20-2007, 10:27 AM
  4. Focus
    By Marty in forum AWT / Swing
    Replies: 1
    Last Post: 05-31-2007, 02:16 AM

Posting Permissions

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