@Override
    public void paint(Graphics g) {
      if ((target instanceof Frame && !(target instanceof JFrame))
          || (target instanceof Dialog && !(target instanceof JDialog))) {
        SwingBaseWindow<?, ?> sf = SwingBaseWindow.this;
        Window f = target;

        Color bg = f.getBackground();
        if (bg == null) bg = UIManager.getColor("window");
        if (bg == null) bg = UIManager.getColor("control");
        if (bg == null) bg = Color.GRAY;

        g.setColor(bg);
        g.fillRect(0, 0, getWidth(), getHeight());

        Point f_loc = sf.getLocationOnScreen();
        Point p_loc = this.getLocationOnScreen();

        int dx = p_loc.x - f_loc.x;
        int dy = p_loc.y - f_loc.y;

        for (Component c : f.getComponents()) {
          Graphics cg = g.create(c.getX() - dx, c.getY() - dy, c.getWidth(), c.getHeight());
          c.paintAll(cg);
          cg.dispose();
        }
      }
    }
Beispiel #2
0
 // draw on screen
 public synchronized void draw(Graphics2D g) {
   Window w = s.getFullScreenWindow();
   g.setColor(w.getBackground());
   g.fillRect(0, 0, s.getWidth(), s.getHeight());
   g.setColor(w.getForeground());
   g.drawString(mess, 100, 100);
 }