本文整理汇总了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 );
}
});
}
示例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);
}
});
}
示例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());
// }
// });
}
示例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");
}
});
}
示例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
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}
示例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();
}
示例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();
}
示例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;
}