From: Miguel <mi...@jm...> - 2004-06-07 16:28:46
|
I just sent a message to jchempaint-devel that crossed yours in the mail. > On Monday 07 June 2004 12:35, Miguel wrote: >> JChemPaint is using the 2D graphics calls that are built into the JDK. > > Is it? It uses CDK's Renderer2D which has this import: > > import java.awt.Font; > import java.awt.FontMetrics; > import java.awt.Graphics; > import java.awt.Point; > import java.awt.event.MouseEvent; > > I thought Java2D uses Graphics2D ? All Java code since 1.2 uses Java2D. For backwards compatibility, the paint(...) routine still takes a Graphics object. But you can immediately cast this to be a Graphics2D object. void paint(Graphics g) { Graphics2D g2d = (Graphics2D)g; ... } This is the proper way to do it as documented by Sun. You can then use g2d.setRenderingHint(...) to turn on antialiasing. Miguel |