本文整理汇总了Java中org.eclipse.swt.SWT.NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.NORMAL属性的具体用法?Java SWT.NORMAL怎么用?Java SWT.NORMAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.NORMAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PluginsSWT
public PluginsSWT(Shell shell, List<String> lines) {
super(shell);
this.pluginsBean = new PluginsBean(lines);
target = pluginsBean.getPlugins();
source = Stream.of(Plugin.values())
.filter(p -> ! target.contains(p))
.collect(Collectors.toList());
targetOriginal = target.stream().collect(Collectors.toList());
rowColorTitle = new Color(display, 70, 130, 180);
int color = myOS == OS.Mac ? 249 : 239;
rowColorBack = new Color(display, color, color, color);
rowColorSelection = display.getSystemColor(SWT.COLOR_WHITE);
fontAwesome = loadCustomFont(getFontAwesomeSize());
fontGap = new Font(display, fontName, 4, SWT.NORMAL);
rowTitleFont = new Font(display, fontName, getTopFontSize(), SWT.BOLD);
rowTextFont = new Font(display, fontName, getTopFontSize() - 2, SWT.NORMAL);
styleTitle = new TextStyle(rowTitleFont, rowColorTitle, null);
styleGap = new TextStyle(fontGap, display.getSystemColor(SWT.COLOR_BLACK), null);
styleRow = new TextStyle(rowTextFont, display.getSystemColor(SWT.COLOR_BLACK), null);
styleTitleSelected = new TextStyle(rowTitleFont, rowColorSelection, null);
styleRowSelected = new TextStyle(rowTextFont, rowColorSelection, null);
}
示例2: createTopContent
protected void createTopContent(String title, InputStream imageName) {
Composite top = new Composite(composite, SWT.NONE);
top.setLayout(new GridLayout(2, false));
top.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
top.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
final Image image = new Image(top.getDisplay(), imageName);
Image resized = resizeImage(image, 48, 48);
Label labelImage = new Label(top, SWT.CENTER);
labelImage.setImage(resized);
Label label = new Label(top, SWT.NONE);
label.setText(title);
final Font newFont = new Font(display, fontName, getTitleFontSize(), SWT.NORMAL);
label.setFont(newFont);
label.setBackground(rowColorSelection);
createLineContent();
top.addDisposeListener(e -> {
newFont.dispose();
resized.dispose();
});
}
示例3: ComponentLabelFigure
/**
* 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);
}
示例4: CommentBoxFigure
/**
* 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);
}
示例5: TableFigure
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);
}
示例6: unhighlightAll
/**
* Unhighlights all text in the editor.
*/
private void unhighlightAll() {
for (StyleRange range : sourceViewer.getTextWidget().getStyleRanges()) {
if (range.foreground != inactiveColor) {
range.foreground = inactiveColor;
range.fontStyle = SWT.NORMAL;
sourceViewer.getTextWidget().setStyleRange(range);
}
}
}
示例7: PluginDialog
public PluginDialog(Shell shell) {
super(shell);
this.display = Display.getDefault();
fontName = display.getSystemFont().getFontData()[0].getName();
backColor = new Color(display, 244, 244, 244);
rowColorSelection = display.getSystemColor(SWT.COLOR_WHITE);
titleFont = new Font(display, fontName, getTitleFontSize(), SWT.NORMAL);
topFont = new Font(display, fontName, getTopFontSize(), SWT.NORMAL);
}
示例8: adjustComponentFigure
private void adjustComponentFigure(Component component) {
Font font = new Font( Display.getDefault(), ModelConstants.labelFont, 10,
SWT.NORMAL );
int labelLength = TextUtilities.INSTANCE.getStringExtents(component.getComponentLabel().getLabelContents(), font).width;
if(labelLength >= ModelConstants.compLabelOneLineLengthLimit && component.getSize().height<96 ){
component.setSize(new Dimension(component.getSize().width, component.getSize().height + ModelConstants.componentOneLineLabelMargin));
ComponentLabel componentLabel = component.getComponentLabel();
componentLabel.setSize(new Dimension(componentLabel.getSize().width, componentLabel.getSize().height + ModelConstants.componentOneLineLabelMargin));
component.setComponentLabelMargin(ModelConstants.componentTwoLineLabelMargin);
}
}
示例9: createDialogArea
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(1, false));
container.getShell().setText(getTitle());
SashForm sashForm = new SashForm(container, SWT.VERTICAL);
sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 0, 0));
HydroGroup expressionEditorcomposite = new HydroGroup(sashForm, SWT.NORMAL);
expressionEditorcomposite.setHydroGroupText(Messages.EVALUATE_EXPRESSION_EDITOR_GROUP_HEADER);
GridLayout gd = new GridLayout(1, false);
expressionEditorcomposite.getHydroGroupClientArea().setLayout(gd);
expressionEditor.setParent(expressionEditorcomposite.getHydroGroupClientArea());
expressionEditorcomposite.setLayout(new GridLayout(1, false));
HydroGroup fieldTableComposite = new HydroGroup(sashForm, SWT.NORMAL);
fieldTableComposite.setLayout(new GridLayout(1, false));
fieldTableComposite.setHydroGroupText(Messages.EVALUATE_FIELD_NAMES_GROUP_HEADER);
fieldTableComposite.getHydroGroupClientArea().setLayout(gd);
createSearchTextBox(fieldTableComposite.getHydroGroupClientArea());
evalDialogFieldTable = new EvalDialogFieldTable().createFieldTable(fieldTableComposite.getHydroGroupClientArea(),
(Map<String, Class<?>>) expressionEditor.getData(ExpressionEditorDialog.FIELD_DATA_TYPE_MAP),
(List<FixedWidthGridRow>) expressionEditor.getData(ExpressionEditorDialog.INPUT_FILEDS_SCHEMA_KEY));
HydroGroup errorComposite = new HydroGroup(sashForm, SWT.NORMAL);
errorComposite.setLayout(new GridLayout(1, false));
errorComposite.setHydroGroupText(Messages.EVALUATE_OUTPUT_CONSOLE_GROUP_HEADER);
errorComposite.getHydroGroupClientArea().setLayout(gd);
createOutputConsole(errorComposite.getHydroGroupClientArea());
sashForm.setWeights(new int[] {121, 242, 140});
return container;
}
示例10: extractRules
private IRule[] extractRules() {
IToken comment = new Token(new TextAttribute(new Color(Display.getCurrent(), commentColor), null, SWT.NORMAL));
return new IRule[] {
/* Commentaire multi-ligne */
new PatternRule("/*", "*/", comment, NO_ESCAPE_CHAR, false),
/* Commentaire à la fin d'une ligne */
new EndOfLineRule("//", comment) };
}
示例11: run
public void run() {
if (printer.startJob(getDisk(0).getFilename())) {
clientArea = printer.getClientArea();
dpiY = printer.getDPI().y;
dpiX = printer.getDPI().x;
// Setup 1" margin:
Rectangle trim = printer.computeTrim(0, 0, 0, 0);
clientArea.x = dpiX + trim.x;
clientArea.y = dpiY + trim.y;
clientArea.width -= (clientArea.x + trim.width);
clientArea.height -= (clientArea.y + trim.height);
// Set default values:
y = clientArea.y;
x = clientArea.x;
gc = new GC(printer);
int fontSize = 12;
if (getCurrentFormat() == FormattedDisk.FILE_DISPLAY_NATIVE) {
fontSize = 10;
} else if (getCurrentFormat() == FormattedDisk.FILE_DISPLAY_DETAIL) {
fontSize = 8;
}
normalFont = new Font(printer, new String(), fontSize, SWT.NORMAL);
headerFont = new Font(printer, new String(), fontSize, SWT.BOLD);
for (int i=0; i<getDisks().length; i++) {
FormattedDisk disk = getDisk(i);
filename = disk.getFilename();
fileHeaders = disk.getFileColumnHeaders(getCurrentFormat());
gc.setFont(headerFont);
computeHeaderWidths();
printFileHeaders();
gc.setFont(normalFont);
println(disk.getDiskName());
printFiles(disk, 1);
}
if (y != clientArea.y) { // partial page
printFooter();
printer.endPage();
}
printer.endJob();
}
}
示例12: getStartNodeFont
public static Font getStartNodeFont () {
Font f = new Font(Display.getCurrent(), "Arial", 8, SWT.NORMAL);
return f;
}
示例13: addChild
/**
*
* Add a component to this graph.
*
* @param component
* the component
* @return true, if the component was successfully added, false otherwise
*
*/
public boolean addChild(Component component) {
String compNewName=generateUniqueComponentName(component);
String componentId= generateUniqueComponentId(component);
if(component != null){
if (canAddSubjobToCanvas(component.getComponentName())
&& components.add(component)) {
component.setParent(this);
//Check length and increment height
Font font = new Font( Display.getDefault(), ModelConstants.labelFont, 10,
SWT.NORMAL );
int labelLength = TextUtilities.INSTANCE.getStringExtents(compNewName, font).width;
ComponentLabel componentLabel = component.getComponentLabel();
if(labelLength >= ModelConstants.compLabelOneLineLengthLimit && component.getSize().height<96 && labelLength!=97){
component.setSize(new Dimension(component.getSize().width, component.getSize().height + ModelConstants.componentOneLineLabelMargin));
componentLabel.setSize(new Dimension(componentLabel.getSize().width, componentLabel.getSize().height + ModelConstants.componentOneLineLabelMargin));
component.setComponentLabelMargin(ModelConstants.componentTwoLineLabelMargin);
}
else{
if(labelLength<ModelConstants.compLabelOneLineLengthLimit){
if(!(component.getSize().height>96)){
component.setSize(new Dimension(component.getSize().width,80));
}
else{
component.setSize(new Dimension(component.getSize().width,component.getSize().height));
}
}
}
component.setComponentLabel(compNewName);
component.setComponentId(componentId);
if (component.isNewInstance()) {
component.setNewInstance(false);
}
firePropertyChange(CHILD_ADDED_PROP, null, component);
updateSubjobVersion();
return true;
}
}
return false;
}
示例14: ComponentFigure
/**
* Instantiates a new component figure.
*
* @param portDetails
* the port details
* @param cIconPath
* the canvas icon path
* @param label
* Label to be displayed on component
* @param acronym
* Acronym to be displayed on component
* @param linkedHashMap
* the properties of components
*/
public ComponentFigure(Component component, String cIconPath, String label, String acronym,
LinkedHashMap<String, Object> properties) {
this.canvasIconPath = XMLConfigUtil.CONFIG_FILES_PATH + cIconPath;
this.acronym = acronym;
this.componentProperties = properties;
layout = new XYLayout();
setLayoutManager(layout);
labelFont = new Font(Display.getDefault(), ELTFigureConstants.labelFont, 9, SWT.NORMAL);
int labelLength = TextUtilities.INSTANCE.getStringExtents(label, labelFont).width;
if (labelLength >= ELTFigureConstants.compLabelOneLineLengthLimitForText) {
this.componentLabelMargin = ELTFigureConstants.componentTwoLineLabelMargin;
this.incrementedHeight = true;
} else if (labelLength < ELTFigureConstants.compLabelOneLineLengthLimitForText) {
this.componentLabelMargin = ELTFigureConstants.componentOneLineLabelMargin;
this.incrementedHeight = false;
}
canvasIcon = new Image(null, canvasIconPath);
this.component=component;
connectionAnchors = new HashMap<String, FixedConnectionAnchor>();
inputConnectionAnchors = new ArrayList<FixedConnectionAnchor>();
outputConnectionAnchors = new ArrayList<FixedConnectionAnchor>();
setInitialColor();
setComponentColorAndBorder();
for (PortDetails pDetail : component.getPortDetails()) {
setPortCount(pDetail);
setHeight(totalPortsAtLeftSide, totalPortsAtRightSide);
setWidth(totalPortsAtBottonSide);
}
acronymFont = new Font(Display.getDefault(), ELTFigureConstants.labelFont, 8, SWT.BOLD);
setFont(acronymFont);
setForegroundColor(org.eclipse.draw2d.ColorConstants.black);
componentCanvas = getComponentCanvas();
attachMouseListener();
}
示例15: toAwtFont
/**
* Create an awt font by converting as much information
* as possible from the provided swt <code>FontData</code>.
* <p>Generally speaking, given a font size, an swt font will
* display differently on the screen than the corresponding awt
* one. Because the SWT toolkit use native graphical ressources whenever
* it is possible, this fact is plateform dependent. To address
* this issue, it is possible to enforce the method to return
* an awt font with the same height as the swt one.
*
* @param device The swt device being drawn on (display or gc device).
* @param fontData The swt font to convert.
* @param ensureSameSize A boolean used to enforce the same size
* (in pixels) between the swt font and the newly created awt font.
* @return An awt font converted from the provided swt font.
*/
public static java.awt.Font toAwtFont(Device device, FontData fontData,
boolean ensureSameSize) {
int style;
switch (fontData.getStyle()) {
case SWT.NORMAL:
style = java.awt.Font.PLAIN;
break;
case SWT.ITALIC:
style = java.awt.Font.ITALIC;
break;
case SWT.BOLD:
style = java.awt.Font.BOLD;
break;
default:
style = java.awt.Font.PLAIN;
break;
}
int height = (int) Math.round(fontData.getHeight() * device.getDPI().y
/ 72.0);
// hack to ensure the newly created awt fonts will be rendered with the
// same height as the swt one
if (ensureSameSize) {
GC tmpGC = new GC(device);
Font tmpFont = new Font(device, fontData);
tmpGC.setFont(tmpFont);
JPanel DUMMY_PANEL = new JPanel();
java.awt.Font tmpAwtFont = new java.awt.Font(fontData.getName(),
style, height);
if (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az)
> tmpGC.textExtent(Az).x) {
while (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az)
> tmpGC.textExtent(Az).x) {
height--;
tmpAwtFont = new java.awt.Font(fontData.getName(), style,
height);
}
}
else if (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az)
< tmpGC.textExtent(Az).x) {
while (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az)
< tmpGC.textExtent(Az).x) {
height++;
tmpAwtFont = new java.awt.Font(fontData.getName(), style,
height);
}
}
tmpFont.dispose();
tmpGC.dispose();
}
return new java.awt.Font(fontData.getName(), style, height);
}