home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.basic;
-
- import com.sun.java.swing.JComponent;
- import com.sun.java.swing.UIManager;
- import com.sun.java.swing.plaf.SpinnerUI;
- import java.awt.Adjustable;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.event.AdjustmentEvent;
- import java.awt.event.AdjustmentListener;
- import java.awt.event.FocusEvent;
- import java.awt.event.FocusListener;
- import java.awt.event.KeyEvent;
- import java.awt.event.KeyListener;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
-
- public class Spinner extends JComponent implements Adjustable, AdjustmentListener, FocusListener, KeyListener, MouseListener {
- protected String txt;
- // $FF: renamed from: d java.awt.Dimension
- protected Dimension field_0;
- protected int ascent;
- protected int value;
- protected boolean haveFocus = false;
- protected int minValue;
- protected int maxValue = 8388607;
- // $FF: renamed from: fm java.awt.FontMetrics
- protected FontMetrics field_1;
- protected int nDigits = 4;
- protected int digitsTyped;
- protected boolean wraps = false;
- protected boolean borderPainted = false;
- protected Color backgroundColor;
- protected int leadingPad;
- public boolean wrapped;
- // $FF: synthetic field
- static Class class$java$awt$event$AdjustmentListener;
-
- public Spinner(int var1, String var2) {
- this.backgroundColor = Color.white;
- this.leadingPad = -1;
- this.wrapped = false;
- this.init(var1, var2);
- }
-
- public Spinner(int var1) {
- this.backgroundColor = Color.white;
- this.leadingPad = -1;
- this.wrapped = false;
- this.init(var1, (String)null);
- }
-
- private void init(int var1, String var2) {
- this.txt = var2;
- this.value = var1;
- ((Component)this).addFocusListener(this);
- ((Component)this).addMouseListener(this);
- ((Component)this).addKeyListener(this);
- this.updateUI();
- }
-
- public int getValue() {
- return this.value;
- }
-
- public void setValue(int var1) {
- if (this.wraps) {
- if (var1 >= this.minValue && var1 <= this.maxValue) {
- this.wrapped = false;
- } else {
- this.wrapped = true;
- }
- }
-
- while(var1 < this.minValue) {
- if (this.wraps) {
- var1 += this.maxValue + 1 - this.minValue;
- } else {
- var1 = this.minValue;
- }
- }
-
- while(var1 > this.maxValue) {
- if (this.wraps) {
- var1 = this.minValue - 1 + var1 - this.maxValue;
- } else {
- var1 = this.maxValue;
- }
- }
-
- if (this.value != var1) {
- this.value = var1;
- if (((Component)this).isShowing()) {
- ((Component)this).repaint(20L);
- }
-
- this.fireAdjustmentValueChanged(new AdjustmentEvent(this, 0, 601, var1));
- }
-
- }
-
- public void setWrap(boolean var1) {
- this.wraps = var1;
- }
-
- public boolean getWrap() {
- return this.wraps;
- }
-
- public void setText(String var1) {
- this.txt = var1;
- if (((Component)this).isShowing()) {
- ((Component)this).repaint(20L);
- }
-
- }
-
- public String getText() {
- return this.txt;
- }
-
- public void setFont(Font var1) {
- if (var1 != ((Component)this).getFont()) {
- super.setFont(var1);
- this.field_0 = null;
- ((Container)this).invalidate();
- }
-
- }
-
- public void setDigits(int var1) {
- this.nDigits = var1;
- }
-
- public int getDigits() {
- return this.nDigits;
- }
-
- public void setLeadingPad(int var1) {
- this.leadingPad = var1;
- }
-
- public int getLeadingPad() {
- return this.leadingPad;
- }
-
- public void setBackgroundColor(Color var1) {
- this.backgroundColor = var1;
- }
-
- public Color getBackgroundColor() {
- return this.backgroundColor;
- }
-
- public boolean isFocusTraversable() {
- return true;
- }
-
- public boolean hasFocus() {
- return this.haveFocus;
- }
-
- public boolean isBorderPainted() {
- return this.borderPainted;
- }
-
- public void setBorderPainted(boolean var1) {
- this.borderPainted = var1;
- ((Container)this).invalidate();
- }
-
- protected void paintBorder(Graphics var1) {
- if (this.isBorderPainted()) {
- super.paintBorder(var1);
- }
-
- }
-
- public void adjustmentValueChanged(AdjustmentEvent var1) {
- this.setValue(var1.getValue());
- }
-
- public void setMinimum(int var1) {
- this.minValue = var1;
- this.setValue(this.value);
- }
-
- public int getMinimum() {
- return this.minValue;
- }
-
- public void setMaximum(int var1) {
- this.maxValue = var1;
- this.setValue(this.value);
- }
-
- public int getMaximum() {
- return this.maxValue;
- }
-
- public void addAdjustmentListener(AdjustmentListener var1) {
- super.listenerList.add(class$java$awt$event$AdjustmentListener != null ? class$java$awt$event$AdjustmentListener : (class$java$awt$event$AdjustmentListener = class$("java.awt.event.AdjustmentListener")), var1);
- }
-
- public void removeAdjustmentListener(AdjustmentListener var1) {
- super.listenerList.remove(class$java$awt$event$AdjustmentListener != null ? class$java$awt$event$AdjustmentListener : (class$java$awt$event$AdjustmentListener = class$("java.awt.event.AdjustmentListener")), var1);
- }
-
- protected void fireAdjustmentValueChanged(AdjustmentEvent var1) {
- Object[] var2 = super.listenerList.getListenerList();
-
- for(int var3 = var2.length - 2; var3 >= 0; var3 -= 2) {
- if (var2[var3] == (class$java$awt$event$AdjustmentListener != null ? class$java$awt$event$AdjustmentListener : (class$java$awt$event$AdjustmentListener = class$("java.awt.event.AdjustmentListener")))) {
- ((AdjustmentListener)var2[var3 + 1]).adjustmentValueChanged(var1);
- }
- }
-
- }
-
- public void setUnitIncrement(int var1) {
- }
-
- public int getUnitIncrement() {
- return 1;
- }
-
- public void setBlockIncrement(int var1) {
- }
-
- public int getBlockIncrement() {
- return 1;
- }
-
- public void setVisibleAmount(int var1) {
- }
-
- public int getVisibleAmount() {
- return 1;
- }
-
- public int getOrientation() {
- return 0;
- }
-
- public void keyTyped(KeyEvent var1) {
- }
-
- public void keyPressed(KeyEvent var1) {
- if (var1.isActionKey()) {
- switch (var1.getKeyCode()) {
- case 38:
- this.setValue(this.value + 1);
- return;
- case 39:
- default:
- break;
- case 40:
- this.setValue(this.value - 1);
- return;
- }
- } else {
- char var2 = var1.getKeyChar();
- if (var2 >= '0' && var2 <= '9') {
- if (this.digitsTyped < this.nDigits) {
- if (this.digitsTyped == 0) {
- this.value = 0;
- }
-
- int var3 = this.value * 10 + var2 - 48;
- if (var3 <= this.maxValue && var3 >= this.minValue) {
- this.setValue(var3);
- ++this.digitsTyped;
- return;
- }
- }
- } else {
- switch (var2) {
- case '\b':
- case '\u007f':
- this.setValue(this.value / 10);
- --this.digitsTyped;
- return;
- case '-':
- this.setValue(-this.value);
- return;
- }
- }
- }
-
- }
-
- public void keyReleased(KeyEvent var1) {
- }
-
- public void mouseClicked(MouseEvent var1) {
- }
-
- public void mousePressed(MouseEvent var1) {
- ((JComponent)this).requestFocus();
- }
-
- public void mouseReleased(MouseEvent var1) {
- }
-
- public void mouseEntered(MouseEvent var1) {
- }
-
- public void mouseExited(MouseEvent var1) {
- }
-
- public void focusGained(FocusEvent var1) {
- this.haveFocus = true;
- this.digitsTyped = 0;
- ((Component)this).repaint();
- }
-
- public void focusLost(FocusEvent var1) {
- this.haveFocus = false;
- ((Component)this).repaint();
- }
-
- public SpinnerUI getUI() {
- return (SpinnerUI)super.ui;
- }
-
- public void setUI(SpinnerUI var1) {
- super.setUI(var1);
- }
-
- public void updateUI() {
- this.setUI((SpinnerUI)UIManager.getUI(this));
- }
-
- public String getUIClassID() {
- return "SpinnerUI";
- }
-
- // $FF: synthetic method
- static Class class$(String var0) {
- try {
- return Class.forName(var0);
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
- }
- }
-