Help to access a JTextArea created in another method ?

Hello, first I am a new to java although i am a very experienced PHP programmer ... i am having trouble figuring out why i cannot access the JTextArea created inside BuildContainer() in my program below from another method NewFile().
I am sure its just a scope issue or something along those lines, can someone please help with this and also explain to me whay it does not work and why something elese if offered will ?
Ive hit a roadblock, and its driving me nuts.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*; 
public class JEditor implements ActionListener {
     public static void main (String args[])
          JEditor Obj = new JEditor ();
          Obj.BuildGui ();
     public void actionPerformed(ActionEvent e)
     public void BuildGui ()
          JFrame WindowFrame = new JFrame("JEditor");
          JMenuBar WindowMenuBar = BuildMenuBar ();
          BuildContainer(WindowFrame.getContentPane());
          WindowFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          WindowFrame.setJMenuBar(WindowMenuBar);
          WindowFrame.pack();
          WindowFrame.setVisible(true);
     public JMenuBar BuildMenuBar ()
          Action Action_MenuNew = new Action_NewFile();
          Action Action_MenuOpen = new Action_OpenFile();
          Action Action_MenuSave = new Action_SaveFile();
          Action Action_MenuExit = new Action_Exit();
          JMenuBar Obj = new JMenuBar ();
          JMenu MenuObj = new JMenu("File");
          JMenuItem MenuItemNew = new JMenuItem(Action_MenuNew);
          JMenuItem MenuItemOpen = new JMenuItem(Action_MenuOpen);
          JMenuItem MenuItemSave = new JMenuItem(Action_MenuSave);
          JMenuItem MenuItemExit = new JMenuItem(Action_MenuExit);          
          MenuItemNew.setText("New");
          MenuItemOpen.setText("Open");
          MenuItemSave.setText("Save");
          MenuItemExit.setText("Exit");     
          MenuItemNew.addActionListener(this);
          MenuItemOpen.addActionListener(this);
          MenuItemSave.addActionListener(this);
          MenuItemExit.addActionListener(this);
          MenuObj.add(MenuItemNew);
          MenuObj.add(MenuItemOpen);
          MenuObj.add(MenuItemSave);
          MenuObj.addSeparator();
          MenuObj.add(MenuItemExit);
          Obj.add(MenuObj);
          return Obj;
     public JToolBar BuildToolBar ()
          Action Action_ButtonNew = new Action_NewFile();
          Action Action_ButtonOpen = new Action_OpenFile();
          Action Action_ButtonSave = new Action_SaveFile();
          JToolBar Obj = new JToolBar ();
          JButton ButtonNew = new JButton (Action_ButtonNew);
          JButton ButtonOpen = new JButton (Action_ButtonOpen);
          JButton ButtonSave = new JButton (Action_ButtonSave);
          ButtonNew.setIcon(new ImageIcon("IconNew.png", "New"));
          ButtonOpen.setIcon(new ImageIcon("IconOpen.png", "Open"));
          ButtonSave.setIcon(new ImageIcon("IconSave.png", "Save"));
          ButtonNew.setToolTipText("New file");
          ButtonOpen.setToolTipText("Open file");
          ButtonSave.setToolTipText("Save file");
          ButtonNew.addActionListener(this);
          ButtonOpen.addActionListener(this);
          ButtonSave.addActionListener(this);
          Obj.add(ButtonNew);
          Obj.add(ButtonOpen);
          Obj.add(ButtonSave);
          return Obj;
     public void BuildContainer (Container Obj)
          Obj.setLayout(new GridBagLayout());
          GridBagConstraints C = new GridBagConstraints();
          JToolBar ToolBar = BuildToolBar ();
          JTextArea FormTextArea = new JTextArea(10, 50);
          FormTextArea.setLineWrap(true);
          FormTextArea.setWrapStyleWord(true);
          JScrollPane FormScrollPane = new JScrollPane(FormTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
          C.gridx = 0;
          C.gridy = 0;
          Obj.add(ToolBar, C);
          C.gridx = 0;
          C.gridy = 1;
          Obj.add(FormScrollPane, C);
     public void NewFile ()
          // Problem is here ? Cannot access the textarea from here, not sure why ?
          FormTextArea.setText("test");
     public class Action_NewFile extends AbstractAction {
          public void actionPerformed(ActionEvent e)
               NewFile ();
};

first I am a new to java You should learn the standard Java naming conventions. Basically variable names and method names should be mixed lower/upper case on each word:
windowFrame -not WindowFrame
buildMenuBar() - not BuildMenuBar()
For class names you do upper case the the first character of each word.
Your code is confusing to read since everything is upper cased and therefore looks like a reference to a class.

Similar Messages

  • How to access my website created from another computer and location?

    I am a beginner.  My nephew made an e-commerce site for me using dreamweaver on a Mac.  I purchased dreamweaver cs5 and have windows vista.  He sent me the FTP address, username and password.  I opened dreamweaver and am asking what to do to access and download the files?

    but it keeps saying that the local files should match exactly to the web which I obviously don't have.
    What's the exact message?
    The whole purpose of connecting is to download remote files to local so they mirror each other.
    It describes how to up load but not download.
    Download is the exact opposite of upload.
    Select Remote View, select all files, click Get.
    When I get to that point, that will download all the webfiles into my local folder rewriting everything there?
    Yes.
    But you don't have any files locally which will be overwirtten, do you? Just an empty folder waiting to be filled with files from the Remote server.

  • Can I create a Stored Procedure That access data from tables of another servers?

    I'm developing a procedure and within it I'm trying to access another server and make a select into a table that belongs to this another server. When I compile this procedure I have this error message: " PLS-00904: insufficient privilege to access object BC.CADPAP", where BC.CADPAP is the problematic table.
    How can I use more than one connection into an Oracle Stored Procedure?
    How I can access tables of a server from a Stored Procedure since the moment I'm already connected with another server?
    Can I create a Stored Procedure That access data from tables of another servers?

    You need to have a Database Link between two servers. Then you could do execute that statement without any problem. Try to create a database link with the help of
    CREATE DATABASE LINK command. Refer Document for further details

  • How to access the activities created by an enduser especially when the enduser has left the organization?Please help me out with the possible solution

    How to access the activities created by an end user especially when the end user has left the organization?Please help me out with the possible solution

    Hi Ramesh,
    In the web UI we have business role IC_manger where you can search the activities based on employee responsible and you can use business transaction assignment functionality to assign those activities to any  other end user or team.
    Else you can also use Agent inbox functionality if you have configure the agent inbox for those activity.
    Hope this helps solving your query

  • How do I access array elements in one method from another method?

    Hi all!
    How do I access the array's elements from another method so that method 2 can have access to method 1's array elements? Thanks for any help!
    I am trying to create a simply program that will use a method to create an array and a SEPARATE method that will sort the array's elements (without using java's built in array features). I can create the program by simply having one method and sorting the array within that same method, BUT I want to sort the array from another method.
    Here's my code so far:
    public class ArraySort {
       public static void createArray(int size){
           double myArray[] = new double[size];    //create my new array
           for(int j=0; j < myArray.length; j++)
              myArray[j] = (200.0 * Math.random() + 1.0);   //fill the array with random numbers
       public static void sortArray(){
           // I WANT THIS METHOD TO ACCESS THE ARRAY ELEMENTS IN THE METHOD ABOVE, BUT DON'T KNOW
          //  HOW???? Please help!
        public static void main(String[] args) {
            createArray(4);    //call to create the array
    }Thanks again!
    - Johnny

    Thanks for the help all! I ve managed to get the program working, using java's built in array sort, but when i try to call on the array sort method from WITHIN my main method, nothing happens!
    Can somebody please tell me why I am not able to call on the sort method from within my main class???? Thanks!
    public class ArraySort {
       public void createArray(double[] arrayName, int size){
           double myArray[] = new double[size];  //create new array
           for(int j=0; j < myArray.length; j++)
              myArray[j] = (200.0 * Math.random() + 1.0);    //populate array with
           }                                                 //random Numbers
           sortArray(myArray); 
       } //Sort array(if I delete this & try to use it in Main method --> doesn't work???
       public void sortArray(double[] arrayName){
           DecimalFormat time = new DecimalFormat("0.00");
           Arrays.sort(arrayName);      //sort array using Java's built in array method
           for(int i = 0; i <arrayName.length; i++)
               System.out.println(time.format(arrayName)); //print arary elements
    public static void main(String[] args) {
    ArraySort newArray = new ArraySort(); //create a new instance
    double myArray[] = new double[0]; //create a new double array
    newArray.createArray(myArray,4); //build the array of indicated size
    //newArray.sortArray(myArray); //This will not work???? WHY?????//

  • Access to a FG from another running program

    Group, Is there any way to "get a hold of" a reference of a functional global running inside another vi?  I have a program that uses a functional global to pass data between vi's of a program.  I have this program starting up as a service when I start the computer so I don't really have access to its front panel.  Part of the data that the FG holds is a STOP flag and will shut down mulitple parts of this program.  I would like to build another program that I can start and run at will that will set the STOP flag in the "hidden" running program.  I am not sure quite how to do this.
    Thanks
    Todd

    What you are essentially asking to do is to access an internal resouce of another program. Doesn't really matter if it's a LabVIEW program. In your case you could enable the ActiveX server for the other program so you can access the VI that way. The LabVIEW Help contains information on how to enable the ActiveX server for an app and how to use it from another application. You could also use shared variables. You can take a look at this overview for more ideas:
     Community: Inter-Application Communication

  • I am currently using Lightroom 5.6 and operating on a Mac with OSX Ver 10.9.5. I am receiving an error problem when doing the following -  I am exporting selected photos from a particular Catalogue saved on Drive 1 to a folder created on another Drive whe

    Hi, I am having a little trouble with exporting images to another drive and Catalogue and need some help if anyone can give me some advice
    I am currently using Lightroom 5.6 and operating on a Mac with OSX Ver 10.9.5.
    I am receiving an error problem when doing the following -
    I am exporting selected photos from a particular Catalogue saved on Drive 1 to a folder created on another Drive where a Lightroom Catalogue has been created. In this Catalogue I have arranged for the images once exported to be moved to a different folder - I used the Auto Import process under the File dialogue box.
    When processing the Export I receive an error message for each of the images being exported indicating the following -
    Heading Import Results
    Some import operations were not performed
    Could not move a file to requested location. (1)
    then a description of the image with file name
    Box Save As                                  Box  OK
    If I click the OK button to each image I can then go to the other Catalogue and all images are then transferred to the file as required.
    To click the OK button each time is time consuming, possibly I have missed an action or maybe you can advise an alternative method to save the time in actioning this process.
    Thanks if you can can help out.

    Thank You, but this is a gong show. Why is something that is so important to us all so very, very difficult to do?

  • A background job creating/instantiating another background job

    Hi,
    Is there any possibility in SAP, that, a background job can create/instantiate another background job ?
    I have one suce requirement, and not sure if this is possible. Any inputs..
    -DK

    yes you can
    when you create a job using SM36,there is a option for start condition
    in that there is an option for After Job
    just give the job name and when that job completes,this job will trigger off
    http://help.sap.com/saphelp_nw04/helpdata/EN/c4/3a7fae505211d189550000e829fbbd/frameset.htm
    Rohit

  • How do I keep a document that was created on another computer? I have the link.

    How do I keep a document that was created on another computer. I have the link. https://adobeformscentral.com/?f=Mv9KGJZhLFi47Q-H63fajA

    Hi,
    The link you provided is for the HTML fillable form. Is that what you are trying to download?
    FormsCentral form files are stored on the FormsCentral servers. If you are the author or a co-author of the form you can access it from any machine by logging into FormsCentral. If you aren't the author or a co-author of the form you will need to contact the author and have them share the form with your FormsCentral account. The following FAQ explains how to share forms with other users:
    http://forums.adobe.com/docs/DOC-2462
    Regards,
    Brian

  • Workflow Does not Start If Created by Another Workflow

    Hi,
    Hope someone can help me here.
    I am using SharePoint 2013 Server and have created two workflows running on two separate lists (workflow 1 runs on list 1 and workflow 2 runs on list 2).
    Workflow 1 creates an item in List 2. The workflow on list 2 does not kick off when the item is created.
    I have tried both SharePoint Designer 2013 workflow and Visual Studio 2013 no code solutions (I have elevated privileges for the workflow app).
    The link below is what I am experiencing, although there doesn't seem to be a solution.
    https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/cb7c2537-ec54-4128-abea-aa5a11cddb54/sharepoint-2013-workflow-does-not-start-when-item-is-created-by-another-workflow?forum=sharepointcustomization
    I am in the process of installing the latest CUs too see if this has been rectified.
    Thanks,
    Nigel

    Hi Nigel,
    Yes, this is the default SharePoint behavior that SharePoint 2013 workflow does not start when item is created by another workflow.
    For a workaround, you can create a event receiver on the List 2 to start the workflow 2 when an item is created.
    Reference:https://social.technet.microsoft.com/Forums/sharepoint/en-US/19f71e38-7c04-430e-aa6b-764cbbf18c1c/2013-workflow-does-not-start-on-item-created-by-a-different-worklow?forum=sharepointcustomization
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/6ee7d704-34c0-4bda-8f2d-8a9ba17c2367/sharepoint-2013-workflow-using-create-item-to-add-an-item-to-another-list-and-have-the-workflow?forum=sharepointcustomization
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Obtaining a reference to an object created in another page

    Hello, In my webapp, i have a controller servlet which delegates the task to appropriate handler classes. My handler class performs the database access, then packages the result set object into a vector. I then create a new object of a javabean with a setPost() method which houses the output. My question is after this is done i forward control to the appropriate jsp for display. But how can i reference the object created in the page before. Will the request.setAttribute() method work for passing the reference to the object, to that jsp page? In other words i just want to access an object created in a different sevlet. Any help would be much appreciated
    thanks
    Gabriel

    Hi
    Yes, if you set the attribute, in this case the Java Bean in the request, it will be available in the JSP to where the request has been forwarded. Note however that the Object's lifetime is limited by that of the request. For Objects which need longer lifetimes you could place them either in the session or the ServletContext. The latter case will give the Object application wide scope and also a lifetime limited only by the lifetime of the application.
    Good Luck!
    Eshwar Rao
    Developer Technical Support
    Sun microsystems inc
    http://www.sun.com/developers/support

  • How can i get access code to create ABAP Program ?

    hi guys ,
    How can i get access code for creating ABAP Program in my System.
    I am using SAP IDES 4.6 Version
    Please Help me out .
    Regards
    Raghu

    Hi Raghu,
    - license your system (http://service.sap.com/licensekey)
    - create a developer key (http://service.sap.com/sscr)
    - create a key for your ABAP program (httP://service.sap.com/sscr)
    Markus

  • Accessing the JTextArea of a JDialog

    hi
    I have a frame with a button and a JDialog with a JTextArea.When i click the button in the frame i should append some datas to the JTextArea in the JDialog.How can i access the JTextArea component of the JDialog from the frame.
    thanks

    Hai
    do't make your JDialog as model dialog. make it setModel(false) and
    create a method with parameter string to update textArea with string
    and call the method in button click event with some string data

  • If I switch on my iCloud will I still be able to access my iWeb created web site currently on MobileMe. I understand I need to find anotherhost before June, but I would like to access iCloub before then.

    If I switch on my iCloud will I still be able to access my iWeb created web site currently on MobileMe. I understand I need to find another host before June, but I would like to access iCloub before then.

    If you want to migrate your MobileMe account to iCloud you do so at http://me.com/move . You will need Lion 10.7.2 on your Mac to be able to use its facilities. Your calendars, contacts, bookmarks and email will be moved to iCloud.
    Your iDisk, including website hosting and Gallery, will be unaffected and can still be accessed as before, though the migration process will probably sign you out in System Preferences>MobileMe and you will need to sign in again there.
    You will continue to be able to use your iWeb site as before. As you say, this will cease at the end of June. This page examines some alternatives:
    http://rfwilmut.net/migrate2

  • What is the use of search helps? where can we creat it?

    use of search helps and where can we create it?

    Hi narendra
    LOCK OBJEC TS
    Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
    SAP Provide three type of Lock objects.
    - Read Lock(Shared Locked)
    protects read access to an object. The read lock allows other transactions read access but not write access to
    the locked area of the table
    - Write Lock(exclusive lock)
    protects write access to an object. The write lock allows other transactions neither read nor write access to
    the locked area of the table.
    - Enhanced write lock (exclusive lock without cumulating)
    works like a write lock except that the enhanced write lock also protects from further accesses from the
    same transaction.
    You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
    Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
    Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
    Technicaly:
    When you create a lock object System automatically creat two function module.
    1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
    2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
    You have to use these function module in your program.
    check this link for example.
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    tables:vbak.
    call function 'ENQUEUE_EZLOCK3'
    exporting
    mode_vbak = 'E'
    mandt = sy-mandt
    vbeln = vbak-vbeln
    X_VBELN = ' '
    _SCOPE = '2'
    _WAIT = ' '
    _COLLECT = ' '
    EXCEPTIONS
    FOREIGN_LOCK = 1
    SYSTEM_FAILURE = 2
    OTHERS = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    SEARCH HELPS
    1) Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help).
    2) Collective search helps combine several elementary search helps. A collective search help thus can offer several alternative search paths.
    3)An elementary search help defines the standard flow of an input help.
    4) A collective search help combines several elementary search helps. The user can thus choose one of several alternative search paths with a collective search help.
    5)A collective search help comprises several elementary search helps. It combines all the search paths that are meaningful for a field.
    6)Both elementary search helps and other search helps can be included in a collective search help. If other collective search helps are contained in a collective search help, they are expanded to the level of the elementary search helps when the input help is called.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee38446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee45446011d189700000e8322d00/content.htm
    pls go through this for search help creation
    http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
    Search Help Exits:
    Re: dynamic values for search help
    Re: Dynamic search  help
    Match code objects are same as Search helps, where they are used in Previous versions of SAP.
    Now in the newer versions Search helps are replaced them.
    Standard Texts are the texts which are maintained in SO10 Tcode
    Every SAP application document is maintained with HEADER and ITEM texts
    and these texts are fetched from SAP using the READ_TEXT Function module
    by passing TEXT ID, TEXTNAME,TEXTOBJECT and LANGUAGE fields
    You can double click on any long text in the systesm and you can see these paramters in the text editor.
    Text Modules are created and used in Smartforms.
    check these links
    http://www.sap-img.com/abap/attach-a-search-help-to-the-screen-field.htm
    http://help.sap.com/saphelp_webas620/helpdata/en/cf/21ee2b446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/97/24a23fa34ffb47e10000000a114084/content.htm
    Reward points if useful
    Regards
    Pavan

Maybe you are looking for