home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- 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.LayoutManager;
- import java.awt.Panel;
- import java.awt.Rectangle;
- import java.awt.image.ImageObserver;
-
- class JDPChiselFrameSidePanel extends Panel {
- Image offscreen;
- Rectangle offscreensize;
- // $FF: renamed from: gr java.awt.Graphics
- Graphics field_0;
- Container target;
- JDPUser user;
- String orientation;
- String panelTitle;
- String titlePos;
- Rectangle Bounds;
- // $FF: renamed from: fm java.awt.FontMetrics
- protected FontMetrics field_1;
- int[] boldWidths;
- Font thisFont;
- Font lastFont;
- int prevTitleHeight;
-
- public JDPChiselFrameSidePanel(JDPUser var1, String var2, String var3, String var4) {
- this.user = var1;
- this.orientation = var2;
- this.panelTitle = var3;
- this.titlePos = var4;
- Rectangle var5 = ((Component)this).bounds();
- if (var2.compareTo(var4) == 0) {
- ((Container)this).setLayout((LayoutManager)null);
- var5 = ((Component)this).bounds();
- ((Component)this).reshape(0, 0, var5.width, 12);
- } else {
- if (var2.equals("West")) {
- ((Container)this).setLayout((LayoutManager)null);
- ((Component)this).reshape(0, 0, 6, var5.height);
- }
-
- if (var2.equals("East")) {
- ((Container)this).setLayout((LayoutManager)null);
- ((Component)this).reshape(0, 0, 6, var5.height);
- }
-
- if (var2.equals("South")) {
- ((Container)this).setLayout((LayoutManager)null);
- ((Component)this).reshape(0, 0, var5.width, 6);
- }
-
- }
- }
-
- public void paint(Graphics var1) {
- this.update(var1);
- }
-
- public Dimension minimumSize() {
- Dimension var1 = new Dimension(7, 6);
- if (this.orientation.equals(this.titlePos)) {
- int var2 = 20;
- int var3 = 14;
- if (this.boldWidths != null) {
- var2 = this.StringWidth(this.panelTitle) + 15;
- }
-
- if (this.field_1 != null) {
- var3 = this.field_1.getHeight();
- }
-
- var1 = new Dimension(var2, var3);
- }
-
- return var1;
- }
-
- public void update(Graphics var1) {
- Rectangle var2 = ((Component)this).bounds();
- if (var2.width != 0 && var2.height != 0) {
- if (this.offscreen == null || var2.width != this.offscreensize.width || var2.height != this.offscreensize.height) {
- if (var2.width < 6) {
- var2.width = 6;
- }
-
- if (var2.height < 6) {
- var2.height = 6;
- }
-
- this.offscreen = ((Component)this).createImage(var2.width, var2.height);
- this.offscreensize = var2;
- this.field_0 = this.offscreen.getGraphics();
- this.field_0.setFont(((Component)this).getFont());
- }
-
- Color var3 = ((Component)this).getBackground();
- this.field_0.setColor(var3);
- this.field_0.fillRect(0, 0, var2.width, var2.height);
- this.field_0.setColor(Color.black);
- this.field_0.setColor(((Component)this).getForeground());
- if (this.thisFont == null) {
- if (this.user != null) {
- this.thisFont = this.user.boldFont;
- } else {
- this.thisFont = ((Component)this).getFont();
- this.thisFont = new Font(this.thisFont.getName(), 1, this.thisFont.getSize());
- }
- }
-
- this.field_0.setFont(this.thisFont);
- this.StringWidth("");
- if (this.field_1 != null) {
- int var4 = this.field_1.getHeight();
- if (var4 != this.prevTitleHeight && this.prevTitleHeight != 0 || var4 != ((Component)this).bounds().height) {
- this.prevTitleHeight = var4;
- if (this.target == null) {
- this.target = ((Component)this).getParent();
- }
-
- this.target.layout();
- this.target.paintAll(this.target.getGraphics());
- }
-
- this.prevTitleHeight = var4;
- }
-
- this.Bounds = ((Component)this).bounds();
- if (this.orientation.compareTo("East") == 0) {
- this.field_0.setColor(JDPUtils.darker(var3));
- this.field_0.drawLine(this.Bounds.width - 5, 0, this.Bounds.width - 5, this.Bounds.height);
- this.field_0.setColor(JDPUtils.brighter(var3));
- this.field_0.drawLine(this.Bounds.width - 4, 0, this.Bounds.width - 4, this.Bounds.height);
- } else if (this.orientation.compareTo("West") == 0) {
- this.field_0.setColor(JDPUtils.darker(var3));
- this.field_0.drawLine(3, 0, 3, this.Bounds.height);
- this.field_0.setColor(JDPUtils.brighter(var3));
- this.field_0.drawLine(4, 0, 4, this.Bounds.height);
- } else if (this.orientation.compareTo("South") == 0) {
- this.field_0.setColor(JDPUtils.darker(var3));
- this.field_0.drawLine(3, 0, 3, this.Bounds.height - 3);
- this.field_0.drawLine(this.Bounds.width - 5, 0, this.Bounds.width - 5, this.Bounds.height - 4);
- this.field_0.drawLine(4, this.Bounds.height - 4, this.Bounds.width - 4, this.Bounds.height - 4);
- this.field_0.setColor(JDPUtils.brighter(var3));
- this.field_0.drawLine(4, 0, 4, this.Bounds.height - 4);
- this.field_0.drawLine(this.Bounds.width - 4, 0, this.Bounds.width - 4, this.Bounds.height - 3);
- this.field_0.drawLine(3, this.Bounds.height - 3, this.Bounds.width - 4, this.Bounds.height - 3);
- if (this.orientation.equals(this.titlePos) && !this.panelTitle.equals("")) {
- this.field_0.setColor(var3);
- this.field_0.fillRect(6, this.Bounds.height - 8, (int)((double)this.panelTitle.length() * (double)6.0F), this.Bounds.height - 5);
- this.field_0.setColor(((Component)this).getForeground());
- this.field_0.drawString(this.panelTitle, 8, this.Bounds.height - 3);
- }
- } else if (this.orientation.compareTo("North") == 0) {
- this.field_0.setColor(JDPUtils.darker(var3));
- this.field_0.drawLine(3, this.Bounds.height - 7, 3, this.Bounds.height);
- this.field_0.drawLine(this.Bounds.width - 5, this.Bounds.height - 7, this.Bounds.width - 5, this.Bounds.height);
- this.field_0.drawLine(3, this.Bounds.height - 7, this.Bounds.width - 4, this.Bounds.height - 7);
- this.field_0.setColor(JDPUtils.brighter(var3));
- this.field_0.drawLine(4, this.Bounds.height - 6, 4, this.Bounds.height);
- this.field_0.drawLine(this.Bounds.width - 4, this.Bounds.height - 6, this.Bounds.width - 4, this.Bounds.height);
- this.field_0.drawLine(4, this.Bounds.height - 6, this.Bounds.width - 5, this.Bounds.height - 6);
- if (this.orientation.equals(this.titlePos) && !this.panelTitle.equals("")) {
- this.field_0.setColor(var3);
- this.field_0.fillRect(6, this.Bounds.height - 8, this.StringWidth(this.panelTitle) + 3, this.Bounds.height - 5);
- this.field_0.setColor(((Component)this).getForeground());
- this.field_0.drawString(this.panelTitle, 8, this.Bounds.height - 3);
- }
- }
-
- var1.drawImage(this.offscreen, 0, 0, (ImageObserver)null);
- }
- }
-
- public Dimension preferredSize() {
- return this.minimumSize();
- }
-
- public void layout() {
- ((Component)this).repaint();
- }
-
- public boolean handleEvent(Event var1) {
- switch (var1.id) {
- case 202:
- ((Component)this).repaint();
- return false;
- default:
- return false;
- }
- }
-
- int StringWidth(String var1) {
- if (this.field_1 == null || this.lastFont == null || this.field_0 != null && !this.field_0.getFont().equals(this.lastFont)) {
- this.field_1 = this.field_0.getFontMetrics();
- this.lastFont = this.field_0.getFont();
- if (this.field_1 != null) {
- this.boldWidths = this.field_1.getWidths();
- }
- }
-
- return this.field_1 != null ? this.field_1.stringWidth(var1) : 0;
- }
- }
-