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

S

Sam

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
 
S

Sam

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
 
J

Josef Garvi

Sam said:
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
 
D

Darryl L. Pierce

Josef Garvi wrote:

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 <[email protected]>
* @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
*/
 
S

Sam

Darryl L. Pierce said:
Josef Garvi wrote:



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
 
D

Darryl L. Pierce

Sam said:
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 <[email protected]>
* @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
*/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top