now, i am trying to do it inside a JFrame. but, i am really confused on how to do it.
i tried to get make the same output that the applet displays but this time inside the JFrame. but it only shows up the frame without the painted rects.
Joined: Feb 03, 2009
first idea I've got:
in the last sourcecode attached, in line 7 You have method called rawr() where You add components to JFrame but You never invoke this method so it's never added to JFrame - am I right?
1) Like Bartek said, you are never invoking the rawr(). After the line where you set the close operation would be suitable.
2) The setVisible should logically be the last line in your mail. In general, initialize, set attributes like icon,title etc, add children and make visible is the way to go.
3) You do not need the repaint. When you add any child to the parent before the call to visible, it draws itself. No need to explicitly invoke the repaint.
4) You got one duplicated call to setVisible in the rawr. You dont need that either, as you are going to make it visible from your main.
You also need to build and show the GUI on the EDT. Typically one should use the SwingUtilities#invokeLater. I will leave it as a search exercise for you to figure out why it needs to be done this way.