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


Java JLabel.setFont方法代码示例

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


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

示例1: TextPanel

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Create the panel.
 */
public TextPanel(String text) {
	
	JLabel lblUpdateChangelog = new JLabel("Update description/change-log:");
	
	JScrollPane scrollPane = new JScrollPane();
	
	JLabel lblDoYouWant = new JLabel("Do you want to install this update?");
	lblDoYouWant.setFont(new Font("Tahoma", Font.PLAIN, 15));
	lblDoYouWant.setHorizontalAlignment(SwingConstants.CENTER);
	GroupLayout groupLayout = new GroupLayout(this);
	groupLayout.setHorizontalGroup(
	    groupLayout.createParallelGroup(Alignment.TRAILING)
	        .addGroup(groupLayout.createSequentialGroup()
	            .addContainerGap()
	            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
	                .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
	                .addComponent(lblUpdateChangelog, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
	                .addComponent(lblDoYouWant, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE))
	            .addContainerGap())
	);
	groupLayout.setVerticalGroup(
	    groupLayout.createParallelGroup(Alignment.LEADING)
	        .addGroup(groupLayout.createSequentialGroup()
	            .addContainerGap()
	            .addComponent(lblUpdateChangelog)
	            .addPreferredGap(ComponentPlacement.RELATED)
	            .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE)
	            .addPreferredGap(ComponentPlacement.RELATED)
	            .addComponent(lblDoYouWant)
	            .addContainerGap())
	);
	
	JTextArea textArea = new JTextArea();
	scrollPane.setViewportView(textArea);
	setLayout(groupLayout);
	textArea.setEditable(false);
	textArea.setText(text);

}
 
开发者ID:mob41,项目名称:osumer,代码行数:43,代码来源:TextPanel.java

示例2: openNothing

import javax.swing.JLabel; //导入方法依赖的package包/类
public void openNothing()
{
    // eanble scrolling
    editorScroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    editorScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    
    JLabel label = new JLabel();
    label.setText("");
    label.setFont(new Font("Monospaced", Font.BOLD, 20));
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setVerticalAlignment(JLabel.CENTER);
    label.setBackground(BloxsColors.$BACKGROUND);
    label.setOpaque(true);
  
    editorScroller.getViewport().add(label);
    editorScroller.getViewport().validate();
    editorScroller.repaint();
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:19,代码来源:MainFrame.java

示例3: createTitle

import javax.swing.JLabel; //导入方法依赖的package包/类
private JComponent createTitle(String text)
{
	JLabel lbl = new JLabel(text);
	lbl.setFont(new Font("serif", Font.BOLD, 16));
	lbl.setBorder(new UnderlineBorder(0, 0, 0, 0));

	return lbl;
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:9,代码来源:AddByNamePanel.java

示例4: getCellRenderer

import javax.swing.JLabel; //导入方法依赖的package包/类
public ListCellRenderer getCellRenderer() {
       return new DefaultListCellRenderer()  {

    public Component getListCellRendererComponent(
      JList list,
      Object value,            // value to display
      int index,               // cell index
      boolean isSelected,      // is the cell selected
      boolean cellHasFocus)    // the list and the cell have the focus
    {
        JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        String s = value.toString();
        label.setText(s);
        //Note currentNote = CurrentProject.getNoteList().getActiveNote();
	 Note currentNote = CurrentNote.get();
        if (currentNote != null) {
           if (getNote(index).getId().equals(currentNote.getId()))
               label.setFont(label.getFont().deriveFont(Font.BOLD));
        }
        if (getNote(index).isMarked())
           label.setIcon(bookmarkIcon);
        //setIcon();
      /*if (isSelected) {
            setBackground(list.getSelectionBackground());
          setForeground(list.getSelectionForeground());
      }
        else {
          setBackground(list.getBackground());
          setForeground(list.getForeground());
      }
      setEnabled(list.isEnabled());
      setFont(list.getFont());
        setOpaque(true);*/
        label.setToolTipText(s);
        return label;
    }
   };

}
 
开发者ID:ser316asu,项目名称:SER316-Ingolstadt,代码行数:40,代码来源:NotesList.java

示例5: inizializza_salaAttesa

import javax.swing.JLabel; //导入方法依赖的package包/类
private void inizializza_salaAttesa() {
    imgSalaAttesa = new JLabel(caricaImmagine("dominio/immagini/salaAttesa.jpg"));
    fraseSalaAttesa = new JLabel("In attesa di altri giocatori");

    Font font = new Font("Sala Attesa", Font.BOLD, 40);
    fraseSalaAttesa.setFont(font);
    fraseSalaAttesa.setForeground(Color.black);
    int strWidth = fraseSalaAttesa.getFontMetrics(font).stringWidth("In attesa di altri giocatori");

    imgSalaAttesa.setBounds(this.getWidth() / 2 - 350, 100, 700, 557);
    fraseSalaAttesa.setBounds(this.getWidth() / 2 - strWidth / 2, 10, strWidth, 100);
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-A,代码行数:13,代码来源:PartitaOnlineGuiView.java

示例6: getJPanelEmpty

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Returns an empty JPanel with an specified test on it.
 *
 * @param text the text to display
 * @return the JPanel
 */
private JPanel getJPanelEmpty(String text) {

	JLabel jLabelText = new JLabel(text);
	jLabelText.setFont(new Font("Dialog", Font.BOLD, 12));
	jLabelText.setHorizontalAlignment(SwingConstants.CENTER);
	
	JPanel emptyPanel = new JPanel();
	emptyPanel.setLayout(new BorderLayout());
	emptyPanel.add(jLabelText, BorderLayout.CENTER);
	return emptyPanel;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:18,代码来源:DynTableJPanel.java

示例7: 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

示例8: estrazioneMazziere

import javax.swing.JLabel; //导入方法依赖的package包/类
private void estrazioneMazziere() {
    int nGiocatori = model.getGiocatori().size();
    
    for(int i = 0; i < nGiocatori; i++)
        stampaNomeFiches(model.getGiocatori().get(i));
    
    pausa(pausa_breve);
    
    for(int i = 0; i < nGiocatori; i++) {
        stampaValoreMano(model.getGiocatori().get(i));
        if(i != nGiocatori - 1)
            stampaCarta((this.getWidth()*(2*i+1))/((nGiocatori-1)*2) - 125, 180, model.getGiocatori().get(i).getCartaCoperta().toString());
        else
            stampaCarta(this.getWidth()/2 - 125, 3*this.getHeight()/4 - 60, model.getGiocatori().get(i).getCartaCoperta().toString());
        
        pausa(pausa_breve);
    }
    
    pausa(pausa_breve);
    
    Giocatore mazziere = model.getMazziere();
    Font font = new Font("Player", Font.BOLD, 70);
    JLabel messaggioMazziere = new JLabel("Il mazziere è: " + mazziere.getNome());
    messaggioMazziere.setFont(font);
    messaggioMazziere.setForeground(Color.black);
    int strWidth = messaggioMazziere.getFontMetrics(font).stringWidth("Il mazziere è: " + mazziere.getNome() + " !!");
    messaggioMazziere.setBounds(this.getWidth()/2 - strWidth/2, this.getHeight()/2 - 60, strWidth, 90);
    
    sfondo.add(messaggioMazziere);
    sfondo.repaint();
    
    pausa(pausa_lunga);
    
    sfondo.removeAll();
    needToMarkMazziere = true;
    for(int i = 0; i < nGiocatori; i++)
        stampaNomeFiches(model.getGiocatori().get(i));
            
    sfondo.repaint();
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-A,代码行数:41,代码来源:PartitaOfflineGuiView.java

示例9: formatLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Sets the desired look of the lavel.
 * 
 * @param label
 *            Label to apply style to.
 * @param selected
 *            If label is selected or not.
 */
default void formatLabel(JLabel label, boolean selected) {
	label.setFont(Fonts.monospace);
	label.setOpaque(true);
	label.setBorder(BorderFactory.createEtchedBorder());
	if (selected) {
		label.setBackground(Color.decode(getTheme().listItemSelected));
	} else {
		label.setBackground(Color.decode(getTheme().listItemBackground));
	}
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:19,代码来源:RenderFormatter.java

示例10: TestWizardPanel

import javax.swing.JLabel; //导入方法依赖的package包/类
public TestWizardPanel() {
	counter++;
	name = "Panel " + counter;
	JLabel jl = new JLabel("<html><center>This is <b>" + name + "</b>.<br>Have a nice day!</center></html>");
	jl.setHorizontalAlignment(SwingConstants.CENTER);
	jl.setHorizontalTextPosition(SwingConstants.CENTER);
	jl.setFont(new Font("Arial", Font.PLAIN, 16));
	jl.setBorder(BorderFactory.createEtchedBorder());

	setLayout(new BorderLayout());

	add(jl, BorderLayout.CENTER);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:14,代码来源:TestWizardPanel.java

示例11: SelectionBar

import javax.swing.JLabel; //导入方法依赖的package包/类
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);
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:38,代码来源:SelectionBar.java

示例12: configRenderer

import javax.swing.JLabel; //导入方法依赖的package包/类
private void configRenderer () {
    categoryLabel = new JLabel();
    categoryLabel.setFont(categoryLabel.getFont().deriveFont(Font.BOLD));
    categoryLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
    categoryLabel.setForeground(QuickSearchComboBar.getCategoryTextColor());

    resultLabel = HtmlRenderer.createLabel();
    ((HtmlRenderer.Renderer)resultLabel).setHtml(true);
    ((HtmlRenderer.Renderer)resultLabel).setRenderStyle(HtmlRenderer.STYLE_CLIP);
    resultLabel.setOpaque(true);
    resultLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));

    shortcutLabel = new JLabel();
    shortcutLabel.setOpaque(true);
    shortcutLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 4));

    cutLabel = new JLabel("...");
    cutLabel.setOpaque(true);
    cutLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 4));

    itemLinePanel = new JPanel();
    itemLinePanel.setBackground(QuickSearchComboBar.getResultBackground());
    itemLinePanel.setLayout(new BorderLayout());
    itemLinePanel.add(resultLabel, BorderLayout.CENTER);


    itemPanel = new JPanel();
    itemPanel.setBackground(QuickSearchComboBar.getResultBackground());
    itemPanel.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 3));
    itemPanel.setLayout(new BorderLayout());
    itemPanel.add(itemLinePanel, BorderLayout.CENTER);

    dividerLine = new JPanel();
    dividerLine.setBackground(QuickSearchComboBar.getPopupBorderColor());
    dividerLine.setPreferredSize(new Dimension(dividerLine.getPreferredSize().width, 1));

    rendererComponent = new JPanel();
    rendererComponent.setLayout(new BorderLayout());
    rendererComponent.add(itemPanel, BorderLayout.CENTER);
    rendererComponent.add(categoryLabel, BorderLayout.WEST);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:SearchResultRender.java

示例13: stylizeHeadingLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
public void stylizeHeadingLabel(JLabel l){
	l.setFont(font_20_bold);
	l.setForeground(Color.WHITE);
	l.setHorizontalAlignment(SwingConstants.LEFT);
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:6,代码来源:TrnControllerGUI.java

示例14: setSideMenu

import javax.swing.JLabel; //导入方法依赖的package包/类
private void setSideMenu() {
    gridLayout = new GridLayout(8, 1, 0, 0);
    sideMenu.setLayout(gridLayout);
    sideMenu.setBackground(Color.BLACK);

    playerTurn = new JLabel("Turn");
    playerTurn.setFont(new Font("Verdana", 0, 20));
    playerTurn.setForeground(new Color(255, 255, 255));

    player1Name = new JLabel();
    player1Name.setFont(new Font("Verdana", 0, 20));
    player1Name.setForeground(new Color(255, 255, 255));

    player1Score = new JLabel();
    player1Score.setIcon(blue);
    player1Score.setFont(new Font("Verdana", 0, 35));
    player1Score.setForeground(new Color(255, 255, 255));

    player2Name = new JLabel();
    player2Name.setFont(new Font("Verdana", 0, 20));
    player2Name.setForeground(new Color(255, 255, 255));

    player2Score = new JLabel();
    player2Score.setIcon(red);
    player2Score.setFont(new Font("Verdana", 0, 35));
    player2Score.setForeground(new Color(255, 255, 255));

    winner = new JLabel("Winner");
    winner.setFont(new Font("Verdana", 0, 20));
    winner.setForeground(new Color(255, 255, 255));
    winner.setVisible(false);

    sideMenu.add(playerTurn);
    sideMenu.add(player1Name);
    sideMenu.add(player1Score);
    sideMenu.add(new JLabel());
    sideMenu.add(player2Name);
    sideMenu.add(player2Score);
    sideMenu.add(new JLabel());
    sideMenu.add(winner);
}
 
开发者ID:data-library,项目名称:jOthelloT,代码行数:42,代码来源:Display.java

示例15: getJLabelHeader

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * Gets the JLabel for a header.
 * @param headerText the header text
 * @return the JLabel header
 */
private JLabel getJLabelHeader(String headerText) {
	JLabel jLabelHeader = new JLabel("  " + headerText);
	jLabelHeader.setFont(new Font("Dialog", Font.BOLD, 12));
	return jLabelHeader;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:11,代码来源:NetworkAddresses.java


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