當前位置: 首頁>>代碼示例>>Java>>正文


Java Font.isBold方法代碼示例

本文整理匯總了Java中java.awt.Font.isBold方法的典型用法代碼示例。如果您正苦於以下問題:Java Font.isBold方法的具體用法?Java Font.isBold怎麽用?Java Font.isBold使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.Font的用法示例。


在下文中一共展示了Font.isBold方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: JMenuItmen_Window

import java.awt.Font; //導入方法依賴的package包/類
private JMenuItmen_Window( String ProjectName, int WindowIndex, boolean setBold  ) {
	
	final int WinIdx = WindowIndex;
	int WinNo = WindowIndex + 1;
	
	if ( WinNo <= 0 ) {
		this.setText( ProjectName );
	}
	else {
		this.setText( WinNo + ": " + ProjectName );
	}		
	if ( setBold ) {
		Font cfont = this.getFont();
		if ( cfont.isBold() == true ) {
			this.setForeground( Application.getGlobalInfo().ColorMenuHighLight() );	
		}
		else {
			this.setFont( cfont.deriveFont(Font.BOLD) );
		}
	}
	this.addActionListener( new ActionListener() {
		public void actionPerformed(ActionEvent evt) {
			Application.getProjectsLoaded().setFocus( WinIdx );							
		}
	});		
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:27,代碼來源:ProjectsLoaded.java

示例2: JMenuItmenLnF

import java.awt.Font; //導入方法依賴的package包/類
/**
 * Instantiates a new JMenuItmen for a single Look and Feel entry.
 *
 * @param LnFName the name of the look and feel
 * @param LnFClass the class of the look and feel
 * @param setBold the set bold
 */
private JMenuItmenLnF(String LnFName, String LnFClass, boolean setBold) {

	this.LnFClass = LnFClass;
	this.setText(LnFName);
	if (setBold == true) {
		Font cfont = this.getFont();
		if (cfont.isBold()) {
			this.setForeground(Application.getGlobalInfo().ColorMenuHighLight());
		} else {
			this.setFont(cfont.deriveFont(Font.BOLD));
		}
	}
	this.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent evt) {
			Application.setLookAndFeel(JMenuItmenLnF.this.LnFClass);
		}
	});
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:26,代碼來源:MainWindow.java

示例3: init

import java.awt.Font; //導入方法依賴的package包/類
@Override
	public void init(GameContainer container) throws SlickException {
		this.container = container;
		this.map = new TiledMap("/home/enzo/newmap.tmx");

		SpriteSheet spriteSheet = new SpriteSheet("/home/enzo/SpriteSheetAnim.png", 64, 64);
		this.animations[0] = loadAnimation(spriteSheet, 0, 1, 0);
		this.animations[1] = loadAnimation(spriteSheet, 0, 1, 1);
		this.animations[2] = loadAnimation(spriteSheet, 0, 1, 2);
		this.animations[3] = loadAnimation(spriteSheet, 0, 1, 3);
		this.animations[4] = loadAnimation(spriteSheet, 1, 9, 0);
		this.animations[5] = loadAnimation(spriteSheet, 1, 9, 1);
		this.animations[6] = loadAnimation(spriteSheet, 1, 9, 2);
		this.animations[7] = loadAnimation(spriteSheet, 1, 9, 3);
	
		Font font = new Font("Verdana", Font.BOLD, 20);
		UnicodeFont uFont = new UnicodeFont(font, font.getSize(), font.isBold(), font.isItalic());
		nameInput = new TextField(container, uFont, 150,20,500,35, new ComponentListener()
	        {
	         public void componentActivated(AbstractComponent source) {
	            message = "Entered1: "+nameInput.getText();
	            nameInput.setFocus(true);
	         }

	    });
		
//		ComponentListener listener = new ComponentListener();
//		TextField nameInput = new TextField(arg0, truetypefont, 150,20,500,35, listener);
//		
//		{
//	        public void componentActivated(AbstractComponent source) {
//	           System.out.println("Entered1: "+nameInput.getText());
//	        }
//	   });
	
	}
 
開發者ID:EnzoMolion,項目名稱:Projet-PLA,代碼行數:37,代碼來源:WindowGame.java

示例4: JTextPaneTableCellRenderer

import java.awt.Font; //導入方法依賴的package包/類
public JTextPaneTableCellRenderer() {
  textPane.setContentType("text/html");
  textPane.setEditable(false);
  textPane.setOpaque(true);
  textPane.setBorder(null);

  textPane.setForeground(UIManager.getColor("Table.selectionForeground"));
  textPane.setBackground(UIManager.getColor("Table.selectionBackground"));

  Font font = UIManager.getFont("Label.font");
  String bodyRule =
      "body { font-family: " + font.getFamily() + "; " + "font-size: "
          + font.getSize() + "pt; "
          + (font.isBold() ? "font-weight: bold;" : "") + "}";
  ((HTMLDocument)textPane.getDocument()).getStyleSheet().addRule(bodyRule);

  textPane.addHyperlinkListener(new HyperlinkListener() {

    @Override
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED))
          MainFrame.getInstance().showHelpFrame(e.getURL().toString(), "CREOLE Plugin Manager");
    }
  });
}
 
開發者ID:GateNLP,項目名稱:gate-core,代碼行數:26,代碼來源:JTextPaneTableCellRenderer.java

示例5: getString

import java.awt.Font; //導入方法依賴的package包/類
private String getString(Font font) {
    String style = ""; // NOI18N

    if (font.isBold()) {
        style += "bold"; // NOI18N
    }
    if (font.isItalic()) {
        style += " italic"; // NOI18N
    }
    else {
        style += " plain"; // NOI18N
    }
    return "[" + font.getName() + ", " + style + ", " + font.getSize() + "]"; // NOI18N
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ComponentLine.java

示例6: getTxtFont

import java.awt.Font; //導入方法依賴的package包/類
/**
 * Override to bold font
 */
@Override
protected Font getTxtFont() {
    Font font = super.getTxtFont();
    if (!font.isBold()) {
        font = font.deriveFont(Font.BOLD);
    }
    return font;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:AbstractWinViewTabDisplayerUI.java

示例7: getListCellRendererComponent

import java.awt.Font; //導入方法依賴的package包/類
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    Component res = orig.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    if (value instanceof ReferedExternalStyleSheetItem) {
        if (res instanceof JLabel) {
            Font font = res.getFont();
            if (!font.isBold()) {
                res.setFont(font.deriveFont(Font.BOLD));
            }
        }
    }
    return res;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:ExtractInlinedStylePanel.java

示例8: JMenuItemLang

import java.awt.Font; //導入方法依賴的package包/類
/**
 * Instantiates a new j menu item lang.
 *
 * @param LangHeader the lang header
 * @param setBold the set bold
 */
private JMenuItemLang(String LangHeader, boolean setBold) {
	this.setText(Language.getLanguageName(LangHeader.toUpperCase()));
	if (setBold) {
		Font cfont = this.getFont();
		if (cfont.isBold()) {
			this.setForeground(Application.getGlobalInfo().ColorMenuHighLight());
		} else {
			this.setFont(cfont.deriveFont(Font.BOLD));
		}
	}
	this.addActionListener(this);
	this.setActionCommand(LangHeader);
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:20,代碼來源:MainWindow.java

示例9: setFont

import java.awt.Font; //導入方法依賴的package包/類
public void setFont(Font font) {
    if (font == null) return;
    int size = font.getSize();
    boolean bold = font.isBold();
    if (bold) {
        _buffer.append("/Helvetica-Bold findfont\n");
    } else {
        _buffer.append("/Helvetica findfont\n");
    }
    _buffer.append("" + size + " scalefont setfont\n");
    _currentFont = font;
}
 
開發者ID:OpenDA-Association,項目名稱:OpenDA,代碼行數:13,代碼來源:EPSGraphics.java

示例10: put

import java.awt.Font; //導入方法依賴的package包/類
/**
 * 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));
}
 
開發者ID:GateNLP,項目名稱:gate-core,代碼行數:19,代碼來源:OptionsMap.java

示例11: fontToString

import java.awt.Font; //導入方法依賴的package包/類
public String fontToString(Font font) {
    StringBuffer sb = new StringBuffer();
    sb.append(font.getName());
    sb.append(" ");
    sb.append(font.getSize());
    if (font.isBold()) {
        sb.append(" bold");
    }
    if (font.isItalic()) {
        sb.append(" italic");
    }
    return sb.toString();
}
 
開發者ID:arodchen,項目名稱:MaxSim,代碼行數:14,代碼來源:CFGOptionsPanel.java

示例12: createStyle

import java.awt.Font; //導入方法依賴的package包/類
private String createStyle (String element, String selector, Font font, Color fg, Color bg, boolean useDefaults) {
    StringBuffer sb = new StringBuffer();
    if (element != null) {
        sb.append (element);
        sb.append (WS);
    }

    if (selector != null) {
        sb.append (DOT);
        sb.append (selector);
        sb.append (WS);
    }

    sb.append (ST_BEGIN);
    boolean first = true;
    if ((!useDefaults || !fg.equals(getDefaultColor())) && fg != null) {
        sb.append (ST_COLOR);
        sb.append (getHtmlColor(fg));
        first = false;
    }

    if ((!useDefaults || !bg.equals (getDefaultBackgroundColor())) && bg != null) {
        if (!first) {
            sb.append (ST_SEPARATOR);
        }
        sb.append (ST_BGCOLOR);
        sb.append (getHtmlColor(bg));
        first = false;
    }

    if ((!useDefaults || !font.equals (getDefaultFont())) && font != null) {
        if (!first) {
            sb.append (ST_SEPARATOR);
        }
        sb.append (ST_FONT_FAMILY);
        sb.append (font.getFamily());   //TODO: Locale should go here
        if (font.isBold()) {
            sb.append (ST_SEPARATOR);
            sb.append (ST_BOLD);
        }
        if (font.isItalic()) {
            sb.append (ST_SEPARATOR);
            sb.append (ST_ITALIC);
        }
        Font df = getDefaultFont();
        if (df != null && df.getSize() != font.getSize()) {
            sb.append (ST_SEPARATOR);
            sb.append (ST_SIZE);
            sb.append (String.valueOf(font.getSize()));
        }
        
    }
    sb.append (ST_END);
    return sb.toString();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:56,代碼來源:HtmlPrintContainer.java

示例13: appendHTMLRepresentation

import java.awt.Font; //導入方法依賴的package包/類
@Override
public StringBuilder appendHTMLRepresentation(StringBuilder sb,
							RSyntaxTextArea textArea, boolean fontFamily,
							boolean tabsToSpaces) {

	SyntaxScheme colorScheme = textArea.getSyntaxScheme();
	Style scheme = colorScheme.getStyle(getType());
	Font font = textArea.getFontForTokenType(getType());//scheme.font;

	if (font.isBold()) {
		sb.append("<b>");
	}
	if (font.isItalic()) {
		sb.append("<em>");
	}
	if (scheme.underline || isHyperlink()) {
		sb.append("<u>");
	}

	boolean needsFontTag = fontFamily || !isWhitespace();
	if (needsFontTag) {
		sb.append("<font");
		if (fontFamily) {
			sb.append(" face=\"").append(font.getFamily()).append('"');
		}
		if (!isWhitespace()) {
			sb.append(" color=\"").append(
					getHTMLFormatForColor(scheme.foreground)).append('"');
		}
		sb.append('>');
	}

	// NOTE: Don't use getLexeme().trim() because whitespace tokens will
	// be turned into NOTHING.
	appendHtmlLexeme(textArea, sb, tabsToSpaces);

	if (needsFontTag) {
		sb.append("</font>");
	}
	if (scheme.underline || isHyperlink()) {
		sb.append("</u>");
	}
	if (font.isItalic()) {
		sb.append("</em>");
	}
	if (font.isBold()) {
		sb.append("</b>");
	}

	return sb;

}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:53,代碼來源:TokenImpl.java


注:本文中的java.awt.Font.isBold方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。