当前位置: 首页>>代码示例>>Java>>正文


Java CanvasTool类代码示例

本文整理汇总了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);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:19,代码来源:AppearanceCanvas.java

示例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);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:34,代码来源:Toolbar.java

示例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);
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:11,代码来源:AppearanceCanvas.java

示例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);
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:11,代码来源:AppearanceCanvas.java

示例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);
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:29,代码来源:Toolbar.java

示例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);
		}
	}
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:10,代码来源:AppearanceCanvas.java

示例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);
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:14,代码来源:AppearanceCanvas.java

示例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);
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:28,代码来源:Toolbar.java

示例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);
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:13,代码来源:AppearanceCanvas.java

示例10: setTool

import com.cburch.draw.canvas.CanvasTool; //导入依赖的package包/类
@Override
public void setTool(CanvasTool value) {
	hidePopup();
	super.setTool(value);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:6,代码来源:AppearanceCanvas.java


注:本文中的com.cburch.draw.canvas.CanvasTool类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。