Search:

Type: Posts; User: Norm

Page 1 of 2 1 2

Search: Search took 0.11 seconds.

  1. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    I think this could be the problem:
    int myX = myArrayList[myIndex].getX();
    if it were coded:
    int myX = myArray[myIndex].getX();
    where myArray was an array it should work.
    With an arraylist it...
  2. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    You will have to learn to read the API doc and use it. That's where everything is defined. And there are often examples of how to use a class. If it's not there it probably doesn't exist.

    Here's ...
  3. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    The Point class's x and y variables are public. Get x by: refToPoint.x

    If you aren't going to write a test class to learn how to use the ArrayList and Point classes, there is not much more I can...
  4. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    Write the simple program and work out the syntax problems there. It will be easier to post code with problems if its a short simple program.

    Read the API doc to see how to use the methods and...
  5. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    You need to learn how to use the classes. Mixing a lot of new code into a larger program makes it very hard to work on fixing the problems. The smaller program will use some of the class's methods...
  6. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    Did you write the simple program to learn how to use the ArrayList and Point classes?
    When you get that to work you will know how to use the classes.
  7. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    You could use the Java SE Point class instead of making your own.

    To get some experience using the classes, make a test program that creates an array list, adds several Point objects to it and...
  8. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    Look at using the Point class.
  9. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    That was discussed in post#55
  10. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    Giving it a size is not too important, it will expand itself if needed.

    You want to save every point that is used to draw segments of the lines you want drawn.

    An advantage of having the points...
  11. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    No that is defining a class.
    This statement in your program is at the class level:
    BlankArea blankArea;

    Look at the definition of scope.
  12. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    Time for some design work and programming:
    Create the arraylist at the class level
    Add points to it where you currently save x,y for the mouse's new location.
    Get the points out of the list and...
  13. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    Calling super.paintComponent().
  14. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    I haven't experimented with leaving out the call to super.paintComponent(). The current program doesn't misbehave on my 1.6 or 1.7 systems.

    Java could be doing weird things on the graphics.
    ...
  15. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    I make BlankArea an inner class.
  16. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    I don't get the textArea display at the top.
  17. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    Post #30 doesn't have a definition for BlankArea. All the testing classes should be together.
  18. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    Call super.paintComponent(g)
  19. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    If you want testers to use the same code as you are using, you need to post it.
  20. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    I don't know what java does with the graphics between calls to paintComponent().
    I've always cleared it to get rid of any left over garbage and to be sure I had control over what was being drawn on...
  21. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    Strange that the top component has the text area with scroll bars.
    Here's what I get:
  22. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    Time for some reading. The java tutorial, the API doc and what Search finds here or with Google.
  23. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    I don't see that happen. Can you take a screen shot and attach it?

    Call the super method and draw the whole screen from the arraylist.
  24. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    Its frail and subject to java recreating a clean graphics context which will lose the old lines.
  25. Replies
    85
    Views
    5,080

    Re: drawLine problem, lines not connected

    That will sort of work until something covers the screen.
    Minimize and restore the window.
Results 1 to 25 of 35
Page 1 of 2 1 2