Java in Browser

  • Thread starter Dirk Bruere at NeoPax
  • Start date
D

Dirk Bruere at NeoPax

Arne said:
The standard Java plugin does not provide such a capability.

I believe that was what I said elsewhere.
I also said that there is a need for it. No doubt you disagree, but we
have customers who would pay. There's a whole slew of devices that would
benefit from a uniform control shell ie a browser to package what are
now disparate programs.

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
R

Roedy Green

Is there any way of getting a Java app to execute in a browser window?
I would like to have the app running in a tab in order to make a
consistent i/f with other stuff that is browser displayed.

You can create a hybrid that will either as an Applet or application.
See http://mindprod.com/jgloss/applet.html

You can run it as a Java Web Start app. You don't have to modify your
app, just add a JNLP file. It is spawned from the browser, but it
runs in its own window.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Learning is not compulsory... neither is survival."
~ Dr. W. (William) Edwards Deming (born: 1900-10-14 died: 1993-12-20 at age: 93))
 
D

Dirk Bruere at NeoPax

Arne said:
True. But that is different from a browse environment.


If this is a high controlled intranet environment with same OS, same
browser, same Java etc., then you may be able to:
- sign you applet
- find the policy file used by the standard browser and Java
- have the PC admins push out a change to that policy file that
gives code signed by you more access
- the users will not be asked for you applets but will be asked
for other applets

I have never tried it, but my understanding is that it should be
possible.

No doubt it is, but our smarter customers probably think PC admins have
something to do with passwords when they start their machine. Still, if
it really were easy I'd be out of a job - where there is difficulty
there is $$$ :)

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
J

John B. Matthews

Dirk Bruere at NeoPax said:
John said:
[...]
So I do everything inside a JPanel, which is contained within a
JFrame?
JFrame is one of a small number of top-level containers; JApplet
is another:

<http://java.sun.com/docs/books/tutorial/uiswing/components/toplevel.html>

One top-level container may not contain another, although the same
content may be placed in either:

<http://sites.google.com/site/drjohnbmatthews/subway>
<http://mindprod.com/jgloss/applet.html>
I've rewritten the app as a JPanel.
I assume it's fairly easy now to add it to any top level container?

Yes, but only one top-level container at a time, as the subway
example shows. An application invokes main(), which adds the
content to a JFrame; in contrast, an applet invokes init(), which
adds the content to a JApplet.

So writing all the stuff as JPanels is the way to go for producing
code that can be put into a number of application types. I think I
might have Sunday evening off...

Actually, JComponent is the base class for all Swing components that are
commonly added to top-level containers:

<http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html>

JPanel is a generic, lightweight, buffered container that's useful for
grouping visually and functionally related components:

<http://java.sun.com/javase/6/docs/api/javax/swing/JPanel.html>

It's common to extend JPanel as a container for several JComponents,
even it one doesn't override any JPanel method.
 
D

Dirk Bruere at NeoPax

John said:
Dirk Bruere at NeoPax said:
John said:
[...]
So I do everything inside a JPanel, which is contained within a
JFrame?
JFrame is one of a small number of top-level containers; JApplet
is another:

<http://java.sun.com/docs/books/tutorial/uiswing/components/toplevel.html>

One top-level container may not contain another, although the same
content may be placed in either:

<http://sites.google.com/site/drjohnbmatthews/subway>
<http://mindprod.com/jgloss/applet.html>
I've rewritten the app as a JPanel.
I assume it's fairly easy now to add it to any top level container?
Yes, but only one top-level container at a time, as the subway
example shows. An application invokes main(), which adds the
content to a JFrame; in contrast, an applet invokes init(), which
adds the content to a JApplet.
So writing all the stuff as JPanels is the way to go for producing
code that can be put into a number of application types. I think I
might have Sunday evening off...

Actually, JComponent is the base class for all Swing components that are
commonly added to top-level containers:

<http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html>

JPanel is a generic, lightweight, buffered container that's useful for
grouping visually and functionally related components:

<http://java.sun.com/javase/6/docs/api/javax/swing/JPanel.html>

It's common to extend JPanel as a container for several JComponents,
even it one doesn't override any JPanel method.

Most of what I'm writing are graphical front ends for existing apps via
UDP on the LAN.


--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
J

John B. Matthews

Dirk Bruere at NeoPax said:
John B. Matthews wrote: [..]
JPanel is a generic, lightweight, buffered container that's useful
for grouping visually and functionally related components:

<http://java.sun.com/javase/6/docs/api/javax/swing/JPanel.html>

It's common to extend JPanel as a container for several
JComponents, even it one doesn't override any JPanel method.

Most of what I'm writing are graphical front ends for existing apps
via UDP on the LAN.

Can you elaborate on this or suggest an example?
 
D

Dirk Bruere at NeoPax

John said:
Dirk Bruere at NeoPax said:
John B. Matthews wrote: [..]
JPanel is a generic, lightweight, buffered container that's useful
for grouping visually and functionally related components:

<http://java.sun.com/javase/6/docs/api/javax/swing/JPanel.html>

It's common to extend JPanel as a container for several
JComponents, even it one doesn't override any JPanel method.
Most of what I'm writing are graphical front ends for existing apps
via UDP on the LAN.

Can you elaborate on this or suggest an example?

Remote control of machinery from a single control point.

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
R

RedGrittyBrick

Dirk said:
No doubt it is, but our smarter customers probably think PC admins have
something to do with passwords when they start their machine. Still, if
it really were easy I'd be out of a job - where there is difficulty
there is $$$ :)


If I understand correctly, you want

* An app that can be passed to your customers as a self-installing exe
file they can install on their Windows XP/Vista PCs.

* The users can then point their web-browser at this application

* The app's GUI appears within the web-browser

* The app can communicate with several devices on the LAN.


I think I'd give more consideration to signing applets or to
understanding Java webstart and how to work with the security features
provided by browsers.

However one way to achieve what you want would be to write the
application in two parts. You could develop a Java application that is
designed to run as a Windows service, use a commercial installer to
create a self-installing exe (with JRE etc if required). This would
provide HTTP service on a known port outside the reserved range. The
"home page" would serve up an applet that provides the GUI, the Applet
would then communicate with the service in a proxy-like way to
communicate with the LAN devices. The unprivileged applet only
communicates with the exe, The exe has the full privileges normally
available to installed applications. The installer would have to add the
application as a service that is launched every time the user's PC is
switched on/rebooted.

Just my ¤0.02 worth.
 
J

John B. Matthews

Dirk Bruere at NeoPax said:
John said:
Dirk Bruere at NeoPax said:
John B. Matthews wrote: [..]
JPanel is a generic, lightweight, buffered container that's
useful for grouping visually and functionally related components:

<http://java.sun.com/javase/6/docs/api/javax/swing/JPanel.html>

It's common to extend JPanel as a container for several
JComponents, even it one doesn't override any JPanel method.
Most of what I'm writing are graphical front ends for existing
apps via UDP on the LAN.

Can you elaborate on this or suggest an example?

Remote control of machinery from a single control point.

I presume you would also query the remote device for its state. A
similar problem was discussed in several recent threads. The author
used JTabbedPane to select any of several remote devices:

<http://groups.google.com/group/comp.lang.java.help/browse_frm/thread/9fab031a014a4d25>
<http://groups.google.com/group/comp.lang.java.help/browse_frm/thread/48dec1e32d2e00e9>
 
D

Dirk Bruere at NeoPax

John said:
Dirk Bruere at NeoPax said:
John said:
John B. Matthews wrote:
[..]
JPanel is a generic, lightweight, buffered container that's
useful for grouping visually and functionally related components:

<http://java.sun.com/javase/6/docs/api/javax/swing/JPanel.html>

It's common to extend JPanel as a container for several
JComponents, even it one doesn't override any JPanel method.
Most of what I'm writing are graphical front ends for existing
apps via UDP on the LAN.
Can you elaborate on this or suggest an example?
Remote control of machinery from a single control point.

I presume you would also query the remote device for its state. A
similar problem was discussed in several recent threads. The author
used JTabbedPane to select any of several remote devices:

<http://groups.google.com/group/comp.lang.java.help/browse_frm/thread/9fab031a014a4d25>
<http://groups.google.com/group/comp.lang.java.help/browse_frm/thread/48dec1e32d2e00e9>

Thanks.
Actually, the problem is slightly more complex in that one of the
control apps is already written by a third party in Java and must be run
in a browser (IE is specified). Unfortunately it's one of the must-haves
and so it kind of sets the standard for whats required.

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
J

John B. Matthews

Dirk Bruere at NeoPax said:
John said:
Dirk Bruere at NeoPax said:
John B. Matthews wrote:
John B. Matthews wrote:
[..]
JPanel is a generic, lightweight, buffered container that's
useful for grouping visually and functionally related components:

<http://java.sun.com/javase/6/docs/api/javax/swing/JPanel.html>

It's common to extend JPanel as a container for several
JComponents, even it one doesn't override any JPanel method.
Most of what I'm writing are graphical front ends for existing
apps via UDP on the LAN.
Can you elaborate on this or suggest an example?
Remote control of machinery from a single control point.

I presume you would also query the remote device for its state. A
similar problem was discussed in several recent threads. The author
used JTabbedPane to select any of several remote devices:

<http://groups.google.com/group/comp.lang.java.help/browse_frm/thread/9fab031a014a4d25>
<http://groups.google.com/group/comp.lang.java.help/browse_frm/thread/48dec1e32d2e00e9>

Thanks. Actually, the problem is slightly more complex in that one of
the control apps is already written by a third party in Java and must
be run in a browser (IE is specified). Unfortunately it's one of the
must-haves and so it kind of sets the standard for whats required.

If you're wanting to migrate away form applets, nothing would preclude
launching the legacy controller from within your application, either in
a browser or an applet viewer:

<http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html>
 
D

Dirk Bruere at NeoPax

John said:
Dirk Bruere at NeoPax said:
John said:
John B. Matthews wrote:
John B. Matthews wrote:
[..]
JPanel is a generic, lightweight, buffered container that's
useful for grouping visually and functionally related components:

<http://java.sun.com/javase/6/docs/api/javax/swing/JPanel.html>

It's common to extend JPanel as a container for several
JComponents, even it one doesn't override any JPanel method.
Most of what I'm writing are graphical front ends for existing
apps via UDP on the LAN.
Can you elaborate on this or suggest an example?
Remote control of machinery from a single control point.
I presume you would also query the remote device for its state. A
similar problem was discussed in several recent threads. The author
used JTabbedPane to select any of several remote devices:

<http://groups.google.com/group/comp.lang.java.help/browse_frm/thread/9fab031a014a4d25>
<http://groups.google.com/group/comp.lang.java.help/browse_frm/thread/48dec1e32d2e00e9>
Thanks. Actually, the problem is slightly more complex in that one of
the control apps is already written by a third party in Java and must
be run in a browser (IE is specified). Unfortunately it's one of the
must-haves and so it kind of sets the standard for whats required.

If you're wanting to migrate away form applets, nothing would preclude
launching the legacy controller from within your application, either in
a browser or an applet viewer:

<http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html>

True, but I'm trying to make the whole thing neat, symmetrical, tidy and
consistent from a user's POV, and its a lot easier to maintain if
A.N.Other writes some app that also runs in a browser (which seems to be
the trend). Anyway, I'm going to stop thinking about it for a while and
just write an applet to work between 2 machines on the LAN - server and
controller.

I can get back to the hard stuff when it needs generalizing. Meanwhile,
I have other problems like PSUs that are failing...

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
D

Dirk Bruere at NeoPax

John said:
Dirk Bruere at NeoPax said:
Owen said:
On 2009-03-03 21:33:25 -0500, Dirk Bruere at NeoPax
<[email protected]> said:

Mark Space wrote:
Dirk Bruere at NeoPax wrote:

Well, at present I am coloring in icons. Any bets that the
artistic "look and feel" arguments will take more time, effort
and cash than writing all the code?
Stay away from making any JFrame or JFrame forms (in the GUI
builder). Use JPanel directly or via the GUI builder (JPanel is
usually about two entries below JFrame when you bring up the
list).
Why?
Because JApplet will replace JFrame when you're building an applet.
You can add JPanels to JApplets the same way you can add them to
JFrames, but you can't add JFrames to JApplets.

(Applets can open JFrames, but they don't look great due to the
browser security crud stuck to the window decorations on most
systems.)
[...]
So I do everything inside a JPanel, which is contained within a JFrame?

JFrame is one of a small number of top-level containers; JApplet is
another:

<http://java.sun.com/docs/books/tutorial/uiswing/components/toplevel.html>

One top-level container may not contain another, although the same
content may be placed in either:

<http://sites.google.com/site/drjohnbmatthews/subway>
<http://mindprod.com/jgloss/applet.html>

Just written my stuff in a JPanel, with all the buttons, code etc, as a
project in Netbeans.
Question is, how do I use that JPanel project in a Desktop App project?
What, and how, do I import?

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
M

Mark Space

Dirk said:
Just written my stuff in a JPanel, with all the buttons, code etc, as a
project in Netbeans.
Question is, how do I use that JPanel project in a Desktop App project?
What, and how, do I import?


Don't.

A "Java Desktop Application" is not something I've seen anyone here
figure out how to use. It might be nice, eventually, but it's far too
rough right now for any serious use. Especially for someone who doesn't
yet know how to use JPanels and JFrames.

Make a regular old Java Application, not the desktop variety. Use the
New->JFrame Form (right click on a package in your application Project
window) to make new GUI elements. For a JFrame, you'll just make the
simplest JFrame, then you'll have to manually edit the constructor so
you can pass in the JPanel you wish to use (I think this is the best way).

More on using the GUI editor in NetBeans:

http://www.netbeans.org/kb/trails/matisse.html
 
D

Dirk Bruere at NeoPax

Mark said:
Don't.

A "Java Desktop Application" is not something I've seen anyone here
figure out how to use. It might be nice, eventually, but it's far too
rough right now for any serious use. Especially for someone who doesn't
yet know how to use JPanels and JFrames.

Make a regular old Java Application, not the desktop variety. Use the
New->JFrame Form (right click on a package in your application Project
window) to make new GUI elements. For a JFrame, you'll just make the
simplest JFrame, then you'll have to manually edit the constructor so
you can pass in the JPanel you wish to use (I think this is the best way).

More on using the GUI editor in NetBeans:

http://www.netbeans.org/kb/trails/matisse.html

Thanks - esp for the info concerning Desktop App.
That partially explains why I've been having trouble with it. I naively
assumed that would be the simplest. This way looks much better.

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
M

Mark Space

Dirk said:
Thanks - esp for the info concerning Desktop App.
That partially explains why I've been having trouble with it. I naively
assumed that would be the simplest. This way looks much better.


I tried out the Desktop App (Simple Application Framework, JSR 296)
about a year ago and found it pretty half-baked then. According to
their website, they still haven't even reached "Early Draft" status, so
I'm not surprised you were having trouble with it.

Swing is like, 12 years old? Something like that. Everybody knows
Swing (nearly, there are some old farts still holding out ;)) and
there's tons of advice and third party documentation available.

Yes, that's the sort of thing that someone new can't really know, and
one of the better uses of this newsgroup, imo.
 
D

Dirk Bruere at NeoPax

Mark said:
I tried out the Desktop App (Simple Application Framework, JSR 296)
about a year ago and found it pretty half-baked then. According to
their website, they still haven't even reached "Early Draft" status, so
I'm not surprised you were having trouble with it.

Swing is like, 12 years old? Something like that. Everybody knows
Swing (nearly, there are some old farts still holding out ;)) and
there's tons of advice and third party documentation available.

Yes, that's the sort of thing that someone new can't really know, and
one of the better uses of this newsgroup, imo.

Well, here's another naive question.
I have a JPanel as a project, with all the resources, buttons etc as
part of it. How do I actually use the panel I have created in another
project eg the app we are discussing above? Can I copy some compiled
file across, or what?

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
N

Nigel Wade

Dirk said:
Well, here's another naive question.
I have a JPanel as a project, with all the resources, buttons etc as
part of it. How do I actually use the panel I have created in another
project eg the app we are discussing above? Can I copy some compiled
file across, or what?

You right-click on the Project in which you want to use the JPanel, and select
Properties. In the Properties dialog select the Libraries category on the left,
and in the tab on the right select Add Project... Find the JPanel project in
the file selector and Add Project JAR files. That will make the JPanel project
available for use in the other Project.
 

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

Similar Threads

Official Java Classes 10
Java in Java 10
Can an Applet beep? 4
Change character in string 105
Webcam in browser 11
File over network timeout 3
Free keyboard applet 5
Substring 53

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top