3 Replies Latest reply on Aug 10, 2012 9:03 AM by 945083

    Accessing controls and their values in different JFrames and Forms

      Hi All - is it possible to access controls and their associated information? For instance in my old .NET application I had a form where the users could input usernames/pwds and also preferences for launching other external tools. The user filled in text boxes and made some selections on combo boxes etc - I then saved these in an ini file which is loaded at runtime. Then from anywhere in the app I could do something like:

      Dim strUserName As String = frmUserSettings.txtUserName.Text//for username
      Dim optLocalorRemote as String = frmUserSettings.cmbLocalorRemote.SelectedItem.ToString()//for selected item in combo box
      Dim optSomeOption as Object = frmSomeForm.SomeControl.Value //etc etc....

      You can call any control in any form and get its associated variables and also call any sub or method belonging to it in .NET. Is this possible to do in Swing frameworks? I have done some searching but can't seem to find the equivalent in Swing

      If it's not possible then can anyone point me in the right direction of how to do this? Would I need to define a class and then have to instantiate each control in the class and have getters/setters or is there an easier way? I basically have a requirement to access control related information across different forms in the application

      I found this:
      But this seems to return control names and not values?

      Thanks in advance for any advice or help - it's appreciated! :)