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


Java SWTResourceManager.getColor方法代碼示例

本文整理匯總了Java中org.eclipse.wb.swt.SWTResourceManager.getColor方法的典型用法代碼示例。如果您正苦於以下問題:Java SWTResourceManager.getColor方法的具體用法?Java SWTResourceManager.getColor怎麽用?Java SWTResourceManager.getColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.wb.swt.SWTResourceManager的用法示例。


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

示例1: showMark

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
public void showMark() {
	int lineindex = st.getLineAtOffset(st.getCaretOffset());
	int lineoffset = st.getOffsetAtLine(lineindex);
	List<TextRegion> lis = new cheakDocument().splitString(st.getLine(st.getLineAtOffset(st.getCaretOffset())), ' ',
			false, null);
	Iterator<TextRegion> it = lis.iterator();
	StyleRange sr = new StyleRange();
	while (it.hasNext()) {
		TextRegion tr = it.next();
		sr.background = SWTResourceManager.getColor(SWT.COLOR_GREEN);
		sr.start = tr.start + lineoffset;
		sr.length = tr.end - tr.start;
		st.setStyleRange(sr);

	}
}
 
開發者ID:piiiiq,項目名稱:Black,代碼行數:17,代碼來源:blackTextArea.java

示例2: initStyleMaps

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
/**
 * Initialize the map of the styles
 */
private void initStyleMaps() {
	styleMaps = new HashMap<Object, StyleContainer>();
	ovverridenAttributes = new HashSet<String>();
	if (leftStringColor == null) {
		leftStringColor = SWTResourceManager.getColor(42, 96, 213);
	}
	JRStyle defaultValue = getElement().getJasperDesign().getDefaultStyle();
	List<INode> list = getStylesRoot(getElement()).getChildren();
	List<INode> externalList = new ArrayList<INode>();
	for (INode style : list) {
		if (style instanceof MStyle) {
			MStyle element = (MStyle) style;
			styleMaps.put(element.getValue(), new StyleContainer(element));
			if (element.getValue() == defaultValue) defaultStyle = element;
		} else if (style instanceof MStyleTemplate) {
			externalList.add(style);
		}
	}
	recursiveReadStyles(externalList, null,defaultValue);
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:24,代碼來源:StylesListSection.java

示例3: refreshGridLayer

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
/**
 * Updates the {@link GridLayer grid} based on properties set on the {@link #getViewer() graphical viewer}:
 * {@link SnapToGrid#PROPERTY_GRID_VISIBLE}, {@link SnapToGrid#PROPERTY_GRID_SPACING}, and
 * {@link SnapToGrid#PROPERTY_GRID_ORIGIN}.
 * <p>
 * This method is invoked initially when the GridLayer is created, and when any of the above-mentioned properties are
 * changed on the viewer.
 */
protected void refreshGridLayer() {
	if (jConfig != null) {
		boolean visible = jConfig.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SHOWGRID, true);
		GridLayer grid = ((APageFigure) getFigure()).getGrid();
		grid.setOrigin((Point) getViewer().getProperty(SnapToGrid.PROPERTY_GRID_ORIGIN));

		int x = jConfig.getPropertyInteger(RulersGridPreferencePage.P_PAGE_RULERGRID_GRIDSPACEX, 10);
		int y = jConfig.getPropertyInteger(RulersGridPreferencePage.P_PAGE_RULERGRID_GRIDSPACEY, 10);

		grid.setSpacing(new Dimension(x, y));
		grid.setVisible(visible);
		getViewer().setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension(x, y));

		String mcolor = jConfig.getProperty(RulersGridPreferencePage.P_PAGE_GRID_COLOR,
				RulersGridPreferencePage.DEFAULT_GRIDCOLOR);
		Color fg = SWTResourceManager.getColor(StringConverter.asRGB(mcolor));
		grid.setForegroundColor(fg);
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:28,代碼來源:PageEditPart.java

示例4: StyledViewTableLabelProvider

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
public StyledViewTableLabelProvider(String tree) {
	this.stagingTree = tree.equalsIgnoreCase("staging");
	File properties = FileHandler.getBundleFile("/cfg/Default.properties");
	defaultProps = new Properties();
	
	
	hiddenColor = SWTResourceManager.getColor(SWT.COLOR_GRAY);
	activeColor = SWTResourceManager.getColor(SWT.COLOR_BLACK);
	nodeHighlightedColor = SWTResourceManager.getColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
	nodeSearchResultColor = SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION);
	try {
		defaultProps.load(new FileReader(properties));
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
開發者ID:tmfev,項目名稱:IDRT-Import-and-Mapping-Tool,代碼行數:17,代碼來源:StyledViewTableLabelProvider.java

示例5: mouseDoubleClick

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
@Override
public void mouseDoubleClick(MouseEvent e) {
    final TreeItem selection;
    if (tree.getSelectionCount() == 1 && (selection = tree.getSelection()[0]).getData() != null) {
        ColorDialog dlg = new ColorDialog(getShell());
        // Change the title bar text
        dlg.setText(selection.getText(0));
        dlg.setRGB(selection.getParent().getMapInv().get(selection).getBackground(1).getRGB());
        // Open the dialog and retrieve the selected color
        RGB rgb = dlg.open();
        if (rgb != null) {
            GColour refCol = new GColour(-1, rgb.red / 255f, rgb.green / 255f, rgb.blue / 255f, 1f);
            tree.getMapInv().get(selection).setBackground(1, SWTResourceManager.getColor(rgb));
            Object[] colourObj = (Object[]) selection.getData();
            ColourType type = (ColourType) colourObj[0];
            switch (type) {
            case OPENGL_COLOUR:
                ((float[]) ((Object[]) colourObj[1])[0])[0] = refCol.getR();
                ((float[]) ((Object[]) colourObj[1])[1])[0] = refCol.getG();
                ((float[]) ((Object[]) colourObj[1])[2])[0] = refCol.getB();
                break;
            case SWT_COLOUR:
                ((Color[]) colourObj[1])[0] = SWTResourceManager.getColor(rgb) ;
                break;
            default:
                break;
            }

            for (EditorTextWindow w : Project.getOpenTextWindows()) {
                for (CTabItem t : w.getTabFolder().getItems()) {
                    ((CompositeTab) t).updateColours();
                }
            }
            tree.build();
            tree.update();
        }
    }
}
 
開發者ID:nilsschmidt1337,項目名稱:ldparteditor,代碼行數:39,代碼來源:OptionsDesign.java

示例6: getColor

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
private Color getColor(String str, Color def) {
	try {
		return SWTResourceManager.getColor(StringConverter.asRGB(str));
	} catch (Exception e) {
		e.printStackTrace();
		return def;
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:9,代碼來源:MCallout.java

示例7: setPrefsBorder

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
public void setPrefsBorder(IFigure rect) {
	if (pref == null) {
		if (jConfig == null)
			jConfig = ((ANode) getModel()).getJasperConfiguration();
		pref = jConfig.getProperty(DesignerPreferencePage.P_ELEMENT_DESIGN_BORDER_STYLE, RECTANGLE);
		String mcolor = jConfig.getProperty(DesignerPreferencePage.P_ELEMENT_DESIGN_BORDER_COLOR,
				DesignerPreferencePage.DEFAULT_ELEMENT_DESIGN_BORDER_COLOR);
		fg = SWTResourceManager.getColor(StringConverter.asRGB(mcolor));
	}
	if (pref.equals(RECTANGLE)) //$NON-NLS-1$
		rect.setBorder(new ElementLineBorder(fg));
	else
		rect.setBorder(new CornerBorder(fg, 5));
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:15,代碼來源:FigureEditPart.java

示例8: setMarginColor

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
protected void setMarginColor() {
	if (jConfig == null)
		jConfig = getModel().getJasperConfiguration();
	String mcolor = jConfig.getProperty(DesignerPreferencePage.P_CONTAINER_MARGIN_COLOR,
			DesignerPreferencePage.DEFAULT_MARGINCOLOR);
	marginColor = SWTResourceManager.getColor(StringConverter.asRGB(mcolor));
	if (figure != null) {
		setupMarginColor();
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:11,代碼來源:APrefFigureEditPart.java

示例9: toSWTColor

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
public static Color toSWTColor(Element element, String attributeName) {
	Document document = element.getOwnerDocument();
	ViewCSS viewCSS = (ViewCSS) document.getDocumentElement();
	CSSStyleDeclaration computedStyle = viewCSS.getComputedStyle(element, null);
	SVGPaint svgPaint = (SVGPaint) computedStyle.getPropertyCSSValue(attributeName);
	if (svgPaint.getPaintType() == SVGPaint.SVG_PAINTTYPE_RGBCOLOR) {
		RGBColor rgb = svgPaint.getRGBColor();
		float red = rgb.getRed().getFloatValue(CSSValue.CSS_PRIMITIVE_VALUE);
		float green = rgb.getGreen().getFloatValue(CSSValue.CSS_PRIMITIVE_VALUE);
		float blue = rgb.getBlue().getFloatValue(CSSValue.CSS_PRIMITIVE_VALUE);
		return SWTResourceManager.getColor((int) red, (int) green, (int) blue);
	}
	return null;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:15,代碼來源:SVGUtils.java

示例10: initializeColors

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
void initializeColors() {
	tokenColors = new Color[MAXIMUM_TOKEN];
	tokenColors[WORD] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
	tokenColors[WHITESPACE] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
	tokenColors[KEYWORD] = SWTResourceManager.getColor(SWT.COLOR_DARK_RED);
	tokenColors[COMMENT] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
	tokenColors[STRING] = SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE);
	tokenColors[OTHER] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
	tokenColors[NUMBER] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
}
 
開發者ID:DaveVoorhis,項目名稱:Rel,代碼行數:11,代碼來源:RelLineStyler.java

示例11: createColor

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
public static Color createColor(RGB rgb) {
		return SWTResourceManager.getColor(rgb);
//		return resManager.createColor(rgb);
	}
 
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:5,代碼來源:Colors.java

示例12: createContents

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
@Override
protected Control createContents(final Composite parent) {

    final Color bgColor = SWTResourceManager.getColor(SWT.COLOR_WHITE);
    final Composite frame = new Composite(parent, SWT.NONE);
    final FormData titleData = new FormData();
    final FormData statusData = new FormData();
    final FormLayout layout = new FormLayout();
    final Label titleLabel = new Label(frame, SWT.NONE);
    final Label statusLabel = new Label(frame, SWT.NONE);
    final ProgressBar bar = new ProgressBar(frame, SWT.NONE);
    final FormData barData = new FormData();

    bar.setMaximum(100);

    titleLabel.setText(Version.getApplicationName() + " " + Version.getVersion() + "\n" + Version.getStage() + "\n(C) " + Version.getDevelopmentLead()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    titleLabel.setBackground(bgColor);
    bar.setBackground(bgColor);
    statusLabel.setBackground(bgColor);

    frame.setLayout(layout);
    frame.setBackgroundImage(ResourceManager.getImage("imgSplash.png")); //$NON-NLS-1$

    barData.left = new FormAttachment(15, 5);
    barData.right = new FormAttachment(100, -5);
    barData.bottom = new FormAttachment(100, -5);
    bar.setLayoutData(barData);

    titleData.left = new FormAttachment(45, 5);
    titleData.right = new FormAttachment(100, 0);
    titleData.top = new FormAttachment(50, 0);
    titleLabel.setLayoutData(titleData);

    statusData.left = new FormAttachment(15, 5);
    statusData.right = new FormAttachment(100, 0);
    statusData.top = new FormAttachment(80, 0);
    statusLabel.setLayoutData(statusData);

    this.bar = bar;
    this.label = statusLabel;

    return frame;
}
 
開發者ID:nilsschmidt1337,項目名稱:ldparteditor,代碼行數:45,代碼來源:SplashScreen.java

示例13: makeShot

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
private Image makeShot(boolean type) {
	// Hopefully no platform uses exactly this color because we'll make
	// it transparent in the image.
	Display display = Display.getCurrent();
	Color greenScreen = SWTResourceManager.getColor(222, 223, 224);

	Shell shell = new Shell(display.getActiveShell(), SWT.NO_TRIM);

	// otherwise we have a default gray color
	shell.setBackground(greenScreen);

	Button button = new Button(shell, SWT.CHECK);
	button.setBackground(greenScreen);
	button.setSelection(type);

	// otherwise an image is located in a corner
	button.setLocation(1, 1);
	Point bsize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);

	// otherwise an image is stretched by width
	bsize.x = Math.max(bsize.x - 1, bsize.y - 1);
	bsize.y = Math.max(bsize.x - 1, bsize.y - 1);
	button.setSize(bsize);
	shell.setSize(bsize);

	Image image = new Image(display, bsize.x, bsize.y);
	shell.open();
	GC gc = new GC(shell);
	try {
		gc.copyArea(image, 0, 0);
	} finally {
		gc.dispose();
		shell.close();
	}

	ImageData imageData = image.getImageData();
	imageData.transparentPixel = imageData.palette.getPixel(greenScreen.getRGB());
	image.dispose();
	Image resultImage = cache.getImage(imageData);
	return resultImage;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:42,代碼來源:CheckBoxLabelProvider2.java

示例14: setPropertyValue

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
@Override
public void setPropertyValue(Object id, Object value) {
	Object oldValue = getPropertyValue(id);
	if (id.equals(JRDesignElement.PROPERTY_X))
		x = (Integer) value;
	else if (id.equals(JRDesignElement.PROPERTY_Y))
		y = (Integer) value;
	else if (id.equals(JRDesignElement.PROPERTY_WIDTH))
		w = (Integer) value;
	else if (id.equals(JRDesignElement.PROPERTY_HEIGHT))
		h = (Integer) value;
	else if (id.equals(PROP_TEXT))
		text = Misc.nvl(value, "");
	else if (id.equals(PROP_FOREGROUND))
		fg = SWTResourceManager.getColor(AlfaRGB.safeGetRGB((AlfaRGB) value));
	else if (id.equals(PROP_BACKGROUND))
		bg = SWTResourceManager.getColor(AlfaRGB.safeGetRGB((AlfaRGB) value));

	properties = getProperities(getParent());

	properties.setProperty("callouts." + i + ".bounds", x + "," + y + "," + w + "," + h);
	properties.setProperty("callouts." + i + ".text", text);// .replace("\n", "\\n"));
	properties.setProperty("callouts." + i + ".bg", StringConverter.asString(bg.getRGB()));
	properties.setProperty("callouts." + i + ".fg", StringConverter.asString(fg.getRGB()));

	String pins = "";
	List<INode> children = getChildren();
	for (INode ch : children) {
		if (ch instanceof MPin) {
			MPin pin = (MPin) ch;
			if (!pins.isEmpty())
				pins += ";";
			pins += pin.getPropertyValue(JRDesignElement.PROPERTY_X) + ","
					+ pin.getPropertyValue(JRDesignElement.PROPERTY_Y);
		}
	}
	if (!pins.isEmpty()) {
		properties.setProperty("callouts." + i + ".pins", pins);
	}
	else{ 
		properties.remove("callouts." + i + ".pins");
	}
	
	getPropertiesHolder(getParent()).getPropertiesMap().setProperty(PROP_CALLOUT,
			FileUtils.getPropertyAsString(properties).replace("\n", "\\n"));
	
	getPropertyChangeSupport().firePropertyChange((String)id, oldValue, value);
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:49,代碼來源:MCallout.java

示例15: getBorderColor

import org.eclipse.wb.swt.SWTResourceManager; //導入方法依賴的package包/類
@Override
protected Color getBorderColor() {
	if (getOwner() instanceof IPrefEditPart)
		return ((IPrefEditPart) getOwner()).getMarginColor();
	return SWTResourceManager.getColor(IPrefEditPart.DEFAULT_MARGINCOLOR);
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:7,代碼來源:CellResizeHandle2.java


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