SetBounds of Components Programming Software Development by Ghost …{ cheer.play(); try { Thread.sleep(600); } catch(Exception excep){} win.setBounds(50,50,331,438); reset(); return; } //this checks for a… Re: SetBounds of Components Programming Software Development by Ghost I want to use setBounds, ao what layout should I use? SetBounds doesn't seem to work with a FlowLayout. Thanks! setBounds problem Programming Software Development by geekman89 … creating a button or anything else, and I use the setBounds method on the elements it does position them where i… the JPanel which contains them. What I need is for setBounds, to set the bounds according to the JPanel and not… JButton b = new JButton("def"); a.setBounds(2, 2, 20, 20); b.setBounds(3, 3, 20, 20); JPanel y = new… how to setBounds in percentage of screen size? Programming Software Development by adi.shoukat Hi, How can I setBounds of a component in percentage of screen size so that … Re: SetBounds of Components Programming Software Development by jwenting [quote] Right now, I am not using a layout. [/quote] Bad! And wrong too! You're implicitly using a NullLayout, which you should never, ever use. Re: SetBounds of Components Programming Software Development by Ghost And why not use a NullLayout? It's an official Java class, so what is wrong with it? Is it just personal preference? Also, I have seen many, many, many projects/games use this style. What should I do instead? Thanks Re: SetBounds of Components Programming Software Development by Ezzaral Use GridLayout or GridBagLayout. Re: SetBounds of Components Programming Software Development by Ghost [QUOTE=Ezzaral;394262]Use GridLayout or GridBagLayout.[/QUOTE] Those do not use pixel locations. They simply use a grid that the user defines. I need to use pixel locations. Re: SetBounds of Components Programming Software Development by masijade Using a NullLayout is not Platform independent as the varying underlying graphics systems display things differently, so the bounds are not always (and usually are not) the same and so your layout will not always work. As far as the buttons showing up under the image, remove everything from the panel before displaying the image, then after … Re: SetBounds of Components Programming Software Development by Ghost Ahh... now this makes sense :) Thank you. I want to use pixel locations because my next project is a game where I draw images and they get moved by the keyboard. Therefore, I think it is easier to use a NullLayout and use pixels. I still have one more question, however. When I run the game, the buttons do not appear. They do not appear unless… Re: SetBounds of Components Programming Software Development by Ezzaral [quote=Ghost;394415]Ahh... now this makes sense :) Thank you. I want to use pixel locations because my next project is a game where I draw images and they get moved by the keyboard. Therefore, I think it is easier to use a NullLayout and use pixels. I still have one more question, however. When I run the game, the buttons do not appear. They … Re: SetBounds of Components Programming Software Development by masijade [QUOTE=Ezzaral;394434]Try adding a call to validate() or repaint() after you have added all components. Since you are using Null Layout, the mechanisms for notifying the container to redraw itself may not behave in an expected manner. When you mouse over something, the window redraws the portion behind the mouse cursor, so this is probably what is… Re: SetBounds of Components Programming Software Development by Ezzaral [quote=masijade;394628]As I mentioned in the last sentence of my post (as well). ;-)[/quote] Yep =) Re: SetBounds of Components Programming Software Development by Ghost [QUOTE=Ezzaral;394782]Yep =)[/QUOTE] I don't know how I missed that :-O Sorry!!! :) But thanks for helping because it worked! Re: SetBounds of Components Programming Software Development by masijade You're Welcome. Re: setBounds problem Programming Software Development by NormR1 Have you tried getting the location of the panel and then adjusting your components positions by considering the panel's location. Re: setBounds problem Programming Software Development by geekman89 Thank you for your suggestion. I have made a method for each JPanel that sets the positions. It works! Re: how to setBounds in percentage of screen size? Programming Software Development by WildBamaBoy You can set a control's location and many other properties from within the code. What you want to do would be done like so, and other properties can be set in a similar way. [CODE]ButtonName.Location = new Point(X, Y);[/CODE] I'd put this in the constructor, after InitializeComponent();, so that it runs when the program is started. Re: how to setBounds in percentage of screen size? Programming Software Development by adi.shoukat WildBamaBoy, Thanks for your suggestion. Yes I am doing this right now, but it's really hectic to set location of each component manually. I thing it nullifies the convenience of drag-drop thing provided by Visual Studio. What do you think? I was expecting some way that we drag a component on form in design time and the component automatically … Re: how to setBounds in percentage of screen size? Programming Software Development by sandeepparekh9 why dont you use Docking and Anchoring properties..??? this will get you going: [URL="http://www.codeproject.com/KB/miscctrl/anchordock.aspx"]http://www.codeproject.com/KB/miscctrl/anchordock.aspx[/URL] Re: how to setBounds in percentage of screen size? Programming Software Development by adi.shoukat [QUOTE=sandeepparekh9;1571629]why dont you use Docking and Anchoring properties..??? this will get you going: [URL="http://www.codeproject.com/KB/miscctrl/anchordock.aspx"]http://www.codeproject.com/KB/miscctrl/anchordock.aspx[/URL][/QUOTE] Thanks for help. Anchor property seems to be doing what I wanted. Resizing is very smooth … Re: how to setBounds in percentage of screen size? Programming Software Development by gulbano yes it does the same.... anchor your control to right and top corner.... or top and left corner Re: how to setBounds in percentage of screen size? Programming Software Development by adi.shoukat [QUOTE=gulbano;1575375]yes it does the same.... anchor your control to right and top corner.... or top and left corner[/QUOTE] Awesome .. It worked :) Thanks everyone for help Help with subtotal Programming Software Development by onlinegear …}); //comments field CommentsField7 = new JTextField(); CommentsField7.setBounds(690, 300, 170, 30); //Order 8 …}); //comments field CommentsField9 = new JTextField(); CommentsField9.setBounds(690, 380, 170, 30); //Order 10 numberLabel10… Change and delete rows in a sql-database Programming Software Development by jin83 …( new Color( 255, 227, 218 ) ); tfPassword.setBounds(840, 45, 120, 20); lblPassword.setFont(new Font(&…quot;); //Lägger till JLabels och position lblTitle.setBounds(20, 420, 220, 20); add(lblTitle); //…//Formaterar och anger position tbSelection.setLayout(null); tbSelection.setBounds(10, 400, 630, 150); //Lägger … Make GUI Button Open Another GUI Programming Software Development by Feriscool …---- label10.setText("MinZ"); contentPane.add(label10); label10.setBounds(new Rectangle(new Point(230, 110), label10.getPreferredSize())); //---- label11…---- label12.setText("MaxY"); contentPane.add(label12); label12.setBounds(new Rectangle(new Point(130, 160), label12.getPreferredSize())); //---- … Re: Help with a reservation program! GUI Messed XD Programming Software Development by buggytoast … ); panel4.add( BusinessClassquantityJTextField ); // set up EconomicClassquantityJTextField EconomicClassquantityJTextField = new JTextField(); EconomicClassquantityJTextField.setBounds( 160, 200, 56, 21 ); EconomicClassquantityJTextField.setText( "0" ); EconomicClassquantityJTextField… Hey check out my prog. It has an error can u find it? Programming Software Development by buggytoast …); enteredScrollPane = new JScrollPane(enteredItemsList); enteredScrollPane.setBounds(20,150,400,150); enteredScrollPane.createVerticalScrollBar();…); orderScrollPane = new JScrollPane(scrollListContent); orderScrollPane.setBounds(20,80,400,220); orderScrollPane.createVerticalScrollBar();… Source Code that don't work? Programming Software Development by buggytoast …); enteredScrollPane = new JScrollPane(enteredItemsList); enteredScrollPane.setBounds(20,150,400,150); enteredScrollPane.createVerticalScrollBar();…); orderScrollPane = new JScrollPane(scrollListContent); orderScrollPane.setBounds(20,80,400,220); orderScrollPane.createVerticalScrollBar();… hey all help please Programming Software Development by mustafaneguib …); contentPane.add(startSoftware); exitSoftware.setBounds(170,420,120,30); exitSoftware…); creditHoursOfCourse.setColumns(22); creditHoursOfCourse.setBounds(120,height,122,22); contentPane…