Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to use setBounds() method??  RSS feed

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am not using any layout, but, instead using setBounds method. is there any restriction with setBounds method. See the following code.



what should i provide in contentpane(marked '*')? and how will setBound work?
 
Rob Spoor
Sheriff
Posts: 21090
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to add "jf.add(jl)" or call "jf.getContentPane().add(jl)" (these two actually do the same). However, the call to setBounds will still be ignored. That's because the direct parent of L, jl, still has a LayoutManager that will reposition L.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so, how can i use setBounds in this example?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> so, how can i use setBounds in this example?

how would anyone exist without the internet?

http://download.oracle.com/javase/tutorial/uiswing/layout/none.html

the smart ones would resort to reading.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the above codings, how can i use dispose() method? I want that, if the user is AUTHORIZED, a new window named 'menuoptions' opens.. and previous window("login") is removed automatically.. i have removed the dispose method with comment in the coding provided above
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the above codings, how can i use dispose() method? I want that, if the user is AUTHORIZED, a new window named 'menuoptions' opens.. and previous window("login") is removed automatically.. i have removed the dispose method with comment in the coding provided above
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the simple answer in an applet is to use a CardLayout
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!