org.eclipse.swt.widgets.Canvas.getFont()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(214)

本文整理了Java中org.eclipse.swt.widgets.Canvas.getFont()方法的一些代码示例,展示了Canvas.getFont()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Canvas.getFont()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Canvas
类名称:Canvas
方法名:getFont

Canvas.getFont介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

  1. /**
  2. * Returns the font that the receiver will use to paint textual information.
  3. *
  4. * @return the receiver's font
  5. *
  6. * @exception SWTException <ul>
  7. * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  8. * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  9. * </ul>
  10. */
  11. public Font getFont () {
  12. checkWidget();
  13. if (font != null) return font;
  14. return parent.getFont ();
  15. }

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

  1. /**
  2. * Returns the font that the receiver will use to paint textual information.
  3. *
  4. * @return the receiver's font
  5. *
  6. * @exception SWTException <ul>
  7. * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  8. * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  9. * </ul>
  10. */
  11. public Font getFont () {
  12. checkWidget();
  13. if (font != null) return font;
  14. return parent.getFont ();
  15. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

  1. /**
  2. * Returns the font that the receiver will use to paint textual information.
  3. *
  4. * @return the receiver's font
  5. *
  6. * @exception SWTException <ul>
  7. * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  8. * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  9. * </ul>
  10. */
  11. public Font getFont () {
  12. checkWidget();
  13. if (font != null) return font;
  14. return parent.getFont ();
  15. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

  1. /**
  2. * Returns the font that the receiver will use to paint textual information.
  3. *
  4. * @return the receiver's font
  5. *
  6. * @exception SWTException <ul>
  7. * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
  8. * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  9. * </ul>
  10. */
  11. public Font getFont () {
  12. checkWidget();
  13. if (font != null) return font;
  14. return parent.getFont ();
  15. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

  1. /**
  2. * Computes the indentations for the given font and stores them in
  3. * <code>fIndentation</code>.
  4. */
  5. protected void computeIndentations() {
  6. if (fCanvas == null || fCanvas.isDisposed())
  7. return;
  8. GC gc= new GC(fCanvas);
  9. try {
  10. gc.setFont(fCanvas.getFont());
  11. fIndentation= new int[fCachedNumberOfDigits + 1];
  12. char[] nines= new char[fCachedNumberOfDigits];
  13. Arrays.fill(nines, '9');
  14. String nineString= new String(nines);
  15. Point p= gc.stringExtent(nineString);
  16. fIndentation[0]= p.x;
  17. for (int i= 1; i <= fCachedNumberOfDigits; i++) {
  18. p= gc.stringExtent(nineString.substring(0, i));
  19. fIndentation[i]= fIndentation[0] - p.x;
  20. }
  21. } finally {
  22. gc.dispose();
  23. }
  24. }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

  1. /**
  2. * Computes the indentations for the given font and stores them in
  3. * <code>fIndentation</code>.
  4. */
  5. protected void computeIndentations() {
  6. if (fCanvas == null || fCanvas.isDisposed())
  7. return;
  8. GC gc= new GC(fCanvas);
  9. try {
  10. gc.setFont(fCanvas.getFont());
  11. fIndentation= new int[fCachedNumberOfDigits + 1];
  12. char[] nines= new char[fCachedNumberOfDigits];
  13. Arrays.fill(nines, '9');
  14. String nineString= new String(nines);
  15. Point p= gc.stringExtent(nineString);
  16. fIndentation[0]= p.x;
  17. for (int i= 1; i <= fCachedNumberOfDigits; i++) {
  18. p= gc.stringExtent(nineString.substring(0, i));
  19. fIndentation[i]= fIndentation[0] - p.x;
  20. }
  21. } finally {
  22. gc.dispose();
  23. }
  24. }

代码示例来源:origin: BiglySoftware/BiglyBT

  1. SWT.DEFAULT, true, false, 2, 1));
  2. font = FontUtils.getFontPercentOf(peerInfoCanvas.getFont(), 0.7f);

代码示例来源:origin: BiglySoftware/BiglyBT

  1. int iFontWeight = -1;
  2. String sFontFace = null;
  3. FontData[] tempFontData = canvas.getFont().getFontData();
  4. FontData[] fd = canvas.getFont().getFontData();

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

  1. /**
  2. * Sets or clears the caret in the "Example" widget.
  3. */
  4. void setCaret () {
  5. Caret oldCaret = canvas.getCaret ();
  6. if (caretButton.getSelection ()) {
  7. Caret newCaret = new Caret(canvas, SWT.NONE);
  8. Font font = canvas.getFont();
  9. newCaret.setFont(font);
  10. GC gc = new GC(canvas);
  11. gc.setFont(font);
  12. newCaret.setBounds(1, 1, 1, gc.getFontMetrics().getHeight());
  13. gc.dispose();
  14. canvas.setCaret (newCaret);
  15. canvas.setFocus();
  16. } else {
  17. canvas.setCaret (null);
  18. }
  19. if (oldCaret != null) oldCaret.dispose ();
  20. }

代码示例来源:origin: BiglySoftware/BiglyBT

  1. }, new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1));
  2. font = FontUtils.getFontPercentOf(pieceInfoCanvas.getFont(), 0.7f);

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

  1. /**
  2. * Double buffer drawing.
  3. *
  4. * @param dest the GC to draw into
  5. */
  6. private void doubleBufferPaint(GC dest) {
  7. Point size= fCanvas.getSize();
  8. if (size.x <= 0 || size.y <= 0)
  9. return;
  10. if (fBuffer != null) {
  11. Rectangle r= fBuffer.getBounds();
  12. if (r.width != size.x || r.height != size.y) {
  13. fBuffer.dispose();
  14. fBuffer= null;
  15. }
  16. }
  17. if (fBuffer == null)
  18. fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
  19. GC gc= new GC(fBuffer);
  20. gc.setFont(fCanvas.getFont());
  21. try {
  22. gc.setBackground(getBackground());
  23. gc.fillRectangle(0, 0, size.x, size.y);
  24. doPaint(gc);
  25. } finally {
  26. gc.dispose();
  27. }
  28. dest.drawImage(fBuffer, 0, 0);
  29. }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

  1. /**
  2. * Double buffer drawing.
  3. *
  4. * @param dest the GC to draw into
  5. */
  6. private void doubleBufferPaint(GC dest) {
  7. Point size= fCanvas.getSize();
  8. if (size.x <= 0 || size.y <= 0)
  9. return;
  10. if (fBuffer != null) {
  11. Rectangle r= fBuffer.getBounds();
  12. if (r.width != size.x || r.height != size.y) {
  13. fBuffer.dispose();
  14. fBuffer= null;
  15. }
  16. }
  17. if (fBuffer == null)
  18. fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y);
  19. GC gc= new GC(fBuffer);
  20. gc.setFont(fCanvas.getFont());
  21. try {
  22. gc.setBackground(getBackground());
  23. gc.fillRectangle(0, 0, size.x, size.y);
  24. doPaint(gc);
  25. } finally {
  26. gc.dispose();
  27. }
  28. dest.drawImage(fBuffer, 0, 0);
  29. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

  1. Font font= fCanvas.getFont();
  2. if (zoom != 100) {
  3. if (fLastFont != null && font == fLastFont.get()) {
  4. gc.setFont(fCanvas.getFont());
  5. if (fForeground != null)
  6. gc.setForeground(fForeground);

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

  1. gc.setFont(fCanvas.getFont());
  2. if (fForeground != null)
  3. gc.setForeground(fForeground);

代码示例来源:origin: BiglySoftware/BiglyBT

  1. fontHeader = FontUtils.getFontPercentOf(cHeaderArea.getFont(), 0.9f);
  2. fontHeaderSmall = FontUtils.getFontPercentOf(fontHeader, 0.8f);
  3. cHeaderArea.setFont(fontHeader);

代码示例来源:origin: BiglySoftware/BiglyBT

  1. Font font = canvas.getFont();
  2. FontData[] fdata = font.getFontData();
  3. fdata[0].setHeight(Constants.isOSX ? 9 : 7);

相关文章

Canvas类方法