Issue number: GUI Service

Obtained from:
Submitted by:  Yana Stamcheva
Reviewed by:
CVS: ----------------------------------------------------------------------
CVS: Issue number:
CVS:   If this change addresses one or more issues,
CVS:   then enter the issue number(s) here.
CVS: Obtained from:
CVS:   If this change has been taken from another system,
CVS:   then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS:   If this code has been contributed to the project by someone else; i.e.,
CVS:   they sent us a patch or a set of diffs, then include their name/email
CVS:   address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS:   If we are doing pre-commit code reviews and someone else has
CVS:   reviewed your changes, include their name(s) here.
CVS:   If you have not had it reviewed then delete this line.
cusax-fix
Yana Stamcheva 20 years ago
parent efc09067d5
commit 8c59770f44

@ -2,33 +2,51 @@
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.awt.image.SampleModel;
public class StatusIcon extends BufferedImage {
private Image bgImage;
private Image iconImage;
private Image bgImage;
private Image iconImage;
private int rightShift = 0;
public StatusIcon (Image bgImage, Image iconImage) {
super( bgImage.getWidth(null),
bgImage.getHeight(null),
BufferedImage.TYPE_4BYTE_ABGR);
this (bgImage, iconImage, 0);
}
public StatusIcon ( Image bgImage,
Image iconImage,
int rightShift) {
super( bgImage.getWidth(null) + rightShift,
bgImage.getHeight(null) + rightShift,
BufferedImage.TYPE_4BYTE_ABGR);
this.bgImage = bgImage;
this.iconImage = iconImage;
this.rightShift = rightShift;
this.getGraphics().drawImage (this.bgImage, 0, 0, null);
this.getGraphics().drawImage (this.bgImage, 0, rightShift/2, null);
if (this.iconImage != null)
this.getGraphics().drawImage (this.iconImage,
(this.bgImage.getWidth(null) -
this.iconImage.getWidth(null)) / 2,
(this.bgImage.getHeight(null) -
this.iconImage.getHeight(null)) / 2, null);
if (this.iconImage != null){
int x = (this.bgImage.getWidth(null) -
this.iconImage.getWidth(null)) / 2;
int y = (this.bgImage.getHeight(null) -
this.iconImage.getHeight(null)) / 2;
this.getGraphics().drawImage ( this.iconImage,
x + rightShift,
y + rightShift,
null);
}
}
public StatusIcon (Image image) {
super( image.getWidth(null),
image.getHeight(null),
BufferedImage.TYPE_4BYTE_ABGR);
@ -36,5 +54,16 @@ public StatusIcon (Image image) {
this.bgImage = image;
this.getGraphics().drawImage (this.bgImage, 0, 0, null);
}
}
public StatusIcon (Image image, int rightShift) {
super( image.getWidth(null) + rightShift,
image.getHeight(null) + rightShift,
BufferedImage.TYPE_4BYTE_ABGR);
this.bgImage = image;
this.getGraphics().drawImage (this.bgImage, 0, rightShift/2, null);
}
}
Loading…
Cancel
Save