tooltip fixes

This commit is contained in:
Kirill Kalishev
2010-08-30 17:28:02 +04:00
parent e0d91553f2
commit db8189124b
2 changed files with 22 additions and 14 deletions
@@ -165,7 +165,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
Color bg = useSystem ? UIManager.getColor("ToolTip.background") : new Color(100, 100, 100, 230);
Color fg = useSystem ? UIManager.getColor("ToolTip.foreground") : Color.white;
Color border = useSystem ? Color.darkGray : bg;
Color border = useSystem ? Color.darkGray : bg.darker();
BalloonBuilder builder = myPopupFactory.createBalloonBuilder(myTipLabel)
.setPreferredPosition(Balloon.Position.above)
@@ -175,8 +175,7 @@ public class IdeTooltipManager implements ApplicationComponent, AWTEventListener
.setShowCallout(true);
myTipLabel.setForeground(fg);
myTipLabel.setBorder(new EmptyBorder(1, 3, 2, 3));
Font font = UIManager.getFont("Label.font");
myTipLabel.setFont(font.deriveFont(Font.PLAIN, font.getSize() - 2));
myTipLabel.setFont(UIManager.getFont("ToolTip.font"));
myCurrentTip = builder.createBalloon();
boolean toCenterX;
@@ -483,7 +483,6 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi
Toolkit.getDefaultToolkit().removeAWTEventListener(myAwtActivityListener);
if (myLayeredPane != null) {
myLayeredPane.removeComponentListener(myComponentListener);
myLayeredPane.remove(myCloseRec);
runAnimation(false, myLayeredPane);
}
@@ -948,10 +947,20 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi
}
}
@Override
protected void paintChildren(Graphics g) {
super.paintChildren(g);
@Override
public void removeNotify() {
super.removeNotify();
if (myLayeredPane != null) {
final JLayeredPane pane = myLayeredPane;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
pane.remove(myCloseRec);
}
});
}
}
public void setAlpha(float alpha) {
@@ -1096,15 +1105,15 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi
balloon.get().dispose();
}
else {
JLabel pane1 = new JLabel("Hello, world!");
JLabel pane2 = new JLabel("Hello, again");
JPanel pane = new JPanel(new BorderLayout());
pane.add(pane1, BorderLayout.CENTER);
pane.add(pane2, BorderLayout.SOUTH);
//JLabel pane1 = new JLabel("Hello, world!");
//JLabel pane2 = new JLabel("Hello, again");
//JPanel pane = new JPanel(new BorderLayout());
//pane.add(pane1, BorderLayout.CENTER);
//pane.add(pane2, BorderLayout.SOUTH);
pane.setBorder(new LineBorder(Color.blue));
//pane.setBorder(new LineBorder(Color.blue));
balloon.set(new BalloonImpl(pane, Color.black, MessageType.ERROR.getPopupBackground(), true, true, true, false, 0, true, null, false, 500));
balloon.set(new BalloonImpl(new JLabel("f"), Color.black, MessageType.ERROR.getPopupBackground(), true, true, true, true, 0, true, null, false, 500));
balloon.get().setShowPointer(true);
if (e.isShiftDown()) {