Results 1 to 2 of 2
  1. #1
    sandor is offline Member
    Join Date
    Apr 2007
    Location
    Pennsylvania,USA
    Posts
    45
    Rep Power
    0

    Default Line break in tool tip..how??

    I am trying to make a line break in my tooltip. It is the one that says
    "Toggle line\n wrap" below. Will try to highlight it if I can figure out how.
    Anyway, any ideas how to manage this? Obviously the \n is not doing it.
    Java Code:
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JToolBar;
    
    public class TestLines
    {
      private static final int PREFERRED_WIDTH=200;
      private static final int PREFERRED_HEIGHT=100;
      
        public TestLines()
        {
           JFrame frame = new JFrame("Test");
           JToolBar toolbar= new JToolBar();
           JButton saveButton = new JButton(" save ");
           saveButton.setToolTipText("Save");
           toolbar.add(saveButton);
           JButton boldButton = new JButton("Bold");
           boldButton.setToolTipText("Bold");
           toolbar.add(boldButton);
           JButton linewrapbutton = new JButton("Line Wrap");
           linewrapbutton.setToolTipText("[COLOR="Blue"]Toggle line\n wrap[/COLOR]");
           toolbar.add(linewrapbutton);
           frame.getContentPane().add("North", toolbar);
           frame.pack();
           frame.setSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
           frame.setVisible(true);
           
        }
    
        /**
         * @param args
         */
        public static void main(String[] args)
        {
            new TestLines();
    
        }
    
    }
    Last edited by sandor; 05-16-2007 at 01:42 AM.

  2. #2
    pegitha is offline Member
    Join Date
    Apr 2007
    Location
    Indiana
    Posts
    83
    Rep Power
    0

    Default

    Try using html
    Java Code:
       linewrapbutton.setToolTipText("<html>Toggle line<br> wrap</br></html>");

Similar Threads

  1. Project management tool
    By Sudha in forum New To Java
    Replies: 0
    Last Post: 01-23-2008, 07:56 PM
  2. Java SQL Admin Tool 2.4.2
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-12-2007, 06:05 PM
  3. SPT Relational Database Web Tool 1.2
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-10-2007, 06:40 PM
  4. Reading in data from file line by line
    By bluekswing in forum New To Java
    Replies: 1
    Last Post: 10-02-2007, 12:19 AM
  5. Swing Tool
    By Nick15 in forum AWT / Swing
    Replies: 2
    Last Post: 05-05-2007, 05:45 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
  •