#31 extending swt Composte

closed-fixed
nobody
5
2008-12-02
2008-11-21
No

Hi. I'm having this strange trowble when extending org.eclipse.swt.widgetsç.Composite like this::

package org.sgx.mlc.gui;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
public class Borrame2 extends Composite {
private Label label = null;
public static void main(String[] args) {
Display display = Display.getDefault();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setSize(new Point(300, 200));
new Borrame2(shell, SWT.NONE);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
public Borrame2(Composite parent, int style) {
super(parent, style);
initialize();
}
private void initialize() {
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
label = new Label(this, SWT.NONE);
label.setText("Label");
this.setLayout(gridLayout);
setSize(new Point(300, 200));
}
}

if I execute this class using IE (tested on 6.0 and 7.0), the message

[Java2Script] Error in loading bin/org/eclipse/swt/widgets/Composite.js!

appears and no shell is showed. In firefox and opera it works fine!

Note: the code abobe is generated atumatically by evlipse visual editor. It seems that, for some reason, in IE the class loader is trying to get the js sources from the project's source folder instead of getting it from j2slib sources.

Discussion

  • Sebastián Gurin

    • labels: --> J2S SWT Library
     
  • Sebastián Gurin

    investigating a little more, it seem that this bug occurs when extending any of the classes implemented/defined in j2slib. for example:

    package org.sgx.mlc.gui;
    import org.eclipse.swt.widgets.Composite;
    import org.eclipse.swt.widgets.Text;
    public class Borrame2 extends Text {
    public Borrame2(Composite parent, int style) {
    super(parent, style);
    }
    public static void main(String[] args) {
    System.out.println("jhsjsjs");
    }

    }

    Ah, and the same error seems to occur in opera too. Only in firefox fine

     
  • Zhou Renjian

    Zhou Renjian - 2008-12-02
    • status: open --> open-fixed
     
  • Zhou Renjian

    Zhou Renjian - 2008-12-02

    Running a Java2Script application will generate an *.html file. And classpath should be written down. In some scenario, classpath is missed in the *.html.

    Bug is fixed in 2.0.0/20081203.

     
  • Zhou Renjian

    Zhou Renjian - 2008-12-02
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks