Search:

Type: Posts; User: ice

Search: Search took 0.18 seconds.

  1. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    Thanks a lot copeg, I just drawed Octagon and finally solved my 2 problems.
    b-)
  2. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    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?
  3. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    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.*;...
  4. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    hi guys, the problem is still not solved, anyone got more ideas?
  5. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    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.
  6. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    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
  7. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    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...
  8. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    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...
  9. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    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? ...
  10. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    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"....
  11. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    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. ?
  12. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    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
  13. Replies
    26
    Views
    4,355

    Re: How to fix this code?

    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...
  14. Replies
    26
    Views
    4,355

    How to fix this code?

    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...
Results 1 to 14 of 14