How to save a new data file inside the executable JAR package?

L

Lew

Daniel said:
True, but you should use Runnable, not Thread!

Also, you should use EventQueue.invokeLater(), not the wrapper
SwingUtilities.invokeLater().

I thought the new wisdom was to use SwingWorker, which has marvelous lifecycle
methods.
<http://java.sun.com/javase/6/docs/api/javax/swing/SwingWorker.html>

That's what Brian Goetz, et al., say in /Java Concurrency in Practice/, anyway.

Of course, they also give the EventQueue advice, I suppose for those
situations where you don't need the full power of SwingWorker. They point out
that SwingUtilities.invokeLater() is a simple wrapper around the EventQueue
call, and exists only for really old versions of Java.
 
J

JTL.zheng

prefs.putInt("MemoryFrame.x", new Integer(location.x));

where does it put the location.x?
how can I find it in registry? or some place else?

You should read the Javadocs for Preferences.
Have you?

I have read it, but not understand...
 
A

Andrew Thompson

Daniel Pitts wrote:
...
True, but you should use Runnable, not Thread!

Some interesting comments. I am going to need
to look more closely into this matter. But (yawns)
sleepy now.

BTW - was whoever writ those docs for invokeLater(),
a fan of 'The Crystals'? My ..extensive music collection
includes two songs by The Crystals - & neither of them
is "Da Doo Ron Ron". ( I am far too tired to be posting
to usenet, at this moment! ;)

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200709/1
 
L

Lew

JTL.zheng said:
where does it put the location.x?
how can I find it in registry? or some place else?



I have read it, but not understand...

If you can elucidate your specific issues with the docs, perhaps we can help
explain them.
 
R

Roedy Green

I'm just curious, why do you create a new Thread to open the new
MemoryFrame? I would usually just create the new MemoryFrame in main().
What's the rationale here?

see http://mindprod.com/jgloss/swingthreads.html

invokeLater gets stuff off the Swing thread without the overhead of
creating a fat new Thread. It uses the Runnable interface without
actually starting a Thread.
 
R

Roedy Green

There is no guarantee that Preferences will use the Windows registry.
It will be in the registry in Windows. The API leaves the
implementation wide open. It COULD be a flat file, or a database.
 
L

Lew

Roedy said:
It will be in the registry in Windows. The API leaves the
implementation wide open. It COULD be a flat file, or a database.

As long as you know that you're running on a JVM that uses the Windows registry.

It seems unlikely that other JVM vendors would do it differently, but there's
no requirement that they use the registry even in Windows.

In practice, if you're using Sun's JVM you are all right, but you're really
not supposed to care how Preferences stores things, according to the Javadocs.
 

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,780
Messages
2,569,609
Members
45,253
Latest member
BlytheFant

Latest Threads

Top