473,394 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

setBounds

176 100+
Hello guys. I just tried out using the setBounds method after looking at it in the Java API under JButton (though any other component should have it) and so anyways I tried it out in a simple little program. But no matter how much I change the parameters the button never changes. Why is this?
Jun 4 '08 #1
5 7282
BigDaddyLH
1,216 Expert 1GB
You should not explicitly set the bounds on any component. Rather, let the container's layout manager determine the components' bounds:

http://java.sun.com/docs/books/tutor...out/index.html
Jun 4 '08 #2
sukatoa
539 512MB
But no matter how much I change the parameters the button never changes. Why is this?
You may set first the container's layout to null before you use setBounds....

regards,
sukatoa
Jun 5 '08 #3
Kid Programmer
176 100+
You may set first the container's layout to null before you use setBounds....

regards,
sukatoa
I just found that out yesterday. setBounds was very useful in getting the exact layout I wanted.
Jun 5 '08 #4
JosAH
11,448 Expert 8TB
I just found that out yesterday. setBounds was very useful in getting the exact layout I wanted.
You shouldn't want that; think of different screen resolutions: your manual
layout goes completely berzerk on them, layout managers won't.

kind regards,

Jos
Jun 5 '08 #5
BigDaddyLH
1,216 Expert 1GB
You may set first the container's layout to null before you use setBounds....

regards,
sukatoa
I recommend against doing that.
Jun 5 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: do | last post by:
This is direction: Modifying the calculateJButtonActionPerformed method. Modify the if statement that starts in line 217 to check if the user has not entered a name and/or selected any...
0
by: Simon Ren | last post by:
I use SetBounds method to do a custom layout for childrens windows of a MDI form. I am able to change the sizes of the child window, but not the position. No matter how I change the x, y parameter...
2
by: Joey Callisay | last post by:
I don't know if this has already been noted but I just found out that the intellisense for the y parameter of the SetBounds method is mistakenly declared to be the new Control.Right property of the...
0
by: Just Me | last post by:
Given a control1 on a UserControl: After much experimentation I find that the x and y values given to control1.SetBounds(x,y,... needs to have the positions of the scrollbars thumbs subtracted...
2
by: Steve Long | last post by:
Hello, I have tried a couple of ways to set the location of a form before it becomes visible and the results have been erratic at best. My latest attempt is to use the SetBounds method passing in...
14
by: spruce moose | last post by:
Hey all. My program reads from a file which contains information about employees(ID, name, address, salary, HourlyRate, etc...). It then stores them in an array of objects and writes and displays the...
3
by: gokulagopal | last post by:
I am sending the code please help me in finding the error and correct it.The code is below: import java.awt.*; import java.awt.event.*; class CalcFrame extends Frame { ...
7
by: Kid Programmer | last post by:
Hey guys. Once again I am making a calculator like I do so much. I ran into an error with this program though. I just couldn't figure out how to make the operators work. I want this calculator to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.