mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
added some icons
This commit is contained in:
Binary file not shown.
+2
-2
@@ -65,7 +65,7 @@ public abstract class AbstractLeadedDIYComponent<T> extends AbstractTransparentC
|
|||||||
* @return shape that represents component body. Shape should not be
|
* @return shape that represents component body. Shape should not be
|
||||||
* transformed and should be referenced to (0, 0).
|
* transformed and should be referenced to (0, 0).
|
||||||
*/
|
*/
|
||||||
protected abstract Shape getComponentShape();
|
protected abstract Shape getBodyShape();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return component body color.
|
* @return component body color.
|
||||||
@@ -111,7 +111,7 @@ public abstract class AbstractLeadedDIYComponent<T> extends AbstractTransparentC
|
|||||||
g2d.setColor(getLeadColor());
|
g2d.setColor(getLeadColor());
|
||||||
g2d.setStroke(new BasicStroke(getLeadThickness().convertToPixels()));
|
g2d.setStroke(new BasicStroke(getLeadThickness().convertToPixels()));
|
||||||
double distance = points[0].distance(points[1]);
|
double distance = points[0].distance(points[1]);
|
||||||
Shape shape = getComponentShape();
|
Shape shape = getBodyShape();
|
||||||
if (shape == null) {
|
if (shape == null) {
|
||||||
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
||||||
return;
|
return;
|
||||||
|
|||||||
+6
-2
@@ -2,6 +2,7 @@ package org.diylc.presenter;
|
|||||||
|
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
|
import java.awt.RenderingHints;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -83,8 +84,11 @@ public class ComponentProcessor {
|
|||||||
IDIYComponent<?> componentInstance = (IDIYComponent<?>) clazz.newInstance();
|
IDIYComponent<?> componentInstance = (IDIYComponent<?>) clazz.newInstance();
|
||||||
Image image = new BufferedImage(Presenter.ICON_SIZE, Presenter.ICON_SIZE,
|
Image image = new BufferedImage(Presenter.ICON_SIZE, Presenter.ICON_SIZE,
|
||||||
java.awt.image.BufferedImage.TYPE_INT_ARGB);
|
java.awt.image.BufferedImage.TYPE_INT_ARGB);
|
||||||
componentInstance.drawIcon((Graphics2D) image.getGraphics(), Presenter.ICON_SIZE,
|
Graphics2D g2d = (Graphics2D) image.getGraphics();
|
||||||
Presenter.ICON_SIZE);
|
g2d
|
||||||
|
.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||||
|
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
|
componentInstance.drawIcon(g2d, Presenter.ICON_SIZE, Presenter.ICON_SIZE);
|
||||||
icon = new ImageIcon(image);
|
icon = new ImageIcon(image);
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user