summaryrefslogtreecommitdiff
path: root/trunk/users/hoeken/gcode-host-old/src/org/reprap/gui/PreviewWindow.java
blob: 595c790ac968e1840defb71426b1183353f66a57 (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
package org.reprap.gui;
import java.awt.BorderLayout;
import javax.media.j3d.*;
import javax.swing.WindowConstants;
//import org.reprap.Extruder;
import org.reprap.Printer;

public class PreviewWindow extends javax.swing.JFrame implements Previewer {

	private PreviewPanel panel;
	
	public PreviewWindow(Printer p) {
		super();
		initGUI(p);
	}
	
	private void initGUI(Printer p) {
		try {
			panel = new PreviewPanel();
			panel.setMachine(p);
			getContentPane().add(panel, BorderLayout.CENTER);
			setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
			pack();
			setSize(500, 350);

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void setMachine(Printer p) {
		panel.setMachine(p);
	}
	
	public void addSegment(double x1, double y1, double z1,
			double x2, double y2, double z2) {
		panel.addSegment(x1, y1, z1, x2, y2, z2);
	}
	
	public void setMessage(String message) {
		panel.setMessage(message);
	}

	public boolean isCancelled() {
		return panel.isCancelled();
	}
	
	public void reset() {
		panel.reset();
	}

	public void setCancelled(boolean isCancelled) {
		panel.setCancelled(isCancelled);
	}
	
	public void setLowerShell(BranchGroup ls)
	{
		panel.setLowerShell(ls);
	}
}