01: /*
02: * Copyright (C) 2007 Jared Alexander Spigner
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: * jspigner@openjx.org
19: *
20: * jxscrollPaneCTL.java
21: *
22: * Created on June 9, 2007, 8:11 PM
23: *
24: */
25:
26: package org.openjx.jx;
27:
28: import java.awt.Component;
29:
30: import java.beans.PropertyChangeEvent;
31:
32: import javax.swing.JScrollPane;
33:
34: import org.openjx.core.JXInterpreter;
35: import org.openjx.core.JXObject;
36: import org.openjx.core.VirtualMachine;
37:
38: /**
39: * This is the control class for the jxscrollpane otherwise known as the
40: * JScrollPane.
41: *
42: * @author Jared Spigner
43: */
44: public class jxscrollPaneCTL extends JXControl {
45:
46: /** This method is called when the compiler wishes to compile the
47: * component into Java code.
48: *
49: * @param vm points to an instance of the Virtual Machine.
50: */
51: public jxscrollPaneCTL(VirtualMachine vm) {
52: super (vm);
53: }
54:
55: /**
56: * This method is called when the compiler wishes to compile the
57: * component into Java code.
58: *
59: * @param jxObject points to the JXObject in the stack we wish to compile
60: * into Java.
61: *
62: * @return true on success, else false on failure.
63: */
64: public boolean Compile(JXObject jxObject) {
65: JXObject tmpObject = jxObject.getElement(0);
66:
67: if (!this .instantiateObject(jxObject,
68: "javax.swing.JScrollPane",
69: new Class[] { Component.class },
70: new Object[] { tmpObject.getObjectLink() }))
71: return false;
72:
73: JScrollPane jScrollPane = (JScrollPane) jxObject
74: .getObjectLink();
75:
76: jxcomponentCTL jxcomponent = new jxcomponentCTL(
77: this .virtualMachine);
78: if (!jxcomponent.Compile(jxObject))
79: return false;
80:
81: this .virtualMachine.getJXCompiler().scriptEngine.put(
82: jScrollPane.getName(), jScrollPane);
83:
84: return true;
85: }
86:
87: /**
88: * This method is called when the interpreter wishes to interpret the
89: * component's script into Java code.
90: *
91: * @return true on success, else false on failure.
92: */
93: public boolean Interpret(JXObject jxObject) {
94: return true;
95: }
96:
97: }
|