File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
    Bookmark Topic Watch Topic
  • New Topic

setLocation and setBounds are not working for JComboBox

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
setLocation and setBounds are not working for JComboBox. All my other code is working perfectly fine though.
At the top of my code is:

I tried this:

and this:

I also tried this:

They all compile and run fine. The JComboBox pops up fine and works fine, just not in the right location.
Please help!
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Don't even try to use setLocation/Size/Bounds. Learn to lay out a GUI the correct way.
http://download.oracle.com/javase/tutorial/uiswing/layout/index.html

edit: as you've already been told.
http://www.coderanch.com/t/531941/GUI/java/specify-position-ComboBox

Also, you haven't taken care of following the convention in respect of variable names.

Honestly, if you're not prepared to learn from the responses to your queries, why bother to ask?
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
I added:

to my code.
Result: blank screen

EDIT: I figured it out
Had to do:

Had to add to frame, not panel...Thank you!
 
Rob Spoor
Sheriff
Pie
Posts: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please UseOneThreadPerQuestion. This is a continuation of this thread.
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic