Example #1
0
 public void paintComponent(Graphics g1) {
   animationCount = 1;
   if (!visible) return;
   Graphics2D g = (Graphics2D) g1;
   float width = getWidth();
   float height = getHeight();
   g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   if (45.0 <= rotate && rotate < 135.0) {
     g.translate(width, 0.0);
     g.rotate(Math.PI * rotate / 180, 0.0, 0.0);
     g.transform(
         AffineTransform.getScaleInstance(height / original_width, width / original_height));
   } else if (135.0 <= rotate && rotate < 225.0) {
     g.rotate(Math.PI * rotate / 180, width / 2, height / 2);
     g.transform(
         AffineTransform.getScaleInstance(width / original_width, height / original_height));
   } else if (225.0 <= rotate && rotate < 315.0) {
     g.translate(-height, 0.0);
     g.rotate(Math.PI * rotate / 180, height, 0.0);
     g.transform(
         AffineTransform.getScaleInstance(height / original_width, width / original_height));
   } else
     g.transform(
         AffineTransform.getScaleInstance(width / original_width, height / original_height));
   if ((dd.dynType & GeDyn.mDynType_Rotate) != 0 && dd.rotate != 0) {
     g.rotate(
         Math.PI * dd.rotate / 180,
         (dd.x0 - getX()) * original_width / width,
         (dd.y0 - getY()) * original_height / height);
   }
   AffineTransform save = g.getTransform();
   AffineTransform save_tmp;
   int rounds = 1;
   if (fillLevel != 1F) rounds = 2;
   int oldColor = 0;
   for (int i = 0; i < rounds; i++) {
     if (rounds == 2) {
       switch (i) {
         case 0:
           if (levelColorTone != GeColor.COLOR_TONE_NO) {
             oldColor = colorTone;
             colorTone = levelColorTone;
           } else if (levelFillColor != GeColor.COLOR_NO) {
             oldColor = fillColor;
             fillColor = levelFillColor;
           }
           break;
         case 1:
           if (levelColorTone != GeColor.COLOR_TONE_NO) colorTone = oldColor;
           else if (levelFillColor != GeColor.COLOR_NO) fillColor = oldColor;
           break;
       }
       switch (levelDirection) {
         case Ge.DIRECTION_UP:
           if (i == 0)
             g.setClip(
                 new Rectangle2D.Float(
                     0F,
                     fillLevel * original_height + Ge.cJBean_Offset,
                     original_width,
                     original_height));
           else
             g.setClip(
                 new Rectangle2D.Float(
                     0F, 0F, original_width, fillLevel * original_height + Ge.cJBean_Offset));
           break;
         case Ge.DIRECTION_DOWN:
           if (i == 0)
             g.setClip(
                 new Rectangle2D.Float(
                     0F,
                     0F,
                     original_width,
                     (1 - fillLevel) * original_height + Ge.cJBean_Offset));
           else
             g.setClip(
                 new Rectangle2D.Float(
                     0F,
                     (1 - fillLevel) * original_height + Ge.cJBean_Offset,
                     original_width,
                     original_height));
           break;
         case Ge.DIRECTION_RIGHT:
           if (i == 0)
             g.setClip(
                 new Rectangle2D.Float(
                     fillLevel * original_width + Ge.cJBean_Offset,
                     0F,
                     original_width,
                     original_height));
           else
             g.setClip(
                 new Rectangle2D.Float(0F, 0F, fillLevel * width + Ge.cJBean_Offset, height));
           break;
         case Ge.DIRECTION_LEFT:
           if (i == 0)
             g.setClip(
                 new Rectangle2D.Float(
                     0F,
                     0F,
                     (1 - fillLevel) * original_width + Ge.cJBean_Offset,
                     original_height));
           else
             g.setClip(
                 new Rectangle2D.Float(
                     (1 - fillLevel) * original_width + Ge.cJBean_Offset,
                     0F,
                     original_width,
                     original_height));
           break;
       }
     }
     {
       int fcolor =
           GeColor.getDrawtype(
               293,
               colorTone,
               colorShift,
               colorIntensity,
               colorBrightness,
               colorInverse,
               fillColor,
               dimmed);
       if (gradient == GeGradient.eGradient_No) {
         g.setColor(GeColor.getColor(fcolor));
         g.fill(shapes[0]);
       } else {
         GeGradient.paint(
             g,
             gradient,
             2,
             -2,
             2F,
             2F,
             13.6808F,
             14.8208F,
             false,
             293,
             colorTone,
             colorShift,
             colorIntensity,
             colorInverse,
             fillColor,
             dimmed);
         g.fill(shapes[0]);
       }
       if (shadow != 0) {
         g.setColor(GeColor.shiftColor(fcolor, -2, colorInverse));
         g.fill(shapes[1]);
         g.setColor(GeColor.shiftColor(fcolor, 2, colorInverse));
         g.fill(shapes[2]);
       }
       g.setStroke(new BasicStroke(1F));
       g.setColor(
           GeColor.getColor(
               0,
               colorTone,
               colorShift,
               colorIntensity,
               colorBrightness,
               colorInverse,
               borderColor,
               dimmed));
       g.draw(shapes[0]);
     }
   }
   if (rounds == 2) g.setClip(null);
   g.setTransform(save);
 }
Example #2
0
 public void paintComponent(Graphics g1) {
   Graphics2D g = (Graphics2D) g1;
   float width = getWidth();
   float height = getHeight();
   g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   double scaleWidth = (1.0 * width / original_width);
   double scaleHeight = (1.0 * height / original_height);
   AffineTransform save = g.getTransform();
   g.setColor(getBackground());
   g.fill(new Rectangle(0, 0, getWidth(), getHeight()));
   g.transform(AffineTransform.getScaleInstance(scaleWidth, scaleHeight)); // scaletest
   AffineTransform save_tmp;
   g.setColor(
       GeColor.getColor(
           0,
           colorTone,
           colorShift,
           colorIntensity,
           colorBrightness,
           colorInverse,
           textColor,
           dimmed));
   g.setFont(new Font("Helvetica", Font.BOLD, 12));
   g.drawString(JopLang.transl("Status"), 13, 91);
   g.setColor(
       GeColor.getColor(
           0,
           colorTone,
           colorShift,
           colorIntensity,
           colorBrightness,
           colorInverse,
           textColor,
           dimmed));
   g.setFont(new Font("Helvetica", Font.BOLD, 12));
   g.drawString(JopLang.transl("LogMessage"), 13, 114);
   g.setColor(
       GeColor.getColor(
           0,
           colorTone,
           colorShift,
           colorIntensity,
           colorBrightness,
           colorInverse,
           textColor,
           dimmed));
   g.setFont(new Font("Helvetica", Font.BOLD, 12));
   g.drawString(JopLang.transl("EventListSize"), 13, 23);
   g.setColor(
       GeColor.getColor(
           0,
           colorTone,
           colorShift,
           colorIntensity,
           colorBrightness,
           colorInverse,
           textColor,
           dimmed));
   g.setFont(new Font("Helvetica", Font.BOLD, 12));
   g.drawString(JopLang.transl("EventLogSize"), 13, 44);
   g.setColor(
       GeColor.getColor(
           0,
           colorTone,
           colorShift,
           colorIntensity,
           colorBrightness,
           colorInverse,
           textColor,
           dimmed));
   g.setFont(new Font("Helvetica", Font.BOLD, 12));
   g.drawString(JopLang.transl("MaxApplAlarms"), 13, 67);
   g.setTransform(save);
 }