473,386 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Layout Manager In JAVA Swing

HI

Can anybody Explain me the GridBagLayout() manager in detail.I mean How to use it.What are the differents constraints like gridx,gridy etc and how to implement them in program.
Feb 11 '07 #1
2 1940
r035198x
13,262 8TB
HI

Can anybody Explain me the GridBagLayout() manager in detail.I mean How to use it.What are the differents constraints like gridx,gridy etc and how to implement them in program.
You are best to read a layout tutorial and practice on the compiler. Learning swing is best done by trying out examples on a compiler.
Feb 12 '07 #2
rengaraj
168 100+
HI

Can anybody Explain me the GridBagLayout() manager in detail.I mean How to use it.What are the differents constraints like gridx,gridy etc and how to implement them in program.
Types of layout managers
The type of layout manager that the parent container uses will determine where the components are positioned within that container.

1. GridLayout
2. FlowLayout
3. BorderLayout
4. GridBagLayout
5. CardLayout
6. No LayoutManager (null)

GridLayout
========
GridLayout ()
GridLayout (int rows, int cols)
GridLayout (int rows, int cols, int hgap, int vgap)
The GridLayout manager arranges components in a grid within a container.

Each cell in the grid is of equal dimensions.

The GridLayout manager ignores the preferred size of each component and resizes them to exactly fit each cell's dimensions.

The GridLayout manager inserts them across each column until that row is filled and then starts at the first column of the next row.

Note:

The setRows () and setColumns () methods does not guarantee that you will get the expected number of columns. The number of columns is calculated by the number of rows and the number of components added. The number of columns specified is respected only if the number of rows is not specified.
Example,

Frame f = new Frame ("GridLayout Example");
f.setBounds (0, 0, 300, 300);
f.setLayout (new GridLayout (3, 3)); // 3 rows x 3 columns
Feb 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Michael | last post by:
Hello I am trying to write a Java-Program which converts a XML-file in a HTML. It should take the Transformation-file from the XML-file itself. Below find a possible XML-file: <?xml...
1
by: de_subhadeep | last post by:
Hi All, My program is running on a headless mode and I need to set the look and feel of my program but it gives me Headless Exception when I try to set the look and feel. The exception is as...
73
by: RobertMaas | last post by:
After many years of using LISP, I'm taking a class in Java and finding the two roughly comparable in some ways and very different in other ways. Each has a decent size library of useful utilities...
3
by: PieMan2004 | last post by:
Hi, ive been looking for a solid java community to help me when im tearing out my hair :) Basically ive constructed a GUI that has to represent the same look and functions of the typical windows...
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
1
by: cozsmin | last post by:
hello, my program is a simple banking application, i need it for my resumee, but i have a little problem i got stuck trying to maek some TextField -s visible , it seems that setting the layout (...
0
oll3i
by: oll3i | last post by:
package library.common; import java.sql.ResultSet; public interface LibraryInterface { public ResultSet getBookByAuthor(String author); public ResultSet getBookByName(String name);
7
oll3i
by: oll3i | last post by:
i need to write publisher subscriber application on openjms and use db4o but i dont know how do i add the references to db4o when i compile the app with javac ? i added db4o-6.1-java5.jar to my...
6
blazedaces
by: blazedaces | last post by:
Hey, so here's an example of what I want to do: This "window" if you will, or simple gui, will accept an ArrayList<String> and in turn spit out for every one of them a checkbox and a text field...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.