Can GWT handle Java Swing?

I am having problems creating a GWT application.

Here: https://developers.google.com/web-toolkit/tools/gwtdesigner/features/menu_editing Google itself talks about the possibility of implementing Java Swing, JFrame in GWT. I am new to Java and don’t know what the SWT equivalent of Swing is, so I have not tried this option.

When I try to run my code (which is built from GWT Designer), I get errors on every line using a 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); 

Return: [ERROR] [gwtearthdemo] - Line 96: No source code for type javax.swing.JFrame; did you forget to inherit the necessary module?

Same for JMenuBar, JMenu.

I saw errors like this with answers suggesting that this function is not applicable to GWT. However, Google offers. Any advice here?

+6
source share
1 answer

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

+8
source

Source: https://habr.com/ru/post/943466/


All Articles