get a slider onto a web page?

G

Geoff Cox

Hello,

I have a small app written in Java 2 which allows a user to answer a
series of questions by positioning the marker on a slider.

After all the questions have been answered the slider values are saved
to a file.

I would like this app to be available on the Net - any ideas please?!

Thanks

Geoff
 
N

Niels Dybdahl

I have a small app written in Java 2 which allows a user to answer a
series of questions by positioning the marker on a slider.

After all the questions have been answered the slider values are saved
to a file.

I would like this app to be available on the Net - any ideas please?!

Convert it to an applet instead of an application.
Create a webserver with a database, that can receive the result from your
applet.

Niels Dybdahl
 
G

Geoff Cox

Convert it to an applet instead of an application.
Create a webserver with a database, that can receive the result from your
applet.

Niels,

Thanks for above - how do I "convert" the java file to an applet?


Cheers

Geoff
 
A

Andrew Thompson

Convert it to an applet instead of an application.

How does that help? Applications can access the net
just as easily (more easily) than applets. Further,
applications are easier to develop, debug and deploy.

<http://www.physci.org/codes/javafaq.jsp#appfirst>

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"The storm broke with a violent flash of lightning, and an apalling crash
of thunder.."
Severed Heads 'Dead Eyes Opened'
 
A

Andrew Thompson

..How do I put a slider on a web page ..

D'Uuuuh! *That* explains why Niels mentioned applets.

I missed that bit in the 'subject', which prompts me to
point out that it is best to repeat key words from the
subject in the body.

OK. Let's pause a second.

If you had a link on the web page to 'do slider stuff'
that might connect to..
a) a web page with a signed applet
b) a JNLP file that invokes your signed application.

Note that b) is significantly easier than a). Especially
since you already have (at least part of) the application.

Do you really want to do all this *specifically* in
a web page, or do you simply want to offer the end
user a link that achieves the end result?
 
G

Geoff Cox

If you had a link on the web page to 'do slider stuff'
that might connect to..
a) a web page with a signed applet
b) a JNLP file that invokes your signed application.

Note that b) is significantly easier than a). Especially
since you already have (at least part of) the application.

Do you really want to do all this *specifically* in
a web page, or do you simply want to offer the end
user a link that achieves the end result?

Andrew,

I guess a link would be OK - the point being that the user should have
access to the app either on a non-net connected PC or via the net.

I see that JNLP means Java Network Launching Protocol - any
suggestions for info for someone new to JNLP?

Thanks

Geoff
 
N

Niels Dybdahl

Convert it to an applet instead of an application.
Niels,

Thanks for above - how do I "convert" the java file to an applet?

An application has a main function. An applet should extend JApplet (or
similar) and have the functions init, start, stop and destroy.
The function init contains that what you usually would put into the main
function. The rest of the functions might be empty.

A class can be an application and an applet at the same time. In that case
the main function should create an instance of the class and a JFrame and
put the applet instance inside the frame and then call the init and the
start functions. This makes it easier to debug the applet, because it can be
debugged as an application.

Niels Dybdahl
 
R

Roedy Green

I have a small app written in Java 2 which allows a user to answer a
series of questions by positioning the marker on a slider.

After all the questions have been answered the slider values are saved
to a file.

I would like this app to be available on the Net - any ideas please?!

There are two main approaches. Convert it to a Applet, or convert it
to JAWS app. Then people can download it and run it very easily.

The third approach is to bundle it up is zip with some install
instructions and let them run it as an app.

If you want to file saved locally, you need a signed Applet or JAWS.

If you want the files save on the server, you need some server side
code to accept the file and put it somewhere.

see http://mindprod.com/jgloss/applet.html
http://mindprod.com/jgloss/jaws.html
http://mindprod.com/jgloss/signedapplet.html
 
A

Andrew Thompson

...
I guess a link would be OK - the point being that the user should have
access to the app either on a non-net connected PC or via the net.

But the site they are accessing is on a server?

This is important because ideally the server gives
a .JNLP it's content-type, and that in turn causes the
browser to decide if it will hand the content of the
link over to JAWS.
I see that JNLP means Java Network Launching Protocol - any
suggestions for info for someone new to JNLP?

(shrugs) Your aplication needs to be jar'd and signed.
The creation of the JNLP file is relatively simple, once
the signing is done.
 
G

Geoff Cox

There are two main approaches. Convert it to a Applet, or convert it
to JAWS app. Then people can download it and run it very easily.

Roedy,

Thanks for these ideas. Will follow up on JAWS etc.

Cheers

Geoff
 
G

Geoff Cox

But the site they are accessing is on a server?
This is important because ideally the server gives
a .JNLP it's content-type, and that in turn causes the
browser to decide if it will hand the content of the
link over to JAWS.

Andrew,

Not sure what you mean, "on a server"?

Geoff
 
A

Andrew Thompson

...
Not sure what you mean, "on a server"?

I skimmed your earlier posts and got the impression
you were distributing this appllication to your users
from a web page coming off a server that was only available
to the staff.

The 'server' is like a web-site, and adds an important
advantage for when dealing with JWS. The advantage is
that the server can send the JNLP file to the client and
specify the Mime-Type.

This is very important, as the mime-type is what a
browser uses to determine whther to open a file or
display it in the browser, or to hand it off to Word
or Excel, or offer to save it (if it's a Zip).

The content-type of a JNLP file should cause the file
to be handed over to JAWS for actioning, but if no
content-type is set, the file might be displayed in
the browser. Cute, but not much use..

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"If no one out there understands, start your own revolution and cut out the
middle man."
Billy Bragg 'Waiting For The Great Leap Forward'
 
R

Roedy Green

Not sure what you mean, "on a server"?

A server is a machine that hosts websites, and more. It runs Servlets
and other code such as SQL databases. The server works in conjunction
with the Applets or JAWS that run on the client's machine. Server
side code is a giant can of worms that I think you should leave if
possible for another day. You have your hands full learning Applets
and JAWS.

See http://mindprod.com/jgloss/servlet.html
 
G

Geoff Cox

An application has a main function. An applet should extend JApplet (or
similar) and have the functions init, start, stop and destroy.
The function init contains that what you usually would put into the main
function. The rest of the functions might be empty.

A class can be an application and an applet at the same time. In that case
the main function should create an instance of the class and a JFrame and
put the applet instance inside the frame and then call the init and the
start functions. This makes it easier to debug the applet, because it can be
debugged as an application.


Thanks Niels - doesn't everything just get more complicated !

Cheers

Geoff
 
G

Geoff Cox

A server is a machine that hosts websites, and more. It runs Servlets
and other code such as SQL databases. The server works in conjunction
with the Applets or JAWS that run on the client's machine. Server
side code is a giant can of worms that I think you should leave if
possible for another day. You have your hands full learning Applets
and JAWS.

Roedy,

I think you may be right! I am used to using php/mysql for server side
code but as all these things need a server I was a bit confused by
Andrew's reference to a server ...

I already have my Java 2 application ready - can you just outline the
steps needed to change (if this possible) the application to an applet
etc? Or, do I have to start again to write an applet?

Cheers

Geoff
 
A

Andrew Thompson

... ...
Thanks Niels - doesn't everything just get more complicated !

It is not as hard as it may seem..

<sscce>
import java.applet.*;
import java.awt.*;

public class HelloWorldAppletApplication extends Applet {

public void init() {
add( new Label("Hello World (Wide Web)!") );
}

public static void main(String[] args) {
Frame f = new Frame("Hello World Application");
HelloWorldAppletApplication helloWorld =
new HelloWorldAppletApplication();
helloWorld.init();
f.add( helloWorld );
f.pack();
f.setVisible(true);
}
}
</sscce>

HTH

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Don't just take me for tryin' to be heavy. Understand, it's time to get
ready.."
Stevie Ray Vaughan and Double Trouble 'Couldn't Stand The Weather'
 
A

Andrew Thompson

....
I think you may be right! I am used to using php/mysql for server side
code but as all these things need a server I was a bit confused by
Andrew's reference to a server ...

You had not specifically mentioned it (that I could see)
it makes JNLP easier.
I already have my Java 2 application ready - can you just outline the
steps needed to change (if this possible) the application to an applet
etc? Or, do I have to start again to write an applet?

Given you *already* have an application, I *strongly*
recommend you try JWS before going any further with the applet.
It can be as simple as putting a file like this on your
server, ..
<http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html#example>
...then linking to it.
 
A

Andrew Thompson

Another thing I keep forgetting to mention is that users
can lauinch an application directly from a link.

Try the 'JTest' link at the top of this page..
<http://www.physci.org/pc/property.jsp>

That technique would allow you to get 'from a link in
a web page, to a slider on the users screen', very
(very) easily for the developer.

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"You can blow out a candle, but you can't blow out a fire. Once the flame
begin to catch, the wind will blow it higher."
Peter Gabriel 'Biko'
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top