Hi, i have a question about 2d programming, i must make a "tv test picture" and i don;t know howto make it because of all the variety in the picture.
Ive been told that i must work in layers?
but what about the circle and the color thats "īnvisible" outside the circle?
and howto to make the white/black border outside?
like this figure:
this is also the same picture that i have to make in java.
Thank you .
this my code:
the file called: Main and MyFrame
i know it it isnt much but thats the best that i can do right now.
i also have problem drawing the circle in the middle of the screen.
By working in layers, it means you need to build things on top of each other. For example, start with a white background, then draw gray boxes and a black border (using for loops), then the circle on top of that... and so on.
In your code, you don't have a main method. That's why it won't run. You need a main method to call all of your other methods. They don't just happen automatically.
Try starting with this code:
public class TVTest
public static void main(String args)
// create Frame
Frame myFrame = new Frame();
// create graphics object
Graphics myGraphics = myFrame.getGraphics();
// add listener to close frame
public void windowClosing(WindowEvent e)
I hope that helps, at least to get the basic format for making frames (and being able to close them).
For the circle in the middle of the screen:
myGraphics.drawOval(0, 0, myFrame.getWidth(), myFrame.getHeight())
that'll do it.