Although it was interesting to write this for a long time, it was not available for a long time. Now let's take a look at my summary.
I hope you can study it together and learn more here to avoid detours.
Flowlayout is the flow layout manager. In Java, the default layout of panel is used. In this layout, the layout is left to right by default. The related code is as follows:
Code:
- Package CN. Jason. Gui;
- Import java. AWT. Button;
- Import java. AWT. flowlayout;
- Import java. AWT. frame;
- Public class testflowlayout {
- Public static void main (string ARGs []) {
- Frame F = new frame ("flowlayout ");
- Button btn1 = new button ("button ");
- Button btn2 = new button ("button ");
- Button btn3 = new button ("button ");
- F. setlayout (New flowlayout (flowlayout. Left ));
- F. Add (btn1 );
- F. Add (btn2 );
- F. Add (btn3 );
- F. setsize (100,100 );
- F. setvisible (true );
- }
- }