Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Add setbounds inside static void main in java  RSS feed

 
Aamir Ali
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am making an application in java, inside static void main, i want to customize all buttons, text areas and want to put them on desired location inside application. I have tried to use setbounds but can not use it, how can i use it, or is there any other way or layout to make my application components customized layout.
 
Campbell Ritchie
Sheriff
Posts: 53740
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I shall move this discussion to our GUIs forum.
You should not be doing anything like that inside the main method. The main method should simply start your application; in the case of a Swing application it would simply start the event dispatch thread.
You should probably not use setBounds on anything other than your top‑level container. You should use a layout, which you can read about in the Java Tutorials, and allow the layout to position your components. That way they retain their appearance if you resize the display.
You might do well to search for a tutorial about MigLayout. I haven't used it, but the people who have all speak well of it.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!