Original Post
How to I specify the exact location I want a button or any type of component?
final JPanel parent = new JPanel();parent.setLayout(null);final JButton child = new JButton("Button");// setBounds(x, y, width, height)child.setBounds(0, 0, 100, 50);parent.add(child)Quote:
Original post by marcmassacre
Thanks for your help...
But how could I specify exactly where I want a button to be on the screen? For instance...
add(new Button("cancel", x, y));
is there anything like that or any way I can do that?
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());getContentPane().add(new JButton("OK"), new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, -1, -1));
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more