I’m working with java and trying to do some anti-aliasing drawing. I used some code that I found in a book, and it causes my computer to crash. (GNOME becomes unresponsive, fragments of the screen get shifted around, windows become invisible, etc) If I hit ctrl+alt+backspace then it gets me out and I can log back in, but that’s my only option at that point.
I’m running the following code in eclipse:
import java.awt.*;
public class GraphicsTest extends ApplicationFrame {
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
Shape shapeOne = new Ellipse2D.Double(40, 20 , 80, 80);
Shape shapeTwo = new Rectangle2D.Double(60, 40 , 80, 80);
setBackground(Color.WHITE);
setLayout(new BorderLayout());
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.draw(shapeOne);
g2.draw(shapeTwo);
}
public static void main(String] args) {
GraphicsTest g = new GraphicsTest();
g.setTitle("Graphics");
g.setSize(300, 150);
g.center();
g.setVisible(true);
}
}
if i comment out:
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
then everything runs fine, so obviously it’s a problem with the antialiasing.
I’m not even sure where I should begin to start trying to fix this.
EDIT: BTW, it works fine in KDE3, so it has to be a gnome problem.