Java for PDA/Mac w/ Swing, database - possible?

Discussion in 'Java' started by Sam, May 17, 2004.

  1. Sam

    Sam Guest

    Hi,

    I'm developing a database/swing educational Java application. Since
    it's for retail distribution, it nees to run on a PDA and a Mac as
    well as Windows. The database also needs to be multi-platform.

    Is this do-able, or will I need separate distributions? I'm also
    interested in software which simulates mac & pda, since I don't want
    to purchase that equipment unless it's absolutely necessary.

    Regards,
    SamHunt90
     
    Sam, May 17, 2004
    #1
    1. Advertising

  2. Sam

    Sam Guest

    (Sam) wrote in message news:<>...
    > Hi,
    >
    > I'm developing a database/swing educational Java application. Since
    > it's for retail distribution, it nees to run on a PDA and a Mac as
    > well as Windows. The database also needs to be multi-platform.
    >
    > Is this do-able, or will I need separate distributions? I'm also
    > interested in software which simulates mac & pda, since I don't want
    > to purchase that equipment unless it's absolutely necessary.
    >
    > Regards,
    > SamHunt90



    If anyone's interested, I have some results from preliminary research,
    very incomplete.

    I think a database the may run on a PDA is something called "sqlLite".
    Hopefully, this can run on the Mac and Windows as well.

    Unfortunately, it looks like the J2ME version doesn't come with AWT.
    My next step is to try to figure out how they do a GUI on J2ME.

    Either way, it looks like if I want to use the regular Swing or AWT
    classes for the Windows distribution, I will need to have a separate
    version for the PDA :)

    SamHunt90
     
    Sam, May 19, 2004
    #2
    1. Advertising

  3. Sam

    Josef Garvi Guest

    Sam wrote:
    >
    > If anyone's interested, I have some results from preliminary research,
    > very incomplete.


    Thanks, that's interesting.

    > I think a database the may run on a PDA is something called "sqlLite".
    > Hopefully, this can run on the Mac and Windows as well.
    >
    > Unfortunately, it looks like the J2ME version doesn't come with AWT.
    > My next step is to try to figure out how they do a GUI on J2ME.


    They are usually done through MIDP. MIDP is more dynamic than AWT or SWING
    with regards to layout of the UI - you specify that something is a command
    rather than where the button should be on the screen This is meant to fit a
    much broader range of device types where some have tiny monitors and others
    relatively large ones, some have pens for input, others keys only.

    To my knowledge, MIDP does not upscale so it can be used on normal PC desktops.

    There is a third-party library called kAWT that was developed before MIDP
    that tries to be AWT-compatible and runs on PDAs. Perhaps that can be
    interesting for your project:

    http://www.kawt.de/


    > Either way, it looks like if I want to use the regular Swing or AWT
    > classes for the Windows distribution, I will need to have a separate
    > version for the PDA :)


    That's likely... :-(
    A good separation of the view and the model will allow you to keep a lot of
    the code common.

    > SamHunt90



    --
    Josef Garvi

    "Reversing desertification through drought tolerant trees"
    http://www.eden-foundation.org/

    new income - better environment - more food - less poverty
     
    Josef Garvi, May 21, 2004
    #3
  4. Josef Garvi wrote:

    <snip>

    >> Either way, it looks like if I want to use the regular Swing or AWT
    >> classes for the Windows distribution, I will need to have a separate
    >> version for the PDA :)

    >
    > That's likely... :-(
    > A good separation of the view and the model will allow you to keep a lot
    > of the code common.


    You *can* maintain an MVC pattern by having a single class that implements
    the CommandListener interface and have it act as the adaptor between the
    LCDUI components and the underlying code that acts on user input.
    Additionally, you can define your own interfaces for the view components
    that lets your underlying classes grab the specific fields needed. I use
    this very same pattern for my application so that I can reuse the
    underlying objects for both desktop and the web.

    --
    /**
    * @author Darryl L. Pierce <>
    * @see The J2ME FAQ <http://mypage.org/mcpierce/j2mefaq.html>
    * @quote "What do you care what others think, Mr. Feynman?"
    * @geek echo '$_ = "Jvtu bopuifs Pfsm ibdlfs."; y/a-z/za-y/; print' |
    perl
    */
     
    Darryl L. Pierce, May 21, 2004
    #4
  5. Sam

    Sam Guest

    "Darryl L. Pierce" <> wrote in message news:<>...
    > Josef Garvi wrote:
    >
    > <snip>
    >
    > >> Either way, it looks like if I want to use the regular Swing or AWT
    > >> classes for the Windows distribution, I will need to have a separate
    > >> version for the PDA :)

    > >
    > > That's likely... :-(
    > > A good separation of the view and the model will allow you to keep a lot
    > > of the code common.

    >
    > You *can* maintain an MVC pattern by having a single class that implements
    > the CommandListener interface and have it act as the adaptor between the
    > LCDUI components and the underlying code that acts on user input.
    > Additionally, you can define your own interfaces for the view components
    > that lets your underlying classes grab the specific fields needed. I use
    > this very same pattern for my application so that I can reuse the
    > underlying objects for both desktop and the web.


    I think I'll need to do something like that - IIRC, the Struts
    framework uses this approach. It's very clever, I'll have to review
    it. Do you have some sample code you can past?

    Regards,
    SamHunt90
     
    Sam, May 22, 2004
    #5
  6. Sam wrote:

    > I think I'll need to do something like that - IIRC, the Struts
    > framework uses this approach. It's very clever, I'll have to review
    > it. Do you have some sample code you can past?


    It's pretty straight forward. The underlying objects all talk to instances
    of [whatever]Model and I have each LCDUI object implement the appropriate
    interface and register itself as the model for the appropriate common
    object. I also use a class named CommandHandler which implements
    CommandListener. All Displayables use the singleton instance of
    CommandHandler as their CommandListener object (CommandHandler.instance).
    This one class has knowledge of how to translate between LCDUI events and
    the shared code. The code for CommandHandler looks like:

    public class CommandHandler
    implements CommandListener
    {
    public static final CommandHandler instance = new CommandHandler();

    private CommandHandler() {}

    public void commandAction(Command cmd,Displayable dsp)
    {
    switch(cmd.getCommandType())
    {
    case Command.BACK:
    if(dsp instanceof ComputerScreen ||
    dsp instanceof ContactScreen)
    {
    /* invoke method on the class
    shared between MIDP and J2SE */
    }
    break;
    }
    }
    }

    --
    /**
    * @author Darryl L. Pierce <>
    * @see The J2ME FAQ <http://mypage.org/mcpierce/j2mefaq.html>
    * @quote "What do you care what others think, Mr. Feynman?"
    * @geek echo '$_ = "Jvtu bopuifs Pfsm ibdlfs."; y/a-z/za-y/; print' |
    perl
    */
     
    Darryl L. Pierce, May 23, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. -
    Replies:
    3
    Views:
    407
    Steve W. Jackson
    Jul 17, 2003
  2. Sam
    Replies:
    1
    Views:
    372
    Darryl L. Pierce
    May 18, 2004
  3. Replies:
    1
    Views:
    1,153
    Steve W. Jackson
    Mar 22, 2005
  4. Big Daddy

    Java 1.2 Swing vs. Java 1.5 Swing

    Big Daddy, Apr 15, 2005, in forum: Java
    Replies:
    2
    Views:
    501
    Pete Barrett
    Apr 16, 2005
  5. Anil
    Replies:
    1
    Views:
    441
    Jean-Luc David [MS-MVP]
    Jul 31, 2004
Loading...

Share This Page