📄 dashdotlineborder.java
字号:
/*******************************************************************************
* $Header: /cvsroot/EOS6/work_dir/niegy/com.primeton.studio.gef.ui/src/com/primeton/studio/gef/ui/figure/DashdotLineBorder.java,v 1.1 2006/12/08 07:04:32 niegy Exp $
* $Revision: 1.1 $
* $Date: 2006/12/08 07:04:32 $
*
*==============================================================================
*
* Copyright (c) 2001-2006 Primeton Technologies, Ltd.
* All rights reserved.
*
* Created on 2006-12-6
*******************************************************************************/
package com.primeton.studio.gef.ui.figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.swt.graphics.Color;
/**
* TODO 此处填写 class 信息
*
* @author niegy (mailto:niegy@primeton.com)
*/
/*
* 修改历史
* $Log: DashdotLineBorder.java,v $
* Revision 1.1 2006/12/08 07:04:32 niegy
* 重构代码
*
*/
public class DashdotLineBorder extends LineBorder {
private int roundedWidth, roundedHeight;
/**
* @param color
* @param width
*/
public DashdotLineBorder(Color color, int width) {
super(color, width);
this.roundedWidth = 20;
this.roundedHeight = 20;
}
public DashdotLineBorder(Color color) {
this(color, 1);
}
/**
* @param color
*/
public DashdotLineBorder(Color color, int roundedWidth, int roundedHeight) {
super(color);
this.roundedWidth = roundedWidth;
this.roundedHeight = roundedHeight;
}
/**
* @param width
*/
public DashdotLineBorder(int width) {
this(null, width);
}
/**
*
*/
public DashdotLineBorder() {
this(null, 1);
}
public void paint(IFigure figure, Graphics graphics, Insets insets) {
tempRect.setBounds(getPaintRectangle(figure, insets));
if (getWidth() % 2 == 1) {
tempRect.width--;
tempRect.height--;
}
tempRect.shrink(getWidth() / 2, getWidth() / 2);
graphics.setLineWidth(getWidth());
if (getColor() != null)
graphics.setForegroundColor(getColor());
graphics.setLineStyle(Graphics.LINE_DOT);
graphics.drawRectangle(tempRect);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -