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, 09:54 PM
By eldiener in forum .NET
Last Post: 01-17-2007, 11:38 PM
Last Post: 08-12-2002, 11:40 PM
By Rob Teixeira in forum .NET
Last Post: 06-06-2002, 06:23 AM
By Jim Ferguson in forum Enterprise
Last Post: 06-27-2000, 10:19 AM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL