Article View: comp.lang.java.gui
Article #83A very humble Java GUI question
From: Paul King
Date: Thu, 22 Mar 2001 00:22
Date: Thu, 22 Mar 2001 00:22
37 lines
2737 bytes
2737 bytes
I am not necessarily new to Java, but am a novice at writing GUI-based
Java programs.
I am trying to build a GUI with a text object (JTextPane). I have a need
to place display text into that object. Here is the declaration:
javax.swing.JTextPane txtMessage = new javax.swing.JTextPane();
Having done that, in the same scope as the current object that the above
declaration was in, I placed this statement in one of the methods, a
response to pressing a button:
txtMessage.text = "Some text";
hoping it would appear as displayed text in the text pane. The logic of
using txtMessage.text is that the "text" part appears as a property on my
CodeWarrior object inspector for the "txtMessage" object. Giving the
"text" property a value in the object inspector results in that value
being displayed.
However, expressing the object as I have above results in CodeWarrior
telling me that the property "text" does not exist as a part of
javax.swing.JTextPane. Indeed, it does not appear to appear in the API for
JTextPane nor any of the classes it implements that I have seen. So, where
is the Object inspector assigning the value? In object inspectors of other
languages I've written in, the properties listed there are properties of
the class that is "inspected". Usually, a simple assignment statement like
the one above should work. However, it does not compile, because "text" is
apparently not a property of JTextPane. Is CodeWarrior trying to screw
with my mind?
If I am going about this all wrong, can anyone suggest how I can write
text into a GUI-based text object?
Thanks for any help you can offer.
PJK
Technical Details
Message-ID:
<rihibt42piiu8mbei09uc7o066ll4sramp@4ax.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!newsfeed.berkeley.edu!ucberkeley!europa.netcrusader.net!205.252.116.205!howland.erols.net!news3.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fd047,e3664f8ad80898dd,start X-Google-Attributes: gidfd047,public X-Google-Thread: 10fd6d,e3664f8ad80898dd,start X-Google-Attributes: gid10fd6d,public X-Google-ArrivalTime: 2001-03-21 16:24:55 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!newsfeed.berkeley.edu!ucberkeley!europa.netcrusader.net!205.252.116.205!howland.erols.net!news3.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail From: Paul King <pking123@sympatico.ca> Newsgroups: comp.lang.java.gui,codewarrior.windows Subject: A very humble Java GUI question Message-ID: <rihibt42piiu8mbei09uc7o066ll4sramp@4ax.com> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 37 Date: Thu, 22 Mar 2001 00:22:58 GMT NNTP-Posting-Host: 64.231.39.162 X-Trace: news20.bellglobal.com 985220578 64.231.39.162 (Wed, 21 Mar 2001 19:22:58 EST) NNTP-Posting-Date: Wed, 21 Mar 2001 19:22:58 EST Organization: Sympatico