Posts mit dem Label ToolTip werden angezeigt. Alle Posts anzeigen
Posts mit dem Label ToolTip werden angezeigt. Alle Posts anzeigen

Mittwoch, 31. Januar 2007

How to set the ToolTip initialDelay / Dismiss Delay?

Problem:
"I want to change the  initDelay / dismissDelay of the ToolTips. How do I do this?"

Solution:

There is a very simple way:

// ToolTips without initial delay?

ToolTipManager.sharedInstance().setInitialDelay(0);

// Show Tooltips for 10 seconds

ToolTipManager.sharedInstance().setDismissDelay(10000);





 

Dienstag, 30. Januar 2007

How to set the ToolTip Color of a single Component?

Problem:
"Using the
UIManager I can only set the ToolTip Color for all Components. I want to set the Color for a single Components like a Button etc. How do I do this?"



Solution:
You need to overwrite theComponents
createToolTip method. For example like this:

public JToolTip createToolTip() {
JToolTip jt = new JToolTip();
jt.setForeground(Color.RED);
jt.setBackground(Color.BLACK);
return jt;
}

Montag, 29. Januar 2007

How to set the background olor or foreground color of a ToolTip / JToolTip ?

Problem:
 "How can I change the background or foreground Color of a Tooltip?"



Solution:
If you want to change the global Color for all Components, use this code:

UIManager.put("ToolTip.foreground",
new ColorUIResource(Color.red));
UIManager.put("ToolTip.background",
new ColorUIResource(Color.black));