How can i create button, when you go across with mouse show that yellow window.
Open.setToolTipText (Open); // how change it from blue to yellow?
How can i create button, when you go across with mouse show that yellow window.
Open.setToolTipText (Open); // how change it from blue to yellow?
The message displayed when the user hovers over a JButton is called a tooltip.
You can create one using the code found in the Java tutorial here: http://docs.oracle.com/javase/tutorial/uiswing/components/tooltip.html
To customize the background of the tooltip, you can do one of two things:
Use the following code to change the tooltip alone:
UIManager.put("ToolTip.background", new ColorUIResource(255, 247, 200)); //#fff7c8
Border border = BorderFactory.createLineBorder(new Color(76,79,83)); //#4c4f53
UIManager.put("ToolTip.border", border);
ToolTipManager.sharedInstance().setDismissDelay(15000); // 15 second delay
setToolTipText(message); // Message to display
Source: Moon Ocean Oracle Blog
The style of the tooltip can be changed in two ways:
It can be changed in the css as follows:
.tooltip{ -fx-background-color: linear-gradient(#e2ecfe, #99bcfd); }
It can be changed in the code itself as follows:
final Tooltip t = new Tooltip(advancePlayBaclFlagVo.getDescriptions() + "["+advancePlayBaclFlagVo.getPlantedDateTime()+"]");
t.setStyle("-fx-background-color: yellow;");