Article View: borland.public.jbuilder.java.swing
Article #11661Communication between classes
From: Bob Hunter
Date: Thu, 15 Apr 1999 00:00
Date: Thu, 15 Apr 1999 00:00
18 lines
1795 bytes
1795 bytes
I cannot figure out how to set new text in an object (text component or label) created in a JFrame from a JDialog. For example, to simplify things I have used the visual designer to create an application with a frame containing a JTextArea and a JButton, both declared with package scope. When the user clicks the button in the frame, a dialog (in the same package) is displayed which also has a JButton and JTextArea. When the button in the dialog is clicked, I would like the dialog to disappear (which is does) and the text I can get from the textarea in the dialog (using the getText method) to appear in the textarea in the frame (using the setText method). I can get text from either textarea and place it in a database just fine but I cannot move text between the two objects. I have tried simply calling frameTextArea.setText from the dialog and I have tried passing the text as a argument into a public method in the frame (and it makes it according to calls to System.out.println), but the text will not show up in the textarea in the frame. What am I doing wrong? I can set new text in a frame textarea obtained from selected nodes in a tree within the frame (using methods in the frame class) just fine, but the frame textarea acts "dead" from outside the frame class. An example would be helpful. Thanks.
Technical Details
Message-ID:
<7f5q2r$jgc19@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,1ba1cbffbb4ed663,start X-Google-Attributes: gid111d45,public From: "Bob Hunter" <bob@webpatent.com> Subject: Communication between classes Date: 1999/04/15 Message-ID: <7f5q2r$jgc19@forums.borland.com> X-Deja-AN: 466904240 Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Newsgroups: borland.public.jbuilder.java.swing