0

Hello I have a problem creating a cache simulator.

I created a panel in witch I want to draw nrofblocks blocks each with blocksize lines.

I don't know what is the best way to do this, that is why I am asking for help.

private static final int LEN = 1024;
/*...*/
int blocksize = Integer.parseInt(textField.getText());
int nrofblocks = LEN/blocksize;

JPanel block_panel = new JPanel();
block_panel.setBounds(140, 16, 534, 398);
getContentPane().add(block_panel);
mKorbel
  • 109,525
  • 20
  • 134
  • 319
Vlad
  • 1
  • 1
    Why not instead of JPanels use Rectangle class, Like [this](http://stackoverflow.com/questions/11400003/how-to-draw-shapens-inside-shapes-solved-new-how-to-create-arraylist-to-use/11400592#11400592). It will give you more control over drawing etc – David Kroukamp Jan 05 '13 at 17:18

1 Answers1

1

I suggest you take a look at GridLayout and here is a tutorial on how to use it.

Juvanis
  • 25,802
  • 5
  • 69
  • 87