summaryrefslogtreecommitdiffstats
path: root/lib/example/GridVersusTable.java
diff options
context:
space:
mode:
authorWe-unite <3205135446@qq.com>2025-02-22 17:17:43 +0800
committerWe-unite <3205135446@qq.com>2025-02-22 17:17:43 +0800
commitc6cd81378149631f528b838b7920bd736833be71 (patch)
tree27e1cde5ee3b3338498127584fd61bdc38e0c8d5 /lib/example/GridVersusTable.java
parent9ff0011281e6ee6324509003463e371a9c213aa8 (diff)
downloadproject-c6cd81378149631f528b838b7920bd736833be71.tar.gz
project-c6cd81378149631f528b838b7920bd736833be71.zip
Format all code, Fix bug report ensure.
The bug report result table should enable people to ensure one by one menually, and there's 3 kinds of states: not sure, currect issure, or wrong report. However, in the old report it's a yes/no question. So it's changed, and the state for each row also works nolonger as intager but enum, to make it more readable. Besides, all codes of this project get formatted, to make it clean, and no more change caused by format in later commits.
Diffstat (limited to 'lib/example/GridVersusTable.java')
-rw-r--r--lib/example/GridVersusTable.java88
1 files changed, 40 insertions, 48 deletions
diff --git a/lib/example/GridVersusTable.java b/lib/example/GridVersusTable.java
index c5746c4..890d2e9 100644
--- a/lib/example/GridVersusTable.java
+++ b/lib/example/GridVersusTable.java
@@ -1,108 +1,100 @@
1package example; 1package example;
2 2
3 3
4 4import java.awt.Font;
5import java.awt.*; 5import java.awt.Frame;
6import java.awt.event.*; 6import java.awt.GridLayout;
7import java.awt.event.WindowAdapter;
8import java.awt.event.WindowEvent;
9import java.awt.event.WindowListener;
7import javax.swing.JButton; 10import javax.swing.JButton;
8import layout.TableLayout; 11import layout.TableLayout;
9 12
10 13
11
12public class GridVersusTable { 14public class GridVersusTable {
13 15
14 16
15 17 protected static Frame showGridWindow() {
16 protected static Frame showGridWindow ()
17 {
18 // Create frame 18 // Create frame
19 Frame frame = new Frame("GridLayout"); 19 Frame frame = new Frame("GridLayout");
20 frame.setFont (new Font("Helvetica", Font.PLAIN, 14)); 20 frame.setFont(new Font("Helvetica", Font.PLAIN, 14));
21 frame.setLayout (new GridLayout(2, 0)); 21 frame.setLayout(new GridLayout(2, 0));
22 22
23 // Create and add buttons 23 // Create and add buttons
24 frame.add (new JButton("One")); 24 frame.add(new JButton("One"));
25 frame.add (new JButton("Two")); 25 frame.add(new JButton("Two"));
26 frame.add (new JButton("Three")); 26 frame.add(new JButton("Three"));
27 frame.add (new JButton("Four")); 27 frame.add(new JButton("Four"));
28 28
29 // Show frame 29 // Show frame
30 frame.pack(); 30 frame.pack();
31 frame.setLocation (0, 10); 31 frame.setLocation(0, 10);
32 frame.show(); 32 frame.show();
33 33
34 return frame; 34 return frame;
35 } 35 }
36 36
37 37
38 38 protected static Frame showTableWindow() {
39 protected static Frame showTableWindow ()
40 {
41 // Create frame 39 // Create frame
42 Frame frame = new Frame("TableLayout"); 40 Frame frame = new Frame("TableLayout");
43 frame.setFont (new Font("Helvetica", Font.PLAIN, 14)); 41 frame.setFont(new Font("Helvetica", Font.PLAIN, 14));
44 42
45 // Set layout 43 // Set layout
46 double f = TableLayout.FILL; 44 double f = TableLayout.FILL;
47 double size[][] = {{f, f}, {f, f}}; 45 double size[][] = {{f, f}, {f, f}};
48 frame.setLayout (new TableLayout(size)); 46 frame.setLayout(new TableLayout(size));
49 47
50 // Create and add buttons 48 // Create and add buttons
51 frame.add (new JButton("One"), "0, 0"); 49 frame.add(new JButton("One"), "0, 0");
52 frame.add (new JButton("Two"), "1, 0"); 50 frame.add(new JButton("Two"), "1, 0");
53 frame.add (new JButton("Three"), "0, 1"); 51 frame.add(new JButton("Three"), "0, 1");
54 frame.add (new JButton("Four"), "1, 1"); 52 frame.add(new JButton("Four"), "1, 1");
55 53
56 // Show frame 54 // Show frame
57 frame.pack(); 55 frame.pack();
58 frame.setLocation (200, 10); 56 frame.setLocation(200, 10);
59 frame.show(); 57 frame.show();
60 58
61 return frame; 59 return frame;
62 } 60 }
63 61
64 62
65 63 protected static Frame showTableWindow2() {
66 protected static Frame showTableWindow2 ()
67 {
68 // Create frame 64 // Create frame
69 Frame frame = new Frame("TableLayout"); 65 Frame frame = new Frame("TableLayout");
70 frame.setFont (new Font("Helvetica", Font.PLAIN, 14)); 66 frame.setFont(new Font("Helvetica", Font.PLAIN, 14));
71 67
72 // Set layout 68 // Set layout
73 double f = TableLayout.FILL; 69 double f = TableLayout.FILL;
74 double size[][] = {{f, f}, {f, f}}; 70 double size[][] = {{f, f}, {f, f}};
75 frame.setLayout (new TableLayout(size)); 71 frame.setLayout(new TableLayout(size));
76 72
77 // Create and add buttons 73 // Create and add buttons
78 frame.add (new JButton("One"), "0, 0"); 74 frame.add(new JButton("One"), "0, 0");
79 frame.add (new JButton("Two"), "1, 1"); 75 frame.add(new JButton("Two"), "1, 1");
80 76
81 // Show frame 77 // Show frame
82 frame.pack(); 78 frame.pack();
83 frame.setLocation (400, 10); 79 frame.setLocation(400, 10);
84 frame.show(); 80 frame.show();
85 81
86 return frame; 82 return frame;
87 } 83 }
88 84
89 85
90 86 public static void main(String args[]) {
91 public static void main (String args[])
92 {
93 WindowListener listener = 87 WindowListener listener =
94 (new WindowAdapter() 88 (new WindowAdapter() {
95 { 89 public void windowClosing(WindowEvent e) {
96 public void windowClosing (WindowEvent e) 90 System.exit(0);
97 {
98 System.exit (0);
99 }
100 } 91 }
92 }
101 ); 93 );
102 94
103 Frame frame = showGridWindow(); 95 Frame frame = showGridWindow();
104 frame.addWindowListener(listener); 96 frame.addWindowListener(listener);
105 97
106 frame = showTableWindow(); 98 frame = showTableWindow();
107 frame.addWindowListener(listener); 99 frame.addWindowListener(listener);
108 100