aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/awt/Component.java
blob: c79d3b706040175d6aec83d0e579601971a289ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* Copyright (C) 1999  Cygnus Solutions

   This file is part of libjava.

This software is copyrighted work licensed under the terms of the
Libjava License.  Please consult the file "LIBJAVA_LICENSE" for
details.  */

package java.awt;
import java.awt.event.*;
//import java.awt.peer.ComponentPeer;

/* A very incomplete placeholder. */

public abstract class Component implements MenuContainer
{
  Container parent;
  java.awt.peer.ComponentPeer peer;
  int x, y, width, height;

  public Container getParent () { return parent; }

  /** @deprecated */
  public java.awt.peer.ComponentPeer getPeer () { return peer; }

  public void setVisible (boolean b)
  { /* FIXME */ }

  public void setSize (Dimension d)
  { setSize(d.width, d.height); }

  public void setSize (int width, int height)
  {
    this.width = width;  this.height = height;
    if (peer != null)
      peer.setBounds(x, y, width, height);
  }

  public void setLocation (int x, int y)
  {
    this.x = x;  this.y = y;
    if (peer != null)
      peer.setBounds(x, y, width, height);
  }

  public void setLocation (Point pt)
  { setLocation(pt.x, pt.y); }

  public void setBounds (int x, int y, int w, int h)
  {
    this.x = x;  this.y = y;
    this.width = w;  this.height = h;
    if (peer != null)
      peer.setBounds(x, y, w, h);
  }

  public void setBounds (Rectangle rect)
  { setBounds(rect.x, rect.y, rect.width, rect.height); }

  public Rectangle getBounds ()
  {
    return new Rectangle(x, y, width, height);
  }

  public Point getLocation ()
  {
    return new Point(x, y);
  }

  public Dimension getSize ()
  {
    return new Dimension(width, height);
  }

  public Dimension getMinimumSize ()
  {
    if (peer == null)
      return new Dimension(width, height);
    else
      return peer.getMinimumSize();
  }

  public Dimension getPreferredSize ()
  {
    if (peer == null)
      return new Dimension(width, height);
    else
      return peer.getPreferredSize();
  }

  public synchronized void addKeyListener (KeyListener listener)
  { /* FIXME */ }

  public boolean isFocusTraversable ()
  { /* FIXME */ return false; }

  public void addNotify () { }
}