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...
Type: Posts; User: Norm
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...
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 ...
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...
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...
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...
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.
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...
Look at using the Point class.
That was discussed in post#55
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...
No that is defining a class.
This statement in your program is at the class level:
BlankArea blankArea;
Look at the definition of scope.
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...
Calling super.paintComponent().
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.
...
I make BlankArea an inner class.
I don't get the textArea display at the top.
Post #30 doesn't have a definition for BlankArea. All the testing classes should be together.
Call super.paintComponent(g)
If you want testers to use the same code as you are using, you need to post it.
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...
Strange that the top component has the text area with scroll bars.
Here's what I get:
Time for some reading. The java tutorial, the API doc and what Search finds here or with Google.
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.
Its frail and subject to java recreating a clean graphics context which will lose the old lines.
That will sort of work until something covers the screen.
Minimize and restore the window.