What are the benefits of using an existing layout manager as opposed writing a listener that handles resizing functions? For instance, I needed to arrange buttons in a grid and center the grid:

```
int h = component.getHeight() / 11;
int w = component.getWidth() / 9;
int offsetX = w;
int offsetY = h;
int x = (2 * column) * w - offsetX;
int y = (2 * row) * h - offsetY;

setBounds(x, y, w, h);

```

Instead of fumbling around with a layout manager I wrote this small bit of code that is activated for the buttons whenever the JPanel is resized. If I were to use a layout manager, it would be more cumbersome to write the code to arrange everything and if I were to say add a component to the JPanel, things would get even more complex as opposed to simply adding a few additions or subtractions.

So given this, would there be any benefits to using a layout manager in a situation as this or would a few customized lines be easier to use and maintain?