View Single Post
  #1 (permalink)  
Old 05-16-2007, 02:35 AM
sandor sandor is offline
Member
 
Join Date: Apr 2007
Location: Pennsylvania,USA
Posts: 46
sandor is on a distinguished road
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.
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("Toggle line\n wrap"); 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 02:42 AM.
Reply With Quote
Sponsored Links