當前位置: 首頁>>代碼示例>>Java>>正文


Java ColorConstants類代碼示例

本文整理匯總了Java中org.eclipse.draw2d.ColorConstants的典型用法代碼示例。如果您正苦於以下問題:Java ColorConstants類的具體用法?Java ColorConstants怎麽用?Java ColorConstants使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ColorConstants類屬於org.eclipse.draw2d包,在下文中一共展示了ColorConstants類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: paintCancel

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
protected void paintCancel(Graphics graphics){
	Rectangle barBounds = getBounds().getCopy();
	barBounds.crop(new Insets(getMargin()));
	if (barBounds.height > getMaxHeight()){
		int dy = (barBounds.height - getMaxHeight())/2;
		barBounds.crop(new Insets(dy,0,dy,0));
	}
	
	Rectangle cancelBounds = barBounds.getCopy();
	cancelBounds.x = cancelBounds.right() - getCancelButtonWidth();
	cancelBounds.width = getCancelButtonWidth();
	
	Color cancelColor = new Color(null,
			ColorUtils.darker(
					ColorUtils.darker(
							graphics.getBackgroundColor().getRGB())));
	graphics.setBackgroundColor(cancelColor);
	int radius = Math.min(15, cancelBounds.height);
	graphics.fillRoundRectangle(cancelBounds, radius, radius);
	graphics.drawRoundRectangle(cancelBounds, radius, radius);
	graphics.setForegroundColor(ColorConstants.white);
	paintString(graphics, "Cancel", cancelBounds);
	cancelColor.dispose();
}
 
開發者ID:ShoukriKattan,項目名稱:ForgedUI-Eclipse,代碼行數:25,代碼來源:SearchBarFigure.java

示例2: paintFigure

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
/**
 * @see nexcore.tool.uml.ui.core.diagram.figure.AbstractNotationNodeFigure#paintFigure(org.eclipse.draw2d.Graphics)
 */
@Override
protected void paintFigure(Graphics graphics) {
    
    super.paintFigure(graphics);
    graphics.drawRectangle(getLocation().x, getLocation().y, getSize().width - 1, getSize().height - 1);

    graphics.setAntialias(SWT.ON);
    
    Rectangle bounds = getBounds();
    if(isDangling()){
        graphics.setForegroundColor(ColorConstants.red);
        graphics.drawOval(bounds.x, bounds.y, 12, 12);
        graphics.drawLine(bounds.x + 2, bounds.y + 2, bounds.x + 10, bounds.y + 10);
        graphics.drawLine(bounds.x + 10, bounds.y + 2, bounds.x + 2, bounds.y + 10);
    }
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:20,代碼來源:DataTypeFigure.java

示例3: paintFigure

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
/**
 * @see Figure#paintFigure(Graphics)
 */
protected void paintFigure(Graphics graphics) {
    if (isOpaque())
        super.paintFigure(graphics);
    Rectangle bounds = getBounds();
    graphics.translate(bounds.x, bounds.y);
    if (icon != null)
        graphics.drawImage(icon, getIconLocation());
    if (!isEnabled()) {
        graphics.translate(1, 1);
        graphics.setForegroundColor(ColorConstants.buttonLightest);
        graphics.drawText(getSubStringText(), getTextLocation());
        graphics.translate(-1, -1);
        graphics.setForegroundColor(ColorConstants.buttonDarker);
    }
    graphics.drawText(getSubStringText(), getTextLocation());
    graphics.translate(-bounds.x, -bounds.y);
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:21,代碼來源:CollapsedLabel.java

示例4: configureGraphicalViewer

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
@Override
protected void configureGraphicalViewer() {
	super.configureGraphicalViewer();
	getGraphicalViewer().getControl().setBackground(ColorConstants.button);

	GraphicalViewer graphicalViewer = getGraphicalViewer();
	MainDesignerRootEditPart rootEditPart = new MainDesignerRootEditPart();

	graphicalViewer.setRootEditPart(rootEditPart);
	// set EditPartFactory
	graphicalViewer.setEditPartFactory(new JasperDesignEditPartFactory());

	// set rulers providers
	RulerProvider provider = new ReportRulerProvider(new ReportRuler(true, RulerProvider.UNIT_PIXELS));
	graphicalViewer.setProperty(RulerProvider.PROPERTY_HORIZONTAL_RULER, provider);

	provider = new ReportRulerProvider(new ReportRuler(false, RulerProvider.UNIT_PIXELS));
	graphicalViewer.setProperty(RulerProvider.PROPERTY_VERTICAL_RULER, provider);

	Boolean isRulerVisible = jrContext.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SHOWRULER);

	graphicalViewer.setProperty(RulerProvider.PROPERTY_RULER_VISIBILITY, isRulerVisible);

	createAdditionalActions();
	graphicalViewer.setKeyHandler(new JSSGraphicalViewerKeyHandler(graphicalViewer));
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:27,代碼來源:CrosstabEditor.java

示例5: createMain

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
@Override
protected IFigure createMain ()
{
    final Figure baseFigure = new LayeredPane ();

    final Layer rootFigure = new Layer ();

    this.connLayer = new ConnectionLayer ();
    this.connLayer.setAntialias ( 1 );
    this.connLayer.setConnectionRouter ( ConnectionRouter.NULL );

    baseFigure.add ( this.connLayer );
    baseFigure.add ( rootFigure );

    rootFigure.setLayoutManager ( new BorderLayout () );
    rootFigure.setBackgroundColor ( ColorConstants.white );

    rootFigure.add ( createArrowFigure (), BorderLayout.RIGHT );
    rootFigure.add ( createEntryGrid ( this.connLayer ), BorderLayout.CENTER );

    return baseFigure;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:23,代碼來源:GenericLevelPresets.java

示例6: rebuildFigure

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
@Override
public void rebuildFigure() {
	getDisplay().setForegroundColor(ColorConstants.black);
	add(getDisplay());
	setConstraint(getDisplay(), new Rectangle(10, 10, -1, -1));
	setOpaque(true);
	setVisible(true);
	setForegroundColor(ServiceNode.FONT_COLOR);
	if (node.getType().equalsIgnoreCase(Enums.ServiceTypes.PROVIDED.name()))
		setBackgroundColor(ColorConstants.green);
	else if (node.getType().equalsIgnoreCase(Enums.ServiceTypes.REQUIRED.name()))
		setBackgroundColor(ColorConstants.orange);
	else
		setBackgroundColor(ServiceNode.DEF_COLOR);
	TooltipFigure tooltip = new TooltipFigure();
	tooltip.setMessage("Service");
	setToolTip(tooltip);
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:19,代碼來源:ServiceFigure.java

示例7: EdgeFigure

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
public EdgeFigure() {
	tooltipFigure = new TooltipFigure();
	setToolTip(tooltipFigure);
	
	this.setLineWidth(this.getLineWidth() * 2);
	
	this.setTargetDecoration(new PolylineDecoration());

	label = new Label("e_"+ID.getId());
	label.setOpaque(true);
	label.setBackgroundColor(ColorConstants.buttonLightest);
	label.setBorder(new LineBorder());
 	add(label, new MidpointLocator(this, 0));
	
	guardedFigure = new GuardFigure();
	blockedFigure = new BlockedFigure();
	actionFigure = new ActionFigure ();
	add (actionFigure, new RelativeLocator(label,0.5,1.5));
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:20,代碼來源:EdgeFigure.java

示例8: createFigure

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
@Override
protected IFigure createFigure() {
	final LineLayout layout = new LineLayout();
	layout.setHorizontal(true);
	layout.setMajorAlignment(FlowLayout.ALIGN_TOPLEFT);
	layout.setMinorAlignment(FlowLayout.ALIGN_BOTTOMRIGHT);
	layout.setMinorSpacing(SPACING);
	layout.setMargin(MARGIN);

	FreeformLayer res = new FreeformLayer();
	final Label toolTip = new Label();
	toolTip.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
	toolTip.setBackgroundColor(ColorConstants.tooltipBackground);
	toolTip.setForegroundColor(ColorConstants.tooltipForeground);
	toolTip.setText(getModel().getTimelineWindow().getProvider().getTextAt(getModel().getBranch()));
	res.setToolTip(toolTip);
	res.setLayoutManager(layout);
	return res;
}
 
開發者ID:eclipse,項目名稱:gemoc-studio,代碼行數:20,代碼來源:BranchEditPart.java

示例9: ComponentLabelFigure

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
/**
 * Creates a new LabelFigure with a MarginBorder that is the given size and
 * a FlowPage containing a TextFlow with the style WORD_WRAP_SOFT.
 * 
 * @param borderSize
 *            the size of the MarginBorder
 */
public ComponentLabelFigure(int borderSize) {
	setBorder(new MarginBorder(borderSize));
	flowPage = new FlowPage();

	textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
			ParagraphTextLayout.WORD_WRAP_SOFT));
	

	flowPage.add(textFlow);
	flowPage.setHorizontalAligment(PositionConstants.CENTER);

	setLayoutManager(new StackLayout());
	add(flowPage);
	font = new Font( Display.getDefault(), "Arial", 9,
			SWT.NORMAL );
	setFont(font);
	setForegroundColor(ColorConstants.black);
	
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:27,代碼來源:ComponentLabelFigure.java

示例10: CommentBoxFigure

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
/**
 * Creates a new CommentBoxFigure with a MarginBorder that is the given size and a FlowPage containing a TextFlow
 * with the style WORD_WRAP_SOFT.
 * 
 * @param borderSize
 *            the size of the MarginBorder
 */
public CommentBoxFigure(int borderSize) {
	setBorder(new MarginBorder(5));
	FlowPage flowPage = new FlowPage();

	textFlow = new TextFlow();

	textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_SOFT));

	flowPage.add(textFlow);

	setLayoutManager(new StackLayout());
	add(flowPage);
	font = new Font(Display.getDefault(), "Arial", 9, SWT.NORMAL);
	setFont(font);
	setForegroundColor(ColorConstants.black);
	setOpaque(false);

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:26,代碼來源:CommentBoxFigure.java

示例11: AbstractNodeFigure

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
public AbstractNodeFigure(AbstractNodeElement node,Image icon){
	this.node=node;
	BorderLayout layout=new BorderLayout();
	this.setLayoutManager(layout);
	ImageFigure iconFigure=new ImageFigure(icon);
	this.add(iconFigure,BorderLayout.LEFT);
	this.label=new Label(this.node.getLabel());
	this.label.setForegroundColor(ColorConstants.black);
	this.add(this.label,BorderLayout.CENTER);
	this.setAntialias(SWT.ON);
	RGB rgb=Activator.getPreference().getBorderColor();
	this.setForegroundColor(new Color(null,rgb.red,rgb.green,rgb.blue));
	rgb=Activator.getPreference().getBackgroundColor();
	this.setBackgroundColor(new Color(null,rgb.red,rgb.green,rgb.blue));
	this.setLineWidth(2);
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:17,代碼來源:AbstractNodeFigure.java

示例12: TableFigure

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
public TableFigure() {
	ToolbarLayout layout = new ToolbarLayout();
	setLayoutManager(layout);
	LineBorder lineBorder = new LineBorder(ColorConstants.lightGray, 2);
	setBorder(lineBorder);
	setOpaque(true);
	setBackgroundColor(ColorConstants.white);

	Font font = new Font(null, "宋體", 11, SWT.NORMAL);
	label.setFont(font);
	label.setBorder(new LineBorder(ColorConstants.lightGray));
	label.setIcon(Activator.getImage(Activator.IMAGE_TABLE_16));
	label.setOpaque(true);
	label.setBackgroundColor(ColorConstants.lightBlue);
	label.setForegroundColor(ColorConstants.black);
	add(label);
	add(columnFigure);
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:19,代碼來源:TableFigure.java

示例13: refreshFigure

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
public void refreshFigure(BaseModel model) {
	Image imageBlank = Activator.getImage(Activator.IMAGE_BLANK);
	Column column = (Column) model;
	setForegroundColor(column.isPk() ? ColorConstants.red : ColorConstants.black);
	pkFigure.setImage(column.isPk() ? Activator.getImage(Activator.IMAGE_PK) : imageBlank);
	fkFigure.setImage(column.isFk() ? Activator.getImage(Activator.IMAGE_FK) : imageBlank);
	firstLabel.setText(" " + column.getLabel() + "/" + column.getName() + " ");

	String type = column.getType();
	DbDialect dbDialect = DbDialectManager.getDbDialect(column.getTable().getSchema().getCurrentDbType());
	ColumnType columnType = DbDialectManager.getColumnType(dbDialect, type);
	String length = column.getLength();
	String decimal = column.getDecimalLength();
	if (columnType.isLength() && columnType.isDecimal() && length.length() > 0 && decimal.length() > 0) {
		type += "(" + length + "," + decimal + ")";
	} else if (columnType.isLength() && length.length() > 0 && decimal.length() == 0) {
		type += "(" + length + ")";
	}
	lastLabel.setText(type);
	notNullFigure.setImage(column.isNotNull() ? Activator.getImage(Activator.IMAGE_NOTNULL) : imageBlank);
	uniqueFigure.setImage(column.isUnique() ? Activator.getImage(Activator.IMAGE_UNIQUE) : imageBlank);

}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:24,代碼來源:ColumnFigure.java

示例14: update

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
private void update() {
	removeAll();
	valid = model.isMatrix();
	if(valid) {
		Object[] array = (Object[]) model.getValues();
		for(Object line : array) {
			int len = Array.getLength(line);
			for(int i = 0; i < len; i++) {
				Object e = Array.get(line, i);
				Label label = new Label(e.toString()); // TODO array deepToString
				label.setForegroundColor(ColorConstants.black);
				add(label);
			}
		}
	}
	getLayoutManager().layout(this);
	repaint();
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:19,代碼來源:MatrixWidget.java

示例15: paintFigure

import org.eclipse.draw2d.ColorConstants; //導入依賴的package包/類
@Override
protected void paintFigure(Graphics g) {
	super.paintFigure(g);
	final int LEG = 5;
	Rectangle r = getBounds();
	g.setLineWidth(1);
	g.setForegroundColor(valid ? ColorConstants.black : PandionJConstants.Colors.ERROR);
	
	g.drawLine(r.x, r.y, r.x, r.y+r.height-1);
	g.drawLine(r.x, r.y, r.x+LEG, r.y);
	g.drawLine(r.x, r.y+r.height-1, r.x+LEG, r.y+r.height-1);

	g.drawLine(r.x+r.width-1, r.y, r.x+r.width-1, r.y+r.height);
	g.drawLine(r.x+r.width-1, r.y, r.x+r.width-1-LEG, r.y);
	g.drawLine(r.x+r.width-1, r.y+r.height-1, r.x+r.width-1-LEG, r.y+r.height-1);

	if(!valid) {
		g.setForegroundColor(PandionJConstants.Colors.ERROR);
		String text = "Invalid matrix";
		int textWidth = FigureUtilities.getTextWidth(text, g.getFont());
		Point p = r.getLocation().translate(r.width/2 - textWidth/2, 5);
		g.drawText(text, p);
	}
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:25,代碼來源:MatrixWidget.java


注:本文中的org.eclipse.draw2d.ColorConstants類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。