KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jaspersoft > jasperserver > irplugin > gui > AntialiasedEditorPane


1 /*
2  * AntialiasedEditorPane.java
3  *
4  * All rights reserved.
5  * Copyright (C) 2005 JasperSoft Corporation
6  *
7  * JasperSoft Corporation
8  * 303 Second Street, Suite 450 North
9  * San Francisco, CA 94107
10  * http://www.jaspersoft.com
11  *
12  *
13  * Created on May 23, 2006, 3:53 PM
14  *
15  */

16
17 package com.jaspersoft.jasperserver.irplugin.gui;
18
19 import java.awt.Graphics JavaDoc;
20 import java.awt.Graphics2D JavaDoc;
21 import java.awt.RenderingHints JavaDoc;
22 import javax.swing.JEditorPane JavaDoc;
23
24 /**
25  *
26  * @author gtoffoli
27  */

28 public class AntialiasedEditorPane extends JEditorPane JavaDoc {
29     
30     private boolean antialias = true;
31     /** Creates a new instance of AntialiasedEditorPane */
32     public AntialiasedEditorPane() {
33         super();
34     }
35     
36     public void paintComponent(Graphics JavaDoc g)
37     {
38         Graphics2D JavaDoc g2 = (Graphics2D JavaDoc)g;
39         if ( antialias )
40         {
41             g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
42             g2.setRenderingHint( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY );
43         }
44         super. paintComponent(g);
45     }
46
47     public boolean isAntialias() {
48         return antialias;
49     }
50
51     public void setAntialias(boolean antialias) {
52         this.antialias = antialias;
53     }
54     
55 }
56
Popular Tags