Re: layout manager, which one? Programming Software Development by Violet_82 … "Show grid" ); checkBoxesPanel.add( showGridCheckBox ); //set up layout manager for checkbox panels checkboxGrid = new GridLayout( 0, 1 );//1 col… "8", 3); textFieldsPanel.add( yTextField ); //set up layout manager for textfields panels textfieldsGrid = new GridLayout( 0, 2, 0, 5… layout manager, which one? Programming Software Development by Violet_82 … this was my first attempt. I have used a FlowLayout layout manager probably because it is the simplest one and I thought… try to understand the whole thing before admitting defeat. Which layout manager should I use? Here is the code: /*Exercise 14.8… Re: layout manager, which one? Programming Software Development by JamesCherrill pack() fits everything together according to the layout manager(s) and any other constrains you have specified. Until …'s only so much you can do with a simple layout manager like GridLayout - I see you already found the h/… while still retaining the resizability and platform independence that a layout manager gives you, you have to go to one of the… Re: layout manager, which one? Programming Software Development by Violet_82 thanks for your help guys. @JamesCherrill before I close this thread I would like to pick up on something you said: > setSize is call for when you're not using a layout manager. Can you actually draw a GUI without using a layout manager? I thought that a layout manager had to be used at all times. Thanks Re: layout manager, which one? Programming Software Development by JamesCherrill …` is call for when you're not using a layout manager. By default, most layout managers will make your window "big enough… set a minimum sze for your window then if the layout manager comes up with a smaller size it should "round… Re: layout manager, which one? Programming Software Development by mKorbel Can you actually draw a GUI without using a layout manager? I thought that a layout manager had to be used at all times. - not you can't, - NullLayout only to supply unwillingness to read the description in (already linked) official Oracle tutorials about How to Use Layout Managers Re: layout manager, which one? Programming Software Development by JamesCherrill … JPanel and its child JPanels. For th JFrame a flow layout is OK - it will place the panels left to right… enough room). For the panels you ned to specify a layout manager that stacks things vertically - eg GridLayout(0,1) - one column… Re: layout manager, which one? Programming Software Development by JamesCherrill There is the option of setting the layout manager to null and positioning/sizing everything in pixels using `setLocation`, `… Layout Manager problem with Swing Programming Software Development by BestJewSinceJC … and I have a problem. I'm using a card layout to flip between multiple windows. Two of these windows are… (as one of the tabs, this JPanel contains the card layout) JPanel 2 (this is inside JPanel 1, and contains the… down should be working. So I guess it's the layout manager which is stopping things from being resized. Hm. Re: layout manager, which one? Programming Software Development by Violet_82 …supposed to keep the flowLayout manager or not. I left …JButton helpButton;//Help private FlowLayout layout;//layout object private JPanel checkBoxesPanel;//panel…;Show grid" ); checkBoxesPanel.add( showGridCheckBox ); //layout.setAlignment( FlowLayout.LEFT ); //elements in textFieldsPanel xLabel =… Re: layout manager, which one? Programming Software Development by Violet_82 … appreciate that the GridLayout, BorderLayout and FlowLayout are very basic layout managers, but I think that I am happy to work… a bit more about these before moving to more complicated layout like GridBagLayout. I know I could use an IDE and… Re: layout manager, which one? Programming Software Development by JamesCherrill …, but setting minimum sizes are more often honoured by the layout managers I happened to use. I didn't keep any… any hard data on this. :) Personally I use GridBagLayout whenever layout really matters. Re: layout manager, which one? Programming Software Development by Phaelax For reference, this will help you learn about layout betters: http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html unable to add a paintComponent panel to a frame with a layout manager Programming Software Development by phy2sma … container for the frame Container content = getContentPane(); // need a layout manager to decide the arrangement of the components on the container… FlowLayout flo = new FlowLayout(); // designate the layout manager to the container content.setLayout(flo); // make components JPanel buttons… Re: unable to add a paintComponent panel to a frame with a layout manager Programming Software Development by JamesCherrill … set size, preferred size, and minimum size and hope your layout manager will respect one of them. OR take the plunge into… GridBagLayout layout manager questions Programming Software Development by Violet_82 … { super( "GridBagLayout" ); layout = new GridBagLayout(); setLayout( layout ); // set frame layout constraints = new GridBagConstraints(); // instantiate constraints //…of type `GridBagConstraints` that we can use with this layout manager, like `fill`, `gridx`, `gridy` etc. Now… JFrame showing nothing. Layout Manager Help... Programming Software Development by StevoLord … buttons show but since it is using a layout manager the setBounds,setLocation,setSize commands dont work. So I used … Re: JFrame showing nothing. Layout Manager Help... Programming Software Development by Katana24 … you are somehow required to. You should ideally use a layout manager or combination of them to structure your frame - Can you… Sizing Elements in a Layout Manager Programming Software Development by abyss776 … a BoxLayout. What is the best way to stop the Layout Manager from resizing my components to take up the entire available… Re: Sizing Elements in a Layout Manager Programming Software Development by NormR1 What layout manager are you using? Can you post a small program that compiles and executes and shows the problem. Re: unable to add a paintComponent panel to a frame with a layout manager Programming Software Development by JamesCherrill Layout managers are pretty fickle about using or ignoring your component's sizes. You could try setMinimumSize for your panel as well as setSize. Re: layout manager, which one? Programming Software Development by JamesCherrill The simplest way is to use multiple JPanels to organise the groups of controls. eg Place 3 JPanels in your JFrame, flowing left to right. In the first one add the two checkboxes, in the second add the x,y labels and fields, in the third add the buttons. In each of those three cases the controls are just placed in a vertical stack (2x2 grid for the… Re: layout manager, which one? Programming Software Development by Violet_82 Thanks JamesCherrill. I didn't know I could do that, so you mean like having a JFrame as I currently do and then inside 3 JPanels. How is a panel different from a JFrame? I will have a go and then post back Re: layout manager, which one? Programming Software Development by mKorbel @JamesCherrill - happy new year, all the best for you and your family - can't resist, flamewar again - [You can also set minimum sizes for your JPanels, which may help with some spacing issues.](http://stackoverflow.com/questions/7229226/should-i-avoid-the-use-of-setpreferredmaximumminimumsize-methods-in-java-swi) - all JComponents can returns… Re: layout manager, which one? Programming Software Development by Violet_82 ok thanks. Layout Managers... Can I use more than one? Programming Software Development by Tyster … everyone, Is it possible to use more than one Layout Manager in a single GUI interface? I have classes (with …I've only built simple programs that use a single layout manager. When I call the setLayout() method on my container… object I can only specify 1 layout manager. What I'm wondering is if its possible to … Re: Layout Managers... Can I use more than one? Programming Software Development by Ezzaral … can only have one layout manager, however you can easily create any layout you wish by nesting containers with the layout that you want… with each JPanel containing a few components. Breaking up the layout like that gives you a lot of control over the… Re: Layout Managers... Can I use more than one? Programming Software Development by Tyster …]Each container can only have one layout manager, however you can easily create any layout you wish by nesting containers with …the layout that you want for each one. …each JPanel containing a few components. Breaking up the layout like that gives you a lot of control over the… Layout Management Programming Software Development by Stefano Mtangoo Please help me to expound how to do layout management. You may choose any layout manager and expound it. I'm doing self teaching most of the time and it is not fun! Please help me ho to arrange. Also which layout is mostly used Re: Layout Management Programming Software Development by Stefano Mtangoo So, according to the doc you have to follow this steps 1. Get content pane 2. Set layout manager for that content pane 3. add components If so does that mean I have to use many panels for single program that needs many layouts?