How to get instance of all components in a frame  dynamically

Hai ,
I want to know how to get the instance names and values of components on a frame . if any body knows anything on this
Please help me
Advance Thanks

Hai ..
Thanks for guiding me here i had copied my example code i am getting name value null
import javax.swing.*;
import java.awt.*;
import java.util.*;
* @author  naveen
public class Test extends javax.swing.JFrame {
    /** Creates new form RaviTest */
    public RaviTest() {
        initComponents();
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    private void initComponents() {
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        getContentPane().setLayout(null);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
        getContentPane().add(jTextField1);
        jTextField1.setBounds(180, 60, 100, 20);
        getContentPane().add(jTextField2);
        jTextField2.setBounds(180, 90, 90, 20);
        jButton1.setText("jButton1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
        getContentPane().add(jButton1);
        jButton1.setBounds(170, 140, 81, 26);
        pack();
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        // Add your handling code here:
        Component[] comp=this.getContentPane().getComponents();
        for(int i=0;i<comp.length;i++)
            if(comp[i] instanceof JTextField)
                getT((JTextField)comp);
public void getT(JTextField jt)
System.out.print("name "+jt.getName());
System.out.println("value "+jt.getText());
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
* @param args the command line arguments
public static void main(String args[]) {
new RaviTest().show();
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
// End of variables declaration
OUTPUT AS :
if we enter some text in text box and press the button we get like this
name null value ABCD
name null value EFGH
may be some components will have name but if they names are not set
then we get null value
what i want is at that i want the jTextField1.. as name(ie.. object name) when the name is not set how to do it

Similar Messages

  • How to get back "Bookmark All Tabs" in menu ? Please if you don't want it (still quite some ppl want because it's usefull), at least allow to get it back trough Preferences (or at least about:config)

    How to get back "Bookmark All Tabs" in menu ? Please if you don't want it (still quite some ppl want because it's usefull), at least allow to get it back trough Preferences (or at least about:config)

    Some menu entries in the main menu bar are hidden if you use the mouse and only appear if you use the keyboard to open the menu (Bug 626825).
    You can see the difference if you use Alt+F to open the File menu or other menus like the Edit menu (Alt+E) and Bookmarks menu (Alt+B) and compare that to what you see if you use the mouse to open the menu after you have made the menu bar visible by tapping Alt or by pressing F10.
    * "Bookmark All Tabs" (Shift+Ctrl+D) no longer shows in the Bookmarks menu unless you open the Bookmarks menu via the keyboard (Alt + B).
    * "Bookmark All Tabs" can be accessed via the right-click context menu of a tab on the tab bar.
    See also:
    * [[/questions/799856#answer-155765]]
    * Bookmark All: https://addons.mozilla.org/firefox/addon/bookmark-all/

  • How can get emails on all devices?

    How can get emails on all devices? When I read an email on my mac, my iphone doesn't download it. How can I change that setting?? I need to have all emails and all my devices!

    It sounds like your using a POP3 email account versus IMAP. With a POP3 account if you do not have the settings configured to leave email on the server the problem you describe will occur. With Outlook 2010 (on a PC for example) you can go into the account settings and configure to leave email on the server. That way both devices will see the email. Check help for your Mac email program for instructions...
    http://www.serverintellect.com/support/email/outlook-leave-on-server/
    A better solution is if your email provider uses IMAP. IMAP sync email folders between multiple devices. Meaning any device will receive the email, all sent email can be seen on the devices. If you delete email from one device the email is deleted from all the other devices. Check with your email provider to see if they offer IMAP services.
    If they do not your choices are to 1) configure email on the Mac as illustrated in the link above or 2) change email providers to something like Gmail or Outlook.com (as examples).
    Also see this for the iPad...
    Using a POP account with more than one device - Apple Support
    FWIW I use Cox IMAP email and fully sync email between a Win 8.1 Update 1 laptop, a Win 7 desktop, an iPad 4, an iPhone 4 and an iPhone 5S.

  • Better way how to get list of all classpath URLs in runtime

    Hello everyone,
    How to get list of all classpath items (URLs) in runtime from Java code?
    I am aware of solution based on System.getProperty("java.class.path"). Is there any alternative?
    This solution has several drawbacks. You have to parse String output. And I not sure if it contains ALL resources (JARs, class directories) loaded by ClassLoader or just reflects -cp arguments.
    Does system property "java.class.path" contain ALL loaded JARs?
    Does it contain items (JARs, class directories) loaded by bootstrap classpath?
    What about JARs loaded in runtime?
    Is the separator ":" always same on all operation systems?
    I was looking for some Java API based solution, method like List<URL> getAllClasspathItems()
    But there is nothing like this in ClassLoader, Class, Runtime or System classes.
    For curious, here is code I use.
    String classpath = System.getProperty("java.class.path");
    StringTokenizer st = new StringTokenizer(classpath, ":");
    while (st.hasMoreElements()) {
         System.out.println(st.nextElement());
    }

    For curious, here are output prints for all 3 methods:
    1) parsing system property
    2) tschodt
    3) overcast SystemClassLoader to URLClassLoader
    /home/espinosa/workspace/jboss_embedded_test1/target/test-classes
    /home/espinosa/workspace/jboss_embedded_test1/target/classes
    /opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
    /opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
    /opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
    package com.sun.org.apache.xerces.internal.impl.validation, Java Platform API Specification, version 1.6
    package com.thoughtworks.qdox.directorywalker
    package com.sun.org.apache.xerces.internal.parsers, Java Platform API Specification, version 1.6
    package java.util.jar, Java Platform API Specification, version 1.6
    package org.testng.internal.thread
    package com.sun.org.apache.xerces.internal.util, Java Platform API Specification, version 1.6
    package java.net, Java Platform API Specification, version 1.6
    package sun.reflect.misc, Java Platform API Specification, version 1.6
    package esp.ejb.samples1.test
    package sun.security.provider, Java Platform API Specification, version 1.
    file:/home/espinosa/workspace/jboss_embedded_test1/target/test-classes/
    file:/home/espinosa/workspace/jboss_embedded_test1/target/classes/
    file:/opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
    file:/opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
    file:/opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
    ...Interestingly, method 1 and 3 gives the same list, same order, same count, just format of item is a little bit different. The order is same as in Eclipse .classpath file.
    Method 2 (tschodt) give significantly more items! rougly 3x! Different order (somewhat random it seems to me). Some items contain extra information, like version and string "Java Platform API Specification".
    It prints not absolute paths but logical Java names.

  • How to get names of all hard disks?

    Hi,
    How to get names of all hard disks.
    For example:
    There are 3 disks in my computer: A, C,D (OS:&#12288;Windows).
    and then I want to know how many disks (3) and their names( A, C, D) are there?
    Please give me some code sapmles. Thanks.
    (---sorry, my English is not very well----)

    Look at a few of these
    http://onesearch.sun.com/search/developers/index.jsp?qt=%22hard+disk%22+label&qp=forum%3A31&qp_name=Java+Programming&col=devforums

  • How to get instance of Class with its type parameters

    Hi,
    Have any of you folks been dealing with generics long enough to show me how this should be written? Or point me to the answer (I have searched as well as I could).
    I boiled down my situation to the included sample code, which is long only because of the inserted comments. And while boiling I accidentally came across a surprise solution (a bug?), but would obviously prefer a smoother solution.
    My Questions (referred to in the code comments):
    #1. Is there a way to get my parameterized type (classarg) without resorting to using the bogus (proto) object?
    #2. Can anyone understand why the "C" and "D" attempts are different? (All I did was use an intermediate variable????) Is this a bug?
    Thanks so much for any input.
    /Mel
    class GenericWeird
       /* a generic class -- just an example */
       static class CompoundObject<T1,T2>
          CompoundObject(T1 primaryObject, T2 secondaryObject)
       /* another generic class -- its main point is that its constr requires its type class */
       static class TypedThing<ValueType>
          TypedThing(Class<ValueType> valuetypeclass)
       // here I just try to create a couple of TypedThings
       public static void main(String[] args)
          // take it for granted that I need to instantiate these two objects:
          TypedThing<String>                        stringTypedThing = null;
          TypedThing<CompoundObject<String,String>> stringstringTypedThing = null;
          // To instantiate stringTypedThing is easy...
          stringTypedThing = new TypedThing<String>(String.class);
          // ...but to instantiate stringstringTypedThing is more difficult to call the constructor
          Class<CompoundObject<String,String>> classarg = null;
          // classarg has got to be declared to this type
          //    otherwise there will rightfully be compiler error about the constructor call below
          // This method body illustrates my questions
          classarg = exploringHowToGetTheArg();
          // the constructor call
          stringstringTypedThing = new TypedThing<CompoundObject<String,String>>(classarg);
       } // end main method
       // try compiling this method with only one of A,B,C,D sections uncommented at a time
       private static Class<CompoundObject<String,String>> exploringHowToGetTheArg()
          Class<CompoundObject<String,String>> classarg = null;
          /* Exhibit A: */
      ////     classarg = CompoundObject.class;
             results in compiler error "incompatible types"
             found   : java.lang.Class<GenericWeird.CompoundObject>
             required: java.lang.Class<GenericWeird.CompoundObject<java.lang.String,java.lang.String>>
                   classarg = CompoundObject.class;
                                            ^
             I understand this.  But how to get the type information?
          /* It's obnoxious, but it looks like I will have to construct a temporary
              prototype instance of type
                 CompoundObject<String,String>
              in order to get an instance of
                 Class<CompoundObject<String,String>>
              (see my Question #1) */
          CompoundObject<String,String> proto = new CompoundObject<String,String>("foo", "fum");
          /* Exhibit B: */
      ////     classarg = proto.getClass();
             results in compiler error: "incompatible types"
             found   : java.lang.Class<capture of ? extends GenericWeird.CompoundObject>
             required: java.lang.Class<GenericWeird.CompoundObject<java.lang.String,java.lang.String>>
                   classarg = proto.getClass();
                                            ^
          /* Exhibit C: */
      ////     classarg = proto.getClass().asSubclass(proto.getClass());
             results in compiler error: "incompatible types"
             found   : java.lang.Class<capture of ? extends capture of ? extends GenericWeird.CompoundObject>
             required: java.lang.Class<GenericWeird.CompoundObject<java.lang.String,java.lang.String>>
                   classarg = proto.getClass().asSubclass(proto.getClass());
                                                         ^
          /* Exhibit D: (notice the similarity to C!): */
      ////     Class tmp1 = proto.getClass();
      ////     classarg = tmp1.asSubclass(tmp1);
          /* It compiles (see my Question #2) */
          return classarg;
       } // end method exploringHowToGetTheArg()
    } // end class GenericWeird

    Thanks so much, Bruce. (Oh my goodness, how would I have ever come up with that on my own?)
    So in summary
    This doesn't compile:
          classarg = (Class<CompoundObject<String,String>>)CompoundObject.class;but these do compile:
          classarg = (Class<CompoundObject<String,String>>)(Class)CompoundObject.class;or
          Class coclass = (Class)CompoundObject.class;
          classarg = (Class<CompoundObject<String,String>>)coclass;And this doesn't compile:
           classarg = proto.getClass().asSubclass(proto.getClass());but this does:
           Class tmp1 = proto.getClass();
           classarg = tmp1.asSubclass(tmp1);

  • How to get instance name

    I was wondering if there was any way to get the instance name
    of the class to the class without having to pass it in when you
    create the instance of it. For example, so I can do this:
    var myObject:CustomClass = new CustomClass();
    and then the class knows whats its instance name being used
    is instead of having to do something like this:
    var myObject:CustomClass = new
    CustomClass("myObject");

    As I think I found out how to gnerate unique key form components passed to my method and afterwards be able to get this key by knowing the component.My code is following:
    public static String generateUniqueKey(Component c){
    String resultString="";
    String s = c.getAccessibleContext().getAccessibleComponent().toString();
    StringBuffer stringbuffer = new StringBuffer(s);
    if(!Character.isJavaIdentifierStart(stringbuffer.charAt(0))){
    resultString="a_";
    }else{
    resultString=resultString+stringbuffer.charAt(0);
    for(int j = 1; j < s.length(); j++){
    if(!Character.isJavaIdentifierPart(stringbuffer.charAt(j))){
    resultString=resultString+"_";
    }else{
    if (stringbuffer.charAt(j)=='$'){
    resultString=resultString+"s_";
    }else{
    resultString=resultString+stringbuffer.charAt(j);
    return resultString;
    Any suggestions on this. May this result in problems anywhere?
    Thanks

  • How to get names of all Windows in a Form Application at runtime

    Dear All,
    I want to get the name of all windows in a form module programatically at run time. How to get it?
    Any help or comments will be highly appreciated.
    Thanks in Advance.
    Best Regards
    Bilal

    Hi Francois Degrelle,
    First of all thanks for the response.
    What if I have no items on a content canvas? In my application, I am using content canvas to hold the Image banner and help text of the current form, having no items at all. I am also using tab canvases to hold all items of form. The tabs are displayed on the content canvas at run time. So the tab canvases acts like frames (In my case).
    Now if I am looping through items, it gives me the list of all of the tab canvases. Whereas the tab canvas always has no window assigned, as it is displayed on content canvas which has that Window which I need. Thus I am unable to get the names of windows in my case through the above stated procedure.
    Another option could be if I can get the name of the content canvas upon which the given tab canvas is displayed?
    Any way to do this or some other way to achieve the use case?
    Any help will be highly appreciated.
    Thanks in advance
    Bilal

  • How to get instance notes in a global

    I have a global in a utility project that gets called through PAPI WS from an external client.
    I want this global to take an instance id as the input argument. It should then get a reference to the instance, get the instance notes currently associated with that instance and pass them back (as an array of delimited strings). The instance will be residing in one of many other projects.
    I can use PAPI in the global to connect to a BusinessProcess:
    connectTo bp
    using url = Fuego.Server.directoryURL,
    user = String(BusinessParameter.getValue(name : "GENIE_UID")),
    password = String(BusinessParameter.getValue(name : "GENIE_PW")),
    process = "/" + ou + "/" + process
    and I can get a reference to the instance using bp.getInstance(), but I can not see anywhere in any of the PAPI methods where I can get the instance notes for that instance.
    BTW I am using both ALBPM 5.5 and 6.0, so I need a solution for both.
    Basically this external client wants to get instance notes for a given instance (and there is other processing I need to do as well - I need to add in custom notes from a custom table before I return the results, so they can't just use PAPI WS directly to get the instance notes).

    I ran into this problem and requested from Product Management that they allow PBL code to get instance notes, audit info, etc. It's been a while since I've run into this problem but I'm sure it's the same issue. You can only get information about the instance notes, audit info, etc from PAPI.
    The architecture of BPM is such that the BPM workspace actually uses PAPI to do all its work. So in other words anything the workspace does, PAPI can do. But from within a process, PBL code doesn't have access to all PAPI functionality. You may want to raise this issue up with product management and see if they have any recommendations.
    BTW - It is not recommended to instrospect BPM tables to use from within your process. Although this would solve your problem, it is not recommended...
    Cheers!
    Mark

  • How to get values of all input text of a form?

    Hi,
    I would like to know how to get all input text value of a form?
    I try this:
            List values = new ArrayList(); 
            values = getBindings().getAttributeBindings(); 
            for (Iterator iterator = values.iterator(); iterator.hasNext();) {
                Object o = iterator.next();
                if (o != null) { 
                    if (o instanceof FacesCtrlAttrsBinding) { 
                        System.out.println("Trace iterator=" + ((FacesCtrlAttrsBinding)o).getName());
    src
    In my jspx, I use panelTabbed component which is in af:form
    With this code, I get all bindings name.
    So I change the [structure |http://h.imagehost.org/0922/jdev.png] putting af:form in each item of my af:panelTabbed without succes.
    The code trace all bindings again, and I just want to get the input text of the form (like *$_POST*, or *$_GET* in php)
    How to do that?
    Thanks for your help.

    Hi,
    I try this:
    private UIComponent getUIComponent(String name) { 
          FacesContext facesCtx = FacesContext.getCurrentInstance(); 
          return facesCtx.getViewRoot().findComponent(name) ; 
    src
    I post the structure again.
    I try:
    // f1 id of af:form
    UIComponent test =  getUIComponent("f1");
    test is not null
    // pfl1 id of af:panelFormLayout
    UIComponent test =  getUIComponent("pfl1");
    but here test is null
    I try
    // f1 id of af:form
    // pt1 id of af:pageTemplate
    // pt2 id of af:panelTabbed
    // sdi1 id of af:showDetailItem
    // ps1 id of af:panelSplitter
    // pgl32 id of af:panelGroupLayout
    // pfl1 id of af:panelFormLayout
    UIComponent test =  getUIComponent("f1:pt1:pt2:sdi1:ps1:pgl32:pfl1");but I have this:
    Error 500--Internal Server Error
    javax.servlet.ServletException: java.lang.IllegalArgumentException: f1So I add
    private static final char SEPARATOR_CHAR = ':';But I have the same error.
    getUIComponent returns null with pt2,sdi1, ps1, pgl32, pfl1 and not null with f1, pt1.
    I don't know why...
    How can I get children (af:inputText) of pfl1 ?
    Thanks

  • How to get Guid of all form libraries

    I have  a requirement where i should get guid of all form libraries so that i dont need to hardcode the Guid of form library in server object model.How can i achieve this..

    Hi Hemandra..
    Thanks for the response,I am looking to relink documents using the code below...Code is working well for single form library but i have 4 to 5 form libraries for which the code should be executed..how can i get this done.I am working with Infopath forms.
    protected
    void btnsubmit_Click(object
    sender, EventArgs e)
    if (RelinkDocuments())
    Label3.Text =
    "Success!!!";
    else
    Label3.Text =
    "Failure";
    private
    bool RelinkDocuments()
    try
    SPSite site =
    SPContext.Current.Site;
    SPWeb spWeb = site.OpenWeb();
    SPList spList = spWeb.Lists[new
    Guid("8E023C18-DAA3-4743-81B7-E034111544BC")];
    SPDocumentLibrary doclib = (SPDocumentLibrary)spList;
    string solutionUrl =
    SPHttpUtility.UrlPathEncode(spWeb.Url
    + "/" +
    doclib.DocumentTemplateUrl, true);
    foreach (SPListItem
    spItem in doclib.Items)
    //loop through the list items
    SPFieldCollection spFields = spItem.Fields;
    foreach (SPField
    spField in spFields)
    //loop through fields resetting them
    if (spField.Type !=
    SPFieldType.Computed &&
    spField.Type !=
    SPFieldType.Invalid && !spField.ReadOnlyField)
    try
    spItem[spField.InternalName] = spItem[spField.InternalName];
    catch (Exception
    e)
    SPContentType spContentType = spList.ContentTypes[(SPContentTypeId)spItem["ContentTypeId"]];
    if (spContentType !=
    null)
    //try to update the item with the content type's template url which is the updated one
    if (spContentType.DocumentTemplate.StartsWith("http://")
    ||
    spContentType.DocumentTemplate.StartsWith(
    "https://"))
    spItem[
    "TemplateUrl"] =
    SPHttpUtility.UrlPathEncode(spContentType.DocumentTemplate,
    true);
    else
    if (spContentType.DocumentTemplate.StartsWith("/"))
    spItem[
    "TemplateUrl"] =
    SPHttpUtility.UrlPathEncode(spWeb.Site.MakeFullUrl(spContentType.DocumentTemplate),
    true);
    else
    spItem[
    "TemplateUrl"] =
    SPHttpUtility.UrlPathEncode(spWeb.Url
    + '/' + spList.RootFolder
    + '/' + spContentType.DocumentTemplate,
    true);
    else
    //no content type found so default template url to solution Url
    spItem[
    "TemplateUrl"] = solutionUrl;
    spItem.Update();
    return
    true;
    catch (Exception
    ex)
    return
    false;

  • HT4859 How to get back my all application from iTunes to my new iOS6

    Hi,
    I have just update my iphone 4 ios5 to ios6, but in that I dont know I am not able to see any of old applications, and I am not able to see my backup, could anybody tell me how to get it back to my new ios6 all those applications and musics etc, as those thing I can see in my MacBook itune, all those are avaible their but in my iphone.
    Cheer
    San

    As you have iOS 6 you must be a developer and therefore should know that discussing iOS 6 outside of the private developer only forums is a violation of the non-disclosure agreement you signed to gain access to it.
    So, post your question in the private developer only forums.

  • How to get - List of all the ad hoc reports in BO 5.1?

    Hi All,
    I want list of all the ad hoc reports in BO 5.1.
    Name of ad hoc report and user would be ideal.
    How can i get? Does anybody know how to get the list?
    Please help me.
    Thanks in advance!
    Amol Mali

    Wrong forum. Please mnove or reporst to Legacy forum:
    SAP BusinessObjects BI Legacy Products
    Ludek

  • How to get list of all sp farm solutions using powershell?

    is there any powershell script can list down all solutions deployed on farm in txt or cvs file?

    Thanks. but this is showing all features. I need only our custom developed features
    Get-SPFeature >> c:\temp\feature.txt
    Let me know how to get?

  • How to get handle to all HSSF worksheets

    Hi Friends,
    Is there any way we can get handle to all the worksheets in the excel file using apache POI classes..
    For eg:
    If there are 10 worksheets, how to get all the sheet names without using
    HSSFSheet sheet = wb.getSheetAt(0)
    Thanks and Regards,
    JG

    Hi masijade,
    I was not aware of the property getNumberOfSheets.
    Thanks for notifying me of that property.
    and this will property will resolve my issue.
    Thanks and Regards,
    JG

Maybe you are looking for

  • Error in creation of sample database during installation of Oracle8

    I am trying to install Oracle8 for Intel Solaris8. Near the end of installation - running database configuration assitant, the creation of the sample database failed by an alert: ORA-03114: not connected to ORACLE I also tried to run database configu

  • OC4J_BPEL – no port available from the port range

    To All, We could not start our BPEL Process Manager and OC4J_BPEL. We have shut down and restarted the Linux server repeatedly and re-running the IRCA. All stacks are running except the OC4J_BPEL and BPM. We keep receiving the following message when

  • I have buy a new HP 8560W notesbook, but I can not play Blu-ray disk?

    I have buy a new HP 8560W notesbook, but I can not play Blu-ray disk? I can not see on HP homepages there is some other disk to buy? Shall I do anything speciel for play Blu-ray?

  • 3KEH Balance Sheet Values not updated in Profit Center

    Hello Peofit Center experts I have Assigned Profit Center for few balance Sheet Accounts in 3KEH.But values are not updated in respective Profit Centers. I have to do any configuration settings for transfer Balance Sheet accounts to Profit center or

  • In need of major help - exchange server

    I need some major help. I just bought my first Blaclberry (8330) and can't get the email to work. We are set up on exchange with Outlook web access. When I go through all the steps I get a message that says a connection could not be established. Chec