java - No output from JFrame? -
So I'm trying to create a tectonic board, though it is not showing anything. (A main square but it just makes "GameBoard")
Any help will be greatly appreciated, thank you in advance.
So I said that the component can not believe I forgot that, I should be tired.
But now what I get is a red square. } logically, steps for you Do not really miss the board on your Jeffrey: , you are making the Jephragram and rectangle, but never add rectangles to your JFrams. @Emidd said, JeffRam.add () does not accept thumb, so you will need to write a class that reciprocates JComponent under its Display problem (see red only): You have to set layout manager for your
public square rectangle JComponent {public rectangle (int x, int y, int w, int h) {super (); Setbound (X, Y, W, H); SetBackground (Color.black); } Public Zero Color (Graphics G) {g.setColor (getBackground ()); G.fillRect (0, 0, getWidth () - 1, getHeight () - 1); Paintchildren (g); }
frame.ed (...); In your loop paintComponent () method Increases to color. JFrame ; I think GridLayout will be most appropriate in your case:
... JFrame frame = new JFrame (); Frame.setLayout (new grid layout (3,3)); ...
Comments
Post a Comment