Java 类java.awt.Font 实例源码

项目:hearthstone    文件:Fontes.java   
public static Font getBelwe(int size) {
    try {
        Font font = Font.createFont(Font.TRUETYPE_FONT, Fontes.class.getResourceAsStream("/com/limagiran/hearthstone/util/belwe.ttf"));
        font = font.deriveFont(Font.BOLD, size);
        return font;
    } catch (Exception ex) {
    }
    return new Font("Tahoma", Font.BOLD, size);
}
项目:openjdk-jdk10    文件:Font2D.java   
protected void setStyle() {

        String fName = fullName.toLowerCase();

        for (int i=0; i < boldItalicNames.length; i++) {
            if (fName.indexOf(boldItalicNames[i]) != -1) {
                style = Font.BOLD|Font.ITALIC;
                return;
            }
        }

        for (int i=0; i < italicNames.length; i++) {
            if (fName.indexOf(italicNames[i]) != -1) {
                style = Font.ITALIC;
                return;
            }
        }

        for (int i=0; i < boldNames.length; i++) {
            if (fName.indexOf(boldNames[i]) != -1 ) {
                style = Font.BOLD;
                return;
            }
        }
    }
项目:incubator-netbeans    文件:SvnOptionsPanel.java   
/** Creates new form SvnOptionsPanel */
public SvnOptionsPanel() {
    initComponents();
    if(Utilities.isWindows()) {
        jLabel5.setText(org.openide.util.NbBundle.getMessage(SvnOptionsPanel.class, "SvnOptionsPanel.jLabel5.windows.text"));
        jLabel11.setText(org.openide.util.NbBundle.getMessage(SvnOptionsPanel.class, "SvnOptionsPanel.jLabel11.text"));
    } else {
        jLabel5.setText(org.openide.util.NbBundle.getMessage(SvnOptionsPanel.class, "SvnOptionsPanel.jLabel5.unix.text"));
        jLabel11.setText(org.openide.util.NbBundle.getMessage(SvnOptionsPanel.class, "SvnOptionsPanel.jLabel11.unix.text"));
    }
    Document doc = textPaneClient.getDocument();
    if (doc instanceof HTMLDocument) { // Issue 185505
        HTMLDocument htmlDoc = (HTMLDocument)doc;
        Font font = UIManager.getFont("Label.font"); // NOI18N
        String bodyRule = "body { font-family: " + font.getFamily() + "; " // NOI18N
            + "color: " + SvnUtils.getColorString(textPaneClient.getForeground()) + "; " //NOI18N
            + "font-size: " + font.getSize() + "pt; }"; // NOI18N
        htmlDoc.getStyleSheet().addRule(bodyRule);
    }
    textPaneClient.setOpaque(false);
    textPaneClient.setBackground(new Color(0,0,0,0)); // windows and nimbus workaround see issue 145826
}
项目:OpenJSharp    文件:TextLayout.java   
/**
 * Constructs a <code>TextLayout</code> from an iterator over styled text.
 * <p>
 * The iterator must specify a single paragraph of text because an
 * entire paragraph is required for the bidirectional
 * algorithm.
 * @param text the styled text to display
 * @param frc contains information about a graphics device which is needed
 *       to measure the text correctly.
 *       Text measurements can vary slightly depending on the
 *       device resolution, and attributes such as antialiasing.  This
 *       parameter does not specify a translation between the
 *       <code>TextLayout</code> and user space.
 */
public TextLayout(AttributedCharacterIterator text, FontRenderContext frc) {

    if (text == null) {
        throw new IllegalArgumentException("Null iterator passed to TextLayout constructor.");
    }

    int start = text.getBeginIndex();
    int limit = text.getEndIndex();
    if (start == limit) {
        throw new IllegalArgumentException("Zero length iterator passed to TextLayout constructor.");
    }

    int len = limit - start;
    text.first();
    char[] chars = new char[len];
    int n = 0;
    for (char c = text.first();
         c != CharacterIterator.DONE;
         c = text.next())
    {
        chars[n++] = c;
    }

    text.first();
    if (text.getRunLimit() == limit) {

        Map<? extends Attribute, ?> attributes = text.getAttributes();
        Font font = singleFont(chars, 0, len, attributes);
        if (font != null) {
            fastInit(chars, font, attributes, frc);
            return;
        }
    }

    standardInit(text, chars, frc);
}
项目:jdk8u-jdk    文件:HelvLtOblTest.java   
public static void main(String[] args) throws Exception {
    String os = System.getProperty("os.name");
    if (!os.startsWith("Mac")) {
         return;
    }
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    Font[] fonts = ge.getAllFonts();
    for (int i=0; i<fonts.length; i++) {
        if (fonts[i].getPSName().equals("Helvetica-LightOblique")) {
             helvFont = fonts[i];
             break;
        }
    }
    if (helvFont == null) {
        return;
    }
    final HelvLtOblTest test = new HelvLtOblTest();
    SwingUtilities.invokeLater(() -> {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.add("Center", test);
        f.pack();
        f.setVisible(true);
    });
    test.compareImages();
}
项目:Logisim    文件:InstanceTextField.java   
void update(Attribute<String> labelAttr, Attribute<Font> fontAttr, Attribute<Color> colorAttr, int x, int y,
        int halign, int valign) {
    boolean wasReg = shouldRegister();
    this.labelAttr = labelAttr;
    this.fontAttr = fontAttr;
    this.colorAttr = colorAttr;
    this.fieldX = x;
    this.fieldY = y;
    this.halign = halign;
    this.valign = valign;
    boolean shouldReg = shouldRegister();
    AttributeSet attrs = comp.getAttributeSet();
    if (!wasReg && shouldReg)
        attrs.addAttributeListener(this);
    if (wasReg && !shouldReg)
        attrs.removeAttributeListener(this);

    updateField(attrs);
}
项目:LivroJavaComoProgramar10Edicao    文件:CheckBoxFrame.java   
public CheckBoxFrame()
{
   super("JCheckBox Test");
   setLayout(new FlowLayout());

   // set up JTextField and set its font
   textField = new JTextField("Watch the font style change", 20);
   textField.setFont(new Font("Serif", Font.PLAIN, 14));
   add(textField); // add textField to JFrame

   boldJCheckBox = new JCheckBox("Bold"); 
   italicJCheckBox = new JCheckBox("Italic"); 
   add(boldJCheckBox); // add bold checkbox to JFrame
   add(italicJCheckBox); // add italic checkbox to JFrame

   // register listeners for JCheckBoxes
   CheckBoxHandler handler = new CheckBoxHandler();
   boldJCheckBox.addItemListener(handler);
   italicJCheckBox.addItemListener(handler);
}
项目:jdk8u-jdk    文件:StyledParagraph.java   
/**
 * Extract a GraphicAttribute or Font from the given attributes.
 * If attributes does not contain a GraphicAttribute, Font, or
 * Font family entry this method returns null.
 */
private static Object getGraphicOrFont(
        Map<? extends Attribute, ?> attributes) {

    Object value = attributes.get(TextAttribute.CHAR_REPLACEMENT);
    if (value != null) {
        return value;
    }
    value = attributes.get(TextAttribute.FONT);
    if (value != null) {
        return value;
    }

    if (attributes.get(TextAttribute.FAMILY) != null) {
        return Font.getFont(attributes);
    }
    else {
        return null;
    }
}
项目:Moenagade    文件:BloxsEditor.java   
private void printHeaderFooter(Graphics g, PageFormat pageFormat, int page, String className)
{
    int origPage = page+1;

    // Add header
    g.setColor(Color.BLACK);
    int xOffset = (int)pageFormat.getImageableX();
    int topOffset = (int)pageFormat.getImageableY()+20;
    int bottom = (int)(pageFormat.getImageableY()+pageFormat.getImageableHeight());
    // header line
    g.drawLine(xOffset, topOffset-8, xOffset+(int)pageFormat.getImageableWidth(), topOffset-8);
    // footer line
    g.drawLine(xOffset,                                    bottom-11,
              xOffset+(int)pageFormat.getImageableWidth(), bottom-11);
    g.setFont(new Font(Font.SANS_SERIF,Font.ITALIC,10));

    Graphics2D gg = (Graphics2D) g;
    String pageString = "Page "+origPage;
    int tw = (int) gg.getFont().getStringBounds(pageString,gg.getFontRenderContext()).getWidth();

    // header text
    if(className!=null)
        g.drawString(className, xOffset, topOffset-10);
    // footer text
    g.drawString(pageString, xOffset+(int)pageFormat.getImageableWidth()-tw,bottom-2);
}
项目:JuggleMasterPro    文件:AnimationJFrame.java   
/**
 * Method description
 * 
 * @see
 */
final public void initBufferingAndFonts() {

    // Hardware double-buffering :
    RepaintManager.currentManager(this).setDoubleBufferingEnabled(false);
    this.setIgnoreRepaint(true);

    // Waiting for the frame to be displayed :
    while (!this.isVisible()) {
        Thread.yield();
    }

    // Images :
    final Graphics2D objLjuggleMasterProJFrameGraphics2D = (Graphics2D) this.getGraphics();

    this.initBounds();

    // Font metrics :
    this.objGnormalFont = objLjuggleMasterProJFrameGraphics2D.getFont();
    this.objGboldFont = this.objGnormalFont.deriveFont(Font.BOLD);
    Constants.objS_GRAPHICS_FONT_METRICS = objLjuggleMasterProJFrameGraphics2D.getFontMetrics();
    objLjuggleMasterProJFrameGraphics2D.dispose();
}
项目:Caritemere    文件:Theme.java   
public static Theme getMedicalWhiteColorScheme() {
    Theme out = new Theme("Medical White");
    out.colors[COL_BACKGROUND] = new Color(0x888888);
    out.colors[COL_WINDOW_BACKGROUND] = new Color(0xbbbbbb);
    out.colors[COL_ACCENT] = new Color(0xbbbbbb);
    out.colors[COL_TEXT_PRIMARY] = new Color(0xffffff);
    out.colors[COL_TEXT_SECONDARY] = new Color(0xeeeeee);
    out.colors[COL_TEXT_TERTIARY] = new Color(0xdddddd);
    out.colors[COL_TEXT_STATUS] = new Color(0xdd9999);
    out.colors[COL_BUTTON] = new Color(0x555555);
    out.colors[COL_BUTTON_HOVER] = new Color(0xffffff);
    out.colors[COL_BUTTON_PRESS] = new Color(0xcccccc);
    out.colors[COL_INFO_WINDOW_BG] = new Color(0x666666);

    out.fonts[FONT_TITLE] = new Font("Mars Needs Cunnilingus", Font.BOLD, 45);
    return out;
}
项目:AgentWorkbench    文件:DynTableCellRenderEditor.java   
/**
 * Returns the JButton for a OntologyClassVisualsation like for TimeSeries or XyChart's.
 *
 * @param dynType the current DynType
 * @param startArgIndex the start argument index
 * @return the JButton for special class
 */
private JButton getJButtonOntologyClassVisualsation(DynType dynType) {

    final DynType dynTypeCurrent = dynType;

    JButton jButtonSpecialClass = new JButton();
    jButtonSpecialClass.setFont(new Font("Arial", Font.BOLD, 11));
    jButtonSpecialClass.setText("Edit");
    jButtonSpecialClass.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            dynTable.setOntologyClassVisualsationVisible(dynTypeCurrent);
        }
    });
    return jButtonSpecialClass;
}
项目:openjdk-jdk10    文件:SunFontManager.java   
private static HashSet<String> getInstalledNames() {
    if (installedNames == null) {
       Locale l = getSystemStartupLocale();
       SunFontManager fontManager = SunFontManager.getInstance();
       String[] installedFamilies =
           fontManager.getInstalledFontFamilyNames(l);
       Font[] installedFonts = fontManager.getAllInstalledFonts();
       HashSet<String> names = new HashSet<String>();
       for (int i=0; i<installedFamilies.length; i++) {
           names.add(installedFamilies[i].toLowerCase(l));
       }
       for (int i=0; i<installedFonts.length; i++) {
           names.add(installedFonts[i].getFontName(l).toLowerCase(l));
       }
       installedNames = names;
    }
    return installedNames;
}
项目:Logisim    文件:PlaRom.java   
@Override
public void paintInstance(InstancePainter painter) {
    PlaRomData data = getPlaRomData(painter);
    Graphics g = painter.getGraphics();
    painter.drawRoundBounds(Color.WHITE);
    Bounds bds = painter.getBounds();
    g.setFont(new Font("sans serif", Font.BOLD, 11));
    GraphicsUtil.drawCenteredText(g, Strings.getter("PlaRomComponent").toString(), bds.getX() + bds.getWidth() / 2,
            bds.getY() + bds.getHeight() / 4);
    GraphicsUtil.drawCenteredText(g, data.getSizeString(), bds.getX() + bds.getWidth() / 2,
            bds.getY() + bds.getHeight() * 2 / 5);
    g.setColor(Color.WHITE);
    g.fillRect(bds.getX() + 4, bds.getY() + bds.getHeight() - bds.getHeight() / 4 - 11, 72, 16);
    g.setColor(Color.BLACK);
    g.drawRect(bds.getX() + 4, bds.getY() + bds.getHeight() - bds.getHeight() / 4 - 12, 72, 16);
    GraphicsUtil.drawCenteredText(g, com.cburch.logisim.gui.menu.Strings.get("editMenu"),
            bds.getX() + bds.getWidth() / 2, bds.getY() + bds.getHeight() - bds.getHeight() / 4 - 6);
    painter.drawPort(0);
    painter.drawPort(1);
    g.setColor(Color.GRAY);
    painter.drawPort(2, Strings.get("ramClrLabel"), Direction.SOUTH);
    painter.drawPort(3, Strings.get("ramCSLabel"), Direction.NORTH);
}
项目:AutonomousCar    文件:TextBox.java   
public TextBox(double x, double y, double width, double height, Background background, String text, Font font, boolean editable, Color textColor, double horizontalMargin, double verticalMargin, double lineSpacing, double cursorWidth, double spamDelay)
{
    super(x,y,width,height,background);
    setDefaultText(text);
    setEditable(editable);
    setTextColor(textColor);
    setFont(font);
    setText(text);
    setHorizontalMargin(horizontalMargin);
    setVerticalMargin(verticalMargin);
    setLineSpacing(lineSpacing);
    setCursorWidth(cursorWidth);
    setSpamDelay(spamDelay);

    cursor = newCursor();
    cursor.setLayer(getLayer() - 1);


}
项目:openjdk-jdk10    文件:XOpenTypeViewer.java   
public Component prepareRenderer(TableCellRenderer renderer,
        int row, int column) {
    Component comp = super.prepareRenderer(renderer, row, column);

    if (normalFont == null) {
        normalFont = comp.getFont();
        boldFont = normalFont.deriveFont(Font.BOLD);
    }

    Object o = ((DefaultTableModel) getModel()).getValueAt(row, column);
    if (column == 0) {
        String key = o.toString();
        renderKey(key, comp);
    } else {
        if (isClickableElement(o)) {
            comp.setFont(boldFont);
        } else {
            comp.setFont(normalFont);
        }
    }

    return comp;
}
项目:Equella    文件:ScriptTargetChooser.java   
private void createGUI()
{
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    setLayout(gridbag);
    setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));

    target = new JTextField();
    target.setEditable(false);
    target.setMinimumSize(new Dimension(150, 20));
    target.setPreferredSize(new Dimension(150, 20));
    target.setMaximumSize(new Dimension(150, 20));
    c.gridx = 0;
    c.weightx = 1;
    c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    gridbag.setConstraints(target, c);
    add(target);

    JButton search = new JButton("..."); //$NON-NLS-1$
    search.setFont(new Font("Sans Serif", Font.PLAIN, 8)); //$NON-NLS-1$
    search.addActionListener(new SearchHandler());
    search.setMinimumSize(new Dimension(18, 20));
    search.setPreferredSize(new Dimension(18, 20));
    search.setMaximumSize(new Dimension(18, 20));
    c.gridx = 1;
    c.weightx = 0;
    gridbag.setConstraints(search, c);
    add(search);
}
项目:oxygen-git-plugin    文件:ToolbarPanel.java   
/**
* Create the "Push" button.
* 
* @return the "Push" button.
*/
private ToolbarButton createPushButton() {
  return new ToolbarButton(createPushAction(), false) {
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);

        String str = "";
        if (pushesAhead > 0) {
            str = "" + pushesAhead;
        }
        if (pushesAhead > 9) {
            pushButton.setHorizontalAlignment(SwingConstants.LEFT);
        } else {
            pushButton.setHorizontalAlignment(SwingConstants.CENTER);
        }
        g.setFont(g.getFont().deriveFont(Font.BOLD, 8.5f));
        FontMetrics fontMetrics = g.getFontMetrics(g.getFont());
        int stringWidth = fontMetrics.stringWidth(str);
        int stringHeight = fontMetrics.getHeight();
        g.setColor(new Color(255, 255, 255, 100));
        g.fillRect(pushButton.getWidth() - stringWidth - 1, pushButton.getHeight() - stringHeight, stringWidth,
                stringHeight);
        g.setColor(Color.BLACK);
        g.drawString(str, pushButton.getWidth() - stringWidth, pushButton.getHeight() - fontMetrics.getDescent());
    }
};
}
项目:org.alloytools.alloy    文件:Artist.java   
/** Draws the given string at (x,y) */
public void drawString(String text, int x, int y) {
    if (text.length() == 0)
        return;
    if (gr != null) {
        gr.drawString(text, x, y);
        return;
    }
    calc();
    Font font = (fontBoldness ? cachedBoldFont : cachedPlainFont);
    GlyphVector gv = font.createGlyphVector(new FontRenderContext(null, false, false), text);
    translate(x, y);
    draw(gv.getOutline(), true);
    translate(-x, -y);
}
项目:trashjam2017    文件:FontData.java   
/**
 * Get a styled version of a particular font family
 * 
 * @param familyName The name of the font family
 * @param style The style (@see java.awt.Font#PLAIN)
 * @return The styled font or null if no such font exists
 */
public static FontData getStyled(String familyName, int style) {
    boolean b = (style & Font.BOLD) != 0;
    boolean i = (style & Font.ITALIC) != 0;

    if (b & i) {
        return getBoldItalic(familyName);
    } else if (b) {
        return getBold(familyName);
    } else if (i) {
        return getItalic(familyName);
    } else {
        return getPlain(familyName);
    }
}
项目:incubator-netbeans    文件:ResultPanelOutput.java   
/**
 * Creates a new instance of ResultPanelOutput
 */
ResultPanelOutput(ResultDisplayHandler displayHandler) {
    super();
    if (LOG) {
        System.out.println("ResultPanelOutput.<init>");
    }

    textPane = new JEditorPane();
    textPane.setFont(new Font("monospaced", Font.PLAIN, getFont().getSize()));
    textPane.setEditorKit(new OutputEditorKit());
    textPane.setEditable(false);
    textPane.getCaret().setVisible(true);
    textPane.getCaret().setBlinkRate(0);
    textPane.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
    setViewportView(textPane);

    /*
     * On GTK L&F, background of the text pane is gray, even though it is
     * white on a JTextArea. The following is a hack to fix it:
     */
    Color background = UIManager.getColor("TextPane.background");   //NOI18N
    if (background != null) {
        textPane.setBackground(background);
    }

    doc = textPane.getDocument();

    AccessibleContext ac = textPane.getAccessibleContext();
    ac.setAccessibleName(NbBundle.getMessage(getClass(),
                                            "ACSN_OutputTextPane"));//NOI18N
    ac.setAccessibleDescription(NbBundle.getMessage(getClass(),
                                            "ACSD_OutputTextPane"));//NOI18N

    this.displayHandler = displayHandler;
}
项目:scorekeeperfrontend    文件:SelectionBar.java   
public SelectionBar()
{
    super();

    Messenger.register(MT.TIMER_SERVICE_CONNECTION, this);
    Messenger.register(MT.SERIES_CHANGED, this);
    Messenger.register(MT.NEW_CHALLENGE, this);
    Messenger.register(MT.CHALLENGE_DELETED, this);

    setBorder(new BevelBorder(0));

    Font f = new Font(Font.DIALOG, Font.BOLD, 14);

    seriesLabel = new CurrentSeriesLabel();
    seriesLabel.setFont(f.deriveFont(Font.PLAIN));
    challengeSelect  = createCombo("challengeChange");
    eventSelect = createCombo("eventChange");

    connectLabel = new JLabel("Not Connected");
    connectLabel.setForeground(Color.RED);
    connectLabel.setFont(f);

    add(createLabel("Series:", f));
    add(seriesLabel);
    add(Box.createHorizontalStrut(40));

    add(createLabel("Event:", f));
    add(eventSelect);
    add(Box.createHorizontalStrut(40));

    add(createLabel("Challenge:", f));
    add(challengeSelect);
    add(Box.createHorizontalStrut(15));

    add(createLabel("Timer:", f));
    add(connectLabel);
}
项目:jdk8u-jdk    文件:AquaInternalFrameBorderMetrics.java   
@Override
protected AquaInternalFrameBorderMetrics getInstance() {
    return new AquaInternalFrameBorderMetrics() {
        protected void initialize() {
            font = new Font("Lucida Grande", Font.PLAIN, 13);
            titleBarHeight = 22;
            leftSidePadding = 8;
            buttonHeight = 15;
            buttonWidth = 15;
            buttonPadding = 6;
            downShift = 1;
        }
    };
}
项目:MapAnalyst    文件:Style.java   
public Style(Color color, Color backColor, Stroke stroke, Font font) {
    super();
    this.color = color;
    this.backColor = backColor;
    this.stroke = stroke;
    this.font = font;
}
项目:kettle_support_kettle8.0    文件:Captcha.java   
/**
 * 随机生成字体、文字大小
 */
public static Font getRandomFont() {
    String[] fonts = { "Verdana", "Tahoma", "Time News Roman", "Quantzite",
            "Astarisborn", "WishfulWaves" };
    int fontIndex = (int) Math.round(Math.random() * (fonts.length - 1));
    int fontSize = (int) Math.round(Math.random() * 4 + 18);
    return new Font(fonts[fontIndex], Font.PLAIN, fontSize);
}
项目:openjdk-jdk10    文件:TextSourceLabel.java   
public AffineTransform getBaselineTransform() {
    Font font = source.getFont();
    if (font.hasLayoutAttributes()) {
        return AttributeValues.getBaselineTransform(font.getAttributes());
    }
    return null;
}
项目:NotifyTools    文件:AwtFontPersistenceDelegate.java   
@Override
protected Expression instantiate(Object oldInstance, Encoder enc) {
    Font font = (Font) oldInstance;
    return new Expression(oldInstance, oldInstance.getClass(),
            BeansUtils.NEW, new Object[] { font.getFontName(),
                    font.getStyle(), font.getSize() });
}
项目:VASSAL-src    文件:CounterDetailViewer.java   
protected void drawLabel(Graphics g, Point pt, String label, int hAlign, int vAlign) {

    if (label != null) {
      Color labelFgColor = fgColor == null ? Color.black : fgColor;
      Graphics2D g2d = ((Graphics2D) g);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
      Labeler.drawLabel(g, label, pt.x, pt.y, new Font("Dialog", Font.PLAIN, fontSize), hAlign, vAlign, labelFgColor, bgColor, labelFgColor);
      g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    }
  }
项目:Servlet_Applet_Communication    文件:LoginApplet.java   
@Override
public void init() {
this.setVisible(true);
this.setSize(500, 500);
this.setBackground(Color.green);
this.setLayout(new FlowLayout());

l1 = new Label("User Name");
l2 = new Label("Password");
tf1 = new TextField(20);
tf2 = new TextField(20);
tf2.setEchoChar('*');
b = new Button("Login");
b.addActionListener(this);

Font font = new Font("arial", Font.BOLD, 25);
l1.setFont(font);
l2.setFont(font);
tf1.setFont(font);
tf2.setFont(font);
b.setFont(font);

this.add(l1);
this.add(tf1);
this.add(l2);
this.add(tf2);
this.add(b);

}
项目:myster    文件:PreferencesDialogBox.java   
public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g.setColor(new Color(150, 150, 150));
    g.drawLine(10, YDEFAULT - 45, XDEFAULT - 20, YDEFAULT - 45);
    if (header.getFont().getSize() != 24) {
        header.setFont(new Font(getFont().getName(), Font.BOLD, 24));
    }
}
项目:OpenJSharp    文件:StandardGlyphVector.java   
private void init(Font font, char[] text, int start, int count,
                  FontRenderContext frc, int flags) {

    if (start < 0 || count < 0 || start + count > text.length) {
        throw new ArrayIndexOutOfBoundsException("start or count out of bounds");
    }

    this.font = font;
    this.frc = frc;
    this.flags = flags;

    if (getTracking(font) != 0) {
        addFlags(FLAG_HAS_POSITION_ADJUSTMENTS);
    }

    // !!! change mapper interface?
    if (start != 0) {
        char[] temp = new char[count];
        System.arraycopy(text, start, temp, 0, count);
        text = temp;
    }

    initFontData(); // sets up font2D

    // !!! no layout for now, should add checks
    // !!! need to support creating a StandardGlyphVector from a TextMeasurer's info...
    glyphs = new int[count]; // hmmm
    /* Glyphs obtained here are already validated by the font */
    userGlyphs = glyphs;
    font2D.getMapper().charsToGlyphs(count, text, glyphs);
}
项目:Tarski    文件:OurConsole.java   
/** This helper method constructs a JTextPane with the given settings. */
private static JTextPane do_makeTextPane(boolean editable, int topMargin, int bottomMargin, int otherMargin) {
   JTextPane x = OurAntiAlias.pane(Color.BLACK, Color.WHITE, new Font("Verdana", Font.PLAIN, 14));
   x.setEditable(editable);
   x.setAlignmentX(0);
   x.setAlignmentY(0);
   x.setCaretPosition(0);
   x.setMargin(new Insets(topMargin, otherMargin, bottomMargin, otherMargin));
   return x;
}
项目:OpenJSharp    文件:FontPanel.java   
public void setFontParams(String name, float size,
                          int style, int transform) {
    boolean fontModified = false;
    if ( !name.equals( fontName ) || style != fontStyle )
      fontModified = true;

    fontName = name;
    fontSize = size;
    fontStyle = style;
    fontTransform = transform;

    /// Recreate the font as specified
    testFont = new Font(fontName, fontStyle, (int)fontSize);
    if ((float)((int)fontSize) != fontSize) {
        testFont = testFont.deriveFont(fontSize);
    }

    if ( fontTransform != NONE ) {
        AffineTransform at = getAffineTransform( fontTransform );
        testFont = testFont.deriveFont( at );
    }
    updateBackBuffer = true;
    updateFontMetrics = true;
    fc.repaint();
    if ( fontModified ) {
        /// Tell main panel to update the font info
        updateFontInfo();
        f2dt.fireUpdateFontInfo();
    }
}
项目:gate-core    文件:OptionsMap.java   
/**
 * Converts the value to string using {@link Strings#toString(Object)}
 * method and then stores it.
 * There is get methods for values that are a String, an Integer, a Boolean,
 * a Font, a List of String and a Map of String*String.
 */
@Override
public Object put(Object key, Object value) {
  if(value instanceof Font){
    Font font = (Font)value;
    String family = font.getFamily();
    int size = font.getSize();
    boolean italic = font.isItalic();
    boolean bold = font.isBold();
    value = family + "#" + size + "#" + italic + "#" + bold;
  }
  return super.put(key.toString(), Strings.toString(value));
}
项目:OpenJSharp    文件:PhysicalStrike.java   
public PhysicalStrike(Font font, FontFamily family, FontStyle style, FontRenderContext frc){
    this.font = font;
    this.family = family;
    this.style = style;
    this.frc = frc;
    this.size2D = font.getNetFont().get_Size();
    this.factor = size2D / family.GetEmHeight(style);
}
项目:OpenJSharp    文件:SunGraphics2D.java   
public FontInfo getGVFontInfo(Font font, FontRenderContext frc) {
    if (glyphVectorFontInfo != null &&
        glyphVectorFontInfo.font == font &&
        glyphVectorFRC == frc) {
        return glyphVectorFontInfo;
    } else {
        glyphVectorFRC = frc;
        return glyphVectorFontInfo =
            checkFontInfo(glyphVectorFontInfo, font, frc);
    }
}
项目:AgentWorkbench    文件:ProjectResources.java   
/**
 * This method initializes jListResources
 * @return javax.swing.JList
 */
private JList<ProjectResource2Display> getJListBinResources() {
    if (jListBinResources == null) {
        jListBinResources = new JList<ProjectResource2Display>();
        jListBinResources.setFont(new Font("Dialog", Font.PLAIN, 12));
    }
    return jListBinResources;
}
项目:parabuild-ci    文件:JThermometer.java   
/**
 * Sets the tick font style.
 *
 * @param style  the style.
 */
public void setTickFontStyle(int style) {
    Font f = getTickLabelFont();
    String fName = f.getFontName();
    Font newFont = new Font(fName, style, f.getSize());
    setTickLabelFont(newFont);
}
项目:OpenJSharp    文件:Font2D.java   
public FontStrike getStrike(Font font) {
    FontStrike strike = (FontStrike)lastFontStrike.get();
    if (strike != null) {
        return strike;
    } else {
        return getStrike(font, DEFAULT_FRC);
    }
}