Esempio n. 1
0
  synchronized void popup(int x, int y, Component component, String text) {

    invalidate();
    textLabel.setText(text);
    textLabel.setForeground(ToolTipManager.getInstance().foreground);
    textLabel.setBackground(ToolTipManager.getInstance().background);
    validate();
    pack();
    try {
      if (x != -1 && y != -1) {
        setLocation(x + 8, y + 8);
      } else {
        Point p = component.getLocationOnScreen();
        Dimension s = component.getSize();
        setLocation(p.x + 8, p.y + s.height + 8);
      }
      setVisible(true);
      toFront();
      lastShow = System.currentTimeMillis();
      dismissed = false;
    } catch (IllegalComponentStateException icse) {

    }
  }
Esempio n. 2
0
 TipWindow(Frame owner) {
   super(owner);
   textLabel =
       new ImageTextLabel() {
         public void paint(Graphics g) {
           super.paint(g);
           g.setColor(getForeground());
           Dimension s = getSize();
           g.drawRect(0, 0, s.width - 1, s.height - 1);
         }
       };
   textLabel.setMargin(new Insets(2, 2, 2, 2));
   setLayout(new GridLayout(1, 1));
   add(textLabel);
 }