Thanks a lot copeg, I just drawed Octagon and finally solved my 2 problems.
b-)
Type: Posts; User: ice
Thanks a lot copeg, I just drawed Octagon and finally solved my 2 problems.
b-)
Thank you a lot copeg, your suggestion of "replace fillPolygon with drawPolygon" is so useful, I can see it is a line now. But how to change those coordinates to show a octagon?
Ok, copeg, I am not sure which part of the code that causes the problem - it doesn't draw polygon. Here is the whole code:
package brainydraw;
import java.awt.*;
import java.awt.event.*;...
hi guys, the problem is still not solved, anyone got more ideas?
Hi copeg
Sorry, that extra setVisible was there by accident, now I removed it. Actually I fully implented your suggestionn when I ran it, but the black polygon is really not shown.
Hi brt93yoda
Thanks very much for sharing what you know. But the main problem still can't be solved - the black polygon is not shown.
Any ways to make it visible?
Thanks heaps
Hi copeg
Thanks, I have shifted setVisible to below, but it still shows an empty frame. You mean OctagonDrag class not used? Is this the reason that black polygon is not shown?
public void...
Great, guys, thanks a lot, now I solved to close the frame, see below updated code. But that black Polygon is still not displayed, where is it?
package brainydraw;
import java.awt.*;
import...
Hi copeg
I just read a bit stack trace, then looked at the error I got, which is:
Line24 is f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); But why? Why?why ?
why can't 'f' get initialized? ...
Hi aussiemcgr
Thanks for your advice, I have changed repaint(); to panel.repaint();, then ran it, it still display exactly same as before: an empty frame and it can't be closed by pressing "x"....
Hi db
Thanks for more idea. I don't inderstand why you said I didn't add mouse listeners to the component? But "addMouseListener(new MousePressListener());" was in init method. ?
Hi db
I have modified it with adding component and repaint() into init() method, please see above new code, but it still doesn't make a difference.
Any more ideas?
Thanks heaps
Hi copeg
Thanks very much for reply, now I changed Frame to Jframe and use method paintcompinent, but it does not make any difference. (You said show() is depreciated, but actually it works fine...
Hi guys
I have 2 problems here:
1. Below code does not draw a black Polygon on the frame, only shows an empty Frame named "Poppy"
2. Once the frame shows, I can't close it by clicking "x" at the...