Draw it out on a sheet of paper and define the appropriate coordinates. See Drawing Arbitrary Shapes
Type: Posts; User: copeg
Draw it out on a sheet of paper and define the appropriate coordinates. See Drawing Arbitrary Shapes
There are still a few things wrong with your code in general. First, no need to have your class extend JFrame when you are using a JFrame variable for most of everything (the init() function has...
Can you post a short compilable example of the code to this point that demonstrates the problem? With all these posts its hard to be sure where the code stands at this point.
It doesn't work because it only partially implements my suggestion from above. There are 2 setVisible calls...
You are adding components to the frame after it is realized (visible). Add things prior, in this example move the setVisible method to the last call in the init function (in which case repaint is not...
You need to initialize the object: (see Creating Objects)
f = new JFrame();
It may work, but you should not rely on deprecated methods. There is a reason they are deprecated, and its...
Are you reading the stack trace? Any exceptions? This is important information...on close look the variable 'f' is never initialized, and the program sequence sets the frame to visible then, when you...
First, I'd encourage you to use a JFrame rather than a Frame (see How to use JFrames). Second, show is deprecated. Use setVisible(true). Next, you shouldn't override the paint method, especially of...