ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Java functions
  • Starting a Java application
JavaExecute (Example)
Starting a Java application
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)Ajax The following code is used to start a Java application. JavaLoad is used to specify the location of the classes required to run the Java application.
// Specifies the location of Classes.ZIP and *.class
// the Java application to start
JavaLoad("D:\sources\AppJava1\classes.Zip;D:\sources\Example\JavaTest")
JavaExecute("Application", "MyString")
// JAVA code
import java.awt.*;
import java.awt.event.*;

PUBLIC class Application {  PUBLIC Application (String[] args){
Window f = new Window (args);
      f.validate();
      f.setVisible(true);
      System.out.println("It's open");
      }

PUBLIC static void main (String[] args) {
      new Application(args);
      }
}

import java.awt.*;
import java.awt.event.*;

PUBLIC class Window extends Frame {
      String[] params;
      // Menu bar
      MenuMenubar = new MenuBar();
      // File menu
      Menu file = new Menu("File");
      // Quit sub-menu
    MenuItem quit = new MenuItem("Quit");

PUBLIC Window(String[] args){
      params = args;

      this.setSize(new Dimension(400, 200));
    this.setTitle("Demo");
      quit.addActionListener(new Frame_ActionListener(this));
    file.add(quit);
      menu.add(file);

    this.setMenuBar(menu);

}

PUBLIC void paint(Graphics g){
      int i;
      for(i = 0;i<params.length;i++)
      g.drawString(params[i], 10, i*50+100);
}
}

class Frame_ActionListener implements ActionListener{
    Window ff;

Frame_ActionListener(Window ff){

this.ff = ff;
}
PUBLIC void actionPerformed(ActionEvent e){
    ff.dispose();
}

}
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help