Skip to main content

Running a cdc application under the CrEme emulator using LWUIT

1 reply [Last post]
wkt
Offline
Joined: 2012-07-10
Points: 0

I made my first attempts with the Netbeans IDE to get
a running cdc application under the CrEme emulator using LWUIT.

But now I fail with a simple HelloWorld example.

Here is roughly my code ( most important parts ) :

public class Main extends javax.swing.JFrame {  
    public Main() { 
    } 
    public static void main(String args[]) { 
        java.awt.EventQueue.invokeLater(new Runnable() { 
            public void run() { 
                //new Main().setVisible(true); 
                //new Main(); 
                Main m = new Main(); 
 
                m.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); 
                m.setTitle("cdc CrEme HW lwuit"); 
                m.setBackground(new java.awt.Color(153, 153, 0)); 
                m.setSize(640,420); 
                org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(m.getContentPane()); 
                m.getContentPane().setLayout(layout); 
                layout.setHorizontalGroup( 
                        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 240, Short.MAX_VALUE)); 
                layout.setVerticalGroup( 
                        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 292, Short.MAX_VALUE)); 
                m.pack(); 
                m.setVisible(true); 
 
                Display.init(this); 
 
                Form f = new Form(); 
                f.setTitle("Hello World"); 
                f.setLayout(new BorderLayout()); 
                f.addComponent("Center", new Label("I am a Label")); 
                f.show(); 
 
            } 
        }); 
    }

If I omit the code behind m.setVisible(true) a JFrame shows up as expected.

I already tried Display.init(m) to no avail.
Also putting the LWUIT code in the constructor doesnt help - no JFrame shows up
any more.

I also changed the JFrame to java.awt.Frame without success.

Does it not work this way ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
wkt
Offline
Joined: 2012-07-10
Points: 0

I now ran the HelloWorld example with the CrEme emulator/JVM on my netbook device and got the following error messages :

java.lang.NoSuchMethodError: com.sun.lwuit.impl.cdc.CDCImplementation$C: method setFocusable(Z)V not found
at com.sun.lwuit.impl.cdc.CDCImplementation$C.()
at com.sun.lwuit.impl.cdc.CDCImplementation.()
at com.sun.lwuit.impl.ImplementationFactory.createImplementation()
at com.sun.lwuit.Display.init()
at Main.()
at Main$1.run()
at java.awt.event.InvocationEvent.dispatch()
at java.awt.EventDispatchThread.run()

I downloaded the LWUIT 1.5 version from ORACLE.