Would it really hurt you after a week to maybe put out a little extra effort and give her the answer
@scotty, Yes, it would hurt. I don't believe in
spoon feeding the answer when people asking are not willing to make an effort. 4 times I had to ask for a
SSCCE before one was created. 4 times I mentioned the getPreferredSize() method need to be implemented. Yet this was still NOT done when the SSCCE was posted and there was no evidence that she even attempted to implement the method. If you don't know how to implement the method you can always search the forum/web for that method name and find plenty of examples to give you ideas on how you might implement the method. You get what you give.
but the component console size printout is still showing 0x0
All components are created with a 0 size and location. The size and location is determined by the layout manager. The layout manager is not invoked until you pack() the frame or make the frame visible.
the jScrollPane is still not there.
That is because you used the pack() method so all components are displayed at their preferred size so there is no reason for the scrollbars to appear. Use your mouse to resize the frame smaller and the scrollbars will appear. This is why it is important to have a proper implementation of the getPreferredSize() method, so the scrollbars will appear as needed.
A better implementation of the getPreferredSize() method should take advantage of your knowledge of your class. In your case all you painting is done based on the values of hard coded variables you can just use a mathematical formula:
In this case a dimension of (2440, 1240) is returned. This is too large to display on a monitor so
you should not use the pack() method on your frame. Instead use something like setSize(800, 600) to make the frame size more reasonable and you will see the scrollbars automatically.
Other comments:
1. Don't call you class Rectangle. There is already a Rectangle class in the JDK by that name so it get confusing
2. Follow standard
Java naming conventions. Class names should not have an "_" in the name. There are no classes like this in the JDK or any text book or tutorial that I have ever seen, so don't make up your own conventions.