(Fang Zhiwen) MutableGridLayout Layout Manager Instructions

xiaoxiao2021-03-06  64

The layout manager is powerful, and the assembly on the interface will scale according to the scaling of the interface. This is a simple interface developed by the author. It is simpler. The main operation functions are as follows: New MutableGridLayout (int COLS, int Rows, int XGAP, INT XGAP) This constructor is used to create an interface of a COLS column ROWS line, where the column interval is XGAP, the horizontal interval is YGAP, which will use the entire interface as a matrix of X * Y as a matrix .getBox (int COL, INT ROW) The function is used to explain the object you want to operate is now (COL 1, ROW 1) this lattice. **** Note the top of the upper left is (0, 0) instead of (1, 1) this with array Expressing the PPLIT (int Row, INT COL) or Split (int Row, Int COL, INT XGAP, INT YGAP) is used to separate the selected lattice, where split (int ution, int co) is an object (Plaid) Cut Become a colS column ROWS row split (int ROW, INT COL, INT XGAP, INT YGAP) is to cut operation objects (plaid) into a colS column ROWS line, where the column interval is XGAP, the horizontal interval is YGAP, of course, It is the object to be object to getBox (m, n) .split (x, y) Merge (int ", INT ENDX, INT ENDY) can be used to combine multiple cells to be combined. Small latches. Its meanings are combined with (STARTX 1, Starty 1) grid and (ENDX 1, Endy 1) grid into a plaid ** tip: If you give the lattice on the diagonal The plaid will also merge the surrounding plaid. For example: Merge (0, 0, 1, 1) (0) (0) (0) (1, 1) plaid will be combined For a big gant .Setblank (Boolean) is used to point out which cell does not need to put into components .SetWidth (int Num, Double Value) or setHeight (int Num, double value) is used to point out the Num column or Num Width or height When your Value> 1 thinks you give an absolute value. Value <1 thinks you give a ratio value. Description: If you want to get the small lattice on the plaid after segmentation, you can reuse the getBox function. . Well, the main operational function is these (you can guarantee your development needs) other features you will understand in your own use. Need to pay attention to the join group The order of the parts is to join the left to right from top to bottom, so you may have a lot of division methods from top to bottom, so you may have a variety of sequence of adding components. Sequential, please don't take care of it. In short, this layout manager is quite powerful. If you need it, you can go to the author blog to ask of course, don't forget the copyright statement of others !!! Example program code and the effect as follows: Import Javax .swing.jbutton; import javax.swing.jframe; import org.fswan.ui.mutableGridLayout;

/ **

* @SampleAuthor Shaobotao (Shao Bo Tao)

* @Author Swan Fong (Fang Zhiwen)

* Sample program for MutableGridLayout layout

* /

Public Class Test

{

Public static void main (string [] args)

{

JFrame JF = New Jframe ("Test Layout");

MutableGridLayout ML = New MutableGridLayout (4, 4, 5, 5);

ml.getBox (1, 1) .split (2, 1);

ml.getBox (3, 3) .split (1, 4);

ml.getbox (1, 2) .Getfill ();

ml.merge (0, 1, 1, 1);

ml.Merge (2, 0, 2, 1);

Ml.getBox (3,0) .SetBlank (TRUE);

Ml.Merge (1, 2, 2, 3);

Ml.getBox (0, 2) .split (2, 5); ml.getbox (0, 3). Split (3, 1);

ml.getBox (0, 2) .merge (0, 3, 1, 3);

Ml.getBox (0,3) .getBox (1, 0) .Setblank (TRUE);

Ml.getBox (0, 2) .GetBox (0, 2) .Setblank (TRUE);

Jf.getContentPane (). setLayout (ml);

For (int i = 0; i <30; i )

{

Jf.getContentPane (). Add ("Button i));

Jf.setsize (200,200); jf.setvisible (TRUE); jf.setdefaultcloseOperation (jframe.exit_on_close);}} If you don't understand, please post or give the author or send my email: Shaobotao @ 126 .com can go to my space to download: Here

转载请注明原文地址:https://www.9cbs.com/read-89349.html

New Post(0)