/*
* myGUI.java
*
* Created on February 5, 2004, 5:35 PM
*/
package pippo;
/**
*
* @author almauser4
*/
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import com.cosylab.gui.framework.Desktop;
import com.cosylab.gui.framework.Launcher;
import com.cosylab.gui.framework.LauncherEnvironment;
import abeans.pluggable.acs.ACSAbeansEngine;
import abeans.pluggable.acs.maci.settings.ACSPlugSettingsPlugIn;
import com.cosylab.abeans.*;
import com.cosylab.abeans.plugins.*;
import com.cosylab.gui.plugins.*;
/**
* Template for ACS Visual Abeans Applications.
*/
public class myGUI extends AbeansLaunchable {
/**
* ACS Abeans engined used by this application.
*/
private ACSAbeansEngine engine;
/**
* Creates a new instance of this class. The default no-arg constructor
* may be used only by visual builders to instantiate an instance of
* launchable panel. During run-time spcific constructor must be used.
* @see com.cosylab.abeans.AbeansLaunchable
*/
public myGUI() {
super();
}
/**
* Creates a new instance of this class that will reside in a JFrame
container.
* @see com.cosylab.abeans.AbeansLaunchable
*/
public myGUI(
Launcher launcher,
LauncherEnvironment env,
JFrame owner) {
super(launcher, env, owner);
}
/**
* Creates a new instance of this class that will reside inside a JInternalFrame
.
* @see com.cosylab.abeans.AbeansLaunchable
*/
public myGUI(
Launcher launcher,
LauncherEnvironment env,
Desktop desk,
JInternalFrame owner) {
super(launcher, env, desk, owner);
}
/**
* Creates a new instance of this class that will reside inside an applet in a web browser.
* @see com.cosylab.abeans.AbeansLaunchable
*/
public myGUI(
Launcher launcher,
LauncherEnvironment env,
JApplet owner) {
super(launcher, env, owner);
}
/**
* @see com.cosylab.abeans.AbeansLaunchable#getAbeansEngine()
*/
public AbeansEngine getAbeansEngine() {
if (engine == null)
engine = new ACSAbeansEngine(getClass().getName());
return engine;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {//GEN-BEGIN:initComponents
smart_Lamp1 = new alma.ISABELLA_LAMP.abeans.smart_Lamp();
gauger1 = new com.cosylab.abeans.displayers.Gauger();
jPanel1 = new javax.swing.JPanel();
setBrightnessButton = new javax.swing.JButton();
onASyncButton = new javax.swing.JButton();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
try {
smart_Lamp1.setRemoteName("SMART_LAMP");
} catch (abeans.pluggable.PlugException e1) {
e1.printStackTrace();
} catch (abeans.core.InitializationException e2) {
e2.printStackTrace();
}
setLayout(new java.awt.GridLayout(0, 1));
gauger1.setDoubleProperty(smart_Lamp1.getBrightness());
gauger1.setTitle("Brightness Value");
add(gauger1);
jPanel1.setLayout(new java.awt.GridBagLayout());
setBrightnessButton.setText("SET BRIGHTNESS");
setBrightnessButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
setBrightnessButtonActionPerformed(evt);
}
});
jPanel1.add(setBrightnessButton, new java.awt.GridBagConstraints());
onASyncButton.setText("ON_ASYNC");
onASyncButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
onASyncButtonActionPerformed(evt);
}
});
jPanel1.add(onASyncButton, new java.awt.GridBagConstraints());
jTextField1.setColumns(10);
jTextField1.setText("red colour");
jPanel1.add(jTextField1, new java.awt.GridBagConstraints());
jTextField2.setColumns(3);
jTextField2.setText("8");
jPanel1.add(jTextField2, new java.awt.GridBagConstraints());
add(jPanel1);
}//GEN-END:initComponents
private void onASyncButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onASyncButtonActionPerformed
// Add your handling code here:
try {
smart_Lamp1.on_async("red",3.0);
}
catch (Exception ex) {
ex.printStackTrace();
}
}//GEN-LAST:event_onASyncButtonActionPerformed
private void setBrightnessButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_setBrightnessButtonActionPerformed
try {
}
catch (Exception ex) {
ex.printStackTrace();
}
// Add your handling code here:
}//GEN-LAST:event_setBrightnessButtonActionPerformed
/**
* This method is called by the Abeans framework at initialization.
*/
public void userInitializeGUI() {
initComponents();
getSystemPane().setPreferredSize(getPreferredSize());
}
/**
* The main entry point for every Java application.
*/
public static void main(String args[]) {
AbeansLaunchable.launch(myGUI.class, args);
}
/**
* This method initializes the standard Abeans plugins.
*/
public void userInitializePlugIns() {
try
{
installPlugIn(AbeansSystemMenuPlugIn.class);
installPlugIn(CosyStandardActionsPlugIn.class);
installPlugIn(AboutPlugIn.class);
installPlugIn(AbeansStandardActionsPlugIn.class);
installPlugIn(VitragePlugIn.class);
installPlugIn(ACSPlugSettingsPlugIn.class);
// uncomment following line(s) to get plugin(s) installed at startup
// installPlugIn(AbeansExceptionPanelPlugIn.class);
// installPlugIn(TreeBrowserPlugIn.class);
// installPlugIn(LoggingPlugIn.class);
// installPlugIn(ReportAreaPlugIn.class);
} catch (Exception e)
{
e.printStackTrace();
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private com.cosylab.abeans.displayers.Gauger gauger1;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JButton onASyncButton;
private javax.swing.JButton setBrightnessButton;
private alma.ISABELLA_LAMP.abeans.smart_Lamp smart_Lamp1;
// End of variables declaration//GEN-END:variables
}