summaryrefslogtreecommitdiff
path: root/trunk/users/hoeken/gcode-host-old/src/org/reprap/gui/StatusMessage.java
blob: a38d1d34ecf1e67ce5bb39d5c348e51092e7247f (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
package org.reprap.gui;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;

import javax.swing.JFrame;
import javax.swing.JTextPane;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class StatusMessage extends javax.swing.JDialog {
	private boolean cancelRequested = false;
	private JButton cancelButton;
	private JTextPane message;

	/**
	* Auto-generated main method to display this JDialog
	*/
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		StatusMessage inst = new StatusMessage(frame);
		inst.setVisible(true);
	}
	
	public StatusMessage(JFrame frame) {
		super(frame);
		initGUI();
	}
	
	private void initGUI() {
		try {
			{
				message = new JTextPane();
				getContentPane().add(message);
				message.setBounds(0, 0, 280, 77);
				message.setEditable(false);
				message.setBackground(Color.blue);
				message.setForeground(Color.yellow);
				message.setEnabled(false);
				SimpleAttributeSet set = new SimpleAttributeSet();
				StyleConstants.setAlignment(set, StyleConstants.ALIGN_CENTER);
				message.setParagraphAttributes(set, true);			}
			{
				cancelButton = new JButton();
				getContentPane().add(cancelButton);
				cancelButton.setText("Cancel");
				cancelButton.setBounds(105, 84, 91, 28);
				cancelButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						cancelButtonActionPerformed(evt);
					}
				});
			}
			
			{
					getContentPane().setLayout(null);
			}
			{
				this.setTitle("Progress");
			}
			this.setSize(288, 137);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void setMessage(String text) {
		message.setText(text);
	}

	public boolean isCancelled() {
		return cancelRequested;
	}

	public void setCancelled(boolean b) {
		cancelRequested = b;
	}
	
	private void cancelButtonActionPerformed(ActionEvent evt) {
		cancelRequested = true;
		setVisible(false);
	}

}