本文整理汇总了Java中com.cburch.draw.canvas.CanvasTool类的典型用法代码示例。如果您正苦于以下问题:Java CanvasTool类的具体用法?Java CanvasTool怎么用?Java CanvasTool使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CanvasTool类属于com.cburch.draw.canvas包,在下文中一共展示了CanvasTool类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AppearanceCanvas
import com.cburch.draw.canvas.CanvasTool; //导入依赖的package包/类
public AppearanceCanvas(CanvasTool selectTool) {
this.selectTool = selectTool;
this.grid = new GridPainter(this);
this.listener = new Listener();
this.oldPreferredSize = null;
addKeyListener(listener);
addMouseListener(listener);
addMouseMotionListener(listener);
addMouseWheelListener(listener);
setPreferredSize(new Dimension(Integer.MAX_VALUE / 100, Integer.MAX_VALUE / 100));
setSelection(new AppearanceSelection());
setTool(selectTool);
CanvasModel model = super.getModel();
if (model != null)
model.addCanvasModelListener(listener);
grid.addPropertyChangeListener(GridPainter.ZOOM_PROPERTY, listener);
}
示例2: paintComponent
import com.cburch.draw.canvas.CanvasTool; //导入依赖的package包/类
@Override
public void paintComponent(Graphics g) {
if (AppPreferences.ANTI_ALIASING.getBoolean()) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
}
g.clearRect(0, 0, getWidth(), getHeight());
CanvasTool current = canvas.getTool();
for (int i = 0; i < tools.length; i++) {
AbstractTool[] column = tools[i];
int x = ICON_SEP + i * (ICON_SEP + ICON_WIDTH);
int y = ICON_SEP;
for (int j = 0; j < column.length; j++) {
AbstractTool tool = column[j];
if (tool == listener.toolPressed && listener.inTool) {
g.setColor(Color.darkGray);
g.fillRect(x, y, ICON_WIDTH, ICON_HEIGHT);
}
Icon icon = tool.getIcon();
if (icon != null)
icon.paintIcon(this, g, x, y);
if (tool == current) {
GraphicsUtil.switchToWidth(g, 2);
g.setColor(Color.black);
g.drawRect(x - 1, y - 1, ICON_WIDTH + 2, ICON_HEIGHT + 2);
}
y += ICON_HEIGHT + ICON_SEP;
}
}
g.setColor(Color.black);
GraphicsUtil.switchToWidth(g, 1);
}
示例3: propertyChange
import com.cburch.draw.canvas.CanvasTool; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
String prop = evt.getPropertyName();
if (prop.equals(GridPainter.ZOOM_PROPERTY)) {
CanvasTool t = getTool();
if (t != null) {
t.zoomFactorChanged(AppearanceCanvas.this);
}
}
}
示例4: toolGestureComplete
import com.cburch.draw.canvas.CanvasTool; //导入依赖的package包/类
@Override
public void toolGestureComplete(CanvasTool tool, CanvasObject created) {
if (tool == getTool() && tool != selectTool) {
setTool(selectTool);
if (created != null) {
getSelection().clearSelected();
getSelection().setSelected(created, true);
}
}
}
示例5: paintComponent
import com.cburch.draw.canvas.CanvasTool; //导入依赖的package包/类
@Override
public void paintComponent(Graphics g) {
g.clearRect(0, 0, getWidth(), getHeight());
CanvasTool current = canvas.getTool();
for (int i = 0; i < tools.length; i++) {
AbstractTool[] column = tools[i];
int x = ICON_SEP + i * (ICON_SEP + ICON_WIDTH);
int y = ICON_SEP;
for (int j = 0; j < column.length; j++) {
AbstractTool tool = column[j];
if (tool == listener.toolPressed && listener.inTool) {
g.setColor(Color.darkGray);
g.fillRect(x, y, ICON_WIDTH, ICON_HEIGHT);
}
Icon icon = tool.getIcon();
if (icon != null)
icon.paintIcon(this, g, x, y);
if (tool.equals(current)) {
GraphicsUtil.switchToWidth(g, 2);
g.setColor(Color.black);
g.drawRect(x - 1, y - 1, ICON_WIDTH + 2, ICON_HEIGHT + 2);
}
y += ICON_HEIGHT + ICON_SEP;
}
}
g.setColor(Color.black);
GraphicsUtil.switchToWidth(g, 1);
}
示例6: propertyChange
import com.cburch.draw.canvas.CanvasTool; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent evt) {
String prop = evt.getPropertyName();
if (prop.equals(GridPainter.ZOOM_PROPERTY)) {
CanvasTool t = getTool();
if (t != null) {
t.zoomFactorChanged(AppearanceCanvas.this);
}
}
}
示例7: AppearanceCanvas
import com.cburch.draw.canvas.CanvasTool; //导入依赖的package包/类
public AppearanceCanvas(CanvasTool selectTool) {
this.selectTool = selectTool;
this.grid = new GridPainter(this);
this.listener = new Listener();
this.oldPreferredSize = null;
setSelection(new AppearanceSelection());
setTool(selectTool);
CanvasModel model = super.getModel();
if (model != null)
model.addCanvasModelListener(listener);
grid.addPropertyChangeListener(GridPainter.ZOOM_PROPERTY, listener);
}
示例8: paintComponent
import com.cburch.draw.canvas.CanvasTool; //导入依赖的package包/类
@Override
public void paintComponent(Graphics g) {
g.clearRect(0, 0, getWidth(), getHeight());
CanvasTool current = canvas.getTool();
for(int i = 0; i < tools.length; i++) {
AbstractTool[] column = tools[i];
int x = ICON_SEP + i * (ICON_SEP + ICON_WIDTH);
int y = ICON_SEP;
for(int j = 0; j < column.length; j++) {
AbstractTool tool = column[j];
if (tool == listener.toolPressed && listener.inTool) {
g.setColor(Color.darkGray);
g.fillRect(x, y, ICON_WIDTH, ICON_HEIGHT);
}
Icon icon = tool.getIcon();
if (icon != null) icon.paintIcon(this, g, x, y);
if (tool == current) {
GraphicsUtil.switchToWidth(g, 2);
g.setColor(Color.black);
g.drawRect(x - 1, y - 1, ICON_WIDTH + 2, ICON_HEIGHT + 2);
}
y += ICON_HEIGHT + ICON_SEP;
}
}
g.setColor(Color.black);
GraphicsUtil.switchToWidth(g, 1);
}
示例9: AppearanceCanvas
import com.cburch.draw.canvas.CanvasTool; //导入依赖的package包/类
public AppearanceCanvas(CanvasTool selectTool) {
this.selectTool = selectTool;
this.grid = new GridPainter(this);
this.listener = new Listener();
this.oldPreferredSize = null;
setSelection(new AppearanceSelection());
setTool(selectTool);
CanvasModel model = super.getModel();
if (model != null) model.addCanvasModelListener(listener);
grid.addPropertyChangeListener(GridPainter.ZOOM_PROPERTY, listener);
}
示例10: setTool
import com.cburch.draw.canvas.CanvasTool; //导入依赖的package包/类
@Override
public void setTool(CanvasTool value) {
hidePopup();
super.setTool(value);
}