I have some JButtons in a JFrame. The layout of JFrame is null. i have given absolute position to button. But when i minimize or maximize frame, the postion of the buttons is getting disturbed how can i set it relative to JFrame dynamically?
Write your own layout. Otherwise, you'll be doing the same thing, just with a mess of listener classes.
Use a layout manager. This is the kind of issue that they are designed to handle automatically.
As others have said, writing your own absolute layout manager is the best way to handle this. Alternatively, you could look at Explicit Layout to see if it meets your needs. There are also references on the web to an AbsoluteLayout class that either does or used to come with Netbeans. Perhaps you could track that down and use it.
Another option from the Java Tutorial:
http://java.sun.com/docs/books/tutorial/uiswing/layout/none.html
I know that in a project I was working on, we needed to do absolute positioning, so we actually made our own Layout (which we called an absolute layout) and passed in constraints to it (which we called the absolute constraints).
Edit: As noted by others, I would recommend using a layout manager unless there is a good reason for absolute positioning. GridBagLayout is a commonly used one, and I have found it to be the best as long as you follow the standards. The java tutorial for it is here:
http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.html