comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* RMI: remote call or local call - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fc3a94862dd47001
* question about Object.clone - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/86e64c7b7efb3866
* How to force GUI updates? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c7ba8200d9e58260
* comp.lang.java.{help,programmer} - what they're for (mini-FAQ 2002-12-28) - 1 
messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a5b70e483b0cf700
* Looking for open source Asteroids game - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6113c3e5f8b103b6
* servet session context sharing in JBoss - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5c162455ab1c1bde
* How to figure out the width and height of an image? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/52ac3d93bff8088f
* store whole InputStream in a String - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d510835287103e9
* Is there an HTTP address returning today's date ? - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/11dfa70bca312606
* JSP: How to allow servlet and applet to share jar files? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8913f11160bcd2c1
* How to display multiple images - 3 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58641d6b8a101c01
* Successor to Java? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9151fedffecef56b
* Servlet as Entry point, default Homepage - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cbf76b232d61f207
* What is Embedded Java? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bacf063e98ecf899
* How to log into a web server? - 4 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/405f9dab611b53f3
* Measuring a short interval in time - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ff66a8cc42d551a2
* gmail anyone? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/edb0463a590e0ea1
* Natural sorting order for alphanumeric fields - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4073d4c9ba733b5
  
==========================================================================
TOPIC: RMI: remote call or local call
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fc3a94862dd47001
==========================================================================

== 1 of 2 ==
Date:   Tues,   Sep 14 2004 1:42 am
From: [EMAIL PROTECTED] (Buu Nguyen) 

Thanks guys, though I still have some issues:

Nigel, checking by IP is not secured as I am afraid (but not sure!!!)
that malicious client can fake the IP, say to be 127.0.0.1, and then
act as server object.

Esmond, I have searched the API and found no such method? the
RemoteServer only exposes method like getClientHost() which return the
IP of the calling host.

Thanks!



== 2 of 2 ==
Date:   Tues,   Sep 14 2004 2:50 am
From: Nigel Wade <[EMAIL PROTECTED]> 

On Tue, 14 Sep 2004 01:42:10 -0700, Buu Nguyen wrote:

> Thanks guys, though I still have some issues:
> 
> Nigel, checking by IP is not secured as I am afraid (but not sure!!!)
> that malicious client can fake the IP, say to be 127.0.0.1, and then
> act as server object.

Whilst it's remotely possible that your server *might* receive
a packet from another system with the source IP set to 127.0.0.1 the 
reply should never get back to it unless your routing table is severely
broken. Thus it would be impossible to establish a TCP connection (which
requires a 3-way handshake). 


-- 
Nigel Wade, System Administrator, Space Plasma Physics Group,
            University of Leicester, Leicester, LE1 7RH, UK 
E-mail :    [EMAIL PROTECTED] 
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555





==========================================================================
TOPIC: question about Object.clone
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/86e64c7b7efb3866
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 14 2004 1:52 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Tony Morris wrote:
>>>If you can't change the class in question, tough luck
>>
>>In fact, you still have one chance, but it will be a bit harder : the
>>reflection api (java.lang.reflect.*)
>>
> 
> 
> Reflection doesn't allow you to change a class, only inspect it.
> Perhaps you were thinking of bytecode enhancment?

What he really wants to do *is* to inspect the classes, I was just saying
that it should more properly be done by giving them equals() methods
instead.

BTW, you can in fact change one aspect of classes (the visibility of
fields and methods) through reflection, which is something that would
be necessary here.




==========================================================================
TOPIC: How to force GUI updates?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c7ba8200d9e58260
==========================================================================

== 1 of 2 ==
Date:   Tues,   Sep 14 2004 2:08 am
From: Babu Kalakrishnan <[EMAIL PROTECTED]> 

Jacob wrote:
> I have a processing loop that in each iteration
> update an image in GUI. When I run the program
> only the last GUI refresh is actually visible.
> 
> I guess the entire processing is complete before
> the AWT thread is ever dispatched and then all
> the events are collapsed into one.
> 
> How can I force the GUI refresh to actually execute
> in each iteration? (I tried the paintImmediately(),
> buth I don't like it and it didn't work either).
> Alternatively how should I organize a threaded
> solution?

I think you have two problems - not one. The first is about repaint events 
getting collapsed into one . Yes, the swing subsystem does optimize painting by 
combining several repaint calls into one, and I think paintimmediately should be 
able to take care of that for you (provided you allow the Event Dispatch Thread 
to run).

The second problem occurs if you're working with images (as you seem to be). 
Even if the EDT does run your painting code, the drawImage method doesn't block, 
but instead spawns a separate thread to perform the image loading/preparation. 
It does the actual painting by using the default ImageObserver implementation of 
java.awt.Component which simply queues a new repaint() call as and when more 
pixels are available for painting. Now if you have changed the image before this 
occurs, it would throw away the image that is currently loading and initiate 
another image preparation cycle with the new image - and it is even possible 
that the actual painting might never take place if you are switching the image 
source too rapidly. This is probably the reason why paintImmediately isn't 
working for you.

If you want to ensure that the changes are seen on screen, you would have to 
pace your processing loop appropriately to ensure that you don't change the 
image source before the actual painting of the image has taken place. Also you 
might need to implement a custom ImageObserver implementation that forces an 
immediate paint rather than queueing a repaint() request. (And needless to say, 
you have to do your processing outside the EDT, and call paintImmediately in the 
EDT using the invokeLater hook)

BK



== 2 of 2 ==
Date:   Tues,   Sep 14 2004 2:42 am
From: Jacob <[EMAIL PROTECTED]> 

Babu Kalakrishnan wrote:

> I think you have two problems - not one. The first is about repaint 
> events getting collapsed into one . Yes, the swing subsystem does 
> optimize painting by combining several repaint calls into one, and I 
> think paintimmediately should be able to take care of that for you 
> (provided you allow the Event Dispatch Thread to run).
> 
> The second problem occurs if you're working with images (as you seem to 
> be). Even if the EDT does run your painting code, the drawImage method 
> doesn't block, but instead spawns a separate thread to perform the image 
> loading/preparation. It does the actual painting by using the default 
> ImageObserver implementation of java.awt.Component which simply queues a 
> new repaint() call as and when more pixels are available for painting. 
> Now if you have changed the image before this occurs, it would throw 
> away the image that is currently loading and initiate another image 
> preparation cycle with the new image - and it is even possible that the 
> actual painting might never take place if you are switching the image 
> source too rapidly. This is probably the reason why paintImmediately 
> isn't working for you.
> 
> If you want to ensure that the changes are seen on screen, you would 
> have to pace your processing loop appropriately to ensure that you don't 
> change the image source before the actual painting of the image has 
> taken place. Also you might need to implement a custom ImageObserver 
> implementation that forces an immediate paint rather than queueing a 
> repaint() request. (And needless to say, you have to do your processing 
> outside the EDT, and call paintImmediately in the EDT using the 
> invokeLater hook)

Thanks, Babu.

I am pretty sure this explains the observed behaviour,
and I should be able to get around it based on your info.





==========================================================================
TOPIC: comp.lang.java.{help,programmer} - what they're for (mini-FAQ 2002-12-28)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a5b70e483b0cf700
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 14 2004 2:25 am
From: [EMAIL PROTECTED] (David Alex Lamb) 

Last-Modified: Sat Dec 28 12:08:40 2002 by David Alex Lamb
Archive-name: computer-lang/java/help/minifaq
Posting-Frequency: every 4 days

Before posting read Jon Skeet's "How to get answers on the comp.lang.java.*
newsgroups" at http://www.pobox.com/~skeet/java/newsgroups.html

Java FAQs and advice:
- Java/Javascript/Powerbuilder HOWTO (Real Gagnon)
  http://www.rgagnon.com/howto.html
- Java Glossary (Roedy Green)  http://www.mindprod.com/jgloss.html
- Java Programmers' FAQ (Peter van der Linden) http://www.afu.com/javafaq.html
- jGuru jFAQs (John Zukowski)    http://www.jguru.com/jguru/faq/
- Focus on Java (John Zukowski)   http://java.about.com/
- Java Q&A (David Reilly)  http://www.davidreilly.com/jcb/faq/

comp.lang.java.help     Set-up problems, catch-all first aid.
    According to its charter, this unmoderated group is for immediate help
    on any Java problem, especially when the source of the difficulty is
    hard to pin down in terms of topics treated on other groups.
        This is the appropriate group for end-users, programmers and
    administrators who are having difficulty installing a system capable of
    running Java applets or programs.  It is also the right group for
    people trying to check their understanding of something in the
    language, or to troubleshoot something simple.

comp.lang.java.programmer  Programming in the Java language.
    An unmoderated group for discussion of Java as a programming language.
    Specific example topics may include:
      o types, classes, interfaces, and other language concepts
      o the syntax and grammar of Java
      o threaded programming in Java - sychronisation, monitors, etc.
      o possible language extensions (as opposed to API extensions).
    The original charter said that discussion explicitly should not include
    API features that are not built into the Java language and gave examples
    like networking and the AWT.  These days AWT belongs in clj.gui, and
    networking is often discussed in clj.programmer.

Do not post binary classfiles or long source listings on any of these
groups. Instead, the post should reference a WWW or FTP site (short source
snippets to demonstrate a particular point or problem are fine).

Don't post on topics that have their own groups, such as:
 comp.lang.java.3d        The Java 3D API
 comp.lang.java.advocacy  Arguments about X versus Y, for various Java X and Y
 comp.lang.java.beans     JavaBeans and similar component frameworks
 comp.lang.java.corba     Common Object Request Broker Architecture and Java
 comp.lang.java.databases Using databases from Java
 comp.lang.java.gui       Java graphical user interface design and construction
 comp.lang.java.machine   Java virtual machines, like JVM and KVM
 comp.lang.java.security  Using Java securely
 comp.lang.java.softwaretools Tools for developing/maintaining Java programs
Don't cross-post between these groups and c.l.j.programmer or .help -- it just
wastes the time of people reading the general groups.

Don't post about JavaScript; it's a different language.  See
comp.lang.javascript instead.
-- 
"Yo' ideas need to be thinked befo' they are say'd" - Ian Lamb, age 3.5
http://www.cs.queensu.ca/~dalamb/   qucis->cs to reply (it's a long story...)




==========================================================================
TOPIC: Looking for open source Asteroids game
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6113c3e5f8b103b6
==========================================================================

== 1 of 3 ==
Date:   Tues,   Sep 14 2004 2:27 am
From: <[EMAIL PROTECTED]> 

I appreciate any help that I can find on this. I am looking for an open 
source Asteroids / Blasteroids game. If anyone knows where I can find one or 
can point me into a better direction as to where I should look that would be 
great.

Thanks,
-J

-- 
"My wife and I were happy for twenty years. Then we met."
-Rodney Dangerfield.
Free ipod? http://www.freeiPods.com/default.aspx?referer=8081838






== 2 of 3 ==
Date:   Tues,   Sep 14 2004 2:42 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Tue, 14 Sep 2004 05:27:31 -0400, <[EMAIL PROTECTED]> wrote:

> I appreciate any help that I can find on this.

I asked you over on c.l.j.help if you'd checked
under the bed and in the broom cupboard, but I did
not think to ask on how many other groups you 
intended to 'look' for your freely downloadable
asteroids source.

Please do not multi-post* J, and continue
the conversation over on c.l.j.help, where
you should be posting exlusively for the moment.

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

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology



== 3 of 3 ==
Date:   Tues,   Sep 14 2004 5:00 am
From: Alex Hunsley <[EMAIL PROTECTED]> 

[EMAIL PROTECTED] wrote:

> I appreciate any help that I can find on this. I am looking for an open 
> source Asteroids / Blasteroids game. If anyone knows where I can find one or 
> can point me into a better direction as to where I should look that would be 
> great.
> 
> Thanks,
> -J

Just out of curiosity.... why?

alex




==========================================================================
TOPIC: servet session context sharing in JBoss
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5c162455ab1c1bde
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 14 2004 12:49 am
From: Kieron Briggs <[EMAIL PROTECTED]> 

Hi all,

Does anyone know of a way to share a servlet context between two web 
applications packaged in separate EAR files? I would like to be able to 
access, for example, a session-scoped javabean from both applications, 
and allow the user to seamlessly switch back and forth with their 
session intact.

I'm using JBoss 3.2.5, if it makes any difference.


Thanks in advance,

Kieron Briggs,
Web Admin, http://www.andrewwilkie.org.au/
Proudly a member of the Ryde Epping Greens




==========================================================================
TOPIC: How to figure out the width and height of an image?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/52ac3d93bff8088f
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 14 2004 2:33 am
From: "ak" <[EMAIL PROTECTED]> 

> >   Image image = Toolkit.getDefaultToolkit().getImage("pretty.gif");
>
> You need to use a MediaTracker here to wait for the image to actually
> load before calling
ImageIcon does exactly that thing

-- 
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader






==========================================================================
TOPIC: store whole InputStream in a String
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d510835287103e9
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 14 2004 2:48 am
From: Rogan Dawes <[EMAIL PROTECTED]> 

Paul Lutus wrote:

> Rogan Dawes wrote:
> 
> 
>>Paul Lutus wrote:
>>
>>
>>
>>>This doesn't solve the problem that the original do-loop doesn't have a
>>>provision to terminate.
>>
>>Neither does your for-loop example, unless there is no input on the
>>first read.
> 
> 
> Which for-loop example are you speaking of? The current one, posted five
> times? Now six times:
> 

Sorry about that. I was reading the thread top down, and had not 
encountered your corrections yet.

>>I would also have expected AK's version to be correct:
>>
>>for (int len=is.read(buffer); len>0; len=is.read(buffer)) {
>>     // do something with buffer
>>}
>>
>>because it updates len at the end of each loop, which yours does not.
>>
>>I might actually start using this in preference to the while construct.
>>I quite like it, stylistically.
> 
> 
> Again, it has a duplicate line of code where this is not necessary. It is
> bad coding practice.

Is it really so bad? I feel that it is being explicit about how the loop 
is initialised, as well as being explicit about how it is updated at the 
end of each loop. Isn't that appropriate for a for-loop?

I understand that you don't like using duplicate lines of code in 
different sections of the algorithm, possibly obscured by intervening 
code doing other things. But when it is on the same line, even in the 
same construct, surely it is reasonable to expect a maintenance 
programmer to understand what is happening?

Your version using the for-loop simply makes use of the for contructs 
ability to enclose the variable definition, without actually using the 
rest of the for-loop's features.

I realise that you don't really think much of your version using the 
for-loop, and so don't support it much, but doesn't it make sense to use 
what the construct offers?

I have also used the equivalent of your while-construct in my code, and 
understand it perfectly. I just think that the for-construct could be 
slightly easier to understand.

Rogan
-- 
Rogan Dawes

*ALL* messages to [EMAIL PROTECTED] will be dropped, and added
to my blacklist. Please respond to "nntp AT dawes DOT za DOT net"




==========================================================================
TOPIC: Is there an HTTP address returning today's date ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/11dfa70bca312606
==========================================================================

== 1 of 3 ==
Date:   Tues,   Sep 14 2004 3:20 am
From: [EMAIL PROTECTED] (Francesco M.) 

Hi all,
well this question isn't exclusive about Java only but it I
hope somebody has got an answer for it.
I'd like to read todays's date opening an URLConnection, so
does anybody know if there's a web address that returns todays'
date in any format ? 
it's something like a minimal web service, as it's accessed via
HTTP protocol..........

Thanks a lot
Francesco



== 2 of 3 ==
Date:   Tues,   Sep 14 2004 3:23 am
From: Thomas Kellerer <[EMAIL PROTECTED]> 

On 14.09.2004 12:20 Francesco M. wrote:
> I'd like to read todays's date opening an URLConnection, so
> does anybody know if there's a web address that returns todays'
> date in any format ? 

And which date should that URL return? It can most probably only return the
server's date, which might be different to your local one


And if you are already inside a Java code, why not simply use
java.util.Date today = new java.util.Date();

Thomas





== 3 of 3 ==
Date:   Tues,   Sep 14 2004 4:26 am
From: Thomas Fritsch <[EMAIL PROTECTED]> 

Francesco M. schrieb:
> Hi all,
> well this question isn't exclusive about Java only but it I
> hope somebody has got an answer for it.
> I'd like to read todays's date opening an URLConnection, so
> does anybody know if there's a web address that returns todays'
> date in any format ? 
> it's something like a minimal web service, as it's accessed via
> HTTP protocol..........
> 
> Thanks a lot
> Francesco

Why not simply calling UrlConnection#getDate on *any* HTTP-URL, which 
gives the time when the HTTP server sent the response. See 
http://java.sun.com/j2se/1.4.2/docs/api/java/net/URLConnection.html#getDate()

-- 
Thomas<dot>Fritsch<squiggle>ops<dot>de





==========================================================================
TOPIC: JSP: How to allow servlet and applet to share jar files?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8913f11160bcd2c1
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 14 2004 3:27 am
From: Nigel Wade <[EMAIL PROTECTED]> 

On Thu, 09 Sep 2004 12:27:54 -0600, Jim Cochrane wrote:

> (I'm using Tomcat on Linux, in case it matters.)
> 
> I have a JSP application that uses an applet and a servlet for which
> several library files are used by both the servlet and the applet.
> Instead of duplicating the shared files - e.g., in different jar files
> within the webapps directory, I'd like to allow the servlet and applet to
> use the same jar file for the shared classes.
> 
> I've found a solution that works, but that does not seem particularly
> elegant (as well as not being portable to Windows):  In the app.jsp file
> that loads the applet:
> 
>       <applet codebase="classes" archive="applib.jar" code="Main_Applet.class"
>       ... >
> 
> Since the servlet expects the applib.jar file to reside under WEB-INF, I
> have hard-linked the file such that it occurs twice within the web
> application directory:
> 
> ./WEB-INF/lib/applib.jar
> ./classes/applib.jar
> 
> I first tried a symbolic link and the applet failed to load, undoubtedly
> because of the security mechanism.
> 
> This solution essentially provides what I want - allowing the servlet and
> applet to share the same file rather than accessing two different copies of
> the same file (saving disk space and guarding against accidentally using
> different versions of applib.jar), but, as I said, it's not very elegant.
> 
> I originally tried loading the applib.jar file from its original location:
> 
>       <applet codebase="WEB-INF/lib" archive="applib.jar" code="Main_Applet.class"
>       ... >
> 
> but the applet failed to load - because of the security mechanism, I
> assume.
> 
> So my question is: Is it possible to come up with a portable solution that
> allows the servlet and applet to use the same file in the same location
> (i.e., with only one link), where portable means it will work on Linux,
> Windows, and UNIX platforms?
> 
> A further question: Is it possible to come up with an even cleaner
> solution, something like e.g., the applet-specific class files are stored
> in applet.jar and the applet loads classes from both applet.jar and from
> applib.jar (so that applib.jar does not need to contain applet-specific
> class files, irrelevant for the servlet), where applib.jar is again shared
> by the servlet and the applet?
> 
> [I did some googling and looking through applet and JSP docs to try to find
> an answer, but with no luck, except for the above inelegant solution.  The
> solution is probably out there, if there is one, I just didn't find it.]
> 
> (I'm posting this question here because it appears to be the most relevant
> java group for this topic.  It's odd, though that there is no java
> newsgroup specific to web development (unless I missed it?).
> [comp.lang.java.programmer seems to cover a lot of very disparate topics -
> I suspect I'm not the only one who finds this a little irritating and
> inefficient.])
> 
> 
> Thanks very much!

The solution I use (on Linux, no idea if it's portable to Windows) is to
put both sets of jars (applet and servlet) in the Tomcat shared folder
<CATALINA_HOME>/shared/lib. I then have a symbolic link from the applet
codebase to the shared folder. The applet codebase is
http://www.server.name:8080/java/lib and a symbolic link
<CATALINA_HOME>webapps/root/java points to <CATALINA_HOME>/shared.

It's a hack, but it works. I've not found a better solution.

-- 
Nigel Wade, System Administrator, Space Plasma Physics Group,
            University of Leicester, Leicester, LE1 7RH, UK 
E-mail :    [EMAIL PROTECTED] 
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555





==========================================================================
TOPIC: How to display multiple images
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/58641d6b8a101c01
==========================================================================

== 1 of 3 ==
Date:   Tues,   Sep 14 2004 3:47 am
From: "ak" <[EMAIL PROTECTED]> 

> I am building a simple Java application. I have a list box in which I
> list a list of image files .jpg, and I want to create an area beside
> the listbox, where whenever the user click on an image in the list, I
> can display the image for him. I tried the ImageIcon class, and
> creating an instance and putting it in a JLabel, which is in a
> scrollable window. It works fine. But now, when I want to display a
> new image. Do I need to create all these objects again and agian.
no just call
Image image = Toolkit.getDefaultToolkit.createImage();
ImageIcon#setImage(image);

-- 
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader





== 2 of 3 ==
Date:   Tues,   Sep 14 2004 4:48 am
From: [EMAIL PROTECTED] (FISH) 

[EMAIL PROTECTED] (John Broadley) wrote in message news:<[EMAIL PROTECTED]>...
> I am building a simple Java application. I have a list box in which I
> list a list of image files .jpg, and I want to create an area beside
> the listbox, where whenever the user click on an image in the list, I
> can display the image for him. I tried the ImageIcon class, and
> creating an instance and putting it in a JLabel, which is in a
> scrollable window. It works fine. But now, when I want to display a
> new image. Do I need to create all these objects again and agian. What
> if I have 100 images, will I end up with a huge number of objects
> creates my my program. Please note that the average size of the images
> is 500kb.

Possibly the cleanest solution (and the one with potentially the least 
resource overhead) is to make your own Icon implementation, which 
supports 'hot swapping' of images.  The Icon interface is very straight
forward, and you shouldn't have any problem rolling your own.  As well
as the Icon methods, add your own method which allows for the current
image to change.  Don't forget to inform the icon's container that it
needs revalidating.


> I saw also a lot of talking about Toolkit related code, but I was not
> able to use such library in my Eclipse platform. Do I need to import
> anything to be able to use the Toolkit facilities like getting for
> example the screen resolution?

java.awt.Toolkit  ...?  :-)


-FISH-   ><>



== 3 of 3 ==
Date:   Tues,   Sep 14 2004 5:01 am
From: "ak" <[EMAIL PROTECTED]> 

> Possibly the cleanest solution (and the one with potentially the least
> resource overhead) is to make your own Icon implementation, which
> supports 'hot swapping' of images
is it not already implemented in ImageIcon?

-- 
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader






==========================================================================
TOPIC: Successor to Java?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9151fedffecef56b
==========================================================================

== 1 of 2 ==
Date:   Tues,   Sep 14 2004 3:52 am
From: [EMAIL PROTECTED] (Yakov) 

> 
> I'm writing a new book, currently using Java.
> 
> http://sdm.book.home.comcast.net
> 
> By the time I finish it (2009?), will Java be an
> anachronism like Pascal and Ada?
> 
> George

Based on my experience, unless it's a language tutorial, Java books
become obsolete within 2 years or so. People are still purchasing my
Java tutorial that was published 2 years ago, but this may not be the
case with other version specific books. People are buying books on
Unix that were published 20 years ago, but as opposed to Unix, Java
open source technologies and J2EE are living creatures and they keep
changing really fast.

If you need five years to write a Java book, most likely you're still
learning the language yourself. Unless you're extremely talented
writer, this project does not have legs...

Good luck anyway

Yakov
http://www.sys-con.com/author/?id=2514



== 2 of 2 ==
Date:   Tues,   Sep 14 2004 4:06 am
From: Daniel Bonniot <[EMAIL PROTECTED]> 


> You are kidding! You are writing the book about Java for 5 years!
> It will be definitely Java but not such book.
> Already published books become obsolete immediatelly.
> And you have plan for 5 years...

Yes, that's a long timeframe. But note that this is not a book _about_ Java, 
it's a book about "Situation-Driven Modeling" _using_ Java as the language for 
its examples. So how much Java evolves in the mean time does not matter much.

Daniel

The Nice programming language: http://nice.sf.net




==========================================================================
TOPIC: Servlet as Entry point, default Homepage
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cbf76b232d61f207
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 14 2004 4:01 am
From: [EMAIL PROTECTED] (Robert Kattke) 

Need a little help on the Architecture of this WebApp!
I am building a website, in which I wanted to track stats on the
Referer.
  String refString = req.getHeader("Referer");

I also need a particular variable "Metro Code" or "mcod", set before
any of the data-driven pages start to do queries and display
information. "mcod" can be set, stored and retrieved via either a
Cookie or Session variable.

Since I was doing some processing, I chose a Servlet as Entry point
(actually wrapped in a jsp).
  <jsp:include page="servlet/ReffServ" flush="true" />

However, if "mcod" is not set, I need to direct the user to a pageform
to let them choose one, otherwise proceed to the main page.  Any
attempt to Forward or Include either in Serlvet or JSP  is giving me
errors like:
StackTrace java.io.IOException: Error: Attempt to clear a buffer
that's already been flushed
StackTrace java.lang.IllegalStateException: Cannot forward after
response has been committed

Suggestions ? Is there an Elegant Solution ? or not so Elegant one ?
TIA




==========================================================================
TOPIC: What is Embedded Java?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bacf063e98ecf899
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 14 2004 4:16 am
From: [EMAIL PROTECTED] 

The whole story goes more or less like this:

J2EE = Java2 Enterprise Edition (typically for server-side apps)
J2SE = Java2 Standard Edition (desktop)
J2ME = Java2 Micro Edition (Java on embedded devices)

There are two configurations defined for J2ME:

CDC = Connected Device Configuration
CLDC = Connected Limited Device Configuration

Each configuration defines a minimum specs for the JVM, along with a
minimal set of APIs. The two configurations target different 'classes'
of devices depending on their capabilties: Memory, CPU power, etc.
Think of the CDC as a version of Java for PDAs, handhelds, embedded
controllers, service gateways, etc. Think of the CLDC as a more
restricted Java for cell phones, pagers, deeply embedded devices, etc.

On top of that you have 'profiles' which define additional APIs for a
given configuration. e.g. the MIDP profile for CLDC defines additional
APIs for mobile devices with a small graphical display, such as cell
phones. There are other profiles too, and some more under construction.

The 'wireless Java' you refer to, along with the discussion of MIDlets,
the Nokia emulator, etc. specifically refers to J2ME + CLDC + MIDP,
which is a very specific flavour of embedded Java (although it is
probably the most popular one.)

Then there is PersonalJava, which is more or less equivalent to the
J2ME CDC configuration. In fact there is one CDC profile, the
PersonalProfile (PP), which specifically aims at PersonalJava
compatibility, in order to provide a seamless migration path for
PersonalJava devices and applications.

Finally there's the now defunct EmbeddedJava (unfortunate name as _all_
of these technologies are actually 'embedded Java'), which was a
technology to allow vendors to subset arbitrary portions of Java for
dedicated-function systems.





==========================================================================
TOPIC: How to log into a web server?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/405f9dab611b53f3
==========================================================================

== 1 of 4 ==
Date:   Tues,   Sep 14 2004 4:27 am
From: Alex Hunsley <[EMAIL PROTECTED]> 

Chris Smith wrote:
> Jacob wrote:
> 
>>I have got access (user/password) to a web server.
>>I can log into the server using a browser; What is
>>the correct approach (i.e. API) from a Java program?
> 
> 
> See java.net.Authenticator.  If you need more flexibility, then take a 
> look at the Jakarta Commons project called HttpClient.

If anyone does proxy auth using HttpClient, take note of a slightly tricksy 
problem which tripped us up, my precious:

http://makeashorterlink.com/?J15E52949



== 2 of 4 ==
Date:   Tues,   Sep 14 2004 4:33 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Tue, 14 Sep 2004 12:27:44 +0100, Alex Hunsley wrote:

> http://makeashorterlink.com/?J15E52949

'As seen on..'
<http://google.com/groups?th=383274bccc94227b>

Only a little longer, and with much 
greater (hopefully) durability.   ;-)

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology



== 3 of 4 ==
Date:   Tues,   Sep 14 2004 4:48 am
From: Alex Hunsley <[EMAIL PROTECTED]> 

Jacob wrote:

> I have got access (user/password) to a web server.
> I can log into the server using a browser; What is
> the correct approach (i.e. API) from a Java program?

As someone else said, you'll need to know the auth scheme.
It is most likely to be "basic" authentication, which is sent in the HTML 
headers and is independent to the actual request itself.
In an nutshell, whatever you use for the HTTP requests should have a way for 
you to set the basic authentication login/pwd in your request.


> The server communicates using SOAP. Do I need the
> soap.jar, mail.jar and activation.jar, or can I
> communicate directly using Soap XML strings and
> the build-in Java XML parser?

Not sure about that aspect of it...
alex



== 4 of 4 ==
Date:   Tues,   Sep 14 2004 4:58 am
From: Alex Hunsley <[EMAIL PROTECTED]> 

Andrew Thompson wrote:

> On Tue, 14 Sep 2004 12:27:44 +0100, Alex Hunsley wrote:
> 
> 
>>http://makeashorterlink.com/?J15E52949
> 
> 
> 'As seen on..'
> <http://google.com/groups?th=383274bccc94227b>
> 
> Only a little longer, and with much 
> greater (hopefully) durability.   ;-)

Ah, I did not know of that feature. How did you generate that link?
thanks
alex






==========================================================================
TOPIC: Measuring a short interval in time
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ff66a8cc42d551a2
==========================================================================

== 1 of 2 ==
Date:   Tues,   Sep 14 2004 4:33 am
From: "Wes Harrison" <[EMAIL PROTECTED]> 

I would like to take two points in my program and measure the elapsed time
between them.  Currently I am doing:

Calendar cal1 = Calendar.getInstance();
long time1 = cal1.getTimeInMillis());
.
.
Calendar cal2 = Calendar.getInstance();
long time2 = cal2.getTimeInMillis());

long diff = time2 - time1;

Is there a better, simpler or faster way of doing this?  I want the elapsed
time in milliseconds.

Thanks,

Wes





== 2 of 2 ==
Date:   Tues,   Sep 14 2004 4:41 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Wes Harrison wrote:

> I would like to take two points in my program and measure the elapsed time
> between them.  Currently I am doing:
> 
> Calendar cal1 = Calendar.getInstance();
> long time1 = cal1.getTimeInMillis());
> .
> .
> Calendar cal2 = Calendar.getInstance();
> long time2 = cal2.getTimeInMillis());
> 
> long diff = time2 - time1;
> 
> Is there a better, simpler or faster way of doing this?  I want the elapsed
> time in milliseconds.

No need for the weighty Calendar objects, just use System.currentTimeMillis() directly




==========================================================================
TOPIC: gmail anyone?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/edb0463a590e0ea1
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 14 2004 4:43 am
From: Rene <[EMAIL PROTECTED]> 

Grant Wagner <[EMAIL PROTECTED]> wrote:
> hilz wrote:
>
> > hi all...
> > i've got coupla gmail invitations to give away.
> > if interested, email me at  hs underscore 74 at hotmail dot com
> > cheers
> > hilz
> >
> > P.S. Please don't change the subject when you reply, so i can find your
> > email!
>
> So all I have to do is E-mail [EMAIL PROTECTED] and I can get a Gmail
> invite? Awesome.

erm yes, that's actually how they work currently. You cannot sign up, you
can only be invited. Once you are in, sometimes you get 6 of those
"invites" you can hand out to your friends. In order to invite them, you'll
need name, surname and an email address (where google-gmail will send the
invite to). Actually you can put in anything for the name's while the email
address is of course required, because there will be a special encoded url
to sign up sent to that.

I also have 6 of those invites left, so if someone is really interested to
try out gmail, send me your email address to "draxinusom (AT) gmail.com"
and I'll send you that invite thingy. You can give anything for your name
if you don't want to reveal your real name. I currently only have 6 invites
free so first comes first serves. Otherwise, the OP also offered them...

CU

René

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB




==========================================================================
TOPIC: Natural sorting order for alphanumeric fields
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4073d4c9ba733b5
==========================================================================

== 1 of 1 ==
Date:   Tues,   Sep 14 2004 4:49 am
From: [EMAIL PROTECTED] (Paul) 

I have a field that contains both numeric and alphanumeric entries, so
e.g. when I do an 'order by' in sql I would get the following order

1.2
1.25
1.3
3
50
6
ALMERA
FOCUS

But in this case , the 6 should be above the 50, but the order by
looks at the first digit only.

To get around this, I tried two implemetations of the comparator class
that I found on the web
http://pierre-luc.paour.9online.fr/NaturalOrderComparator.java and
http://www.davekoelle.com/alphanum.jsp. These seemed to work well
EXCEPT for the cases containing decimal points
i.e. in the following order 
1.2
1.3
1.25

Does anyone know of a sort that gets around this problem.



=======================================================================

You received this message because you are subscribed to the
Google Groups "comp.lang.java.programmer".  

comp.lang.java.programmer
[EMAIL PROTECTED]

Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]

Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe


=======================================================================
Google Groups: http://groups-beta.google.com 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM
--------------------------------------------------------------------~-> 

<a href=http://English-12948197573.SpamPoison.com>Fight Spam! Click Here!</a> 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/kumpulan/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to