Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Font


     
      t.setText("Sample Text");
        t.setFont(SWTResourceManager.getFont("Courier New", 8, SWT.NORMAL));
        t.setForeground(new Color(d, this.foreGround));
       
        t.setFont(new Font(d, this.fontData));
        t.setForeground(new Color(d, this.foreGround));
       
      GridData gd_t = new GridData(SWT.FILL, SWT.FILL, false, false, 10, 1);
      gd_t.heightHint = 74;
      t.setLayoutData(gd_t);
      new Label(s, SWT.NONE);
      final Button btnChange = new Button(s, SWT.PUSH | SWT.BORDER);
      btnChange.setText("Change Font");
      btnChange.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          FontDialog fd = new FontDialog(s, SWT.NONE);
          fd.setText("Select Font");
          fd.setRGB(t.getForeground().getRGB());
          fd.setFontList(t.getFont().getFontData());

           FontData newFont = fd.open();
          if(newFont==null)
              return;
          t.setFont(new Font(d, newFont));
          t.setForeground(new Color(d, fd.getRGB()));
         
        }
      });
     
      Button btnSave = new Button(s, SWT.NONE);
      btnSave.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
           saveFontData(t.getFont().getFontData()[0],t.getForeground().getRGB());
           s.dispose();
        }
      });
      btnSave.setText("Save");
     
      Button btnReset = new Button(s, SWT.NONE);
      btnReset.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            t.setFont(new Font(d, fontData));
            t.setForeground(new Color(d, aktForeGround));
        }
      });
      btnReset.setText("Reset");
     
View Full Code Here


                e.printStackTrace();
            }
            g.fillRectangle(x1, c.getBounds().height
                    - height, width, c.getBounds().height);
            g.setBackground(disp.getSystemColor(SWT.COLOR_WHITE));
            Font f = new Font(disp, "Arial", 14, SWT.NORMAL);
            g.setFont(f);
            if (i < maxLbl) {
                if (g.getFontMetrics().getHeight() < width
                        && c.getBounds().height
                           > g.getFontMetrics().getAverageCharWidth()
                                * binLabels[i].length()) {
                    Transform tr = new Transform(disp);
                    tr.rotate(-90.0f);
                    g.setTransform(tr);
                    Path p = new Path(disp);
                    p.addString(binLabels[i], -c.getBounds().height + 5,
                            x1 + (int) (0.5 * width) - 10, f);
                    g.fillPath(p);
                    tr.rotate(90.0f);
                    g.setTransform(tr);
                    tr.dispose();
                    p.dispose();
                }
                f.dispose();
            }
        }
        g.setForeground(disp.getSystemColor(SWT.COLOR_WHITE));
        if (title != null) {
            g.drawString(title, 2, 20);
View Full Code Here

                e.printStackTrace();
            }
            g.fillRectangle(x1, c.getBounds().height
                    - height, width, c.getBounds().height);
            g.setBackground(disp.getSystemColor(SWT.COLOR_WHITE));
            Font f = new Font(disp, "Arial", 14, SWT.NORMAL);
            g.setFont(f);
            if (i < maxLbl) {
                if (g.getFontMetrics().getHeight() < width
                        && c.getBounds().height
                           > g.getFontMetrics().getAverageCharWidth()
                                * binLabels[i].length()) {
                    Transform tr = new Transform(disp);
                    tr.rotate(-90.0f);
                    g.setTransform(tr);
                    Path p = new Path(disp);
                    p.addString(binLabels[i], -c.getBounds().height + 5,
                            x1 + (int) (0.5 * width) - 10, f);
                    g.fillPath(p);
                    tr.rotate(90.0f);
                    g.setTransform(tr);
                    tr.dispose();
                    p.dispose();
                }
                f.dispose();
            }
        }
        g.setForeground(disp.getSystemColor(SWT.COLOR_WHITE));
        if (title != null) {
            g.drawString(title, 2, 20);
View Full Code Here

    }
   
    public void paintLabels(Labeling labeling, GC gc) {
        Device device = gc.getDevice();
        String fname = ARIAL_NARROW;
        Font basefont = new Font(device, fname, 12, SWT.NORMAL);
       
        for (Label each: labeling.labels()) {
            FontData[] fontData = basefont.getFontData();
           
            each.render(gc, fontData);
        }
       
        basefont.dispose();
    }
View Full Code Here

    new FontInstruction( null );
  }

  @Test
  public void testHasFont() {
    Font font = display.getSystemFont();
    FontInstruction instruction = new FontInstruction( font );

    Font actualFont = instruction.getFont();

    assertSame( font, actualFont );
  }
View Full Code Here

    resource.bindTo( widgets );
  }

  @Test
  public void testAppliesFont() {
    Font font = FontDescriptor.createFrom( shell.getDisplay().getSystemFont() ).setHeight( 44 ).createFont( shell.getDisplay() );
    Rule rule = PassePartout.when( new AlwaysTrueContidtion() ).then( new FontInstruction( font ) );
    ResourceImpl resource = new ResourceImpl( rule );

    resource.bindTo( shell );
View Full Code Here

    return true;
  }
   
    private void createScriptFileEditor(Composite parent) {
        Font font = parent.getFont();
        Group group = new Group(parent, SWT.NONE);
        group.setText("File to e&xecute:");
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        group.setLayoutData(gd);
        GridLayout layout = new GridLayout();
View Full Code Here

  private Text customBrowserPath;
  private Button customBrowserBrowse;

  public void createControl(Composite parent)
  {
        Font font = parent.getFont();

        Composite comp = new Composite(parent, SWT.NONE);
        setControl(comp);

        GridLayout topLayout = new GridLayout();
View Full Code Here

  }

  protected void createCustomBrowserPathPart(Composite mainComposite)
  {
    Font font = mainComposite.getFont();

    // vertical space
    new Label(mainComposite, SWT.NULL);

    Composite bPathComposite = new Composite(mainComposite, SWT.NULL);
View Full Code Here

  private DirectoryFieldEditor fHTMLRootDir;
  private FileFieldEditor fHTMLRootFile;

  public void createControl(Composite parent)
  {
        Font font = parent.getFont();

        Composite comp = new Composite(parent, SWT.NONE);
        setControl(comp);

        GridLayout topLayout = new GridLayout();
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.Font

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.