Win a copy of Spark in Action this week in the Open Source Projects forum!

Bob Chad

+ Follow
since May 20, 2010
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bob Chad

Ok so this is how to do it. We need to use InputSource
import org.xml.sax.InputSource;

8 years ago

I have a problem retrieving the lastest copy of a file on a server. It seems to be a cache problem.

I solved the problem when reading .TXT files by using this

urlConn.setUseCaches(false) forces Java to reload the file from the server

I have a problem when reading XML files, Java will load the XML file from the web server ONCE only.
How can I force Java to reload ?

Here's my code

If call this code once in my program, it works,
I delete the XML file from the server,
I call this code again using a refresh button,
it still works (??)

Thanks for your help

8 years ago

What does the Java console say ?
9 years ago

Have you tried to access your Txt file directly in a web browser. If you cannot, it could be that the file server doesn't allow access to txt extension.
(defined in .htaccess)
9 years ago

I have a question about writing a file to my web server. I understand I cannot do this directly.
So I use a PHP script that is called by my applet. I've tried 2 methods, but none are satisfactory.

The first is to pass the content of the file to write using the PHP ?param= option. It works, But if param is too long, I get a 414 Error by the server saying the url is too long. So that's no good.

The second is to call the script for every line written, It works, but this is very very slow.

I'm running out of ideas. Could you please help

I would like to keep it simple.


Here my Applet method to run the PHP script

and the php script

9 years ago
Ok, so for anyone interested here's what I've found...

Note: It is important for the startup time to have the same JVM arguments in the applet tags, as well as within the JNLP applet description, here see property sun.java2d.noddraw. Only if JVM arguments of the JNLP applet description are satisfied by the applet tag’s JVM, the plugin will not need to start a new JVM. OF course, the applet tag’s JVM spec may exceed the JNLP applet’s one.

found here JOGL FAQ

I've solved my problem by removing the following line in the JNLP file

Now Java console only launches once even in Safari
Safari functions strangely with java Applet, compared to IE, Firefox, Opera & Chrome
It seems to ignore JNLP file

Anyway it all works, here's the applet code

and the jnlp file

9 years ago
No one noticed this problem before ?
9 years ago
Hi everyone,
I have a strange problem. I've created an applet and a jnlp launch file wich work no problem.
On some browsers, IE & Firefox, the java console is launched twice (2 JVM) . Then after a few minutes, the first console closes..
On Safari, no problem, only one console.

The applet is signed and i use JOGL

Here is the applet code

and here is the jnlp code

This doesn't seem to affect the applet, but I'd like to know why.

Thanks for your help
9 years ago
Ok I understand...
Thanks alot,

I'll try this, but I will have to solve the problem of Opengl context in different threads before...

9 years ago
Ok thanks, but I don't understand how this can work

Inside the display() function, the mouse listener won't be executed.
The display function runs from start to end without being interrupted

So the boolean variable will be set only when display is finished, or before it is called

9 years ago
Thanks for your answer.

I'm not sure I understand right.

You say

use a Swing Timer to periodically check the state of the execution of the program

But it's the same problem, the code of the timer needs to get the mouse button state to position the boolean variable
Or otherwise, the code of the timer needs to force execution of the listener to get the button state ?
I don't know how to do that

9 years ago
Ok but It does work...the UI is responding

If I use
I can test the mouse position to quit the loop

All I need is the same function, but querying the mouse button state.

9 years ago
Hi ,

Thanks but this won't work, as I want to break from rendering (display) if mouse is Down while rendering

Say it takes 5 seconds to render, if user presses mouse button after 3 seconds, while program is still in display loop, then quit
9 years ago

thanks for trying to help me out

Yes I have added listeners to my Glcanvas:


and I've completed the corresponding mouse functions so the user can move around in the scene

But this doesn't help my problem
I want to exit the display functions on a mouse click

The display function is added this way

I need to test the mouse state inside this function


9 years ago
Thanks for your reply.

I can't use a listener because i'm inside the Display function of GLCanvas

What i'm trying to do, is to exit a loop by clicking with the mouse button

For {
If mouse button is down then exit for

I can do it if the mouse moves

Ideally I would need a function like this:

But it doesn't seem to exist

9 years ago