Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.java
More file actions
Latest commit
94 lines (77 loc) · 2.26 KB
/
Copy pathGraph.java
File metadata and controls
94 lines (77 loc) · 2.26 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
93
94
importjavax.swing.*;
importjava.awt.*;
importjava.awt.event.*;
classRootextendsJFrame {
publicMyTabletable;
publicRoot() {
super("jgraphq1");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
build(getContentPane());
// display the windows
// pack();
setVisible(true);
getRootPane().
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).
put(KeyStroke.getKeyStroke("ESCAPE"), "quit");
getRootPane().getActionMap().put("quit", newAbstractAction() {
publicvoidactionPerformed(ActionEvente) {
System.out.println("Bye Bye");
System.exit(0);
}
});
}
publicvoidbuild(Containerpanel) {
panel.setLayout(newGridBagLayout());
GridBagConstraintsgbc = newGridBagConstraints();
GridBagConstraints_gbc = newGridBagConstraints();
// gbc_def
// _gbc.gridx=0; _gbc.gridy=0;
// _gbc.insets= new Insets(0, 0, 0, 0);
_gbc.gridwidth = 1; _gbc.gridheight = 1;
_gbc.weightx = 0; _gbc.weighty = 0;
_gbc.fill = GridBagConstraints.NONE;
_gbc.anchor = GridBagConstraints.FIRST_LINE_START;
gbc = _gbc;
JCheckBoxjoin_pts = newJCheckBox("Join Points", true);
panel.add(join_pts, gbc);
JCheckBoxpts_show = newJCheckBox("Show Point", true);
gbc.gridx = 1;
panel.add(pts_show, gbc);
JCheckBoxpts_label = newJCheckBox("Point Label");
gbc.gridx = 2;
panel.add(pts_label, gbc);
table = newMyTable();
gbc.weightx = 1; gbc.weighty = 1;
gbc.gridx = 0; gbc.gridy = 1;
gbc.gridwidth = 4; gbc.gridheight = 1;
gbc.insets = newInsets(0, 0, 0, 0);
gbc.fill = GridBagConstraints.BOTH;
gbc.anchor = GridBagConstraints.CENTER;
panel.add(table, gbc);
join_pts.addActionListener(newActionListener() {
publicvoidactionPerformed(ActionEvente) {
table.canvas.join = !table.canvas.join;
repaint();
}
});
pts_show.addActionListener(newActionListener() {
publicvoidactionPerformed(ActionEvente) {
table.canvas.point = !table.canvas.point;
repaint();
}
});
pts_label.addActionListener(newActionListener() {
publicvoidactionPerformed(ActionEvente) {
table.canvas.label = !table.canvas.label;
repaint();
}
});
}
}
publicclassGraph {
publicstaticvoidmain(String[] args) {
Rootroot = newRoot();
root.setSize(600, 462);
root.setLocation(350, 150);
}
}