-
Notifications
You must be signed in to change notification settings - Fork 644
Expand file tree
/
Copy pathPanel.java
More file actions
67 lines (53 loc) · 1.58 KB
/
Copy pathPanel.java
File metadata and controls
67 lines (53 loc) · 1.58 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
package ir.urmia.bigclam;
import javax.swing.*;
import java.awt.*;
public class Panel extends JPanel {
private JTextField iterationsValue;
private JTextField kValue;
public Panel() {
JPanel panel = this;
panel.setPreferredSize(new Dimension(300, 100));
JLabel labelK = new JLabel("Number of communities:");
JLabel labelIterations = new JLabel("Number of iterations:");
kValue = new JTextField();
iterationsValue = new JTextField();
labelK.setAlignmentX(0.0f);
kValue.setAlignmentX(0.0f);
labelIterations.setAlignmentX(0.0f);
iterationsValue.setAlignmentX(0.0f);
this.add(labelK);
this.add(kValue);
this.add(labelIterations);
this.add(iterationsValue);
BoxLayout layout = new BoxLayout(panel, BoxLayout.Y_AXIS);
panel.setLayout(layout);
panel.add(labelK);
panel.add(kValue);
panel.add(labelIterations);
panel.add(iterationsValue);
}
public int getK() {
int i = 0;
try {
i = Integer.valueOf(kValue.getText());
} catch (Exception ex) {
return 0;
}
return i;
}
public void setK(int k) {
this.kValue.setText(String.valueOf(k));
}
public void setIterations(int i) {
this.iterationsValue.setText(String.valueOf(i));
}
public int getIterations() {
int i = 0;
try {
i = Integer.valueOf(iterationsValue.getText());
} catch (Exception ex) {
return 0;
}
return i;
}
}