Methods Summary |
---|
public void | action()
if ( boolDoAction == false )
return;
state = !state;
informListener();
|
public java.awt.Dimension | getPreferredSize()
return new Dimension(width, height);
|
public boolean | getValue()
return state;
|
public void | mouseActivity()
if (isEnabled()) {
if (mouseIn) {
if (mouseDown) {
visualState = DOWN;
if (mouseUp) {
action();
visualState = ACTIVE;
}
}
else {
visualState = ACTIVE;
}
}
else {
visualState = NORMAL;
}
}
else {
visualState = DISABLED;
}
repaint();
|
public void | mouseClicked(java.awt.event.MouseEvent e)
int modifier = e.getModifiers();
if ((modifier & InputEvent.BUTTON2_MASK) == 0
&& (modifier & InputEvent.BUTTON3_MASK) == 0 ) {
mouseClick = true;
mouseActivity();
mouseClick = false;
}
|
public void | mouseEntered(java.awt.event.MouseEvent e)
mouseIn = true;
mouseActivity();
|
public void | mouseExited(java.awt.event.MouseEvent e)
mouseIn = false;
mouseActivity();
if ( threadContPress != null ) {
threadContPress.stopNormaly ();
threadContPress = null;
}
|
public void | mousePressed(java.awt.event.MouseEvent e)
int modifier = e.getModifiers();
if ((modifier & InputEvent.BUTTON2_MASK) == 0
&& (modifier & InputEvent.BUTTON3_MASK) == 0 ) {
mouseDown = true;
mouseUp = false;
mouseActivity();
if ( boolContPress == true || boolPopup == true ) {
if ( threadContPress != null )
threadContPress.stopNormaly ();
threadContPress = new ContPressThread ( this );
if ( boolPopup == true )
threadContPress.setDelayedPress ( POPUP_DELAY );
threadContPress.start ();
}
boolDoAction = true;
}
|
public void | mouseReleased(java.awt.event.MouseEvent e)
int modifier = e.getModifiers();
if ((modifier & InputEvent.BUTTON2_MASK) == 0
&& (modifier & InputEvent.BUTTON3_MASK) == 0 ) {
mouseUp = true;
mouseActivity();
mouseUp = false;
mouseDown = false;
if ( threadContPress != null ) {
threadContPress.stopNormaly ();
threadContPress = null;
}
}
|
public void | paint(java.awt.Graphics g)
int index = state? 1:0;
Image image = null;
switch (visualState) {
case NORMAL:
image = imageNormal[index];
break;
case ACTIVE:
image = imageActive[index];
break;
case DOWN:
image = imageDown[index];
break;
case DISABLED:
image = imageDisabled[index];
break;
}
if (image != null)
g.drawImage(image, 0, 0, this);
|
protected void | processContPress()
if ( boolContPress == true )
informListener ();
else if ( boolPopup == true && mouseIn && mouseDown ) {
boolDoAction = false;
processMousePopup ();
}
|
protected void | processMouseEvent(java.awt.event.MouseEvent event)
super.processMouseEvent ( event );
if ( event.isPopupTrigger() ) {
processMousePopup ();
}
|
protected void | processMousePopup()
// Dimension dim;
if ( menuPopup != null ) {
// dim = this.getSize ();
menuPopup.show ( this, 0, height );
}
|
public void | setContMousePress(boolean boolSet)
boolContPress = boolSet;
|
public void | setEnabled(boolean value)
super.setEnabled(value);
if (value == false) {
visualState = DISABLED;
//setCursor( new Cursor(Cursor.DEFAULT_CURSOR) );
}
else {
if (mouseIn) {
if (mouseDown)
visualState = DOWN;
else
visualState = ACTIVE;
}
else {
visualState = NORMAL;
//setCursor(new Cursor(Cursor.HAND_CURSOR));
}
}
repaint();
|
public void | setMousePopup(boolean boolPopup)
this.boolPopup = boolPopup;
|
public void | setPopupMenu(java.awt.PopupMenu menuPopup)
if (menuPopup != null) {
setMousePopup ( true );
this.menuPopup = menuPopup;
this.add ( menuPopup );
} else if (this.menuPopup != null) {
setMousePopup(false);
remove(this.menuPopup);
this.menuPopup = null;
}
|
public void | setValue(boolean newState)
if (state != newState) {
state = newState;
repaint();
}
|