本文整理汇总了Java中java.awt.RenderingHints.VALUE_ANTIALIAS_ON属性的典型用法代码示例。如果您正苦于以下问题:Java RenderingHints.VALUE_ANTIALIAS_ON属性的具体用法?Java RenderingHints.VALUE_ANTIALIAS_ON怎么用?Java RenderingHints.VALUE_ANTIALIAS_ON使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.RenderingHints
的用法示例。
在下文中一共展示了RenderingHints.VALUE_ANTIALIAS_ON属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readObject
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.borderStroke = SerialUtilities.readStroke(stream);
this.borderPaint = SerialUtilities.readPaint(stream);
this.backgroundPaint = SerialUtilities.readPaint(stream);
this.progressListeners = new EventListenerList();
this.changeListeners = new EventListenerList();
this.renderingHints = new RenderingHints(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
// register as a listener with sub-components...
if (this.title != null) {
this.title.addChangeListener(this);
}
for (int i = 0; i < getSubtitleCount(); i++) {
getSubtitle(i).addChangeListener(this);
}
this.plot.addChangeListener(this);
}
示例2: paint
public void paint(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHints(rh);
Dimension size = getSize();
if (initialize) {
reset(size.width, size.height);
initialize = false;
}
this.step(size.width, size.height);
render(size.width, size.height, g2);
}
示例3: actionPerformed
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source == cmbPaint) {
paintType = (PaintType)cmbPaint.getSelectedItem();
} else if (source == cmbCycle) {
cycleMethod = (CycleMethod)cmbCycle.getSelectedItem();
} else if (source == cmbSpace) {
colorSpace = (ColorSpaceType)cmbSpace.getSelectedItem();
} else if (source == cmbShape) {
shapeType = (ShapeType)cmbShape.getSelectedItem();
} else if (source == cmbXform) {
xformType = (XformType)cmbXform.getSelectedItem();
} else if (source == cbAntialias) {
antialiasHint = cbAntialias.isSelected() ?
RenderingHints.VALUE_ANTIALIAS_ON :
RenderingHints.VALUE_ANTIALIAS_OFF;
} else if (source == cbRender) {
renderHint = cbRender.isSelected() ?
RenderingHints.VALUE_RENDER_QUALITY :
RenderingHints.VALUE_RENDER_SPEED;
}
gradientPanel.updatePaint();
}
示例4: paint
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
g2d.addRenderingHints(renderHints);
g2d.setPaint(Color.BLACK);
Stroke stroke = new BasicStroke(2.f,
BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER);
g2d.setStroke(stroke);
PintarTextos(g2d);
}
示例5: paintComponent
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g); //paint background
if (diagramaAtual == null) {
return;
}
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
Canvas.setPaint(Color.BLACK);
Stroke stroke = new BasicStroke(2.f,
BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER);
Canvas.setStroke(stroke);
Canvas.drawRect(box.getLocation().x, box.getLocation().y, box.getWidth(), box.getHeight());
Canvas.setPaint(Color.GRAY);
Canvas.drawRect(box.getLocation().x + 1, box.getLocation().y + 1, box.getWidth(), box.getHeight());
//Canvas.setPaint(Color.BLACK);
}
示例6: paint
@Override
public void paint(Graphics g) {
RenderingHints renderHints =
new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
super.paint(g);
for (IObjetoPintavel p: pintaveis) {
p.setOutroPintor(true);
p.DoPaint(Canvas);
p.setOutroPintor(false);
}
}
示例7: paint
@Override
public void paint(Graphics g) {
super.paint(g);
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
Canvas.setStroke(new BasicStroke(
1f,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND));
Canvas.setPaint(Color.BLACK);
paint2D(Canvas);
}
示例8: TreePanel
/**
* Constructs a new tree panel which handles drawing of the current tree.
*
* @param window
* The window used for position related information.
*
* @param manager
* The style manager used to handle colors.
*/
public TreePanel(final Window window, final StyleManager manager) {
this.mWindow = window;
this.mHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
this.mHints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
this.mHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
this.mHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
this.mManager = manager;
this.addMouseMotionListener(this);
this.setPreferredSize(window.getTreePanelSize());
this.setBorder(LineBorder.createBlackLineBorder());
this.setBackground(manager.getTreepanelColor());
}
示例9: updateImageBuffer
public void updateImageBuffer(int width, int height)
{
this.imageBuffer = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
this.imageBufferGraphics = (Graphics2D) imageBuffer.getGraphics();
RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
this.imageBufferGraphics.setFont(font);
imageBufferGraphics.setRenderingHints(rh);
standardTransform = imageBufferGraphics.getTransform();
}
示例10: readObject
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.borderStroke = SerialUtilities.readStroke(stream);
this.borderPaint = SerialUtilities.readPaint(stream);
this.backgroundPaint = SerialUtilities.readPaint(stream);
this.progressListeners = new EventListenerList();
this.changeListeners = new EventListenerList();
this.renderingHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
// register as a listener with sub-components...
if (this.title != null) {
this.title.addChangeListener(this);
}
for (int i = 0; i < getSubtitleCount(); i++) {
getSubtitle(i).addChangeListener(this);
}
if (this.legend != null) {
this.legend.addChangeListener(this);
}
//if (this.plot != null) {
// the plot can never be null.
this.plot.addChangeListener(this);
//}
}
示例11: ExternalPaint
public void ExternalPaint(Graphics g) {
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
Canvas.setStroke(new BasicStroke(
1f,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND));
Canvas.setPaint(Color.BLACK);
for (int i = subItens.size() - 1; i > -1; i--) {
Elementar e = subItens.get(i);
if (e.CanPaint()) {
e.DoPaint(Canvas);
}
}
}
示例12: ExternalPaintSelecao
public void ExternalPaintSelecao(Graphics g) {
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
Canvas.setStroke(new BasicStroke(
1f,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND));
Canvas.setPaint(Color.BLACK);
for (int i = getItensSelecionados().size() - 1; i > -1; i--) {
FormaElementar e = getItensSelecionados().get(i);
e.HidePontos(true);
if (e.CanPaint()) {
e.DoPaint(Canvas);
}
e.HidePontos(false);
}
}
示例13: getListCellRendererComponent
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
Legenda.ItemDeLegenda entry = (Legenda.ItemDeLegenda) value;
setText(entry.getTexto());
BufferedImage off_Image = new BufferedImage(ehLina ? 32 : 16, 16, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = off_Image.createGraphics();
RenderingHints renderHints =
new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
g.addRenderingHints(renderHints);
g.setColor(entry.getCor());
if (ehLina) {
g.fillRect(1, 6, 30, 4);
} else {
g.fillRect(1, 1, 14, 14);
}
ImageIcon img = new ImageIcon(off_Image);
setIcon(img);
if (isSelected) {
setBackground(HIGHLIGHT_COLOR);
setForeground(Color.white);
} else {
setBackground(Color.white);
setForeground(Color.black);
}
return this;
}
示例14: paintComponent
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g); //paint background
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
//renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
Canvas.setStroke(new BasicStroke(
1f,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND));
Canvas.setPaint(Color.BLACK);
ProcessPaint(Canvas);
}
示例15: drawArrow
private void drawArrow(Graphics2D g, int x1, int y1, int x2, int y2) {
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.addRenderingHints(renderHints);
g.setStroke(new BasicStroke(
getSetaLargura(),
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND));
//g.setPaint(Color.BLACK);
int ARR_SIZE = 3 + getSetaLargura();
double dx = x2 - x1, dy = y2 - y1;
double angle = Math.atan2(dy, dx);
int len = (int) Math.sqrt(dx * dx + dy * dy);
AffineTransform at = AffineTransform.getTranslateInstance(x1, y1);
at.concatenate(AffineTransform.getRotateInstance(angle));
//AffineTransform bkp = g.getTransform();
g.setTransform(at);
// Draw horizontal arrow starting in (0, 0)
g.drawLine(ARR_SIZE, 0, len - ARR_SIZE, 0);
if (isSetaPontaEsquerda()) {
g.fillPolygon(new int[]{len, len - ARR_SIZE, len - ARR_SIZE, len},
new int[]{0, -ARR_SIZE, ARR_SIZE, 0}, 4);
}
if (isSetaPontaDireita()) {
g.fillPolygon(new int[]{0, ARR_SIZE, ARR_SIZE, 0},
new int[]{0, -ARR_SIZE, ARR_SIZE, 0}, 4);
}
}