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


Java Graphics2D.getRenderingHints方法代码示例

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


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

示例1: paint

import java.awt.Graphics2D; //导入方法依赖的package包/类
public @Override void paint(Graphics g) {
    Object value = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N
    Map renderingHints = (value instanceof Map) ? (java.util.Map)value : null;
    if (renderingHints != null && g instanceof Graphics2D) {
        Graphics2D g2d = (Graphics2D) g;
        RenderingHints oldHints = g2d.getRenderingHints();
        g2d.setRenderingHints(renderingHints);
        try {
            super.paint(g2d);
        } finally {
            g2d.setRenderingHints(oldHints);
        }
    } else {
        super.paint(g);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ListCompletionView.java

示例2: paint

import java.awt.Graphics2D; //导入方法依赖的package包/类
public
@Override
void paint(Graphics g) {
    // Antialiasing if necessary
    Object value = (Map) (Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N
    Map renderingHints = (value instanceof Map) ? (java.util.Map) value : null;
    if (renderingHints != null && g instanceof Graphics2D) {
        Graphics2D g2d = (Graphics2D) g;
        RenderingHints oldHints = g2d.getRenderingHints();
        g2d.setRenderingHints(renderingHints);
        try {
            super.paint(g2d);
        } finally {
            g2d.setRenderingHints(oldHints);
        }
    } else {
        super.paint(g);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ResultBar.java

示例3: paint

import java.awt.Graphics2D; //导入方法依赖的package包/类
public @Override void paint(Graphics g) {
    Object value = Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints"); //NOI18N
    Map renderingHints = (value instanceof Map) ? (java.util.Map)value : null;
    if (renderingHints != null && g instanceof Graphics2D) {
        Graphics2D g2d = (Graphics2D) g;
        RenderingHints oldHints = g2d.getRenderingHints();
        g2d.setRenderingHints(renderingHints);
        try {
            super.paint(g2d);
        } finally {
            g2d.setRenderingHints(oldHints);
        }
    } else {
        super.paint(g);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ListCompletionView.java

示例4: gInfo

import java.awt.Graphics2D; //导入方法依赖的package包/类
public gInfo(Graphics2D g)
{
	transform = g.getTransform();
	paint = g.getPaint();
	stroke = g.getStroke();
	font = g.getFont();
	composite = g.getComposite();
	bgrnd = g.getBackground();
	shape = g.getClip();
	hints = g.getRenderingHints();
}
 
开发者ID:Chroniaro,项目名称:What-Happened-to-Station-7,代码行数:12,代码来源:TStack.java

示例5: paintComponent

import java.awt.Graphics2D; //导入方法依赖的package包/类
/**
 * 
 */
public void paintComponent(Graphics g) {
  super.paintComponent(g);

  // Draws the background
  paintBackground(g);

  // Creates or destroys the triple buffer as needed
  if (tripleBuffered) {
    checkTripleBuffer();
  } else if (tripleBuffer != null) {
    destroyTripleBuffer();
  }

  // Paints the buffer in the canvas onto the dirty region
  if (tripleBuffer != null) {
    mxUtils.drawImageClip(g, tripleBuffer, this);
  }

  // Paints the graph directly onto the graphics
  else {
    Graphics2D g2 = (Graphics2D) g;
    RenderingHints tmp = g2.getRenderingHints();

    // Sets the graphics in the canvas
    try {
      mxUtils.setAntiAlias(g2, antiAlias, textAntiAlias);
      drawGraph(g2, true);
    } finally {
      // Restores the graphics state
      g2.setRenderingHints(tmp);
    }
  }

  eventSource.fireEvent(new mxEventObject(mxEvent.PAINT, "g", g));
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:39,代码来源:mxGraphComponent.java

示例6: paintComponent

import java.awt.Graphics2D; //导入方法依赖的package包/类
/**
 * 
 */
public void paintComponent(Graphics g)
{
	super.paintComponent(g);

	// Draws the background
	paintBackground(g);

	// Creates or destroys the triple buffer as needed
	if (tripleBuffered)
	{
		checkTripleBuffer();
	}
	else if (tripleBuffer != null)
	{
		destroyTripleBuffer();
	}

	// Paints the buffer in the canvas onto the dirty region
	if (tripleBuffer != null)
	{
		mxUtils.drawImageClip(g, tripleBuffer, this);
	}

	// Paints the graph directly onto the graphics
	else
	{
		Graphics2D g2 = (Graphics2D) g;
		RenderingHints tmp = g2.getRenderingHints();

		// Sets the graphics in the canvas
		try
		{
			mxUtils.setAntiAlias(g2, antiAlias, textAntiAlias);
			drawGraph(g2, true);
		}
		finally
		{
			// Restores the graphics state
			g2.setRenderingHints(tmp);
		}
	}

	eventSource.fireEvent(new mxEventObject(mxEvent.PAINT, "g", g));
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:48,代码来源:mxGraphComponent.java

示例7: draw

import java.awt.Graphics2D; //导入方法依赖的package包/类
public void draw(Graphics2D g) {
//	if(!display) return;
int yr1 = 1900;
int yr2 = 2005;
try {
	long[] interval = timeInterval();
	Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
	if( db.before.isSelected() ) {
			cal.setTimeInMillis(interval[0]);
			yr1 = cal.get(cal.YEAR);
	}
	if( db.after.isSelected() ) {
		cal.setTimeInMillis(interval[1]);
		yr2 = cal.get(cal.YEAR);
	}
} catch(Exception e) {
}
//	System.out.println( yr1 +"\t"+ yr2);
	float size = 2.0f + 6f/(float)map.getZoom();
	Arc2D.Float dot = new Arc2D.Float(-size/2f, -size/2f, size, size, 0f, 360f, Arc2D.CHORD);
	float size1 = 2.0f + 7f/(float)map.getZoom();
	GeneralPath triangle = new GeneralPath();
	triangle.moveTo(0f, size1/2f );
	triangle.lineTo(size1/2f, -size1/2f );
	triangle.lineTo(-size1/2f, -size1/2f );
	triangle.closePath();
//	Rectangle2D.Float square = new Rectangle2D.Float(-size1/2f, -size1/2f, size1, size1);
	AffineTransform at = g.getTransform();
	g.setStroke( new BasicStroke( .5f/(float)map.getZoom() ) );
	RenderingHints hints = g.getRenderingHints();
	g.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING,
			RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
	g.setRenderingHint( RenderingHints.KEY_ANTIALIASING,
			RenderingHints.VALUE_ANTIALIAS_ON);

	Shape shape = dot;
	for(int k=0 ; k<xyd.length ; k++) {
	//	Shape shape = triangle;
	//	if( xyd[k][5]<=1991f ) shape = dot;
		if( xyd[k][5]>yr2 )continue;
		if( xyd[k][5]<yr1 )continue;
		g.translate( (double)xyd[k][0], (double)xyd[k][1] );
	//	g.setColor( Color.black );
	//	g.draw(shape);
		g.setColor( color[k] );
		g.fill(shape);
		g.setColor( Color.black );
		g.draw(shape);
		g.setTransform( at );
	}
	g.setFont( (new Font("Serif", Font.BOLD, 1)).deriveFont( size1*1.5f));
	Rectangle2D rect = map.getClipRect2D();
	double s = (double) size1;
	double x = rect.getX() + s;
	double y = rect.getY() + 2.*s;
//	g.translate( x, y );
//	g.setColor( Color.white );
//	g.fill( dot );
//	g.setColor( Color.black );
//	g.draw( dot );
//	g.translate( s, s/2.);
//	String year = db.startF.getText();
//	String dateString = db.before.isSelected()
//		? "before 1/1/"+year
//		: "after 1/1/"+year;
//	g.drawString( dateString, 0, 0);
//	g.drawString( "before 1/1/1991", 0, 0);
//	g.setTransform(at);
//	g.translate( x, y+s*2.0 );
//	g.setColor( Color.white );
//	g.fill( triangle );
//	g.setColor( Color.black );
//	g.draw( triangle );
//	g.translate( s, s/2.);
//	g.drawString( "after 1/1/1991", 0, 0);
	g.setTransform(at);
	g.setRenderingHints( hints);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:79,代码来源:D18oObservations.java


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