gauravflame
asked on
Java Description
Can anyone explain below line of code
and
What is here 2,3,4,5 means ?
========================== ===
BPanel.setLayout( new GridLayout( 2, 3, 4, 5 ) );
and
What is here 2,3,4,5 means ?
==========================
BPanel.setLayout( new GridLayout( 2, 3, 4, 5 ) );
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> BPanel.setLayout( new GridLayout( 5, 3, 5, 5 ) );
Thats setting the layout of BPanel to be a 5 x 3 grid
Thats setting the layout of BPanel to be a 5 x 3 grid
And 5 pixel gap between cells
(Make the necessary adjustments since yours ;-))
2 number of rows, 3 number of columns, 4 horizontal gap between cells, 5 vertical gap between cells
ASKER
Why to use GridLayout ? Buttons are arranged for BPanel from BorderLayout
BPanel.setLayout( new GridLayout( 5, 3, 5, 5 ) );
Observation ::
If I comment out Gridlayout line of code everything on contentpane become scatter
BPanel.setLayout( new GridLayout( 5, 3, 5, 5 ) );
Observation ::
If I comment out Gridlayout line of code everything on contentpane become scatter
no, content pane uses a border layout.
BPanel by default would use a flow layout
BPanel by default would use a flow layout
ASKER
I think by Default layout manager is Border Layout in Java swing
My Question If BPanel setting itself to Border layout why it is need to set on Grid Layout.
or It is to deal with good interface
My Question If BPanel setting itself to Border layout why it is need to set on Grid Layout.
or It is to deal with good interface
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>
My Question If BPanel setting itself to Border layout why it is need to set on Grid Layout.
or It is to deal with good interface
>>
Because a BorderLayout wouldn't lay out the buttons in a neat grid
My Question If BPanel setting itself to Border layout why it is need to set on Grid Layout.
or It is to deal with good interface
>>
Because a BorderLayout wouldn't lay out the buttons in a neat grid
ASKER
Thanks all clear :)
:-)
ASKER
contentpane.add( BPanel , BorderLayout.CENTER ) ; // put on the content pane
BPanel.setLayout( new GridLayout( 5, 3, 5, 5 ) );