示例#1
0
 @Override
 public final void paintIcon(InstancePainter painter) {
   Graphics g = painter.getGraphics();
   g.setColor(Color.black);
   if (painter.getGateShape() == AppPreferences.SHAPE_RECTANGULAR) {
     Icon iconRect = getIconRectangular();
     if (iconRect != null) {
       iconRect.paintIcon(painter.getDestination(), g, 2, 2);
     } else {
       paintIconRectangular(painter);
     }
   } else if (painter.getGateShape() == AppPreferences.SHAPE_DIN40700) {
     Icon iconDin = getIconDin40700();
     if (iconDin != null) {
       iconDin.paintIcon(painter.getDestination(), g, 2, 2);
     } else {
       paintIconRectangular(painter);
     }
   } else {
     Icon iconShaped = getIconShaped();
     if (iconShaped != null) {
       iconShaped.paintIcon(painter.getDestination(), g, 2, 2);
     } else {
       paintIconShaped(painter);
     }
   }
 }
示例#2
0
 //
 // graphics methods
 //
 @Override
 public void paintIcon(InstancePainter painter) {
   Icon icon;
   if (painter.getGateShape() == AppPreferences.SHAPE_SHAPED) {
     icon = ICON_SHAPED;
   } else {
     icon = ICON_RECTANGULAR;
   }
   icon.paintIcon(painter.getDestination(), painter.getGraphics(), 2, 2);
 }
示例#3
0
 //
 // painting methods
 //
 @Override
 public void paintIcon(InstancePainter painter) {
   Graphics g = painter.getGraphics();
   g.setColor(Color.black);
   if (painter.getGateShape() == AppPreferences.SHAPE_RECTANGULAR) {
     if (toolIconRect != null) {
       toolIconRect.paintIcon(painter.getDestination(), g, 2, 2);
     } else {
       g.drawRect(0, 2, 16, 16);
       GraphicsUtil.drawCenteredText(g, RECT_LABEL, 8, 8);
       g.drawOval(16, 8, 4, 4);
     }
   } else if (painter.getGateShape() == AppPreferences.SHAPE_DIN40700) {
     if (toolIconDin != null) {
       toolIconDin.paintIcon(painter.getDestination(), g, 2, 2);
     } else {
       g.drawRect(0, 2, 16, 16);
       GraphicsUtil.drawCenteredText(g, RECT_LABEL, 8, 8);
       g.drawOval(16, 8, 4, 4);
     }
   } else {
     if (toolIcon != null) {
       toolIcon.paintIcon(painter.getDestination(), g, 2, 2);
     } else {
       int[] xp = new int[4];
       int[] yp = new int[4];
       xp[0] = 15;
       yp[0] = 10;
       xp[1] = 1;
       yp[1] = 3;
       xp[2] = 1;
       yp[2] = 17;
       xp[3] = 15;
       yp[3] = 10;
       g.drawPolyline(xp, yp, 4);
       g.drawOval(15, 8, 4, 4);
     }
   }
 }