home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Canvas;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.image.ImageObserver;
-
- class afIcon2 extends Canvas {
- String Label;
- String Descr;
- afIconBar mum;
- Image photo;
- boolean fullb;
- boolean Sinin;
- int val;
- boolean cente;
- boolean mouseisdown;
- boolean buttisup;
- boolean mouseisover;
- int hori;
- int vert;
- // $FF: renamed from: f java.awt.Font
- Font field_0;
- // $FF: renamed from: fm java.awt.FontMetrics
- FontMetrics field_1;
- private Image offScreenImage;
- private Dimension offScreenSize;
- private Graphics offScreenGraphics;
-
- void overthetop() {
- this.mum.overthetop(this.val);
- }
-
- public boolean mouseEnter(Event evt, int x, int y) {
- this.mouseisover = true;
- this.overthetop();
- ((Component)this).repaint();
- return true;
- }
-
- public boolean mouseExit(Event evt, int x, int y) {
- this.mouseisover = false;
- ((Component)this).repaint();
- return true;
- }
-
- public void paint(Graphics g) {
- g.setFont(this.field_0);
- g.setColor(this.mum.nickCol);
- int widAp = ((Component)this).size().width;
- int heiAp = ((Component)this).size().height;
- g.fillRect(0, 0, widAp + 1, heiAp + 1);
- int l = this.field_1.stringWidth(this.Label);
- int h = this.field_1.getHeight();
- this.hori = (widAp - l) / 2;
- this.vert = (heiAp + h / 2) / 2;
- if (!this.cente) {
- this.vert += 15;
- }
-
- if (this.photo != null) {
- int wid = this.photo.getWidth(this);
- int hei = this.photo.getHeight(this);
- int widMultip = widAp / wid + 1;
- int heiMultip = heiAp / hei + 1;
- int phori = 19 - (this.val - 1) * 33;
- int pvert = 1;
- if (this.buttisup) {
- g.drawImage(this.photo, phori, pvert, this);
- } else {
- g.drawImage(this.photo, phori + 1, pvert + 1, this);
- }
- }
-
- if (this.fullb) {
- this.mouseisover = true;
- }
-
- if (this.mouseisover) {
- g.setColor(this.mum.nickCol);
- g.draw3DRect(0, 0, widAp - 1, heiAp - 1, true);
- }
-
- if (this.buttisup) {
- g.setColor(this.mum.nickCol);
- g.fillRect(0, 0, widAp, 3);
- g.fillRect(0, 34, widAp, 20);
- g.fillRect(0, 0, 22, heiAp);
- g.fillRect(widAp - 23, 0, 35, heiAp);
- if (this.mouseisover) {
- g.setColor(this.mum.nickCol);
- g.draw3DRect(0, 0, widAp - 1, heiAp - 1, true);
- }
-
- if (this.Sinin) {
- g.setColor(Color.white);
- g.drawString(this.Label, this.hori + 1, this.vert + 1);
- }
-
- g.setColor(this.mum.nickCol2);
- g.drawString(this.Label, this.hori, this.vert);
- } else if (!this.buttisup) {
- g.setColor(this.mum.nickCol);
- g.fillRect(0, 0, widAp, 4);
- g.fillRect(0, 35, widAp, 20);
- g.fillRect(0, 0, 23, heiAp);
- g.fillRect(widAp - 22, 0, 35, heiAp);
- g.setColor(this.mum.nickCol);
- g.draw3DRect(0, 0, widAp - 1, heiAp - 1, false);
- if (this.Sinin) {
- g.setColor(Color.white);
- g.drawString(this.Label, this.hori + 2, this.vert + 2);
- }
-
- g.setColor(this.mum.nickCol2);
- g.drawString(this.Label, this.hori + 1, this.vert + 1);
- }
-
- }
-
- public boolean mouseUp(Event evt, int x, int y) {
- this.mouseisdown = false;
- this.buttisup = true;
- this.mouseisover = true;
- this.buttonclick();
- ((Component)this).repaint();
- return true;
- }
-
- public void distroy() {
- this.offScreenGraphics.dispose();
- }
-
- public void mouser() {
- this.mouseisover = false;
- ((Component)this).repaint();
- }
-
- public final synchronized void update(Graphics g) {
- Dimension d = ((Component)this).size();
- if (this.offScreenImage == null || d.width != this.offScreenSize.width || d.height != this.offScreenSize.height) {
- this.offScreenImage = ((Component)this).createImage(d.width, d.height);
- this.offScreenSize = d;
- this.offScreenGraphics = this.offScreenImage.getGraphics();
- }
-
- this.paint(this.offScreenGraphics);
- g.drawImage(this.offScreenImage, 0, 0, (ImageObserver)null);
- }
-
- public boolean mouseDown(Event evt, int x, int y) {
- this.mouseisdown = true;
- this.buttisup = false;
- this.mouseisover = false;
- ((Component)this).repaint();
- return true;
- }
-
- void buttonclick() {
- this.mum.buttonclick(this.val);
- }
-
- public afIcon2(int v, afIconBar dad, Image tasphoto, String lab, String Des, boolean cent) {
- this.mum = dad;
- this.Label = lab;
- this.Descr = Des;
- this.val = v;
- this.photo = tasphoto;
- this.fullb = this.mum.fullb;
- this.Sinin = this.mum.Sinkin;
- String Face = this.mum.Face;
- boolean Bolder = this.mum.Bolder;
- this.field_0 = new Font(Face, 0, 12);
- if (Bolder) {
- this.field_0 = new Font(Face, 1, 12);
- ((Component)this).setBackground(this.mum.nickCol);
- }
-
- this.field_1 = ((Component)this).getFontMetrics(this.field_0);
- this.cente = cent;
- this.mouseisdown = false;
- this.buttisup = true;
- ((Component)this).repaint();
- }
- }
-