Here you can find the source of createJLabel(String text, Font font)
Parameter | Description |
---|---|
text | the text for the label. |
font | the font. |
public static JLabel createJLabel(String text, Font font)
//package com.java2s; /* =========================================================== * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * * (C) Copyright 2000-2017, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version./*from ww w.j a va 2 s . com*/ * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners.] * */ import java.awt.Color; import java.awt.Font; import javax.swing.JLabel; public class Main { /** * Creates a label with a specific font. * * @param text the text for the label. * @param font the font. * * @return The label. */ public static JLabel createJLabel(String text, Font font) { JLabel result = new JLabel(text); result.setFont(font); return result; } /** * Creates a label with a specific font and color. * * @param text the text for the label. * @param font the font. * @param color the color. * * @return The label. */ public static JLabel createJLabel(String text, Font font, Color color) { JLabel result = new JLabel(text); result.setFont(font); result.setForeground(color); return result; } }