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.
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();
}
}