当前位置: 首页>>代码示例>>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;未经允许,请勿转载。