>>> Let's run Python on Mobile

วันพฤหัสบดี, มกราคม 25, 2550

How to Swing on UIQ

You can't run normal Swing application on UIQ.
(Swing is Java2SE(or more),but PersonalJava on UIQ is Java 1.1)
But you can make your own Swing app. that can run on UIQ.
Here is how to do that...

Once upon the time,when Java was version 1.1,there was a Swing Package named "swingall.jar".
File named swingall.jar,was prepared for compiling and running Swing app. on Java1.1.
Try Google-searching for swingall.jar.
Swingall.jar has many versions,the version you need is version that has folder "javax" insided.

To compile Swing app. for UIQ,You have to use JDK1.1.8,that can D/L here
After JDK1.1.8 installation(in C:\JDK1.1.8),place swingall.jar in C:\(current folder),and use this command to compile.
(My example sourcecode is C:\Stest.java)

path .;C:\jdk1.1.8\bin
javac -classpath ".;C:\swingall.jar;C:\JDK1.1.8\lib\classes.zip" Stest.java

Then you have file Stest.class in C:\ on your PC.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Stest extends JButton implements ActionListener {
Stest() {
public void actionPerformed(ActionEvent e) {
public static void main(String args[]) {
JFrame MyFrame = new JFrame("Hello!!");
Container MyCont = MyFrame.getContentPane();
MyCont.setLayout(new FlowLayout());
Stest TheButton = new Stest();

How to run Swing app. on UIQ.
Just place swingall.jar in C:\classes (on UIQ),and add classpath(-cp) to C:\classes\swingall.jar

Or you can run it with jRun in jCompile program.
After install jrunp800.sis,change content of jRun.txt into...
-cp C:\classes\swingall.jar;C:\classes Stest

Place swingall.jar and Stest.class in C:\classes on UIQ.
Activate jRun,you will run your Swing app. on your UIQ like this.