public int convertHeightInCharsToPixels(int chars) { if (_fontMetrics == null) return 0; return _fontMetrics.getHeight() * chars; } protected void initializeDialogUnits(Control control)
private int getLabelHeight() { if (_labelVisible && (_label != null) && (!_label.equals("")) && (_fontMetrics != null)) { return _fontMetrics.getHeight(); } return 0; }
/** * Returns the colorized square size. * * @param fontMetrics * @return the colorized square size. */ public static int getSquareSize(FontMetrics fontMetrics) { return fontMetrics.getHeight() - 2 * fontMetrics.getDescent(); }
@Override public void layout(GC gc, int width, Locator locator, Hashtable<String, Object> ResourceTable, boolean selected) { locator.resetCaret(); if (locator.rowHeight==0) { FontMetrics fm = gc.getFontMetrics(); locator.rowHeight = fm.getHeight(); } locator.y += locator.rowHeight; locator.rowHeight = 0; locator.rowCounter++; }
@Override public void layout(GC gc, int width, Locator locator, Hashtable<String, Object> ResourceTable, boolean selected) { locator.resetCaret(); if (locator.rowHeight==0) { FontMetrics fm = gc.getFontMetrics(); locator.rowHeight = fm.getHeight(); } locator.y += locator.rowHeight; locator.rowHeight = 0; locator.rowCounter++; }
int getBandHeight () { if (font == null) return ExpandItem.CHEVRON_SIZE; GC gc = new GC (this); FontMetrics metrics = gc.getFontMetrics (); gc.dispose (); return Math.max (ExpandItem.CHEVRON_SIZE, metrics.getHeight ()); }
int getBandHeight () { if (font == null) return ExpandItem.CHEVRON_SIZE; GC gc = new GC (this); FontMetrics metrics = gc.getFontMetrics (); gc.dispose (); return Math.max (ExpandItem.CHEVRON_SIZE, metrics.getHeight ()); }
int getBandHeight () { if (font == null) return ExpandItem.CHEVRON_SIZE; GC gc = new GC (this); FontMetrics metrics = gc.getFontMetrics (); gc.dispose (); return Math.max (ExpandItem.CHEVRON_SIZE, metrics.getHeight ()); }
@Override public Point computeSizeConstraints(int widthInChars, int heightInChars) { if (fSymbolicFontName == null) return null; GC gc= new GC(fBrowser); Font font= JFaceResources.getFont(fSymbolicFontName); gc.setFont(font); double width= gc.getFontMetrics().getAverageCharacterWidth(); int height= gc.getFontMetrics().getHeight(); gc.dispose(); return new Point((int) (widthInChars * width), heightInChars * height); }
@Override public Point computeSizeConstraints(int widthInChars, int heightInChars) { if (fSymbolicFontName == null) return null; GC gc= new GC(fBrowser); Font font= fSymbolicFontName == null ? JFaceResources.getDialogFont() : JFaceResources.getFont(fSymbolicFontName); gc.setFont(font); int width= gc.getFontMetrics().getAverageCharWidth(); int height= gc.getFontMetrics().getHeight(); gc.dispose(); return new Point(widthInChars * width, heightInChars * height); }
public int getFontHeight() { if (fontHeight == -1) { Font font = getFont(); GC gc = new GC(getDisplay()); gc.setFont(font); FontMetrics fm = gc.getFontMetrics(); fontHeight = fm.getHeight(); gc.dispose(); } return fontHeight; }
public int getFontHeight() { if (fontHeight == -1) { Font font = getFont(); GC gc = new GC(getDisplay()); gc.setFont(font); FontMetrics fm = gc.getFontMetrics(); fontHeight = fm.getHeight(); gc.dispose(); } return fontHeight; }
private void drawText(Graphics graphics) { String[] strings = splitString(getText()); int y = 0; int lineHeight = FigureUtilities.getFontMetrics(getFont()).getHeight(); for (int i = 0; i < strings.length; i++) { graphics.drawText(getSubStringText(strings[i]), 0, y); y += lineHeight; } }
public int getFontBaselineHeight() { if (fontBaselineHeight == -1) { Font font = getFont(); GC gc = new GC(getDisplay()); gc.setFont(font); FontMetrics fm = gc.getFontMetrics(); fontBaselineHeight = fm.getHeight() - fm.getDescent(); gc.dispose(); } return fontBaselineHeight; }
public int getFontHeight() { if (fontHeight == -1) { Control c = getMessageControl(); if (c == null) return 0; GC gc = new GC(c.getDisplay()); gc.setFont(c.getFont()); fontHeight = gc.getFontMetrics().getHeight(); gc.dispose(); } return fontHeight; }
public int getFontHeight() { if (fontHeight == -1) { Control c = getMessageControl(); if (c == null) return 0; GC gc = new GC(c.getDisplay()); gc.setFont(c.getFont()); fontHeight = gc.getFontMetrics().getHeight(); gc.dispose(); } return fontHeight; }
public int getFontBaselineHeight() { if (fontBaselineHeight == -1) { Font font = getFont(); GC gc = new GC(getDisplay()); gc.setFont(font); FontMetrics fm = gc.getFontMetrics(); fontBaselineHeight = fm.getHeight() - fm.getDescent(); gc.dispose(); } return fontBaselineHeight; }
public int getFontBaselineHeight() { if (fontBaselineHeight == -1) { Control c = getMessageControl(); if (c == null) return 0; GC gc = new GC(c.getDisplay()); gc.setFont(c.getFont()); FontMetrics fm = gc.getFontMetrics(); fontBaselineHeight = fm.getHeight() - fm.getDescent(); gc.dispose(); } return fontBaselineHeight; }
public int getFontBaselineHeight() { if (fontBaselineHeight == -1) { Control c = getMessageControl(); if (c == null) return 0; GC gc = new GC(c.getDisplay()); gc.setFont(c.getFont()); FontMetrics fm = gc.getFontMetrics(); fontBaselineHeight = fm.getHeight() - fm.getDescent(); gc.dispose(); } return fontBaselineHeight; }
protected void addEmptyTreeMessage(GC gc) { // here we print a message when the document is empty just to give the // user a visual cue // so that they know how to proceed to edit the blank view gc.setForeground(fTree.getDisplay().getSystemColor(SWT.COLOR_BLACK)); gc.setBackground(fTree.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); gc.drawString(XMLEditorMessages.XMLTreeExtension_3, 10, 10); gc.drawString(XMLEditorMessages.XMLTreeExtension_4, 10, 10 + gc.getFontMetrics().getHeight()); }