Henk van Weers wrote:
> Dear all,
> I have Octave-3.2.4_i686-pc-mingw32_gcc-4.4.0_setup.exe and java package
> java-1.2.7 installed on a windows xp machine. I copied the following
> code from Martin Helm, posted nov 07, 2010 (I also attached the compiled
> class):
> --- begin test_java.m ---
>
> pkg load java
> javaaddpath(".");
>
> surf(rand(10));
> sleep(0.1);
> jd = java_new("javax.swing.JDialog");
> sl = java_new("OctSlider", "Slider1", "callback", 0, 359, 0);
> jd.add(sl);
> jd.setModal(1);
> jd.setSize(250, 50);
> a = jd.setVisible(1);
> disp(a)
> pkg unload java
>
> --- end test_java.m ---
>
>
> --- begin callback.m ---
>
> function callback(n)
> [a, b] = view();
> view(n, b)
> drawnow
> endfunction
>
> --- end callback.m ---
>
>
> --- begin OctSlider.java ---
>
> import javax.swing.JSlider;
> import javax.swing.event.ChangeEvent;
> import javax.swing.event.ChangeListener;
>
> import org.octave.Octave;
>
>
> public class OctSlider extends JSlider implements ChangeListener {
>
> private String callBack = "";
>
> public OctSlider(String name, String callBack, int min, int max, int
> value){
> super(min, max, value);
> this.callBack = callBack;
> setName(name);
> addChangeListener(this);
> }
>
> @Override
> public void stateChanged(ChangeEvent e) {
> if (e.getSource() == this && getValueIsAdjusting()) {
> int val = (int)getValue();
> Octave.call(callBack, new Object[]{val}, new Object[] {});
> }
> }
>
> }
>
> --- end OctSlider.java ---
>
> When I run the code I get the Jslider dialog. However when I move the
> slide I get following errors (see attached "error list.txt") in the
> octave window.

Confirmed with Octave-3.4.2_MinGW (Tatsuro's build) with Java-1.2.8 package.

>                According to Martin Helm the code runs fine on linux and
> he suspects it has to do with the java package build for windows.

Considering Java's claim and fame for platform-independence, Martin Helm 
has a point there.

> Can anybody help me out with this?

Hopefully the Java package maintainer?

Philip

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to