Article View: borland.public.jbuilder.java.swing
Article #977Re: Saving a reference to a JTextPane
From: Wolf
Date: Tue, 15 Jun 2004 18:12
Date: Tue, 15 Jun 2004 18:12
72 lines
2765 bytes
2765 bytes
"Lori M Olson [TeamB]" <javadragon@techie.com> wrote:
>Wolf wrote:
>
>> Hi,
>>
>> I want to make several classes write messages to a JTextPane which has been created by one of them. I tried to save a reference to the pane in a class which controlls the user interface; later on I want to use this reference to write to the TextPane:
>>
>> JTextPane TextPane = new JTextPane();
>> uic.setTextPane(TextPane);
>>
>> When setting TextPane to the uic slot I get a java.lang.NullPointerException
>>
>> What am I doing wrong?
>>
>> Regards
>>
>> Wolf
>
>So where is the code for the setTextPane method?
>
>--
>
>Regards,
>
>Lori Olson [TeamB]
>
>------------
>
>Save yourself, and everyone else, some time and search the
>newsgroups and the FAQ-O-Matic before posting your next
>question.
>
>Google Advanced Newsgroup Search
> http://www.google.ca/advanced_group_search
>Other Newsgroup Searches:
> http://www.borland.com/newsgroups/ngsearch.html
>Joi Ellis's FAQ-O-Matic:
> http://www.visi.com/~gyles19/fom-serve/cache/1.html
>
Lori,
my idea was (and maybe I'm compleately wrong)
to store a reference to an existing TextPane
'somewhere', to make it accessable to diferent
clases. My controller has the following methods
for 'storing' and 'retrieving' the reference,
but even the 'set' produces the mentioned error.
Here follows the code for both methods.
public class UIController {
....
public void setTextPane(JTextPane pane) {
TextPane = pane;
}
public JTextPane getTextPane() {
return TextPane;
}
....
}
Similar code works for passing around references
of, for example, trees, treenodes and treemodels.
I dont understand why it does'nt work with panes.
Is it posible that the pane is not really initialized
till put into a type of container?
Regards, Wolf
Technical Details
Message-ID:
<40cf3c06$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mailReferences:
<40ceba2d$1@newsgroups.borland.com> <40cf10f8$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,2de37b4a0a5af4c7 X-Google-Attributes: gid111d45,public From: "Wolf" <respro-aguas@ej-gv.es> Sender: "Wolf" <respro-aguas@ej-gv.es> Reply-To: "Wolf" <respro-aguas@ej-gv.es> Subject: Re: Saving a reference to a JTextPane Newsgroups: borland.public.jbuilder.java.swing X-User-Info: 62.99.27.47 References: <40ceba2d$1@newsgroups.borland.com> <40cf10f8$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <40cf3c06$1@newsgroups.borland.com> Date: 15 Jun 2004 11:12:22 -0700 X-Trace: newsgroups.borland.com 1087323142 207.105.83.66 (15 Jun 2004 11:12:22 -0700) Lines: 74 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail