This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes setLocation and setBounds are not working for JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply locked New topic
Author

setLocation and setBounds are not working for JComboBox

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

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!


“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

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?


luck, db
There are no new questions, but there may be new answers.
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

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

Joined: Oct 27, 2005
Posts: 19656
    
  18

Please UseOneThreadPerQuestion. This is a continuation of this thread.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setLocation and setBounds are not working for JComboBox
 
Similar Threads
Clip Board Problem
symbol : constructor JComboBox(java.lang.String[],int,int)...cannot find symbol
How to specify X and Y position of a ComboBox?
Save information in SQL database using timer
Scrollbar not working