summaryrefslogtreecommitdiff
path: root/branches/sm-unittesting/src/org/reprap/gui/PreviewWindow.java
blob: c4a925eede89eb6c175a4f3c737cff365518d41e (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
package org.reprap.gui;
import java.awt.BorderLayout;

import javax.swing.WindowConstants;

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

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

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void setMaterial(int index) {
		panel.setMaterial(index);
	}
	
	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);
	}
	
}