blob: 035f4f0b369bb71bbe00ecbad335e5c5335887f8 (
plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
Add to org.reprap.Main above "JMenuItem toolsExerciser":
JMenuItem toolsWorkingVolume = new JMenuItem("Working volume probe", KeyEvent.VK_W);
toolsWorkingVolume.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
new org.reprap.gui.steppertest.WorkingVolumeFrame();
}
catch (Exception ex) {
JOptionPane.showMessageDialog(null, "Working volume probe exception: " + ex);
ex.printStackTrace();
}
}});
toolsMenu.add(toolsWorkingVolume);
Existing WorkingVolumeFrame:
/* @author Ed Sells 27 July 2007
*
* Status: Actively working on it.
*
* Designed to walk the axes to their extents
* thus setting the working volume of the printer.
*
*/
package org.reprap.gui.steppertest;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
//import javax.swing.JTextField;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
//import org.reprap.Printer;
//import java.io.IOException;
public class WorkingVolumeFrame extends JFrame {
private JLabel status;
public WorkingVolumeFrame()
{
status = new JLabel("Pick an axis, then zero it by clicking on the home button.");
getContentPane().add(status, BorderLayout.CENTER);
createControlPanel();
pack();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
show();
}
public void createControlPanel()
{
JPanel xPanel = createXPanel();
//JPanel yPanel = createYPanel();
//JPanel zPanel = createZPanel();
JPanel controlPanel = new JPanel();
controlPanel.setLayout(new GridLayout(3,1));
controlPanel.add(xPanel);
//controlPanel.add(yPanel);
//controlPanel.add(zPanel);
getContentPane().add(controlPanel, BorderLayout.SOUTH);
}
public JPanel createXPanel()
{
JButton home = new JButton("Home");
home.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
status.setText("Homing...");
status.repaint();
//onHomeReset();
//When homed, reset JLabel to "When homed, push an 'Advance' button to move towards the end of the axis..."
}
});
JButton advanceFast = new JButton("Advance FAST");
advanceFast.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
status.setText("Advancing... be ready to push the STOP button when the axis nears the end.");
status.repaint();
//go fast;
}
});
JButton advanceSlow = new JButton("Advance SLOW");
advanceSlow.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
status.setText("Advancing... be ready to push the STOP button when the axis nears the end.");
status.repaint();
//go slow;
}
});
JButton stop = new JButton("STOP!");
stop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
status.setText("Axis stopped. To save this position as the endstop, click 'Set as Limit'.");
status.repaint();
//stop;
}
});
JButton set = new JButton("Set as Limit");
set.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
status.setText("Limit set. Returning home...");
status.repaint();
//update preferences
//go home
//when home reset JLabel
}
});
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(new EtchedBorder(), "X-Axis"));
panel.add(home);
panel.add(advanceFast);
panel.add(advanceSlow);
panel.add(stop);
panel.add(set);
return panel;
}
}
|