import java.awt.*;
import org.jopas.*;
public class Example6 extends Frame {
JopasLabel plot;
Jopas jopas;
TextField aleatorio;
public Example6() {
jopas = new Jopas ();
aleatorio= new TextField();
aleatorio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
aleatorioActionPerformed(evt);
}
});
addWindowListener( new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
System.exit(0);
}
});
plot = new JopasLabel(jopas);
add( "South",aleatorio );
add( "Center",plot );
jopas.Execute("y=rand(1,20)");
plot.paintLabel("y","Example 6","Samples","Value");
pack();
setSize(300,300);
setVisible(true);
}
private void aleatorioActionPerformed(java.awt.event.ActionEvent evt) {
Matrix L = new Matrix(Double.parseDouble(aleatorio.getText()), "L");
jopas.Load(L);
jopas.Execute("y=rand(1,L)");
plot.paintLabel("y","Example 6","Samples","Value");
}
public static void main( String args[] ) {
Example6 example6 = new Example6();
}
} |