当前位置: 首页>>代码示例>>Java>>正文


Java JLabel.getFont方法代码示例

本文整理汇总了Java中javax.swing.JLabel.getFont方法的典型用法代码示例。如果您正苦于以下问题:Java JLabel.getFont方法的具体用法?Java JLabel.getFont怎么用?Java JLabel.getFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JLabel的用法示例。


在下文中一共展示了JLabel.getFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SelectorItemRenderer

import javax.swing.JLabel; //导入方法依赖的package包/类
public SelectorItemRenderer() {
    west = new JLabel();
    east = new JLabel();
    setLayout(new BorderLayout());
    add(west, BorderLayout.WEST);
    add(east, BorderLayout.EAST);

    fg = javax.swing.UIManager.getDefaults().getColor("ComboBox.foreground");
    bg = javax.swing.UIManager.getDefaults().getColor("ComboBox.background");
    fgSelected = javax.swing.UIManager.getDefaults().getColor("ComboBox.selectionForeground");
    bgSelected = javax.swing.UIManager.getDefaults().getColor("ComboBox.selectionBackground");
    inFile = Color.gray;

    plain = west.getFont();
    bold = plain.deriveFont(Font.BOLD);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:CreateRulePanel.java

示例2: getPlotter

import javax.swing.JLabel; //导入方法依赖的package包/类
@Override
public JComponent getPlotter() {
	DataTable table = getDataTable();
	if (table != null && table.getNumberOfRows() > MAX_NUMBER_OF_ROWS) {
		LogService.getRoot().log(Level.INFO, "com.rapidminer.gui.plotter.mathplot.SurfacePlot2D.too_many_examples",
				new Object[] { table.getNumberOfRows(), MAX_NUMBER_OF_ROWS });
		// Display Label with error message because Plot3DPanel can not handle such a lot of
		// data points
		JLabel label = new JLabel(I18N.getGUILabel("surface3DPlot.too_many_examples", MAX_NUMBER_OF_ROWS));
		label.setHorizontalAlignment(SwingConstants.CENTER);
		Font originalFont = label.getFont();
		label.setFont(originalFont.deriveFont((float) (originalFont.getSize() * 1.25)));
		originalFont.deriveFont(new AffineTransform());

		return label;
	} else {
		return super.getPlotter();
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:20,代码来源:SurfacePlot3D.java

示例3: createSubGroupPanel

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Creates a panel with a heading.
 *
 * @param labelText
 *            The text for the heading
 *
 * @return The panel
 */
private JPanel createSubGroupPanel(String labelText) {
    JLabel subGroupLabel = new JLabel();
    Font font = subGroupLabel.getFont();
    font = font.deriveFont(Font.BOLD, 14f);
    subGroupLabel.setFont(font);
    subGroupLabel.setForeground(SettingsTabs.COLOR_SUBGROUP);
    subGroupLabel.setText(labelText);
    int top = SUBGROUP_TOP_MARGIN;
    if (isFirstSubGroup) {
        isFirstSubGroup = false;
        top = FIRST_SUBGROUP_TOP_MARGIN;
    }
    subGroupLabel.setBorder(BorderFactory.createEmptyBorder(top, 0, 7, 0));

    JPanel subGroupPanel = new JPanel();
    subGroupPanel.setLayout(new BoxLayout(subGroupPanel, BoxLayout.LINE_AXIS));
    subGroupPanel.add(subGroupLabel);
    subGroupPanel.add(Box.createHorizontalGlue());
    return subGroupPanel;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:29,代码来源:SettingsPropertyPanel.java

示例4: buildStepTitle

import javax.swing.JLabel; //导入方法依赖的package包/类
protected void buildStepTitle()
{
    ttlLabel = new JLabel(wizard.getStepDescription(wizard.getAllSteps()[0]));
    ttlLabel.setBorder(BorderFactory.createCompoundBorder(BorderFactory
        .createEmptyBorder(5, 5, 12, 5), BorderFactory.createMatteBorder(0, 0, 1, 0, UIManager
        .getColor("textText")))); // NOI18N
    ttlPanel = new JPanel()
    {
        private static final long serialVersionUID = 1L;
        public void doLayout()
        {
            Dimension d = ttlLabel.getPreferredSize();
            if (ttlLabel.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT)
            {
                ttlLabel.setBounds(getWidth() - d.width, 0, getWidth(), d.height);
            }
            else
            {
                ttlLabel.setBounds(0, 0, getWidth(), d.height);
            }
        }

        public Dimension getPreferredSize()
        {
            return ttlLabel.getPreferredSize();
        }
    };
    ttlPanel.add(ttlLabel);
    Font f = ttlLabel.getFont();
    if (f == null)
    {
        f = UIManager.getFont("controlFont"); // NOI18N
    }
    if (f != null)
    {
        f = f.deriveFont(Font.BOLD);
        ttlLabel.setFont(f);
    }

}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:41,代码来源:WizardDisplayerImpl.java

示例5: buildContents

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Creates dialog contents with the given title and description.
 *
 * @param title the title
 * @param description the description
 */
private static Component buildContents(String title, String description) {
  final JLabel titleLabel = new JLabel(title);
  final Font f = titleLabel.getFont();
  titleLabel.setFont(f.deriveFont(Font.BOLD, f.getSize()*1.2f));

  final FlowLabel descriptionLabel = new FlowLabel(description);

  final JPanel panel = new JPanel();
  final GroupLayout layout = new GroupLayout(panel);
  panel.setLayout(layout);

  layout.setAutocreateGaps(true);
  layout.setAutocreateContainerGaps(false);

  layout.setHorizontalGroup(
    layout.createParallelGroup(GroupLayout.LEADING, true)
      .add(titleLabel)
      .add(descriptionLabel));

  layout.setVerticalGroup(
    layout.createSequentialGroup()
      .add(titleLabel)
      .addPreferredGap(LayoutStyle.UNRELATED)
      .add(descriptionLabel));

  return panel;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:34,代码来源:Dialogs.java

示例6: resetAllDayLabels

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Reset all day labels back to plain font.
 */
private void resetAllDayLabels() {
    JLabel[] labels = {jLabel9, jLabel10, jLabel11, jLabel12, jLabel13, jLabel14, jLabel5, jLabel6};
    for (JLabel label : labels) {
        final Font oldFont = label.getFont();
        // Reset BOLD attribute.
        final Font font = oldFont.deriveFont(oldFont.getStyle() & ~Font.BOLD);
        label.setFont(font);
    }
}
 
开发者ID:lead4good,项目名称:open-java-trade-manager,代码行数:13,代码来源:ChartJDialog.java

示例7: mkDict

import javax.swing.JLabel; //导入方法依赖的package包/类
private <T> Hashtable<Integer,JLabel> mkDict(final ChoicePref<T> pref) {
	Hashtable<Integer,JLabel> dict = new Hashtable<Integer,JLabel>();
	int sel = pref.getSelectedIndex();
	for (int i = 0; i < pref.validChoices().size(); i++) {
		JLabel label = makeLabel(pref.renderValueShort(pref.validChoices().get(i)));
		if (i == sel) {
			Font font = label.getFont();
			label = OurUtil.make(label, new Font(font.getName(), Font.BOLD, font.getSize()));
		}
		dict.put(i, label);
	}
	return dict;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:14,代码来源:PreferencesDialog.java

示例8: UniversalControlSettingPanel

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Uses a MigLayout("wrap 2, insets 10 15 20 5", "[][fill, grow]")
 */
protected UniversalControlSettingPanel()
{
	super(new MigLayout("wrap 2, insets 10 15 20 5", "[][fill, grow]"));
	JLabel label = new JLabel(CurrentLocale.get(getTitleKey()));
	Font titleFont = label.getFont();
	label.setFont(new Font(titleFont.getName(), Font.BOLD, titleFont.getSize()));
	add(label, "span 2, gapbottom 10");
}
 
开发者ID:equella,项目名称:Equella,代码行数:12,代码来源:UniversalControlSettingPanel.java

示例9: makeEditorPane

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Create a JEditorPane that will convert the text into html with working hyperlinks.
 * This can be included in a messageDialog with, e.g.
 * JOptionPane.showMessageDialog(null, ep)
 * @param text
 * @return
 */
public static JEditorPane makeEditorPane(String text) {
    // for copying style
    JLabel label = new JLabel();
    Font font = label.getFont();

    // create some css from the label's font
    StringBuffer style = new StringBuffer("font-family:" + font.getFamily() + ";");
    style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
    style.append("font-size:" + font.getSize() + "pt;");
	
    //need to use editor pane and hyperlink listener so that we can include hyperlinks in help text
    JEditorPane ep = new JEditorPane("text/html", "<html><body style=\"" + style + "\">" //
            + text //
            + "</body></html>");

    ep.addHyperlinkListener(new HyperlinkListener()
    {
        @Override
        public void hyperlinkUpdate(HyperlinkEvent e)
        {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED))
            	BrowseURL.browseURL(e.getURL().toString());
        }
    });
	ep.setEditable(false);
	ep.setBackground(label.getBackground());
	
	return ep;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:37,代码来源:GeneralUtils.java

示例10: label

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Create a new label with some default look
 * @param name		the string data for the label
 * @param bold		whether or not to make the Font bold
 * @return			a pointer to the new JLabel
 */
protected JLabel label(String name, boolean bold)
{
    JLabel lbl = new JLabel(name);

    Font base = lbl.getFont();
    if (bold) lbl.setFont(base.deriveFont(Font.BOLD));
    else lbl.setFont(base.deriveFont(Font.PLAIN));

    labels.put(name, lbl);
    return lbl;
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:18,代码来源:BaseDialog.java

示例11: createHeader

import javax.swing.JLabel; //导入方法依赖的package包/类
private JComponent createHeader( String title ) {
    JLabel label = createLabel( title );
    Font defaultFont = label.getFont();
    label.setFont( defaultFont.deriveFont( Font.BOLD ).deriveFont( defaultFont.getSize2D()+2.0f ));
    return label;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:BrowserMenu.java

示例12: showErrorMessage

import javax.swing.JLabel; //导入方法依赖的package包/类
private void showErrorMessage() {
		 // for copying style
	    JLabel label = new JLabel();
	    Font font = label.getFont();

	    // create some css from the label's font
	    StringBuffer style = new StringBuffer("font-family:" + font.getFamily() + ";");
	    style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
	    style.append("font-size:" + font.getSize() + "pt;");
		 JEditorPane ep = new JEditorPane("text/html", "<html><body style=\"" + style + "\">"//
		            + "TextToSpeech executable not found."
		            + "<br>Please make sure that the path variable leads to the espeak executable!"
		            + "<br>If you do not have espeak installed yet, please download it from <a href=http://espeak.sourceforge.net\">http://espeak.sourceforge.net</a>."
		            + "<br>Linux users can use the following command: 'sudo apt-get install espeak' " //
		            + "</body></html>");

		    // handle link events
		    ep.addHyperlinkListener(new HyperlinkListener()
		    {
		        @Override
		        public void hyperlinkUpdate(HyperlinkEvent e)
		        {
		            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED))
		            	if (Desktop.isDesktopSupported()) {
		            	      Desktop desktop = Desktop.getDesktop();
		            	      try {
		            	        desktop.browse(e.getURL().toURI());
		            	      } catch (IOException f) {
		            	        JOptionPane.showMessageDialog(null,
		            	            "Failed to launch the link, your computer is likely misconfigured.",
		            	            "Cannot Launch Link",JOptionPane.WARNING_MESSAGE);
		            	      } catch (URISyntaxException e1) {
								// TODO Auto-generated catch block
								e1.printStackTrace();
							}
		            	    } else {
		            	      JOptionPane.showMessageDialog(null,
		            	          "Java is not able to launch links on your computer.",
		            	          "Cannot Launch Link", JOptionPane.WARNING_MESSAGE);
		            	    }
//		                ProcessHandler.launchUrl(e.getURL().toString()); // roll your own link launcher or use Desktop if J6+
		        }
		    });
		    ep.setEditable(false);
		    ep.setBackground(label.getBackground());

//
//		JOptionPane.showMessageDialog(PlayRelease.startGui, "TextToSpeech executable not found.\nPlease make sure that the path variable leads to the espeak executable!\nIf you do not have espeak installed yet, please downlaod it from '<HTML>http://espeak.sourceforge.net/</HTML>'."
//				+ "\n Linux users can use the following command: sudo apt-get install espeak","Error occurred",JOptionPane.ERROR_MESSAGE);
		JOptionPane.showMessageDialog(PlayRelease.startGui, ep,"Error occurred",JOptionPane.ERROR_MESSAGE);
	}
 
开发者ID:CognitiveModeling,项目名称:BrainControl,代码行数:52,代码来源:TextToSpeech.java

示例13: Renderer

import javax.swing.JLabel; //导入方法依赖的package包/类
public Renderer()
{
	dateFormat = new SimpleDateFormat();

	icon = new IconLabel();

	filename = new JLabel(" ");
	// filename.setVerticalAlignment(SwingConstants.CENTER);

	Font f = filename.getFont();
	filename.setFont(f.deriveFont((float) (f.getSize() + 2)));

	sizeLabel = new JLabel(CurrentLocale.get("cell.size"));
	size = new JLabel();
	modifiedLabel = new JLabel(CurrentLocale.get("cell.modified"));
	modified = new JLabel();

	Dimension modPrefSize = modifiedLabel.getPreferredSize();
	final int width1 = 40;
	final int width2 = Math.max(sizeLabel.getPreferredSize().width, modPrefSize.width) + 5;
	final int height1 = filename.getPreferredSize().height;
	final int height2 = modPrefSize.height;

	MigLayout layout = new MigLayout("", "[" + width1 + "][" + width2 + "][200 - " + (width2 + width1) + "]",
		"[" + height1 + "]2[" + height2 + "]2[" + height2 + "]");

	base = new JPanel(layout);
	base.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	base.setBackground(Color.WHITE);

	base.add(icon, "cell 0 0, spany 3");
	base.add(filename, "cell 1 0, spanx 2");
	base.add(sizeLabel, "cell 1 1");
	base.add(size, "cell 2 1");
	base.add(modifiedLabel, "cell 1 2");
	base.add(modified, "cell 2 2");
	int prefHeight = height1 + (height2 * 2) + 24; // size of the 3 rows
													// plus a little
													// padding

	base.setPreferredSize(new Dimension(MAX_CELL_WIDTH, prefHeight));
	base.setMaximumSize(new Dimension(MAX_CELL_WIDTH, prefHeight));
	base.setMinimumSize(new Dimension(MAX_CELL_WIDTH, prefHeight));

	if( CurrentLocale.isRightToLeft() )
	{
		base.applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:51,代码来源:FileListPanel.java

示例14: GlassProgressPane

import javax.swing.JLabel; //导入方法依赖的package包/类
protected GlassProgressPane(final String messageText, final int total, final Component activeComponent,
	final boolean stopClosing, final AdvancedSwingWorker<?> worker, final boolean cancellable)
{
	super(activeComponent, stopClosing);

	this.worker = worker;

	message = new JLabel(messageText);
	message.setForeground(Color.WHITE);
	message.setHorizontalAlignment(SwingConstants.CENTER);
	message.setHorizontalTextPosition(SwingConstants.CENTER);

	Font font = message.getFont();
	message.setFont(new Font(font.getFamily(), Font.BOLD, (int) (font.getSize() * 1.2)));

	progress = new JProgressBar();
	setTotal(total);

	// We cannot I18N the button text, as this class is initialised before
	// CurrentLocale.
	cancel = new JButton("Cancel");
	cancel.addActionListener(new ActionListener()
	{
		@Override
		public void actionPerformed(ActionEvent e)
		{
			cancel.setEnabled(false);
			GlassProgressPane.this.worker.interrupt();
		}
	});

	final int height1 = message.getPreferredSize().height;
	final int height2 = progress.getPreferredSize().height;
	final int height3 = cancel.getPreferredSize().height;
	final int width1 = cancel.getPreferredSize().width;

	final int[] rows = {height3, TableLayout.FILL, height1, height2, TableLayout.FILL, height3,};
	final int[] cols = {width1, TableLayout.FILL, 100, TableLayout.FILL, width1,};

	setLayout(new TableLayout(rows, cols));
	setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	add(message, new Rectangle(0, 2, 5, 1));
	add(progress, new Rectangle(2, 3, 1, 1));
	add(cancel, new Rectangle(4, 5, 1, 1));

	setCancellable(cancellable);
}
 
开发者ID:equella,项目名称:Equella,代码行数:48,代码来源:GlassProgressPane.java

示例15: unboldLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
public static JLabel unboldLabel(JLabel label) {
	Font font = label.getFont();
	label.setFont(font.deriveFont(font.getStyle() & ~Font.BOLD));
	return label;
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:6,代码来源:GuiTricks.java


注:本文中的javax.swing.JLabel.getFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。