Results 1 to 3 of 3
Thread: create own shape
- 12-10-2010, 04:18 PM #1
Member
- Join Date
- Dec 2010
- Posts
- 1
- Rep Power
- 0
create own shape
Hi, every body
I created a simple application in netbeans which uses wu algorithm for drawing antialiased lines. The application is made from a JFrame and JPanel. I can choose the color of the line etc. The problem is that I want to be able to use the algorithm in other applications and I dont want to copy it everytime to new project. I would like to know if there is possibility to create similar class to Line2D from Graphics2D so I could draw the line like this:
I thougt that I would copy the line2D class and recreate it to suit my needs but it seems that there is no drawing process at all in this class. Could you please tell me if there is any way to create a class similar to line2D?Java Code:protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(lineColor); Shape s = new WuLine(x1, y1, x2, y2); g2d.draw(s); }
Thanks.Last edited by kepep; 12-10-2010 at 06:03 PM. Reason: Im sorry I forgot to remove non english comments from the source code.
- 12-11-2010, 12:20 AM #2
Member
- Join Date
- Dec 2010
- Posts
- 1
- Rep Power
- 0
Hi,
im kinda new to Java too, but i cant see any assigment from RHS...
Havent you forgot return shape object from the contructor?
Regards RL
- 12-15-2010, 07:43 PM #3
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
Similar Threads
-
Help with Move Shape
By romina in forum AWT / SwingReplies: 2Last Post: 12-09-2010, 03:25 AM -
how to change the shape of the JFrame to a oval shape
By kiki2009 in forum Java 2DReplies: 1Last Post: 04-02-2010, 12:48 PM -
rezise shape
By frankenstein in forum Java 2DReplies: 5Last Post: 07-30-2009, 12:44 AM -
implementing shape
By sidkdbl07 in forum Java 2DReplies: 1Last Post: 01-12-2008, 06:42 PM -
tool to create shape frame
By boy22 in forum AWT / SwingReplies: 1Last Post: 08-05-2007, 04:10 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks