setBounds « Layout « Java Swing Q&A





1. Are there any drawbacks if you use setLayout(null) for say JFrame and use setBounds method to set the positions of components in that JFrame    stackoverflow.com

Are there any drawbacks if you use setLayout(null) for say JFrame and use setBounds method to set the positions of components in that JFrame. GUI prospect.

2. why setBounds() method does not work even after setting seLayout() as null?    stackoverflow.com

Usually setBounds() method positions the called object in the specified location and in specified size..right? I created a JFrame class and demonstrated its working on a button with setting setLayout(null). Then I created ...

3. Updating location of JPanel    stackoverflow.com

im currently working on a game in Java and a problem occured. It is a strategy game. My game area or map is a JPanel, which i put in a JScrollPane, allowing ...

4. setBounds() method doubt in swings    coderanch.com

1) What ever the layout manager I use, If I resize the frame I created,I cant view the resized frame.it is oon the top of my command prompt window but just as a thin liine showing Frame title and with maximize,minimize and close buttons. You need to set the size of the frame explicitly by calling frame.setSize() or pack(). The frame ...

5. setBounds Problem    coderanch.com

6. Help with setBounds    coderanch.com

Hi! Trying to make my first GUI in JAVA. A very simple program. The buttons on the welcome screen does not end up where I want them to... JButton someButton = new JButton("Info"); someButton.setBounds(50, 20, 40, 20); content.add(someButton); The button appears on the same place on the welcome screen regardless if I use setBounds or not. What have I missed? (maybe ...

7. Wings setbounds problem    coderanch.com

Thanks Everyone.. i am not that good in swing . i want to arrange components wherever i want .In such case which layout i must choose and which methods can be used to place those components in right place; And one more doubt....how good it is to write web app in wingS ...coz there are also many other frameworks available...?

8. how to use setBounds() method??    coderanch.com

i am not using any layout, but, instead using setBounds method. is there any restriction with setBounds method. See the following code. import java.awt.*; import java.awt.event.*; import java.applet.*; import javax.swing.*; /* * */ public class Login extends JFrame implements ActionListener { JLabel U_Name, Password; JTextField User; JPasswordField Pass; JButton L,E; public static void main(String[] args) { Login ...

9. Issues with null layout and setBounds    coderanch.com

I am new to Java Swing. I am writing some simple swing programs which use null layout. I want to get feel of swing, how to position them. I had rough time with Layouts, so tried using null layout. As I am going to make this as an applet, I don't think that it is going to bother me much on ...





11. Positioning using setBounds    java-forums.org

Hello there, i am creating JTextField and JComboBox inside a painted rectangle on a panel. The location for JTextField and JComboBox is set using the setBounds method. However, everytime the frame is maximized or resized, both the JTextField and JComboBox get repositioned to the top middle of the frame. Could you advice why it happens and how do i update new ...

12. setBounds not working (no errors; runs and compiles fine)    java-forums.org

Java Code: import javax.swing.JFormattedTextField; import javax.swing.*; import java.awt.*; import java.text.NumberFormat; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class Risk extends JPanel { public int leftNumber, rightNumber, setbad; public JButton Enter; public JFormattedTextField stupid, yummy; public JLabel smart, dumb, nook, shook; public String nos, yos, setnice; public NumberFormat yucker = NumberFormat.getNumberInstance(); public NumberFormat nucker = NumberFormat.getNumberInstance(); public Risk() { setbad = 1; smart = ...

13. GUI Problem with setBounds();    java-forums.org

Hello, I am creating a startscreen for a project, I can't seem to get the setBounds() methods to work. I want all three buttons to be the same width but it just isn't happening. They are all remaining at their default width. Can anyone see what is wrong? Java Code: package Start; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import ...

14. Using setBounds with jLayeredPane    forums.oracle.com

In the future Swing related questions should be posted in the Swing forum. You need to do some reading on how Layout Managers work: http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html In your example the layered pane is using a null layout, but the frame is still using a BorderLayout by default. So read the above tutorial to figure out how the BorderLayout works. You are adding ...