Layout Manager, Single component
Hello all, I am new to this community and fair new to Java programming. I am reading about layout managers and used several layout managers in order to show a single component in a JPanel, eg a button. So far all i have found/managed to do is to make this button appear in a specific position leaving the rest of the space unoccupied.
What I want to do is to show this button in the panel but occupy all available space as well as be resizable to the panel. Panel gets bigger? Button still occupies full size of it.
Any help is appreciated, thank you.
use border layout and put your component in the center.
Code inside the init method of an applet, jframe or something else:
add(new Button("Center"), BorderLayout.CENTER);
There is no fear in the true love!
By awyeah in forum VB Classic
Last Post: 05-05-2008, 08:54 PM
By eldiener in forum .NET
Last Post: 01-17-2007, 10:38 PM
Last Post: 08-12-2002, 10:40 PM
By Rob Teixeira in forum .NET
Last Post: 06-06-2002, 05:23 AM
By Jim Ferguson in forum Enterprise
Last Post: 06-27-2000, 09:19 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center