ShowGridLayout
2014-05-06 22:27
211 查看
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.GridLayout;
public class ShowGridLayout extends JFrame {
public ShowGridLayout() {
// Set GridLayout, 3 rows, 2 columns, and gaps 5 between
// components horizontal and vertically
setLayout(new GridLayout(3, 2, 5, 5));
// Add lables and text fields to the frame
add(new JLabel("First Name"));
add(new JTextField(8));
add(new JLabel("Mi"));
add(new JTextField(1));
add(new JLabel("Last Name"));
add(new JTextField(8));
}
/* Main method */
public static void main(String[] args) {
ShowGridLayout frame = new ShowGridLayout();
frame.setTitle("ShowGridLayout");
frame.setSize(200,125);
frame.setLocationRelativeTo(null); // Center the frame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.GridLayout;
public class ShowGridLayout extends JFrame {
public ShowGridLayout() {
// Set GridLayout, 3 rows, 2 columns, and gaps 5 between
// components horizontal and vertically
setLayout(new GridLayout(3, 2, 5, 5));
// Add lables and text fields to the frame
add(new JLabel("First Name"));
add(new JTextField(8));
add(new JLabel("Mi"));
add(new JTextField(1));
add(new JLabel("Last Name"));
add(new JTextField(8));
}
/* Main method */
public static void main(String[] args) {
ShowGridLayout frame = new ShowGridLayout();
frame.setTitle("ShowGridLayout");
frame.setSize(200,125);
frame.setLocationRelativeTo(null); // Center the frame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
相关文章推荐
- 关于REUSE_ALV_GRID_DISPLAY函数的slis_layout_alv的字段使用的说明
- 关于REUSE_ALV_GRID_DISPLAY函数的slis_layout_alv的字段使用的说明
- CSS Grid Layout Module
- iphone Dev 开发实例9:Create Grid Layout Using UICollectionView in iOS 6
- [CSS] Get up and running with CSS Grid Layout
- according to datakey in th grid to show the image or not
- RecyclerView--GridLayoutManager设置某个item占据的列数
- 自定义控件三部曲之动画篇(十一)——layoutAnimation与gridLayoutAnimation
- GridLayoutManager 高度与设定不一致的坑
- 如何使用GridLayoutAnimation实现gridView加载动画
- CSS List Grid Layout 图片垂直居中
- 2C01-View-Layout-Animation-Grid-Fade
- Android布局文件之GridLayout
- Animation动画详解(十一)——layoutAnimation与gridLayoutAnimation
- 关于REUSE_ALV_GRID_DISPLAY函数的slis_layout_alv的字段使用的说明
- Android 布局之GridLayout
- AndroidRecyclerviewGridLayoutManager列间距 - Android Recyclerview GridLayoutManager column spacing
- RecyclerView高度随Item自适应 GridLayoutManager和LinearLayoutManager都适用
- 各个浏览器开启CSS Grid Layout的方式
- SWT GridLayout 网格布局