Results 1 to 2 of 2
  1. #1
    nihar_deb is offline Member
    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

    Default Access textarea from diffrent class

    Hi ,
    I have two classes A and B.
    Class B has a dialog and textArea. I want to update textarea content using settext() method from class A
    What is the way to do this?

    --ND

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    You could do this by making the JTextArea (I assume you're using Swing -- you don't specify), but I don't recommend this. Better to only expose the functionality you need. Give the class that holds the JTextArea public methods that do this, for e.g., a setTextAreaText(String text) method and/or an appendToTextArea(String text) method.

Similar Threads

  1. can i listen to variable change in diffrent class
    By gloomy1991 in forum New To Java
    Replies: 2
    Last Post: 01-08-2011, 02:50 AM
  2. How to keep a string through out diffrent methods
    By bmist in forum Java Applets
    Replies: 33
    Last Post: 05-27-2010, 07:24 PM
  3. Replies: 0
    Last Post: 04-04-2010, 11:06 AM
  4. Add diffrent components in jtable
    By anilkumar_vist in forum Advanced Java
    Replies: 1
    Last Post: 11-23-2009, 06:03 AM
  5. Replies: 0
    Last Post: 11-17-2009, 07:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •