Package java.awt

Examples of java.awt.Font.deriveFont()


      else if (textattribute.equals(TextAttribute.WEIGHT))
      {
        final Font font = getFont();
        final Map fontAttributes = font.getAttributes();
        fontAttributes.put(TextAttribute.WEIGHT, iter.getAttributes().get(textattribute));
        setFont(font.deriveFont(fontAttributes));
      }
    }
  }

  public void drawString(final String s, final float x, float y)
View Full Code Here


        public void paintIcon(Component c, Graphics graphics, int x, int y) {
            Font font = UIManager.getFont("TextField.font");
            Graphics2D g = (Graphics2D)graphics.create(x, y, getIconWidth(), getIconHeight());
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
            g.setFont(font.deriveFont(Font.BOLD, getIconWidth()*3/4));
            g.setColor(Color.green.darker());
            final int SW = Math.max(getIconWidth()/10, 4);
            g.setStroke(new BasicStroke(SW));
            g.drawArc(SW/2, SW/2, getIconWidth()-SW-1, getIconHeight()-SW-1, 0, 360);
            Rectangle2D bounds =
View Full Code Here

            Color bg = getBackground();
            g.setColor(new Color(bg.getRed(), bg.getGreen(), bg.getBlue()));

            g.fill(new Ellipse2D.Float(0,0,size,size));
            Font font = getFont();
            g.setFont(font.deriveFont(Font.BOLD, size/12));
            g.setColor(new Color(0,0,0,128));
            g.setStroke(border);
            g.draw(new Ellipse2D.Float(0,0,size-1,size-1));
            g.draw(new Ellipse2D.Float(margin,margin,size-margin*2-1,size-margin*2-1));

 
View Full Code Here

        // Update the labels
        textLabel.setText(text != null ? text : "");

        Font font = (Font)menu.getStyles().get("font");
        textLabel.getStyles().put("font", font);
        keyboardShortcutLabel.getStyles().put("font", font.deriveFont(Font.ITALIC));

        Color color;
        if (button.isEnabled()) {
            if (highlighted) {
                color = (Color)menu.getStyles().get("activeColor");
View Full Code Here

     */
    @Override
    public void initialize() {

        Font buttonFont = viewSource.getFont();
        viewSource.setFont(buttonFont.deriveFont(buttonFont.getSize() / 2));
        viewSource.setPreferredSize(new Dimension(150, 15));
        viewSource.setEnabled(false);

        topLeftSPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, frame.mainFrameTree.bugListPanel(),
                frame.createCommentsInputPanel());
View Full Code Here

            setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

            Font labelFont = UIManager.getFont("Label.font");

            nameLabel = new JLabel();
            nameLabel.setFont(labelFont.deriveFont(Font.BOLD));
            add(nameLabel);

            idLabel = new JLabel();
            add(idLabel);
View Full Code Here

    //ascent is the distance between the baseline and the tallest character
    int width = getWidthFor(string, currentFont);

    int direction; //direction of size change (towards smaller or bigger)
    if(width > maxWidth){
      currentFont = currentFont.deriveFont(size - 1);
      size--;
      direction = -1;
    } else {
      currentFont = currentFont.deriveFont(size + 1);
      size++;
View Full Code Here

    if(width > maxWidth){
      currentFont = currentFont.deriveFont(size - 1);
      size--;
      direction = -1;
    } else {
      currentFont = currentFont.deriveFont(size + 1);
      size++;
      direction = 1;
    }
    while(size > 0){
      currentFont = currentFont.deriveFont(size);
View Full Code Here

      currentFont = currentFont.deriveFont(size + 1);
      size++;
      direction = 1;
    }
    while(size > 0){
      currentFont = currentFont.deriveFont(size);
      //rectangle = currentFont.getStringBounds(testString, frc);
      width = getWidthFor(string, currentFont);
      if(direction == 1){
        if(width > maxWidth){
          size = size - 1;
View Full Code Here

      //rectangle = currentFont.getStringBounds(testString, frc);
      width = getWidthFor(string, currentFont);
      if(direction == 1){
        if(width > maxWidth){
          size = size - 1;
          return currentFont.deriveFont(size);
        }
        else size = size + 1;
      } else {
        if(width < maxWidth)
          return currentFont;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.