added some icons

This commit is contained in:
bancika
2011-01-09 12:44:24 +00:00
parent 41bcfec45e
commit f2fa8195b3
3 changed files with 8 additions and 4 deletions
@@ -65,7 +65,7 @@ public abstract class AbstractLeadedDIYComponent<T> extends AbstractTransparentC
* @return shape that represents component body. Shape should not be
* transformed and should be referenced to (0, 0).
*/
protected abstract Shape getComponentShape();
protected abstract Shape getBodyShape();
/**
* @return component body color.
@@ -111,7 +111,7 @@ public abstract class AbstractLeadedDIYComponent<T> extends AbstractTransparentC
g2d.setColor(getLeadColor());
g2d.setStroke(new BasicStroke(getLeadThickness().convertToPixels()));
double distance = points[0].distance(points[1]);
Shape shape = getComponentShape();
Shape shape = getBodyShape();
if (shape == null) {
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
return;
@@ -2,6 +2,7 @@ package org.diylc.presenter;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -83,8 +84,11 @@ public class ComponentProcessor {
IDIYComponent<?> componentInstance = (IDIYComponent<?>) clazz.newInstance();
Image image = new BufferedImage(Presenter.ICON_SIZE, Presenter.ICON_SIZE,
java.awt.image.BufferedImage.TYPE_INT_ARGB);
componentInstance.drawIcon((Graphics2D) image.getGraphics(), Presenter.ICON_SIZE,
Presenter.ICON_SIZE);
Graphics2D g2d = (Graphics2D) image.getGraphics();
g2d
.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
componentInstance.drawIcon(g2d, Presenter.ICON_SIZE, Presenter.ICON_SIZE);
icon = new ImageIcon(image);
} catch (InstantiationException e) {
e.printStackTrace();