forked from speakfly/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplaceJDialog.java
More file actions
92 lines (80 loc) · 2.37 KB
/
Copy pathreplaceJDialog.java
File metadata and controls
92 lines (80 loc) · 2.37 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package notepad;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class replaceJDialog extends JDialog {
private final JPanel contentPanel = new JPanel();
private JTextField textField;
private JTextField textField_1;
private static boolean isopen = false;
/**
* Launch the application.
*/
public static boolean getisopen()
{
return isopen;
}
public static void main(String[] args) {
try {
replaceJDialog dialog = new replaceJDialog();
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the dialog.
*/
public replaceJDialog() {
setBounds(100, 100, 585, 300);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(null);
JLabel lblCha = new JLabel("查找内容:");
lblCha.setBounds(39, 48, 88, 18);
contentPanel.add(lblCha);
JLabel label = new JLabel("替换为:");
label.setBounds(39, 79, 72, 18);
contentPanel.add(label);
textField = new JTextField();
textField.setBounds(121, 45, 209, 24);
contentPanel.add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setBounds(121, 79, 209, 24);
contentPanel.add(textField_1);
textField_1.setColumns(10);
JButton button = new JButton("查找下一个");
button.setBounds(390, 44, 113, 27);
contentPanel.add(button);
JButton button_1 = new JButton("替换");
button_1.setBounds(390, 84, 113, 27);
contentPanel.add(button_1);
JButton button_2 = new JButton("全部替换");
button_2.setBounds(390, 124, 113, 27);
contentPanel.add(button_2);
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton("OK");
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton("Cancel");
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
}
}