forked from whatofit/JavaGUI_UTF8
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainTest.java
More file actions
43 lines (32 loc) · 1.02 KB
/
Copy pathMainTest.java
File metadata and controls
43 lines (32 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.table.DefaultTableModel;
import com.DUT.swing.components.table.mergecells.gridbagtable.GridBagTable;
public class MainTest implements ActionListener {
private GridBagTable table;
private MainTest()
{
JFrame d = new JFrame();
DefaultTableModel model = new DefaultTableModel(5,5);
table = new GridBagTable(model);
table.setRowHeight(20);
JScrollPane pane = new JScrollPane(table);
d.getContentPane().add(pane, BorderLayout.CENTER);
JButton btn = new JButton("合并/拆分");
d.getContentPane().add(btn, BorderLayout.NORTH);
btn.addActionListener(this);
d.setBounds(0, 0, 400, 400);
d.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
table.mergeCells(table.getSelectedRows(), table.getSelectedColumns());
}
public static void main(String[] fsd){
new MainTest();
}
}