GeneralPath « Development « Java Swing Q&A





1. GeneralPath curveTo    stackoverflow.com

i would like to know how to define the control point, here is what i do now, but it is really not efficient and the curve is not smooth.

MyPoint pointStart = ...

2. GeneralPath    coderanch.com

I think the API doesn't spell it out in this case (that was the first place I looked). In rooting around Sun for an hour, I get the feeling that this is for making your own seriously goofy shapes. Would that be a correct statement? And it looks like it works like the old LOGO programming language. Is that right?

3. GeneralPath don't works    coderanch.com

import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import javax.swing.*; public class PathDemo { public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new PathPanel()); f.setSize(400,400); f.setLocation(200,200); f.setVisible(true); } } class PathPanel extends JPanel { GeneralPath path; public PathPanel() { addMouseListener(new PathPlacer(this)); setBackground(Color.white); } protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if(path == null) init(); ...