OPERATING SYSTEM(S):
--------------------
Linux AMD64
FULL JDK VERSION(S):
-------------------
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_02-b05, mixed mode)
DESCRIPTION:
------------
PROBLEM DESCRIPTION:
In Linux, when the tooltip has some text which has \n character in it then it ignores it and displays all the text in a single line.
Please note: The same text *does* appear on different lines on the Windows Platform.
TESTCASE DESCRIPTION
---------------------
import java.awt.AWTException;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Sample {
public static void main(String[] args) {
PopupMenu pm = new PopupMenu();
MenuItem exit = new MenuItem("Exit");
pm.add(exit);
exit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
SystemTray st = SystemTray.getSystemTray();
String multiLined = "First Line\nSecond Line\nThird Line\n";
TrayIcon ti = new TrayIcon(java.awt.Toolkit.getDefaultToolkit()
.getImage("flower.jpg"), multiLined, pm);
ti.setImageAutoSize(true);
try {
st.add(ti);
} catch (AWTException e) {
e.printStackTrace();
}
}
}
STEPS TO REPRODUCE
--------------------
1) compile the above program
2) run java -cp . Sample
3) Put the mouse pointer over the tray icon, you will see the tool tip is not split into multiple lines. This bevahiour is different from the windows build, where it shows as multiple lines.