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

Today's topics:

* Tomcat Help - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fa88f8cee5426f60
* Writing an applet - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/65200da724cd6649
* JavaMail - RFC822 - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/149d82568868d99e
* please I need help on my java Applet - 2 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b9a589a8cfda9bef
* I dont understand my exceptions - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b213942a33958593
* Packing JRE - 3 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d1a5c7579f5f09e2
* forward the request to a window with specific parameters (please help) - 2 
messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f8cd8b618b09cc15
* Returning java.util.List in Axis - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/68216cf4012386bc
* Programming Languages for the Java Virtual Machine - 5 messages, 4 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dafae86cd33e6e7d
* how to add double key listener - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/34818454dc6c7b28
* Refreshing JTree - 4 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/492f41aedabbda5

==============================================================================
TOPIC: Tomcat Help
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fa88f8cee5426f60
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 23 2004 9:03 pm
From: Juha Laiho  

"Paul W" <[EMAIL PROTECTED]> said:
>Due to a poorly written application that my company is thinking about
>buying, I have to setup a server to run 3 (or more!) instances of
>Tomcat at the same time.
...
>Thanks for any advice (outside that I'm insane) that you can provide,

No advice to give, sorry for that, but just a word of encouragement
that I'm running several Tomcat instances on Unix platform without
problems. Or, ok, at times I'd welcome more memory on the machines,
but then, this shouldn't be an issue with any near-current Intel
system; memory is rather inexpensive there.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)




==============================================================================
TOPIC: Writing an applet
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/65200da724cd6649
==============================================================================

== 1 of 2 ==
Date: Thurs, Dec 23 2004 9:09 pm
From: Andrew Thompson  

On Thu, 23 Dec 2004 09:48:57 -0500, GaryM wrote:

> Andrew Thompson <[EMAIL PROTECTED]> wrote in news:8xhq0bf2kg5
> [EMAIL PROTECTED]:
> 
>> 1) The leading '<' and trailing '>' preserve long URL's
> 
> Andrew, That is only for certain readers.

Which news-clients does that not work for?

>.The only way to preserve long urls it to turn off 
> word wrap (Xnews makes this easy) 

How do I turn off the word wrap in your news reader?

> ..or use a URL redirection service à la tinyurl.com.

Which disappear after a few days.

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane



== 2 of 2 ==
Date: Thurs, Dec 23 2004 6:05 pm
From: GaryM  

Andrew Thompson <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:

> 
> Which news-clients does that not work for?
>

Which ones does it work for is a more valid question.
Two perhaps?

> 
> How do I turn off the word wrap in your news reader?
> 

Why do you need to?

http://groups-beta.google.com/group/rec.audio.opinion/browse_thread/thread/d0812f654e5a9fd3/d88e0f9c136dd4b3?q=usenet+%22long+urls%22&_done=%2Fgroups%3Fq%3Dusenet+%22long+urls%22%26hl%3Den%26lr%3D%26sa%3DN%26tab%3Dwg%26&_doneTitle=Back+to+Search&&d#d88e0f9c136dd4b3

> 
> Which disappear after a few days.
>

Sure it's volatile. So is the URL though less so. 
I try to do both when I remember.




==============================================================================
TOPIC: JavaMail - RFC822
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/149d82568868d99e
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 23 2004 4:14 pm
From: Barry Margolin  

In article <[EMAIL PROTECTED]>,
 Rico <[EMAIL PROTECTED]> wrote:

> Now, if I use [EMAIL PROTECTED];[EMAIL PROTECTED] , wanting to be RFC822 
> compliant,
> Javamail complains that the semi-colon is illegal: not in group.
> Trivial fix is to replace the semi-colon with comma.
> 
> Yet, not that I lack other things to do, I did go and read RFC822 to
> find out how to associate a name with a list of email addresses and
> they say:
> 
> group       =  phrase ":" [#mailbox] ";"
> 
> The part between square brackets is my list of email addresses, separated
> by commas.
> 
> So, that'd mean I use: 
>       "marc and tommy":[EMAIL PROTECTED],[EMAIL PROTECTED];
>       
> Not surprisingly, it doesn't work.
> 
> Maybe someone could please help me make sense of what I've read then.
> How do I associate a name string with a group of email addresses?
> And where does JavaMail expect the semi-colon to be for a group? Thanks.

Maybe the problem isn't with JavaMail, but with your SMTP server.  Group 
syntax is somewhat arcane, and I wouldn't be surprised if there are some 
servers that don't recognize it.

-- 
Barry Margolin, [EMAIL PROTECTED]
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***




==============================================================================
TOPIC: please I need help on my java Applet
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b9a589a8cfda9bef
==============================================================================

== 1 of 2 ==
Date: Thurs, Dec 23 2004 9:15 pm
From: Andrew Thompson  

On 23 Dec 2004 18:49:44 GMT, Joona I Palaste wrote:

> It means something like "short simple complete compilable example".

Short, self contained, compilable example.  Otherwise, spot on.

And to the OP, read the *link*.  ( SheeEEsh ;-) 

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane



== 2 of 2 ==
Date: Thurs, Dec 23 2004 9:42 pm
From: Andrew Thompson  

On Thu, 23 Dec 2004 11:54:54 -0500, java10 wrote:

> //i have stream line the code too some extent, when i compiled it there was
> no error but what i want it to do is when it say "pay this amount" the user
> can input an amount to pay then it will display the remaining change.

Tabs, long lines, redundant elements in arrays..

The SSCCE document warns you against all three.  Please 
read it carefully before preparing future examples.

Having said that, this example *is* self-contained (the most 
important bit) so I will give you a bit of a push in the right 
direction with some code.  It is up to you to do the research
needed to understand it.  And no, I am still not sure I understand
what you are attempting.  But anyway, let's jump straight to
'actionPerformed()'

...
>     public void actionPerformed (ActionEvent e) {
....
>                       {
>         JOptionPane.showMessageDialog(this, "please pay this amount £" +
> twoDP.format(bill));

  JOptionPane.showMessageDialog(this, 
    "please pay this amount £" +twoDP.format(bill));

  String tendered = JOptionPane.showInputDialog(this, "Payment of £");

  /* You are dealing with monetary amounts as doubles, but you should
  always treat them as int's..
  http://www.xdweb.net/~dibblego/java/faq/answers.html#Q41 */
  double amountTendered;
  try {
    amountTendered = Double.parseDouble(tendered);
    double balance = amountTendered - bill;
    JOptionPane.showMessageDialog(this,
      "Your change is £" +twoDP.format(balance));
  } catch (NumberFormatException nfe) {
    // note how this statement is broken across several lines
    // to make it shorter.
    JOptionPane.showMessageDialog(this,
      tendered + " is not recognised as a money value!");
  }
...

HTH

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane




==============================================================================
TOPIC: I dont understand my exceptions
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b213942a33958593
==============================================================================

== 1 of 2 ==
Date: Thurs, Dec 23 2004 1:31 pm
From: [EMAIL PROTECTED] (Harri) 

Hello,

and sorry i know my question is not very significant but i dont know
what else i should tell you. Maybe someone can help me anyhow?

I developed a webapplication with one servlet. Calling this Servlet
throws an exception:

javax.servlet.ServletException: Servlet.init() for servlet doSchedule
threw exception
        
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
        org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
        
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
        
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
        
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
        
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
        java.lang.Thread.run(Thread.java:534)


root cause 

java.lang.ClassCastException
        java.util.Properties.store(Properties.java:534)
        
org.quartz.impl.jdbcjobstore.StdJDBCDelegate.serializeProperties(StdJDBCDelegate.java:3671)
        
org.quartz.impl.jdbcjobstore.StdJDBCDelegate.serializeJobData(StdJDBCDelegate.java:3653)
        
org.quartz.impl.jdbcjobstore.StdJDBCDelegate.insertJobDetail(StdJDBCDelegate.java:497)
        
org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport.java:838)
        
org.quartz.impl.jdbcjobstore.JobStoreTX.storeJobAndTrigger(JobStoreTX.java:169)
        org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:576)
        org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:221)
        or_servlets.Schedule_Servlet.init(Schedule_Servlet.java:116)
        javax.servlet.GenericServlet.init(GenericServlet.java:211)
        
org.quartz.ee.servlet.QuartzInitializerServlet.init(QuartzInitializerServlet.java:102)
        
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
        org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
        
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
        
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
        
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
        
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
        java.lang.Thread.run(Thread.java:534)

i do not understand what that means.
Can somebody tell me what that might means?
Or can somebody tell me where and how to find it out?

Lot og thanks for your help

Harri E.



== 2 of 2 ==
Date: Thurs, Dec 23 2004 10:40 pm
From: Andrew Thompson  

On 23 Dec 2004 13:31:07 -0800, Harri wrote:

> java.lang.ClassCastException

<http://mindprod.com/jgloss/runerrormessages.html#CLASSCASTEXCEPTION>

More generally..
<http://mindprod.com/jgloss/errormessages.html>

HTH

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane




==============================================================================
TOPIC: Packing JRE
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d1a5c7579f5f09e2
==============================================================================

== 1 of 3 ==
Date: Thurs, Dec 23 2004 9:47 pm
From: Andrew Thompson  

On 23 Dec 2004 15:02:48 GMT, [EMAIL PROTECTED] wrote:

> Andrew Thompson <[EMAIL PROTECTED]> wrote:
>> http://www.physci.org/codes/javafaq.jsp#exe
> 
> I'm not sure I entirely agree with all the points made in the section
> you linked.  For example:
> 
>> You lose 'free' upgrades to your program. Anytime your user
>> downloads a new faster virtual machine, your app gets a speed boost.
>> If you are using an exe, you will not get this benefit.
> 
> This could be considered undesirable, as well.  Consider if the user
> either actively or passively downloads a newer JVM that has subtle
> bugs in the libraries or JIT compiler that did not exist before.

You can 'have your cake and eat it too' with JWS, since you can 
specify either a *minimum* version of Java, or a *specific* version.

> There are, in fact, quite a few good reasons for wanting to deliver to
> a customer a native .exe with everything statically compiled into it.

Would you care to list them for the purposes of progressing
this thread, or are they secret?

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane



== 2 of 3 ==
Date: Thurs, Dec 23 2004 9:50 pm
From: Andrew Thompson  

On Thu, 23 Dec 2004 18:07:20 GMT, Bill Tschumy wrote:

> On Thu, 23 Dec 2004 11:07:03 -0600, ByteCoder wrote
> (in article <[EMAIL PROTECTED]>):
> 
>> Bill Tschumy wrote:
..
>>> On Mac OS X, WebStart will automatically offer to create a double-clickable 
>>> executable after the app has been run a couple of times.  This seems like 
>>> an 
>>> ideal solution to me and I wish the windows version would implement it.
>> [...]
>> 
>> It does ask you to create a link on the windows desktop when you execute 
>> a webstart app for the second time.
> 
> I've never seen it do that for any Webstart app I've run.  Interesting.  I 
> guess I'll have to explore further.

That got me once, as well.  AFAIR there is a 'checkbox' shown
in early invocatoins of JWS that asks if you want to 'integrate
the app. to desktop' (or words to that effect).  I think the
options are 'yes', 'no', and 'no and do not bother me again'.

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane



== 3 of 3 ==
Date: Thurs, Dec 23 2004 11:10 pm
From: ByteCoder  

Andrew Thompson wrote:
> On Thu, 23 Dec 2004 18:07:20 GMT, Bill Tschumy wrote:
> 
> 
>>On Thu, 23 Dec 2004 11:07:03 -0600, ByteCoder wrote
>>(in article <[EMAIL PROTECTED]>):
>>
>>
>>>Bill Tschumy wrote:
> 
> ..
> 
>>>>On Mac OS X, WebStart will automatically offer to create a double-clickable 
>>>>executable after the app has been run a couple of times.  This seems like 
>>>>an 
>>>>ideal solution to me and I wish the windows version would implement it.
>>>
>>>[...]
>>>
>>>It does ask you to create a link on the windows desktop when you execute 
>>>a webstart app for the second time.
>>
>>I've never seen it do that for any Webstart app I've run.  Interesting.  I 
>>guess I'll have to explore further.
> 
> 
> That got me once, as well.  AFAIR there is a 'checkbox' shown
> in early invocatoins of JWS that asks if you want to 'integrate
> the app. to desktop' (or words to that effect).  I think the
> options are 'yes', 'no', and 'no and do not bother me again'.

That's right and was the case at least until Java 1.4.2. I don't know 
(yet) how it works with Java 1.5.

-- 
-------------
- ByteCoder -           ...I see stupid people
-------------
                    Curiosity *Skilled* the cat




==============================================================================
TOPIC: forward the request to a window with specific parameters (please help)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f8cd8b618b09cc15
==============================================================================

== 1 of 2 ==
Date: Thurs, Dec 23 2004 1:56 pm
From: [EMAIL PROTECTED] 

page0.asp->page1.jsp

When the user click submit button in page0.asp, it will post the form
request to page1.jsp.
page0.asp and page1.jsp are in separate machines. In page1.jsp, based
on the parameter
interfaceName, it will forward to different jsp pages. However, we want
to forward the request
to a window with parameter like the following, without the menu bar and
toolbar.

The question is how to forward the request to a window like that?

window.open("test2.jsp",null,

"height=500,width=500,status=yes,toolbar=no,menubar=no,location=no");


//page1.jsp
<%
String interfaceName = request.getParameter("interfaceName");
if (interfaceName != null)
{       if (interfaceName.equalsIgnoreCase("id1"))
url="/id1.jsp";
else if (interfaceName.equalsIgnoreCase("id2"))
url="/id2.jsp";
else if (interfaceName.equalsIgnoreCase("id3"))
url="/id3.jsp";
//etc...

request.getRequestDispatcher(url).forward(request,response);
}
%>


Please help and advise. thanks!!




== 2 of 2 ==
Date: Thurs, Dec 23 2004 10:37 pm
From: Andrew Thompson  

On 23 Dec 2004 13:56:42 -0800, [EMAIL PROTECTED] wrote:

> However, we want
> to forward the request
> to a window with parameter like the following, without the menu bar and
> toolbar.

A 'pop-up'?

Controlled intranet, or on the wilds of the internet?

If it is the internet, toss what you want.  The *user* generally 
wants *no* friggin* *pop-ups*.  This is of major relevance to a
web application, since browser and plug-in manufacturers are finally
listenning to users and including pop-up blockers as default.
Your web-app. will have a high maintentance/suppport overhead if
you attempt to release an internet based web-app. with pop-ups.

F'Ups set to c.l.javascript, as those folks have fought the hard 
yards when it comes to pop-ups.

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane




==============================================================================
TOPIC: Returning java.util.List in Axis
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/68216cf4012386bc
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 23 2004 2:29 pm
From: [EMAIL PROTECTED] 

Hi,

When I generate the classes using a WSDL I get a return type of
Object[] instead of the java.util.List object. From what I understand
List is serializable.
Any reason why it is changing the return type to Object[]?

Thanks,

-R





==============================================================================
TOPIC: Programming Languages for the Java Virtual Machine
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/dafae86cd33e6e7d
==============================================================================

== 1 of 5 ==
Date: Thurs, Dec 23 2004 2:44 pm
From: [EMAIL PROTECTED] 

When we talk about Programming Languages for the Java Virtual Machine,
does it mean the programming language runs on top of JVM? In other
words, it will generate .class. 

Please advise. thanks!!




== 2 of 5 ==
Date: Fri, Dec 24 2004 12:35 am
From: ByteCoder  

[EMAIL PROTECTED] wrote:
> When we talk about Programming Languages for the Java Virtual Machine,
> does it mean the programming language runs on top of JVM? In other
> words, it will generate .class. 
> 
> Please advise. thanks!!

Please elaborate, what do you mean?

-- 
-------------
- ByteCoder -           ...I see stupid people
-------------
                    Curiosity *Skilled* the cat



== 3 of 5 ==
Date: Thurs, Dec 23 2004 5:50 pm
From: Starshine Moonbeam  

In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] ([EMAIL PROTECTED]) dropped a +5 bundle of 
words...

> When we talk about Programming Languages for the Java Virtual Machine,
> does it mean the programming language runs on top of JVM? In other
> words, it will generate .class. 
> 
> Please advise. thanks!!

Your programming language for the JAVA Virtual Machine would be the Java 
programming language.

-- 
Starshine Moonbeam
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM












== 4 of 5 ==
Date: Thurs, Dec 23 2004 4:26 pm
From: [EMAIL PROTECTED] 

> Your programming language for the JAVA Virtual Machine would be the
Java
> programming language.


http://flp.cs.tu-berlin.de/~tolk/vmlanguages.html
What does it mean here?




== 5 of 5 ==
Date: Thurs, Dec 23 2004 4:25 pm
From: [EMAIL PROTECTED] (Ian A. Mason) 


Try googling for these:

SKIJ
JScheme
SISC
Kawa
JLambda
SILK

They should lead you to examples, and papers.




==============================================================================
TOPIC: how to add double key listener
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/34818454dc6c7b28
==============================================================================

== 1 of 2 ==
Date: Thurs, Dec 23 2004 3:31 pm
From: "SaintSpeak"  

hi,
i want to catch the key event when SHIFT+TAB are pressed simultaneously
to shift focus to the previous focusable component. the key event is
caught on a JComboBox. if somebody knows the code to do so plz post it.
thanx in advance.




== 2 of 2 ==
Date: Fri, Dec 24 2004 12:34 am
From: ByteCoder  

SaintSpeak wrote:
> hi,
> i want to catch the key event when SHIFT+TAB are pressed simultaneously
> to shift focus to the previous focusable component. the key event is
> caught on a JComboBox. if somebody knows the code to do so plz post it.
> thanx in advance.
> 

Here you go:
"How to write a key-listener"
<http://java.sun.com/docs/books/tutorial/uiswing/events/keylistener.html>
and:
"How to use the focus subsystem"
<http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html>

It might be a little more than you expected or wanted, but at least 
you'll understand when you've read it. It is actually quite easy when 
you get the hang of it.

-- 
-------------
- ByteCoder -           ...I see stupid people
-------------
                    Curiosity *Skilled* the cat




==============================================================================
TOPIC: Refreshing JTree
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/492f41aedabbda5
==============================================================================

== 1 of 4 ==
Date: Thurs, Dec 23 2004 3:33 pm
From: "Arun"  

My program starts by choosing an xml file, traversing it etc into a
JTree, adding the JTree to a frame then showing this on the screen.

The traversing is done in an extension of JTree named XMLTree.
The XMLTree is created using for example
JTree buildTree = XMLTree(filename);

That is all and well.

But when i wish to use another file, i load it in again by using the
command
buildTree = XMLTree(filename);

However the tree doesnt refresh. How can i get the tree to refresh with
the new data?




== 2 of 4 ==
Date: Fri, Dec 24 2004 12:38 am
From: ByteCoder  

Arun wrote:
> My program starts by choosing an xml file, traversing it etc into a
> JTree, adding the JTree to a frame then showing this on the screen.
> 
> The traversing is done in an extension of JTree named XMLTree.
> The XMLTree is created using for example
> JTree buildTree = XMLTree(filename);
> 
> That is all and well.
> 
> But when i wish to use another file, i load it in again by using the
> command
> buildTree = XMLTree(filename);
> 
> However the tree doesnt refresh. How can i get the tree to refresh with
> the new data?

Could you post some code from your XMLTree extension?

-- 
-------------
- ByteCoder -           ...I see stupid people
-------------
                    Curiosity *Skilled* the cat



== 3 of 4 ==
Date: Thurs, Dec 23 2004 3:50 pm
From: "Arun"  

> Could you post some code from your XMLTree extension?
>


Did this before i learnt about treemodels.
I don't want to implement one now!
Heres the code...
Thanks




*************************************************************

import java.util.List;

import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;

import org.jdom.Document;
import org.jdom.Element;


public class XMLTree extends JTree{

public XMLTree(Document doc)
{
super(makeRootNode(doc));
}


private static DefaultMutableTreeNode makeRootNode(Document xmlDom)

{
// Recursively descends the tree and copies corresponding
// dom nodes.
try{
Element rootElement = xmlDom.getRootElement();
DefaultMutableTreeNode rootNode = buildTree(rootElement);
return(rootNode);
}
catch(Exception e) {
// Returns error message if building of tree is not successful
String errorMessage = "Error making root node: " + e;
System.err.println(errorMessage);
e.printStackTrace();
return(new DefaultMutableTreeNode(errorMessage));
}
}

private static DefaultMutableTreeNode buildTree(Element
rootElement)
{
// Makes a JTree node for the root, then makes JTree
// nodes for each child and adds them to the root node.
DefaultMutableTreeNode rootNode = new
DefaultMutableTreeNode(rootElement.getName());
addChildNodes(rootNode,rootElement);
return(rootNode);
}

private static void addChildNodes(DefaultMutableTreeNode
parentNode, Element parentElement)
{
// Creates list of all children of current parent element
List allChildren = parentElement.getChildren();
// Checks to see the element has any children
if (allChildren.size() != 0)
{
for( int x = 0; x < allChildren.size(); x++)
{
// Creates a new element from current element in list
Element childElement = (Element)allChildren.get(x);
// Converts this element into a node
DefaultMutableTreeNode childNode = new
DefaultMutableTreeNode(childElement.getName());
// Adds this node to the current parent node
parentNode.add(childNode);
// Checks to see if this child node has a child node of
itself.
// If so, then adds child node to that. Recursive procedure.
addChildNodes(childNode, childElement);
}
                }
    }
    
    
    
    
}




== 4 of 4 ==
Date: Fri, Dec 24 2004 1:10 am
From: ByteCoder  

Arun wrote:
>>Could you post some code from your XMLTree extension?
>>
> 
> 
> 
> Did this before i learnt about treemodels.
> I don't want to implement one now!
> Heres the code...
> Thanks
<snip code>

Would it be possible to make a new TreeModel from a file and when that's 
done apply it to the JTree?

I'm not sure if that's useful, but here it is anyway:
<http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html>

Good luck! :)

-- 
-------------
- ByteCoder -           ...I see stupid people
-------------
                    Curiosity *Skilled* the cat



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

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

To post to this group, send email to [EMAIL PROTECTED] or
visit http://groups-beta.google.com/group/comp.lang.java.programmer

To unsubscribe from this group, send email to
[EMAIL PROTECTED]

To change the way you get mail from this group, visit:
http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

To report abuse, send email explaining the problem to [EMAIL PROTECTED]

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

Reply via email to