Java Code Examples for org.eclipse.swt.SWT#BOLD
The following examples show how to use
org.eclipse.swt.SWT#BOLD .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractPydevPrefs.java From Pydev with Eclipse Public License 1.0 | 6 votes |
protected void handleAppearanceColorListSelection() { int i = fAppearanceColorList.getSelectionIndex(); String key = fAppearanceColorListModel[i][1]; RGB rgb = PreferenceConverter.getColor(fOverlayStore, key); fAppearanceColorEditor.setColorValue(rgb); String styleKey = fAppearanceFontListModel[i][1]; int styleValue = fOverlayStore.getInt(styleKey); if ((styleValue & SWT.BOLD) == 0) { fFontBoldCheckBox.setSelection(false); } else { fFontBoldCheckBox.setSelection(true); } if ((styleValue & SWT.ITALIC) == 0) { fFontItalicCheckBox.setSelection(false); } else { fFontItalicCheckBox.setSelection(true); } updateAppearanceColorWidgets(fAppearanceColorListModel[i][2]); }
Example 2
Source File: PTFontEditor.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * @see org.eclipse.nebula.widgets.opal.propertytable.editor.PTChooserEditor#getTextFor(org.eclipse.nebula.widgets.opal.propertytable.PTProperty) */ @Override protected String getTextFor(final PTProperty property) { if (property.getValue() == null) { return ""; } final FontData fontData = (FontData) property.getValue(); final StringBuilder sb = new StringBuilder(); if (fontData != null) { sb.append(fontData.getName()).append(",").append(fontData.getHeight()).append(" pt"); if ((fontData.getStyle() & SWT.BOLD) == SWT.BOLD) { sb.append(", ").append(ResourceManager.getLabel(ResourceManager.BOLD)); } if ((fontData.getStyle() & SWT.ITALIC) == SWT.ITALIC) { sb.append(", ").append(ResourceManager.getLabel(ResourceManager.ITALIC)); } } return sb.toString(); }
Example 3
Source File: BoundaryTimerEventLabel2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void refreshFont() { FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); if (style != null) { FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } }
Example 4
Source File: StartEventLabelEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void refreshFont() { FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); if (style != null) { FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } }
Example 5
Source File: ThrowLinkEventLabel2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void refreshFont() { FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); if (style != null) { FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } }
Example 6
Source File: GridColumnGroup_Test.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Test( expected = IllegalArgumentException.class ) public void testSetHeaderFont_DisposedFont() { Font font = new Font( display, "Arial", 20, SWT.BOLD ); font.dispose(); group.setHeaderFont( font ); }
Example 7
Source File: SyntaxHighlighter.java From textuml with Eclipse Public License 1.0 | 5 votes |
protected void initialize(String[] keywords) { ColorRegistry registry = JFaceResources.getColorRegistry(); IToken keyword = new Token(new TextAttribute(registry.get(KEYWORD_COLOR), null, SWT.BOLD)); IToken string = new Token(new TextAttribute(registry.get(STRING_COLOR))); IToken number = new Token(new TextAttribute(registry.get(NUMBER_COLOR))); IToken annotation = new Token(new TextAttribute(registry.get(ANNOTATION_COLOR))); IToken defaultToken = new Token(new TextAttribute(registry.get(DEFAULT_COLOR))); List<IRule> rules = new ArrayList<IRule>(); // strings rules.add(new SingleLineRule("\"", "\"", string, '\\')); // annotations rules.add(new MultiLineRule("[", "]", annotation)); // numbers rules.add(new NumberRule(number)); // keywords and normal (default) text WordRule wordRule = new WordRule(new WordDetector(), defaultToken); for (int i = 0; i < keywords.length; i++) { wordRule.addWord(keywords[i], keyword); } rules.add(wordRule); setRules(rules.toArray(new IRule[rules.size()])); }
Example 8
Source File: SwtDisplayServer.java From birt with Eclipse Public License 1.0 | 5 votes |
public Object createFont( FontDefinition fd ) { int iStyle = 0; if ( fd.isBold( ) ) { iStyle |= SWT.BOLD; } if ( fd.isItalic( ) ) { iStyle |= SWT.ITALIC; } return new Font( _d, fd.getName( ), (int) Math.round( ( fd.getSize( ) ) * dScale ), iStyle ); }
Example 9
Source File: WrappingLabel2EditPart.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * @generated */ protected void refreshFont() { FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); if (style != null) { FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } }
Example 10
Source File: SeparatorPanel.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public void initComponents(String label) { GridLayout gridLayout = new GridLayout(2, false); setLayout(gridLayout); GridData layoutData = new GridData(); layoutData.grabExcessHorizontalSpace = true; layoutData.horizontalAlignment = GridData.FILL; setLayoutData(layoutData); // Text label StyledText gridLinesLabel = new StyledText(this, SWT.NONE); gridLinesLabel.setEditable(false); Display display = Display.getDefault(); FontData data = display .getSystemFont().getFontData()[0]; Font font = new Font(display, data.getName(), data.getHeight(), SWT.BOLD); gridLinesLabel.setFont(font); gridLinesLabel.setBackground(Display.getCurrent().getSystemColor (SWT.COLOR_WIDGET_BACKGROUND)); gridLinesLabel.setText(label); // Separator line Label separator = new Label (this, SWT.SEPARATOR | SWT.HORIZONTAL); GridData separatorData = new GridData(); separatorData.grabExcessHorizontalSpace = true; separatorData.horizontalAlignment = GridData.FILL; separatorData.horizontalIndent = 5; separator.setLayoutData(separatorData); }
Example 11
Source File: IntermediateThrowMessageEventLabel2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void refreshFont() { FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); if (style != null) { FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } }
Example 12
Source File: SemanticHighlightingManager.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Initialize semantic highlightings. */ private void initializeHighlightings() { fSemanticHighlightings= SemanticHighlightings.getSemanticHighlightings(); fHighlightings= new Highlighting[fSemanticHighlightings.length]; for (int i= 0, n= fSemanticHighlightings.length; i < n; i++) { SemanticHighlighting semanticHighlighting= fSemanticHighlightings[i]; String colorKey= SemanticHighlightings.getColorPreferenceKey(semanticHighlighting); addColor(colorKey); String boldKey= SemanticHighlightings.getBoldPreferenceKey(semanticHighlighting); int style= fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL; String italicKey= SemanticHighlightings.getItalicPreferenceKey(semanticHighlighting); if (fPreferenceStore.getBoolean(italicKey)) style |= SWT.ITALIC; String strikethroughKey= SemanticHighlightings.getStrikethroughPreferenceKey(semanticHighlighting); if (fPreferenceStore.getBoolean(strikethroughKey)) style |= TextAttribute.STRIKETHROUGH; String underlineKey= SemanticHighlightings.getUnderlinePreferenceKey(semanticHighlighting); if (fPreferenceStore.getBoolean(underlineKey)) style |= TextAttribute.UNDERLINE; boolean isEnabled= fPreferenceStore.getBoolean(SemanticHighlightings.getEnabledPreferenceKey(semanticHighlighting)); fHighlightings[i]= new Highlighting(new TextAttribute(fColorManager.getColor(PreferenceConverter.getColor(fPreferenceStore, colorKey)), null, style), isEnabled); } }
Example 13
Source File: CallActivityNameEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void refreshFont() { FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); if (style != null) { FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } }
Example 14
Source File: ParameterNameValueEditPart.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * @generated */ protected void refreshFont() { FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); if (style != null) { FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } }
Example 15
Source File: StartErrorEventLabelEditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * @generated */ protected void refreshFont() { FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); if (style != null) { FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } }
Example 16
Source File: SWTBoldStyler.java From saros with GNU General Public License v2.0 | 5 votes |
private SWTBoldStyler() { super(); int defHeight = (int) JFaceResources.getFontRegistry().defaultFont().getFontData()[0].height; // Create the font data so that it becomes bold. FontData fontData = new FontData(SWTBoldStyler.class.getSimpleName(), defHeight, SWT.BOLD); // Put the font in the registry. JFaceResources.getFontRegistry() .put(SWTBoldStyler.class.getSimpleName(), new FontData[] {fontData}); }
Example 17
Source File: DesignerRepresentation.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Show the exception message that prevented to draw the chart * * @param g2d * @param ex * The exception that occured */ private final void showException( GC g2d, Exception ex ) { Point pTLC = new Point( 0, 0 ); // String sWrappedException = ex.getClass( ).getName( ); Throwable th = ex; String sMessage = null; if ( th instanceof BirtException ) { sMessage = ( (BirtException) th ).getLocalizedMessage( ); } else { sMessage = ex.getMessage( ); } if ( sMessage == null ) { sMessage = "<null>"; //$NON-NLS-1$ } // StackTraceElement[] stea = ex.getStackTrace( ); Dimension d = getSize( ); Device dv = Display.getCurrent( ); Font fo = new Font( dv, "Courier", SWT.BOLD, 12 ); //$NON-NLS-1$ g2d.setFont( fo ); FontMetrics fm = g2d.getFontMetrics( ); g2d.setBackground( dv.getSystemColor( SWT.COLOR_WHITE ) ); g2d.fillRectangle( pTLC.x + 20, pTLC.y + 20, d.width - 40, d.height - 40 ); g2d.setForeground( dv.getSystemColor( SWT.COLOR_BLACK ) ); g2d.drawRectangle( pTLC.x + 20, pTLC.y + 20, d.width - 40, d.height - 40 ); Region rgPrev = new Region( ); g2d.getClipping( rgPrev ); g2d.setClipping( pTLC.x + 20, pTLC.y + 20, d.width - 40, d.height - 40 ); int x = pTLC.x + 25, y = pTLC.y + 20 + fm.getHeight( ); g2d.setForeground( dv.getSystemColor( SWT.COLOR_BLACK ) ); g2d.drawString( ERROR_MSG, x, y ); y += fm.getHeight( ); g2d.setForeground( dv.getSystemColor( SWT.COLOR_RED ) ); g2d.drawText( sMessage, x, y ); g2d.setClipping( rgPrev ); rgPrev.dispose( ); fo.dispose( ); }
Example 18
Source File: JavaViewer.java From birt with Eclipse Public License 1.0 | 4 votes |
private final void showException( GC g2d, Exception ex ) { String sWrappedException = ex.getClass( ).getName( ); Throwable th = ex; while ( ex.getCause( ) != null ) { ex = (Exception) ex.getCause( ); } String sException = ex.getClass( ).getName( ); if ( sWrappedException.equals( sException ) ) { sWrappedException = null; } String sMessage = null; if ( th instanceof BirtException ) { sMessage = ( (BirtException) th ).getLocalizedMessage( ); } else { sMessage = ex.getMessage( ); } if ( sMessage == null ) { sMessage = "<null>";//$NON-NLS-1$ } StackTraceElement[] stea = ex.getStackTrace( ); Point d = this.getSize( ); Device dv = Display.getCurrent( ); Font fo = new Font( dv, "Courier", SWT.BOLD, 16 );//$NON-NLS-1$ g2d.setFont( fo ); FontMetrics fm = g2d.getFontMetrics( ); g2d.setBackground( dv.getSystemColor( SWT.COLOR_WHITE ) ); g2d.fillRectangle( 20, 20, d.x - 40, d.y - 40 ); g2d.setForeground( dv.getSystemColor( SWT.COLOR_BLACK ) ); g2d.drawRectangle( 20, 20, d.x - 40, d.y - 40 ); g2d.setClipping( 20, 20, d.x - 40, d.y - 40 ); int x = 25, y = 20 + fm.getHeight( ); g2d.drawString( "Exception:", x, y );//$NON-NLS-1$ x += g2d.textExtent( "Exception:" ).x + 5;//$NON-NLS-1$ g2d.setForeground( dv.getSystemColor( SWT.COLOR_RED ) ); g2d.drawString( sException, x, y ); x = 25; y += fm.getHeight( ); if ( sWrappedException != null ) { g2d.setForeground( dv.getSystemColor( SWT.COLOR_BLACK ) ); g2d.drawString( "Wrapped In:", x, y );//$NON-NLS-1$ x += g2d.textExtent( "Wrapped In:" ).x + 5;//$NON-NLS-1$ g2d.setForeground( dv.getSystemColor( SWT.COLOR_RED ) ); g2d.drawString( sWrappedException, x, y ); x = 25; y += fm.getHeight( ); } g2d.setForeground( dv.getSystemColor( SWT.COLOR_BLACK ) ); y += 10; g2d.drawString( "Message:", x, y );//$NON-NLS-1$ x += g2d.textExtent( "Message:" ).x + 5;//$NON-NLS-1$ g2d.setForeground( dv.getSystemColor( SWT.COLOR_BLUE ) ); g2d.drawString( sMessage, x, y ); x = 25; y += fm.getHeight( ); g2d.setForeground( dv.getSystemColor( SWT.COLOR_BLACK ) ); y += 10; g2d.drawString( "Trace:", x, y );//$NON-NLS-1$ x = 40; y += fm.getHeight( ); g2d.setForeground( dv.getSystemColor( SWT.COLOR_DARK_GREEN ) ); for ( int i = 0; i < stea.length; i++ ) { g2d.drawString( stea[i].getClassName( ) + ":"//$NON-NLS-1$ + stea[i].getMethodName( ) + "(...):"//$NON-NLS-1$ + stea[i].getLineNumber( ), x, y ); x = 40; y += fm.getHeight( ); } fo.dispose( ); }
Example 19
Source File: DualListSnippet.java From nebula with Eclipse Public License 2.0 | 4 votes |
private static List<DLItem> createItems(final Shell shell) { final List<DLItem> list = new ArrayList<>(); String defaultFontName = null; int defaultHeight = -1; for (final FontData fontData : shell.getFont().getFontData()) { if (defaultFontName == null) { defaultFontName = fontData.getName(); } if (defaultHeight == -1) { defaultHeight = fontData.getHeight(); } } final Font font = new Font(shell.getDisplay(), defaultFontName, defaultHeight, SWT.BOLD); list.add(new DLItem("Austria", createImage(shell, "austria"))); list.add(new DLItem("Belgium", createImage(shell, "belgium"))); list.add(new DLItem("Bulgaria", createImage(shell, "bulgaria"))); list.add(new DLItem("Cyprus", createImage(shell, "cyprus"))); list.add(new DLItem("Czech Republic", createImage(shell, "czech"))); list.add(new DLItem("Denmark", createImage(shell, "denmark"))); list.add(new DLItem("Estonia", createImage(shell, "estonia"))); list.add(new DLItem("Finland", createImage(shell, "finland"))); list.add(new DLItem("France", createImage(shell, "france"), font)); list.add(new DLItem("Germany", createImage(shell, "germany"))); list.add(new DLItem("Greece", createImage(shell, "greece"))); list.add(new DLItem("Hungary", createImage(shell, "hungary"))); list.add(new DLItem("Ireland", createImage(shell, "ireland"))); list.add(new DLItem("Italy", createImage(shell, "italy"))); list.add(new DLItem("Latvia", createImage(shell, "latvia"))); list.add(new DLItem("Lithuania", createImage(shell, "lithuania"))); list.add(new DLItem("Luxembourg", createImage(shell, "luxembourg"))); list.add(new DLItem("Malta", createImage(shell, "malta"))); list.add(new DLItem("Netherlands", createImage(shell, "netherlands"))); list.add(new DLItem("Poland", createImage(shell, "poland"), shell.getDisplay().getSystemColor(SWT.COLOR_WHITE), shell.getDisplay().getSystemColor(SWT.COLOR_RED))); list.add(new DLItem("Portugal", createImage(shell, "portugal"))); list.add(new DLItem("Romania", createImage(shell, "romania"))); list.add(new DLItem("Slovakia", createImage(shell, "slovakia"))); list.add(new DLItem("Slovenia", createImage(shell, "slovenia"))); list.add(new DLItem("Spain", createImage(shell, "spain"))); list.add(new DLItem("Sweden", createImage(shell, "sweden"))); list.add(new DLItem("United Kingdom", createImage(shell, "unitedkingdom"))); shell.addDisposeListener(e -> { font.dispose(); }); return list; }
Example 20
Source File: SWTFont.java From tuxguitar with GNU Lesser General Public License v2.1 | 4 votes |
public boolean isBold() { FontData[] fd = this.getControl().getFontData(); return ( fd != null && fd.length > 0 ? ((fd[0].getStyle() & SWT.BOLD) != 0) : false ); }