Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can GWT handle Java Swing?

I'm having some trouble building a GWT application.

Here: https://developers.google.com/web-toolkit/tools/gwtdesigner/features/menu_editing Google themselves talk of the possibility of Java Swing, JFrame implementation in the GWT. I am a Java newbie and don't know what the SWT equivalent of Swing is, so I haven't tried that option.

When I try to run my code (which is built from the GWT Designer) I get errors at each line that uses JFrame:

JFrame frame = new JFrame();

        JMenuBar menuBar = new JMenuBar();
        frame.setJMenuBar(menuBar);

        JMenu mnNewMenu = new JMenu("Test");
        menuBar.add(mnNewMenu);

        JMenu mnNewMenu_1 = new JMenu("Test");
        mnNewMenu.add(mnNewMenu_1);

Returning: [ERROR] [gwtearthdemo] - Line 96: No source code is available for type javax.swing.JFrame; did you forget to inherit a required module?

Ditto for JMenuBar, JMenu.

I have seen errors similar to this with answers suggesting that the function in question is not applicable to GWT. However, Google suggests it is. Any advice here?

like image 813
Kyle Wright Avatar asked Apr 23 '13 17:04

Kyle Wright


1 Answers

In GWT you are restricted to use only some of the java classes since it is not possible to convert all the java classes to javascript. You can find a list of the allowed classes in this link: List of Classes

like image 115
Suresh Atta Avatar answered Oct 31 '22 09:10

Suresh Atta