To access the controls and their values in different JFrames and forms

Hi all - is it possible to access controls and their associated information? For example, in my old .NET application, I got a form where users could enter usernames/people with disabilities and also preferences for the launch of other external tools. The user filled in the text boxes and made a few selections on combo boxes etc. - I then recorded in an ini file which is loaded at run time. Then from anywhere in the application 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 the drop-down list box
Dim optSomeOption as Object = frmSomeForm.SomeControl.Value //etc etc...

You can call any control in any form and obtain its associated variables and also call any method belonging to him in .NET or void. Is it possible to do in the frameworks for Swing? I did some research but can't seem to find the equivalent in Swing

If it is not possible can then someone point me in the right direction on how to do it? Do I need to define a class and I then have to instantiate each control in the class and have the getters/setters or y at - it an easier way? I essentially have an obligation to access related information across different forms in the application

I found this:
http://StackOverflow.com/questions/4958600/get-a-swing-component-by-name
But this seems to return the control names and no values?

Thanks in advance for any advice or help - we appreciate it! :)

Hello Matt,

for what you do with files .ini, java provides the java.util.Properties class.
To access the other JFrames and forms (JPanels), you pass a reference to this framework/Panel to the place (class or method) where you want to retrieve information from this framework/Panel.
Example:

public class MyFrame extends JFrame {
  JPanel myPanel1= new JPanel(...);
...
  MyVeryOwnPanel mvop= new MyVeryOwnPanel(myPanel1,...);
}

Now within mvop, you can look at what happened to myPanel1.

HTH

Tags: Java

Similar Questions

  • cannot access the icons and files in windows xp

    I write on behalf of the client. Customer is unable to access his files in his computer based on Windows XP and icons.

    Hello

    • Did you change your computer before this problem?
    • You receive an error message during the access, the icons and files?

    This problem occurs when one or more of the following conditions are met:

    • The registry values that are associated with the file name extension are corrupted or missing values.
    • The computer is infected with a virus.

    You can view these methods:

    Method 1:

    Let us check in SafeMode if the problem persists.

    A description of the options to start in Windows XP Mode
    http://support.Microsoft.com/kb/315222

     

    Method 2:

    Here is an article that will guide you in the process of fixing the issue:

    Important: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    How to back up and restore the registry in Windows

    Cannot open files with extensions such as.exe, .com, and.lnk on a Windows XP-based computer

  • Help! I can't access the control panel

    Help, please. I can't access the control panel, it ask me to the user and the password but I don't remember to have them change! I tried with admin/admin, but nothing, I tried to reset with buttom for 5 seconds but nothing... I'm desperate!

    Linksys WAG320N

    Press and hold the button of reset for 30 seconds, then release it.  Wait 10 seconds and cycle power to the router.  Now connect to 192.168.1.1 username "admin", password "admin".  I'm sure that the WAG uses these passwords.  Try now.

  • OffficeJet 6500 a. Impossible to access the Control Panel on Windows8

    I have a new laptop and you downloaded the complete HP software features. The test printing and scanning seem to work correctly. However I can't find how to access the Control Panel on my desk. He has not created an icon in my windows8 start pages.

    I have a button that says HP Printer Control allowsme to buy ink and my printer is offline. There is no scan options.

    How to access the control of printing/scanning panel full or, better yet, bind it to the control of the printer button.

    Thank you

    Hi SaraLK,

    I can help you find the digitization program. In the start screen or screen of tile, without clicking anything that this, start typing the HP. You should see the Officejet 6500 a, or even click on files and it should appear. When you click the Officejet 6500 has the help of the printer opens, you can also click with the right button on the icon and PIN to the taskbar so that it is always available right form the office.

    Here is another way, you can create shortcuts taskbar Windows 8 for your favorite programs. Please take no offense to the referenced site, it helps to make everything easier!  I use it all the time.

    I hope this helps.

  • How can I access the control panel?

    Original title - Control Panel

    How can I access the control panel?

    Hello

    Press Windows key + I when you are on the desktop and click on Control Panel option from the control panel side, called charm so open. This will take you to the Control Panel.
    Hope this helps, good luck :)
  • To access the video and music files downloaded from an application

    I downloaded some music and videos using an application, the JW library, but I can't access the music or videos with the exception of this app. Is there a solution?

    I really need to put these media on a playlist in media player so I can listen to songs while on other activities.

    What should I do to make media players to access the music and videos?

    Thank you

    Hello

    Maybe these applications help you ☞ JW Player & Music JW.

  • I pressed "do not ask again" when prompted to access the microphone and camera. IWant to reverse this trend

    I pressed accidentally on 'don't ask' when prompted to access the camera and microphone on a Web site that is crucial for its use. How do I reverse this order? changing the security settings did not help

    Go to the page you want to change the permissions and click the globe icon or the lock to the left of the address. From there, click on the button "additional information". In the window that appears, select the "permissions" tab Then find the camera and microphone access settings and change them to "allow".

  • My laptop connects is more to the internet, either hard wired or wireless. When it is hard wired, the laptop displays connection but I can't access the internet, and I've done it before.

    My laptop connects is more to the internet, either hard wired or wireless.  When it is hard wired, the laptop displays connection but I can't access the internet, and I've done it before.  My other computer has service very well (or I wouldn't send this message) I checked everything, what to do?

    original title: internet connection.

    Hi vonhatten,

    1. Did you the latest changes on the computer?
    2. You receive an error message when you try to connect to the internet?
    3. You have security software installed on the computer?

    Refer to the article below and try the steps mentioned, check if it helps.

    In Windows network connection issues

    http://support.Microsoft.com/kb/313242

  • How to access the BIOS and disable hype-threading on xp

    How to access the BIOS and disable hype-threading on xp

    THX

    During the initial boot, you should see a brief message posted to press a specific key (usually the delete key) to access the BIOS. If there is an option to disable Hyper-Threading, you will need to find it.  You can also see if there is a guide for your motherboard and the BIOS options.

    Any reason, you need to disable?

    J W Stuart: http://www.pagestart.com

  • My old MSN e-mail account was hacked and blocked. I created a new Windows Live Hotmail account. How can I access the emails and blocked my old account contact information?

    My old MSN e-mail account was hacked and blocked. I created a new hotmail account. How can I access the emails and blocked my old account contact information?  Thanks for any help!

    original title: hacked E-mail

    Hi BigByrd,

    I'm afraid it's almost impossible to access the old MSN your Hotmail account is newly created account.
    See you soon ~
  • Cannot access the control panel?

    I can't access the control panel or one of its programs in a newly installed Windows Vista Home Premium.

    I can't access the control panel or one of its programs in a newly installed Windows Vista Home Premium.

    This gives a try...

    Start button > in the search box, type appwiz.cpl > press the Enter key > column to the left, click on Control Panel

    Control Panel opens upward?

  • Need to access the 'Documents and Settings' folder in Windows 7

    I am importing an ArcMAP GIS project to my new Windows 7 computer (the project was launched on Windows XP).  Because the files in this project were initially located in the subdirectories of the "Documents and Settings" folder, map search these files in this folder.  So, I need to access this folder if I put the files in the location that arcmap is expected to make them, or that I inform manually map the new location, one at a time, hundreds and hundreds of files.  Is there a way I can access the "Documents and Settings" folder to add new subdirectories and files in it?  After some research, I found the folder, but I said that I don't have authority (even as an administrator) to access and modify the content of the folder.  Thank you

    I am importing an ArcMAP GIS project to my new Windows 7 computer (the project was launched on Windows XP).  Because the files in this project were initially located in the subdirectories of the "Documents and Settings" folder, map search these files in this folder.  So, I need to access this folder if I put the files in the location that arcmap is expected to make them, or that I inform manually map the new location, one at a time, hundreds and hundreds of files.  Is there a way I can access the "Documents and Settings" folder to add new subdirectories and files in it?  After some research, I found the folder, but I said that I don't have authority (even as an administrator) to access and modify the content of the folder.  Thank you

    Hey ITromble

    read the below information about junction points even through it was written on vista

    http://www.Svrops.com/Svrops/articles/jpoints.htm

    Old path

    New path

    \Documents and Settings

    \Users

    Here is the vista forums

    link below is in Forum windows 7

    http://answers.Microsoft.com/en-us/Windows/default.aspx#tab=2

    Walter, the time zone traveller

  • Can't access the "devices and printers" in Windows 7

    I'm unable to access the "devices and printers" menu in windows 7 (32)

    When I click on the menu, it crashes just a white screen and never load.  I checked the print spooler service and it is running...

    If you have installed McAfee software that can block the enumeration of objects in devices and printers.  Make sure that the Bluetooth service works also if you have any compatible bluetooth devices. Alan Morris Windows printing team; Here Microsoft Knowledge Base search: http://support.microsoft.com/search/Default.aspx?adv=1

  • Dear Adobe, I've updated my account, my payment charged 2 times 1 EUR and still I can't access the PS and LR! Pls help me to find a contact in the customer service! Much thanks! Rita Frei

    Dear Adobe, I've updated my account, my payment charged 2 times 1 EUR and still I can't access the PS and LR! Pls help me to find a contact in the customer service! Much thanks! Rita Frei

    Go to Adobe Creative Cloud


    Hi Rita,.

    For 1 EUR costs please see Adobe Store | Order FAQ and your online payment

    You will need to contact support by calling/chat for this request.

    Contact the customer service

    * Be sure to stay connected with your Adobe ID before accessing the link above *.

    Kind regards

    Sheena

  • I have been using LR for at least 4 years now and have continually updated. Current version LR6. I now want to join CC and thus access the PS and all the great stuff. Question: Can I get a refund or the recognition of the fact that I bought LR? Yo

    I have been using LR for at least 4 years now and have continually updated. Current version LR6. I now want to join CC and thus access the PS and all the great stuff. Question: Can I get a refund or the recognition of the fact that I bought LR? Your answer please. PS - no doubt a question you get more often. !@

    Hi Philippe,.

    Please see: pricing and membership creative cloud plans | Adobe Creative Cloud

    Otherwise, you can join Adobe sales for rate applications.

    Kind regards

    Sheena

Maybe you are looking for

  • MBAir backup iPad 4?

    I have 8 GB on my MBAir and 32 GB on my iPad.  Can I save all my MBAir files on my iPad?  If so, how this is done? Thank you.

  • Reader SuperDrive woes.

    Have a Macbook Air Yosemite running.  Reader SuperDrive already worked before but now not read or eject.  I think that there is a DVD in there, but I'm not 100% sure.  In addition, Finder says "Remote Disc" even with the disconnected Superdrive. I do

  • How to disable internet access for a computer on a local network?

    I have two Pros Mac 2012 Mid, connected by an Airport Extreme. I'd like one of them (which I edit video projects) stay on my local network, but the Internet to protect better of Trojans, viruses, etc... Is anyone know the step by step procedure to im

  • Fun cursors (example: Cursor Mania)?

    Are fun cursors secure download? I hear things good and bad things about them. I would download the sliders, but I heard that they can cause my computer becomes slow and does not say, that should be. Can someone give me an answer on this? If the answ

  • adding logo signature in outlook express

    pleasae help me configure my signature and logo to go on my mail in outlook express