Menu

[r79]: / GraphScript / trunk / ls / graph / ui / ScriptPanel.java  Maximize  Restore  History

Download this file

67 lines (58 with data), 1.8 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
package ls.graph.ui;
import java.awt.BorderLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.border.Border;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.TabSet;
import javax.swing.text.TabStop;
public class ScriptPanel extends JPanel
{
private static final long serialVersionUID = 1L;
// private MainWindow window = null;
ScriptPanel(MainWindow w)
{
super();
// this.window = w;
initComponents();
}
private JTextPane txtScript = null;
private void initComponents()
{
this.setLayout(new BorderLayout());
txtScript = new JTextPane();
txtScript.setEditable(true);
txtScript.setEnabled(true);
txtScript.setAlignmentY(0.0f);
//txtScript.setFont(new Font("Arial",Font.PLAIN,11));
Style style = txtScript.addStyle("Script", null);
float tabLength = 7.0f;
style.addAttribute(
StyleConstants.FontConstants.TabSet,
new TabSet(new TabStop[]
{new TabStop(tabLength),
new TabStop(tabLength*2),
new TabStop(tabLength*3),
new TabStop(tabLength*4),
new TabStop(tabLength*5),
new TabStop(tabLength*6)}));
style.addAttribute(StyleConstants.FontConstants.FontFamily, "Courier New");
txtScript.setLogicalStyle(style);
JScrollPane scrollPanel = new JScrollPane(txtScript);
this.add(scrollPanel,BorderLayout.CENTER);
Border scriptPaneBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),"Algorithm Code");
this.setBorder(scriptPaneBorder);
}
void setScriptText(String st)
{
if (st != null)
txtScript.setText(st);
}
String getScriptText()
{
return txtScript.getText();
}
}
MongoDB Logo MongoDB