When putting widgets like JList or Jbutton on containers like Jpanel , how does one set position as to where they are displayed ,
Printable View
When putting widgets like JList or Jbutton on containers like Jpanel , how does one set position as to where they are displayed ,
If you don't want to use one of the layout managers, Remove the layout manager and use one or more of the JComponent methods to set the components position.
which method to call to remove default layout manager ( flow layout ) , and which method of JComponent
to set position .
Have you read the API doc for the JComponent class to see what methods could be useful?
Are there any that deal with the layout manager or the location and size of the component?
My advice is don't do this. There are very few occasions where you need to manually position components - in all my years of programming in Java I never yet had a situation where I can't get a layout manager to do the job for me (admittedly I had to write my own layout manager on a couple of occasions but it's not that hard to do).Quote:
which method to call to remove default layout manager ( flow layout )
Using layout managers may seem a little complicated at first but once you get the hang of them the benefits are more than worth the effort.