home *** CD-ROM | disk | FTP | other *** search
- package java.awt;
-
- import java.awt.image.ColorModel;
- import java.awt.image.ImageObserver;
- import java.awt.image.ImageProducer;
- import java.awt.peer.ComponentPeer;
- import java.io.PrintStream;
-
- public abstract class Component implements ImageObserver {
- ComponentPeer peer;
- Container parent;
- // $FF: renamed from: x int
- int field_0;
- // $FF: renamed from: y int
- int field_1;
- int width;
- int height;
- Color foreground;
- Color background;
- Font font;
- boolean visible = true;
- boolean enabled = true;
- boolean valid = false;
-
- Component() {
- }
-
- public Container getParent() {
- return this.parent;
- }
-
- public ComponentPeer getPeer() {
- return this.peer;
- }
-
- public Toolkit getToolkit() {
- ComponentPeer peer = this.peer;
- if (peer != null) {
- return peer.getToolkit();
- } else {
- Container parent = this.parent;
- return parent != null ? ((Component)parent).getToolkit() : Toolkit.getDefaultToolkit();
- }
- }
-
- public boolean isValid() {
- return this.peer != null && this.valid;
- }
-
- public boolean isVisible() {
- return this.visible;
- }
-
- public boolean isShowing() {
- if (this.visible && this.peer != null) {
- Container parent = this.parent;
- return parent == null || ((Component)parent).isShowing();
- } else {
- return false;
- }
- }
-
- public boolean isEnabled() {
- return this.enabled;
- }
-
- public Point location() {
- return new Point(this.field_0, this.field_1);
- }
-
- public Dimension size() {
- return new Dimension(this.width, this.height);
- }
-
- public Rectangle bounds() {
- return new Rectangle(this.field_0, this.field_1, this.width, this.height);
- }
-
- public synchronized void enable() {
- if (!this.enabled) {
- this.enabled = true;
- if (this.peer != null) {
- this.peer.enable();
- }
- }
-
- }
-
- public void enable(boolean cond) {
- if (cond) {
- this.enable();
- } else {
- this.disable();
- }
- }
-
- public synchronized void disable() {
- if (this.enabled) {
- this.enabled = false;
- if (this.peer != null) {
- this.peer.disable();
- }
- }
-
- }
-
- public synchronized void show() {
- if (!this.visible) {
- this.visible = true;
- if (this.peer != null) {
- this.peer.show();
- if (this.parent != null) {
- this.parent.invalidate();
- }
- }
- }
-
- }
-
- public void show(boolean cond) {
- if (cond) {
- this.show();
- } else {
- this.hide();
- }
- }
-
- public synchronized void hide() {
- if (this.visible) {
- this.visible = false;
- if (this.peer != null) {
- this.peer.hide();
- if (this.parent != null) {
- this.parent.invalidate();
- }
- }
- }
-
- }
-
- public Color getForeground() {
- Color foreground = this.foreground;
- if (foreground != null) {
- return foreground;
- } else {
- Container parent = this.parent;
- return parent != null ? ((Component)parent).getForeground() : null;
- }
- }
-
- public synchronized void setForeground(Color c) {
- this.foreground = c;
- if (this.peer != null) {
- c = this.getForeground();
- if (c != null) {
- this.peer.setForeground(c);
- }
- }
-
- }
-
- public Color getBackground() {
- Color background = this.background;
- if (background != null) {
- return background;
- } else {
- Container parent = this.parent;
- return parent != null ? ((Component)parent).getBackground() : null;
- }
- }
-
- public synchronized void setBackground(Color c) {
- this.background = c;
- if (this.peer != null) {
- c = this.getBackground();
- if (c != null) {
- this.peer.setBackground(c);
- }
- }
-
- }
-
- public Font getFont() {
- Font font = this.font;
- if (font != null) {
- return font;
- } else {
- Container parent = this.parent;
- return parent != null ? ((Component)parent).getFont() : null;
- }
- }
-
- public synchronized void setFont(Font f) {
- this.font = f;
- if (this.peer != null) {
- f = this.getFont();
- if (f != null) {
- this.peer.setFont(f);
- }
- }
-
- }
-
- public synchronized ColorModel getColorModel() {
- return this.peer == null ? this.getToolkit().getColorModel() : this.peer.getColorModel();
- }
-
- public void move(int x, int y) {
- this.reshape(x, y, this.width, this.height);
- }
-
- public void resize(int width, int height) {
- this.reshape(this.field_0, this.field_1, width, height);
- }
-
- public void resize(Dimension d) {
- this.reshape(this.field_0, this.field_1, d.width, d.height);
- }
-
- public synchronized void reshape(int x, int y, int width, int height) {
- boolean resized = this.width != width || this.height != height;
- if (resized || this.field_0 != x || this.field_1 != y) {
- this.field_0 = x;
- this.field_1 = y;
- this.width = width;
- this.height = height;
- if (this.peer != null) {
- this.peer.reshape(x, y, width, height);
- if (resized) {
- this.invalidate();
- }
-
- if (this.parent != null) {
- this.parent.invalidate();
- }
- }
- }
-
- }
-
- public Dimension preferredSize() {
- ComponentPeer peer = this.peer;
- return peer != null ? peer.preferredSize() : this.minimumSize();
- }
-
- public Dimension minimumSize() {
- ComponentPeer peer = this.peer;
- return peer != null ? peer.minimumSize() : this.size();
- }
-
- public void layout() {
- }
-
- public void validate() {
- while(!this.valid && this.peer != null) {
- this.valid = true;
- this.layout();
- }
-
- }
-
- public void invalidate() {
- this.valid = false;
- }
-
- public Graphics getGraphics() {
- ComponentPeer peer = this.peer;
- return peer != null ? peer.getGraphics() : null;
- }
-
- public FontMetrics getFontMetrics(Font font) {
- ComponentPeer peer = this.peer;
- return peer != null ? peer.getFontMetrics(font) : this.getToolkit().getFontMetrics(font);
- }
-
- public void paint(Graphics g) {
- }
-
- public void update(Graphics g) {
- g.setColor(this.getBackground());
- g.fillRect(0, 0, this.width, this.height);
- g.setColor(this.getForeground());
- this.paint(g);
- }
-
- public void paintAll(Graphics g) {
- ComponentPeer peer = this.peer;
- if (this.visible && peer != null) {
- this.validate();
- peer.paint(g);
- }
-
- }
-
- public void repaint() {
- this.repaint(0L, 0, 0, this.width, this.height);
- }
-
- public void repaint(long tm) {
- this.repaint(tm, 0, 0, this.width, this.height);
- }
-
- public void repaint(int x, int y, int width, int height) {
- this.repaint(0L, x, y, width, height);
- }
-
- public void repaint(long tm, int x, int y, int width, int height) {
- ComponentPeer peer = this.peer;
- if (peer != null && width > 0 && height > 0) {
- peer.repaint(tm, x, y, width, height);
- }
-
- }
-
- public void print(Graphics g) {
- this.paint(g);
- }
-
- public void printAll(Graphics g) {
- ComponentPeer peer = this.peer;
- if (this.visible && peer != null) {
- this.validate();
- peer.print(g);
- }
-
- }
-
- public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) {
- int rate = -1;
- if ((flags & 48) != 0) {
- rate = 0;
- } else if ((flags & 8) != 0) {
- String isInc = System.getProperty("awt.image.incrementaldraw");
- if (isInc == null || isInc.equals("true")) {
- String incRate = System.getProperty("awt.image.redrawrate");
-
- try {
- rate = incRate != null ? Integer.parseInt(incRate) : 100;
- if (rate < 0) {
- rate = 0;
- }
- } catch (Exception var10) {
- rate = 100;
- }
- }
- }
-
- if (rate >= 0) {
- this.repaint((long)rate, 0, 0, this.width, this.height);
- }
-
- return (flags & 160) == 0;
- }
-
- public Image createImage(ImageProducer producer) {
- ComponentPeer peer = this.peer;
- return peer != null ? peer.createImage(producer) : this.getToolkit().createImage(producer);
- }
-
- public Image createImage(int width, int height) {
- ComponentPeer peer = this.peer;
- return peer != null ? peer.createImage(width, height) : null;
- }
-
- public boolean prepareImage(Image image, ImageObserver observer) {
- return this.prepareImage(image, -1, -1, observer);
- }
-
- public boolean prepareImage(Image image, int width, int height, ImageObserver observer) {
- ComponentPeer peer = this.peer;
- return peer != null ? peer.prepareImage(image, width, height, observer) : this.getToolkit().prepareImage(image, width, height, observer);
- }
-
- public int checkImage(Image image, ImageObserver observer) {
- return this.checkImage(image, -1, -1, observer);
- }
-
- public int checkImage(Image image, int width, int height, ImageObserver observer) {
- ComponentPeer peer = this.peer;
- return peer != null ? peer.checkImage(image, width, height, observer) : this.getToolkit().checkImage(image, width, height, observer);
- }
-
- public synchronized boolean inside(int x, int y) {
- return x >= 0 && x - this.field_0 < this.width && y >= 0 && y - this.field_1 < this.height;
- }
-
- public Component locate(int x, int y) {
- return this.inside(x, y) ? this : null;
- }
-
- public void deliverEvent(Event e) {
- this.postEvent(e);
- }
-
- public boolean postEvent(Event e) {
- ComponentPeer peer = this.peer;
- if (this.handleEvent(e)) {
- return true;
- } else {
- Component parent = this.parent;
- if (parent != null) {
- e.translate(this.field_0, this.field_1);
- if (parent.postEvent(e)) {
- return true;
- }
- }
-
- return peer != null ? peer.handleEvent(e) : false;
- }
- }
-
- public boolean handleEvent(Event evt) {
- switch (evt.id) {
- case 403:
- case 401:
- return this.keyDown(evt, evt.key);
- case 504:
- return this.mouseEnter(evt, evt.x, evt.y);
- case 402:
- case 404:
- return this.keyUp(evt, evt.key);
- case 503:
- return this.mouseMove(evt, evt.x, evt.y);
- case 502:
- return this.mouseUp(evt, evt.x, evt.y);
- case 501:
- return this.mouseDown(evt, evt.x, evt.y);
- case 1005:
- return this.lostFocus(evt, evt.arg);
- case 1004:
- return this.gotFocus(evt, evt.arg);
- case 1001:
- return this.action(evt, evt.arg);
- case 506:
- return this.mouseDrag(evt, evt.x, evt.y);
- case 505:
- return this.mouseExit(evt, evt.x, evt.y);
- default:
- return false;
- }
- }
-
- public boolean mouseDown(Event evt, int x, int y) {
- return false;
- }
-
- public boolean mouseDrag(Event evt, int x, int y) {
- return false;
- }
-
- public boolean mouseUp(Event evt, int x, int y) {
- return false;
- }
-
- public boolean mouseMove(Event evt, int x, int y) {
- return false;
- }
-
- public boolean mouseEnter(Event evt, int x, int y) {
- return false;
- }
-
- public boolean mouseExit(Event evt, int x, int y) {
- return false;
- }
-
- public boolean keyDown(Event evt, int key) {
- return false;
- }
-
- public boolean keyUp(Event evt, int key) {
- return false;
- }
-
- public boolean action(Event evt, Object what) {
- return false;
- }
-
- public void addNotify() {
- this.valid = false;
- }
-
- public synchronized void removeNotify() {
- if (this.peer != null) {
- this.peer.dispose();
- this.peer = null;
- }
-
- }
-
- public boolean gotFocus(Event evt, Object what) {
- return false;
- }
-
- public boolean lostFocus(Event evt, Object what) {
- return false;
- }
-
- public void requestFocus() {
- ComponentPeer peer = this.peer;
- if (peer != null) {
- peer.requestFocus();
- }
-
- }
-
- public void nextFocus() {
- ComponentPeer peer = this.peer;
- if (peer != null) {
- peer.nextFocus();
- }
-
- }
-
- protected String paramString() {
- String str = this.field_0 + "," + this.field_1 + "," + this.width + "x" + this.height;
- if (!this.valid) {
- str = str + ",invalid";
- }
-
- if (!this.visible) {
- str = str + ",hidden";
- }
-
- if (!this.enabled) {
- str = str + ",disabled";
- }
-
- return str;
- }
-
- public String toString() {
- return this.getClass().getName() + "[" + this.paramString() + "]";
- }
-
- public void list() {
- this.list(System.out, 0);
- }
-
- public void list(PrintStream out) {
- this.list(out, 0);
- }
-
- public void list(PrintStream out, int indent) {
- for(int i = 0; i < indent; ++i) {
- out.print(" ");
- }
-
- out.println(this);
- }
- }
-