Get back component from JPanel

by java
I know JPanel can get back components by JPanel.getComponents() like
private JPanel panelCenter = new JPanel ();
panelCenter.getComponents();
I want to know is JPanel able to get component just by the specified component's name?
e.g. panelCenter.getComponent("buttom");
or like vb.net Me.Controls("buttom").Visible = True
Thanks
Francis SZE

None of JPanel, JComponent, Container or Component have a method to get a component by name.
You can either:
1. Keep references to the objects you place in your JPanel (highly recommended :)
or
2. Iterate over the result of getComponents() and test for getName().equals(requestedName)

Similar Messages

  • How can i get a component from frame?

    how can i get a JTextField component from the frame?
    in my program i use button and text fields, when button is pressed the action listener performs the needed actions: it must take the values in the text fields and do something with them,
    for example i have a button - view:
    look at the comments
    public class _ActionListener_search implements ActionListener {
         private JFrame frame;
         private database dtbs;
         public _ActionListener_search(JFrame frame, database dtbs) {
              this.frame = frame;
              this.dtbs = dtbs;
         @Override
         public void actionPerformed(ActionEvent arg0) {
              if (arg0.getActionCommand().equals("view_person"))
                                            //HERE i want to get values from text fields!
                                            //i need to get JTextField component from frame and use it
    view.addActionListener(new _ActionListener_search(frame, dtbs));how can i do it?
    is this a correct way?

    Encephalopathic wrote:
    If you know that you're going to need the data held in them why not give the class that holds them a public method that returns the Strings that they hold.
    public String getTextFieldXyzText()
    return textFieldXyz.getText();
    }Then if your actionlistener has a reference to this class's object, it can simply call the above method.That's what I was thinking. The view has a method getXyzText() and the listener (or some larger, enclosing controller) knows the view.
    What I would get away from is a single, switch-board listener hooked to a 100 unrelated buttons.

  • How to get back fields from INSERT statement in batch mode(getGeneratedKeys

    Hi,
    I wanted to insert records to database and get back some fields.
    I create prepared statement:
    preparedStatement = connection.prepareStatement(sqlQuery, columnIndexes);
    then I set parameters.
    Following code works properly:
    preparedStatement.executeUpdate();
    generatedKeys = preparedStatement.getGeneratedKeys();
    if (generatedKeys.next()) {
    doSomething();
    But when I try to do this by batch I get exception:
    Caused by: java.lang.ArrayIndexOutOfBoundsException: 22
         at oracle.jdbc.driver.T4CNumberAccessor.unmarshalOneRow(T4CNumberAccessor.java:190)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:612)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:966)
         at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10644)
         at org.jetel.component.DBOutputTable.runInBatchMode(DBOutputTable.java:619)
    My "batch" code:
    for(...){
    setParameters(preparedStatement);
    preparedStatement.addBatch();
    preparedStatement.executeBatch();
    Isn't it a bug?
    Can I get back fields (eg. from last insert added to batch)?
    I hope somebody can help me.
    Agata

    This code works for me but only inserting one row. More than one causes an ArrayIndexOutOfBoundsException once sendBatch is called.

  • Friend deleted app (my disk for iphone) and need to get back data from my icloud backup...need help!

         I had this app called my disk (app store name is: Lock photo+video safe - secure folder manager to protect private photos vault & hide secret picture file privacy) This app lets me have two passwords with different pictures and videos in each of them. It's a really great app.
         My friend deleted the app by "accident" and I need to get the app back with all my data. I have a backup of the app on my icloud backup that was taken place two months ago (around same time the app was deleted). It shows up in the cloud saying I have 4gb worth of that app in the cloud. I restore my phone back to that backup but the app data is not there. I wasn't sure if I had to wait till my iphone backs up everything (like music and pictures for example) for it to show up but as soon as the app downloaded I opened it hapilly knowing I have my data back but unfortunately it was not there. In the app itself, there's an option to backup from the cloud but it just brings up this window that says you can back up from the cloud (doesn't have a place to hit that says restore or anything).
         Is there something I am doing wrong? Can anyone help me? I really need that app data back because I have pictures of memories with friends and family inside that app that I do not have anywhere else. Once i get the back back ill be sure to save the photos onto my computer just incase anything goes wrong again.
    Thanks everyone for the help!
    Nikhil

    fwiw
    It seems that in a case like this you'd need to reset the device to factory settings and then restore from iCloud backup.
    Sadly the reset to factory settings could cause more trouble than its worth.
    Apple's iCloud backup, could, but does not let the user restore one app or its data.
    You'll also find that even though that App's data is in the cloud, you as its owner do not have access to it.
    Hope it helps/

  • Getting back contacts from Blackberry Protect

    so my Blackberry has broken and im getting rid of it but all my contacts are saved on the BB.
    they are backed up on Blackberry Protect online but how do i get the contacts from BB protect to my SIM card???

    Hi and Welcome to the Community!
    The only way to do exactly as you request would be via another BB...restore from BB Protect, and then copy (one by one) your contacts from that BB to the SIM. BB Protect backups can only be used to restore to a BB...there is no other usage of that method of backup.
    The Desktop Software, on the other hand, offers more robust access to your data. For instance, you can obtain a PC-based 3rd party BBB/IPD parsing app. Further, with Desktop Software prior to 7.0, you can export your contacts to CSV on your PC.
    In any event, if all you have is BB Protect backup, then there only solution is as I've said above.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Remove component from JPanel

    Hi,
    i've to remove a component from the center (BorderLayout.CENTER) of a JPanel without knowing the name of the component at runtime. I know only that the component is in the center position of the panel. How can i do?
    Thanks
    Luca

    normally what i will do i removeall first and then i add the north or south component so you dont have to worry what is in your center of the panel

  • Lost all data. How to get back information from iCloud.

    Hello everyone! My iPhone updated itself and deleted all my messages, mailbox, what's app. I guess it happened because I had got a new iOS7  before. How can I get back all information using iCloud? Would be great if you help to find a solution! Thank you!

    Did you try ...
    Settings - iCloud - login to your account ?
    by default it should get back all your info saved there.

  • TS3992 how can get back pictures from icloud

    Hi Every One.. I have ipad mini & already backup the file (pictures) into icloud an about 2.7gig file.. How can i get back/transfer all the file in icloud to my new ipad retina..please help me

    http://support.apple.com/kb/PH12521?viewlocale=en_US&locale=en_US

  • HELP: How to get window (JFrame) from JPanel ???

    Hi there,
    anyone knows how I can get a ref. to the window (in the form of JFrame) from my JPanel that is in the actual window??
    I need that window when I display a modal dialog from the panel, as the dialog constructor takes the window as a param.
    I could always pass a window-ref. to the JPanel when I create it, but as I have a lot of panels, I'd rather be able to get it just when I need it from the JPanel!
    Thanks a lot for any help on this issue!
    Best regards,
    AC

    Thanks a lot!
    I'll use windowForComponent in swingUtils, I think getRootPane() would only return the panel that the component is in!
    Regards,
    AC

  • How do I get back features from older Firefox versions?

    Some features of older version FF are gone from FF 4.0.
    3 I particularly miss:
    (1) Percentage bar in upper left corner page of Inbox messages. GONE!
    (2) I could click on arrow on right side panel (annoying ads) and hide said panel and widen my Inbox message area. This useful feature now GONE!
    (3) Most important of all I could click on an e-mail picture file and preview thumbnail of photo before downloading it. Someone in their wisdom decided that that wasn't useful or timesaving; now that's GONE!
    My question is are there any plug-ins or add-ons available to get these features back in Version 4.o?
    If so, I'd like specific instructions on how to do this.

    I know that Firefox doesn't do e-mail, but I view my e-mail through SmartZone which I access through Firefox browser.
    If there is a way to view messages in SmartZone without going through either Firefox or Internet Explorer I'd love to know about it.
    Thanks.

  • HELP!!! Can I get back files from a folder that has been copied over?

    I had a file in the trash with the same name as a file on my desktop. I accidentally started copying it from the trash to my desktop. It erased some of the files I had on my desktop in that folder that were very important, before I could stop it from copying. Is there any way to get the files back? They had been on my desktop for a few months. I'm thinking that maybe they are stored somewhere on the computer. I tried a search but came up with nothing. I usually back up to a external hard drive but I didn't this time and I'm paying for it now!

    When a file is erased, the space on the drive that the data occupies is not necessarily erased. It is just unallocated, so that other new data can use it. However, until that new data overwrites that same physical space on the drive, your old data may still be recoverable.
    To do this, you need to use a data recovery tool. There are tools that specialize in data recovery, such as
    http://www.prosofteng.com/products/data_rescue.php
    and other tools have a have multiple functions, including data recovery
    http://www.micromat.com/index.php?option=com_content&task=view&id=202&Itemid=107
    If you want to try recovering the data using such a tool, you should stop using the Mac (or use it as little as possible). Any use of the Mac will make it more likely that the space occupied by the old data will be overwritten. If that happens, the portion that is overwritten will not be recoverable.
    This is a good example of when Time Machine (part of Leopard and Snow Leopard) would be extremely helpful. It does backups to an external drive automatically, in the background, once per hour that the Mac is active. You just set it up and then forget about it. You can get any file back that you accidentally erase, even an older version of it.

  • Getting Back Values from Shift Register from Other Loop (FPGA)

    Referring to the picture above, both while loops are inside one while loop (not shown in picture). Problem is im trying to execute the numeric control once only and use the value from the second loop after that. I tried many ways and still have no idea how...could someone help? Thanks in advanced
    Solved!
    Go to Solution.

    augustg,
    You might try using a case structure to route the numeric control into that shift register only on the first iteration of the outer while loop and in all other cases route the output of the case second loops shift register back into the first. Kind of hard to put into words, but something like this:
    The case structure to the right that I added has one additional case "Default". In this case the value from the shift register of the outermost while loop is wired straight through. Hope this helps!
    Nick C | Staff LabVIEW Platform Product Support Engineer | National Instruments

  • How to get back videos from iPhone

    Hi,
    I have many videos on my old iPhone under iPod application.
    How can I upload them onto my computer and then on my new iPhone without Backup/Restore because Apple recommended to not restore the new iPhone from the last backup.
    Thanks!

    The songs I'm trying to reload on my phone are on my PC.  These we had loaded into iTunes.  I can remove them all from the library and then add them all back one by one I imagine.  The problem I'm having is that I removed them manually from the phone, they still appear in iTunes music library yet they won't sync.  I don't want to take the time to compare the phone to my library, remove from the library what's missing on the phone and then add them all back again.  64GB (mostly music) will take a while.

  • Can I get back up from my iPhone that's on my account sent to my Samsung Galaxy?

    I have 4 accounts on my billing statement, can I send backup from my iPhone and have it delivered to my Samsung Galaxy S4,  including contacts and email address's?
    If so, how?

    Actually, you can transfer all the iTunes music on you iPhone to the new PC, but not any non-iTunes music you ripped yourself.  Backing up the iTunes library on the old computer and restoring to the new iTunes library is preferable, but if this can't be done:
    1. Authorize the new computer with your iTunes account/\.
    2. Disable automatic syncing on connection in iTunes prefs > devices > disable....
    3. Connect phone to computer
    4. Right-click device tab on right border of iTunes window and select "Transfer Purchases."  This will transfer all iTunes purchased music, media and apps.

  • Problem getting jsp component from jspdynpage

    Hi,
      I am making a call in my java class in method
    doProcessBeforeOuput with the following call
    table = (TableView) this.getComponentByName("tableview_AddMaterial");
    Object[] objs = this.getComponents();
    Both return nulls for the object, how does someone access the jsp tables or text fields defined by id in htmlb in your java code I did check and all these are defined
    private IPageContext pageContext;
    private IPortalComponentRequest request;
    private IPortalComponentResponse response;
    private IPortalComponentSession session;
    private IPortalComponentContext userContext;
    private IPortalComponentProfile userProfile;
    Also here is my htmltable in the jsp
    <hbj:tableView
    id="tableview_AddMaterial"
    model="DHB.queryResultsModel"
    design="TRANSPARENT"
    headerVisible="false"
    footerVisible="true"
    visibleRowCount="50"
    visibleFirstRow="1"
    selectionMode="MULTISELECT">
    </hbj:tableView>
    Any help would be greatly appreciated and I do reward points for helpful answers
    Cheers,
    Devlin

    Hi Devlin
    You can access the fields in jsp as follows.For example, consider tableview with id "myTableView".
    <b>TableView table = (TableView) this.getComponentByName("myTableView");</b>
    If you add this line, you can get all the values related to tableview.For example, to get the first visible row of the tableview, the code goes as follows.
    <b>int firstVisibleRow = table.getVisibleFirstRow();</b>
    Jsp for the same:
    ==================
    <hbj:tableView
                        id="myTableView"
                        model="tablebean.model"
                        design="ALTERNATING"
                        headerVisible="true"
                        footerVisible="true"
                        selectionMode="MULTISELECT"
                        headerText="Office locations"
                        visibleFirstRow="1"
                        visibleRowCount="5"
                        rowCount="16"
                        width="500px">
                   </hbj:tableView>
    Try and let me know the results.
    Hope this helps.
    Regards
    Yoga

Maybe you are looking for

  • EJB 3.0 web services security (WS-Security)

    How do I enable WS-Security on EJB 3.0 based web services? Since only the @WebService annotation is required to expose a EJB 3.0 bean as a web service, how do I configure options that were previously in oracle-webservices.xml under the <security> tag

  • Intall CS6 on Mac and PC

    I have a CS6 license for a Mac.  As per the permitted install, I would like to install it on 1 Mac and 1 PC.  Can I do that?

  • Pavillion DM 1 - 2010nr Entertainment Notebook (I want my baby back!)

    OK, I am having a hard time of this, and I will try to be as complete and accurate as possible. I got excited about Windowas 8 and downloaded a compatibility checker and found my notebook to be compatible, so I installed it, and I hate it!  I am sure

  • Link to Summary Report

    Is it possible to display the Summary Report in a website? I created a form, my visitors fill it out but cannot see the result. Any suggestions?

  • How to automatically resume .part file

    i want, if internet connect after disconnect then autometically start download .part file. we don't need to resume it then what should do?