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


Java Font.PLAIN属性代码示例

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


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

示例1: updateFont

/**
 * 
 */
protected void updateFont() {
  int size = (int) Math.round(state.fontSize * state.scale);
  int style = ((state.fontStyle & mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD) ? Font.BOLD
      : Font.PLAIN;
  style += ((state.fontStyle & mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC) ? Font.ITALIC
      : Font.PLAIN;

  if (lastFont == null || !lastFontFamily.equals(state.fontFamily) || size != lastFontSize
      || style != lastFontStyle) {
    lastFont = createFont(state.fontFamily, style, size);
    lastFontFamily = state.fontFamily;
    lastFontStyle = style;
    lastFontSize = size;
  }

  state.g.setFont(lastFont);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:20,代码来源:mxGraphicsCanvas2D.java

示例2: zujian

/**各组件*/
public void zujian() {
	
	iconLabel = new JLabel("2048");
	iconLabel.setFont(new Font("Impact",Font.BOLD,108));
	iconLabel.setForeground(new Color(173, 113, 66));
	add(iconLabel);
	Font font = new Font("微软雅黑", Font.PLAIN, 27);
	dropButton.addActionListener(this);
	dropButton.setFont(font);
	dropPanel.setBounds(0, 0, 460, 680);
	add(dropButton);

	classicButton.addActionListener(this);
	classicButton.setFont(font);
	classicPanel.setBounds(0, 0, 460, 680);
	add(classicButton);
	
}
 
开发者ID:brandonbai,项目名称:game2048_tetris,代码行数:19,代码来源:MainPanel.java

示例3: print

public int print(Graphics g, PageFormat fmt, int pageNo) {
	if( pageNo>0 ) return NO_SUCH_PAGE;
	Graphics2D g2 = (Graphics2D)g;
	Dimension dim = wwd.getPreferredSize();
	Rectangle r = wwd.getBounds();

	if(r.width>dim.width) r.width = dim.width;
	if(r.height>dim.height) r.height = dim.height;

	org.geomapapp.util.DateFmt df = new org.geomapapp.util.DateFmt();
	int secs = (int)(System.currentTimeMillis()/1000L);
	String date = df.format(secs);
	Font font = new Font("SansSerif", Font.PLAIN, 8);
	g.setFont( font );
	Rectangle2D r2d = font.getStringBounds(date, g2.getFontRenderContext());
//	g2.translate( r.getWidth()-20.-r2d.getWidth(), r.getHeight()+18. );
	g2.setColor( Color.black);

//	g.setClip( new Rectangle( 0, 0, r.width, r.height) );
	double w = fmt.getImageableWidth();
	double h = fmt.getImageableHeight();
	double x = fmt.getImageableX();
	double y = fmt.getImageableY();
	g2.translate(x, y);
	double scale = Math.min( w / r.getWidth(), h / r.getHeight());
	int xd = (int)(scale*r.getWidth()-10.-r2d.getWidth());
	int yd = (int)(scale*r.getHeight()+18.);
	g2.drawString( date, xd, yd);
	g2.translate( -r.getX()*scale, -r.getY()*scale );
	g2.scale( scale, scale);

	wwd.getContext().makeCurrent();
	BufferedImage image = Screenshot.readToBufferedImage(r.width, r.height);
	g2.drawImage(image, 0, 0, this);
	return PAGE_EXISTS;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:36,代码来源:WWMap.java

示例4: previewFont

/**
 * Called from the action handlers to get the font info, build a font, and
 * set it.
 */
protected void previewFont() {
  resultName = fontNameChoice.getSelectedItem();
  String resultSizeName = fontSizeChoice.getSelectedItem();
  int resultSize = Integer.parseInt(resultSizeName);
  isBold = bold.getState();
  isItalic = italic.getState();
  int attrs = Font.PLAIN;
  if (isBold)
    attrs = Font.BOLD;
  if (isItalic)
    attrs |= Font.ITALIC;
  resultFont = new Font(resultName, attrs, resultSize);
  // System.out.println("resultName = " + resultName + "; " +
  //     "resultFont = " + resultFont);
  previewArea.setFont(resultFont);
  pack(); // ensure Dialog is big enough.
}
 
开发者ID:mathhobbit,项目名称:EditCalculateAndChart,代码行数:21,代码来源:FontChooser2.java

示例5: testEquals

/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    TextTitle t1 = new TextTitle();
    TextTitle t2 = new TextTitle();
    assertEquals(t1, t2);
    
    t1.setText("Test 1");
    assertFalse(t1.equals(t2));
    t2.setText("Test 1");
    assertTrue(t1.equals(t2));
    
    Font f = new Font("SansSerif", Font.PLAIN, 15);
    t1.setFont(f);
    assertFalse(t1.equals(t2));
    t2.setFont(f);
    assertTrue(t1.equals(t2));
    
    t1.setTextAlignment(HorizontalAlignment.RIGHT);
    assertFalse(t1.equals(t2));
    t2.setTextAlignment(HorizontalAlignment.RIGHT);
    assertTrue(t1.equals(t2));
    
    // paint
    t1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 
            3.0f, 4.0f, Color.blue));
    assertFalse(t1.equals(t2));
    t2.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 
            3.0f, 4.0f, Color.blue));
    assertTrue(t1.equals(t2));
    
    // backgroundPaint
    t1.setBackgroundPaint(new GradientPaint(4.0f, 3.0f, Color.red, 
            2.0f, 1.0f, Color.blue));
    assertFalse(t1.equals(t2));
    t2.setBackgroundPaint(new GradientPaint(4.0f, 3.0f, Color.red, 
            2.0f, 1.0f, Color.blue));
    assertTrue(t1.equals(t2));
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:41,代码来源:TextTitleTests.java

示例6: loadFonts

public static void loadFonts()
{
	roboto22 = new XFontRenderer(new Font("Roboto", Font.PLAIN, 44),
		true, 8);
	roboto18 = new XFontRenderer(new Font("Roboto", Font.PLAIN, 36),
		true, 8);
	roboto15 = new XFontRenderer(new Font("Roboto", Font.PLAIN, 30),
		true, 8);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:9,代码来源:Fonts.java

示例7: _getAWTFontWeight

static private int _getAWTFontWeight(Object weight)
{
  if (weight == CoreStyle.BOLD_FONT_WEIGHT)
    return Font.BOLD;

  return Font.PLAIN;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:7,代码来源:GeneratedImageRenderer.java

示例8: muestraMensajeRecibido

@Override
public synchronized void muestraMensajeRecibido(MensajeSimple m){

	String nivel = "";
	Color c = new Color(0);
	
	Font f = new Font("Times",Font.PLAIN,12);
	areaTrazaMensajes.setFont(f);
	areaTrazaMensajes.setForeground(Color.black);
	//Concateno el nuevo mensaje con el que habia antes

	areaTrazaMensajes.append("Mensaje Recibido --> Emisor : "+m.getEmisor()+". Clase del Contenido: "+m.getContenido().getClass().getSimpleName()+"\n"
                    + "      Valores Contenido : "+"\n" +m.getContenido()+"\n");//+". Entidad emisora: "+traza.getEntidadEmisora()+"\n");
	//si escribo null,borra lo anterior
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:15,代码来源:PanelTrazasAgteReactivo.java

示例9: EntrantRenderer

public EntrantRenderer()
{
	super();
	background = new Color(240, 240, 240);
	backgroundSelect = new Color(120, 120, 120);
	backgroundError = new Color(255, 120, 120);
	backgroundErrorSelect = new Color(230, 100, 100);
	topLine = null;
	bottomLine = null;

	topFont = new Font(Font.DIALOG, Font.BOLD, 11);
	bottomFont = new Font(Font.DIALOG, Font.PLAIN, 11);
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:13,代码来源:DriverTable.java

示例10: setStyle

private void setStyle(ByteBuffer os_2Table) {
        /* fsSelection is unsigned short at buffer offset 62 */
        if (os_2Table == null || os_2Table.capacity() < 64) {
            super.setStyle();
            return;
        }
        int fsSelection = os_2Table.getChar(62) & 0xffff;
        int italic  = fsSelection & fsSelectionItalicBit;
        int bold    = fsSelection & fsSelectionBoldBit;
        int regular = fsSelection & fsSelectionRegularBit;
//      System.out.println("platname="+platName+" font="+fullName+
//                         " family="+familyName+
//                         " R="+regular+" I="+italic+" B="+bold);
        if (regular!=0 && ((italic|bold)!=0)) {
            /* This is inconsistent. Try using the font name algorithm */
            super.setStyle();
            return;
        } else if ((regular|italic|bold) == 0) {
            /* No style specified. Try using the font name algorithm */
            super.setStyle();
            return;
        }
        switch (bold|italic) {
        case fsSelectionItalicBit:
            style = Font.ITALIC;
            break;
        case fsSelectionBoldBit:
            if (FontUtilities.isSolaris && platName.endsWith("HG-GothicB.ttf")) {
                /* Workaround for Solaris's use of a JA font that's marked as
                 * being designed bold, but is used as a PLAIN font.
                 */
                style = Font.PLAIN;
            } else {
                style = Font.BOLD;
            }
            break;
        case fsSelectionBoldBit|fsSelectionItalicBit:
            style = Font.BOLD|Font.ITALIC;
        }
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:TrueTypeFont.java

示例11: setFontSize

/**
 * Sets a new font size for the axes labels and title.
 *
 * @param fontSize the fontSize to set, e.g 12. This is in points.
 */
synchronized public void setFontSize(int fontSize) {
    if (this.fontSize != fontSize) {
        this.fontSize = fontSize;
        textRenderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, getFontSize()), true, true);
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:11,代码来源:ImageDisplay.java

示例12: Grid

/**
 * Constructor declaration
 *
 */
public Grid() {

    super();

    fFont = new Font("Dialog", Font.PLAIN, 12);

    setLayout(null);

    sbHoriz = new Scrollbar(Scrollbar.HORIZONTAL);

    add(sbHoriz);

    sbVert = new Scrollbar(Scrollbar.VERTICAL);

    add(sbVert);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:Grid.java

示例13: Scrollbar

public Scrollbar(Color myColor, double width)
{
    super(ScrollBox.this.getWidth() - width,0,width,0,"",new Font("",Font.PLAIN,16),Color.BLACK,new Background(myColor),myColor,myColor,AstheticButton.DEFAULT_BUTTON_PRESS_SHADOW,0) ;
}
 
开发者ID:AutonomousCarProject,项目名称:AutonomousCar,代码行数:4,代码来源:ScrollBox.java

示例14: generateFont

public static Font generateFont(int Size){
	return new Font("Arial", Font.PLAIN, Size); // Generates font 
}
 
开发者ID:PhentixDevs,项目名称:PhySIX,代码行数:3,代码来源:FontUtil.java

示例15: drawSelectLine

/**
 * Draw the selected line of the convex hull 
 * and the information about it
 * @param g Graphic object
 * @param p1 The first point of the line
 * @param p2 The second point of the line
 * @param s3d Information aboute the classes
 * @param classNames The name of the classes
 */
public void drawSelectLine(Graphics2D g, DPoint p1, DPoint p2, Vector<Object> s3d, String[] classNames) {
	if ((p1 != null) && (p2 != null)) {
		//Draw the selected line
		Stroke oldStro = g.getStroke();
		Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
		g.setStroke(stroke);
		g.setColor(Color.BLACK);
		g.drawLine((int) (p1.getX() * scale) + tran_x, tran_y - (int) (p1.getY() * scale), (int) (p2.getX() * scale) + tran_x, tran_y
				- (int) (p2.getY() * scale));
		g.setStroke(oldStro);

		//Set the middle point
		int x = (int) p2.getX() + (int) ((p1.getX() - p2.getX()) / 2);
		int y = (int) p2.getY() + (int) ((p1.getY() - p2.getY()) / 2);
		x = (int) (x * scale) + tran_x + (pointSize + 3);
		y = tran_y - (int) (y * scale) - (pointSize + 1);

		Font label = new Font("Arial", Font.PLAIN, 7 + pointSize);
		g.setFont(label);

		//Draw the label
		for (int i = 0; i < s3d.size(); i++) {
			// Current sector
			FinalSect2D sect = (FinalSect2D) s3d.get(i);
			String pb11 = format2Dec.format(sect.getBeta11() * 100);
			String pb12 = format2Dec.format(sect.getBeta1() * 100);
			String pb21 = format2Dec.format(sect.getBeta22() * 100);
			String pb22 = format2Dec.format(sect.getBeta2() * 100);

			if (sect.countStation() < 2) {
				continue;
			}

			Station2D d1 = (sect.getstation()).get(0);
			Station2D d2 = (sect.getstation()).get(1);
			int d1x = (int) (d1.getVert()).getX();
			int d1y = (int) (d1.getVert()).getY();
			int d2x = (int) (d2.getVert()).getX();
			int d2y = (int) (d2.getVert()).getY();
			int p1x = (int) (p1.getX() * 100);
			int p1y = (int) (p1.getY() * 100);
			int p2x = (int) (p2.getX() * 100);
			int p2y = (int) (p2.getY() * 100);
			double t1 = ((p1.getY() - p2.getY()) / ((p2.getX() * p1.getY()) - (p1.getX() * p2.getY())));
			double t2 = ((p2.getX() - p1.getX()) / ((p2.getX() * p1.getY()) - (p1.getX() * p2.getY())));

			if (((d1x == p1x) && (d1y == p1y) && (d2x == p2x) && (d2y == p2y)) || ((d1x == p2x) && (d1y == p2y) && (d2x == p1x) && (d2y == p1y))) {
				g.drawString(classNames[0] + "=" + format4Dec.format(t1) + " job/sec", x, y - (8 + pointSize));
				g.drawString(classNames[1] + "=" + format4Dec.format(t2) + " job/sec", x, y);

				g.drawString(classNames[1] + "% [" + pb22 + "," + pb12 + "]", x, y - 2 * (8 + pointSize));
				g.drawString(classNames[0] + "% [" + pb21 + "," + pb11 + "]", x, y - 3 * (8 + pointSize));
				break;
			}
		}
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:66,代码来源:PainterConvex2D.java


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