How do I create a variable name on the fly?

Hi,
If I have a String containing a value, how do I create a variable name using that value during program execution? That is if I have
String fred = "newvar";
How do I then create a new String with the name "newvar" (using the contents of fred)? I will never know what the content of fred is until this point. What I'd like to be able to do is something like
String fred.subString(0) = "a new value";
Obviously this won't work but if it did the statement would evaluate to something like
String newvar = "a new value";
Appreciate any help you can give,
Dave.

Here u go:
   private JCheckBox AddCheckBox( String strText, int nTextID )
      JCheckBox checkbox = null;
      Class checkboxDefinition;
      Class[] stringArgsClass = new Class[] {String.class};
      Constructor stringArgsConstructor;
      Object[] stringArgs = null;
      String arg = "";
      arg = "CheckBox" + nTextID;
      String label = new String(arg);
      stringArgs = new Object[] {label};
      try
        checkboxDefinition = Class.forName("javax.swing.JCheckBox");
        stringArgsConstructor = checkboxDefinition.getConstructor(stringArgsClass);
        checkbox = (JCheckBox) createObject(stringArgsConstructor, stringArgs);
        checkbox.setName(label);
        checkbox.setText(strText);
        checkbox.setSize(new java.awt.Dimension(CQuestionBase.PAGEWIDTH, 21));
        checkbox.putClientProperty("1",new Integer(nTextID));
        checkbox.setVisible(true);
      catch (ClassNotFoundException e)
        System.out.println(e);
      catch (NoSuchMethodException e)
        System.out.println(e);
      return checkbox;
   }This code was based on an example I found about two years ago. You can use the same methodolgy to create objects of any kind. Again, look at java.lang.Reflect.

Similar Messages

  • How do I create a variable that uses Previous() and references itself.

    I am trying to create a crosstab with a number of meaures in it. I have a variable called opening stock and another called closing stock. The opening stock for day 2 is the closing stock for day 1 and is a variable [LV Opening Stock] defined as =Previous([closing stock];Row).  This works fine. But, the closing stock for day 2 is the opening stock plus production minus sales. So my variable has to reference the previous days closing stock.
    When it is defined as =[LV Opening Stock]+[Planned Production Qty]-[Forecast Daily Qty] it validates but when I try to save it I get the following message :  The formula for variable [LV Opening Stock] contains a reference to a variable with the same short name. You must use the fully-qualified variable name in the formula to remove this ambiguity. (Error: WIS 10040)
    How do I solve this? What is the fully-qualified name? Is it because it's effectively referencing itself?
    I'm using XI R2 sp4
    Thanks
    John

    Hi. I'm having the same issue. Please share with us if you find a solution.
    Many thanks.

  • How do I create a Skype Name in this new environme...

    For a variety of reasons, I have created a new Microsoft Account. In attempting to set it up with Skype, I was never asked to create a Skype Name. This has created issues sining into Skype, as well as telling people how to Skype me. I do NOT want to give them my email address as my Skype contact. A Skype name is much more suited for this situation.
    How do I create a Skype name that people can use to call me?
    This beggs the question of why Loging into Skype and idnetification is co complicated. Associated with this one account there are the following methods of primary identification: Skype Name, Microsoft Account, Display Name, Skype Community Name, and there seems to be an additional display name for each Skype accont in the Community which begins with live: and then a modified form of the user's email address. That is A LOT to remember. I had a difficult time just logging in because it asks for my Skype name and the blank would not accept any of the aforementioned identifications. I had to get here by signing into Skype Desktop and then clicking a link to go through rather than signing in. The sign in would not accept my credentials.
    Bottom line is all these issues would go away if I could figure out how to get a skype name.

    See this:
    http://community.skype.com/t5/Security-Privacy-Trust-and/New-to-Skype-and-having-trouble-signing-in/...

  • How do I create a variable video delay of a live stream...

    I have a live video feed from my webcam in my Flash Application. I have a second video window next to it that I want to place a variable delayed video of the live stream. Therefore, I need to save the video stream in memory/disk and create this variable delay, say 5-60 seconds. As well as, continue to capture the live stream. The camera I am using suppots H.264 encoding.
    How do I create a variable length queue or buffer to hold the video stream coming into the flash application. Do I create a memory variable or write this to disk ? I have been looking over the ActionScript 3.0 documentation and I can not figure out how to code this either way ( as a memory variable or write to disk queue ).
    I want to be able to change the delay, view the delay stream in slow motion and scrub through the delayed stream.
    I would like to do this with out having to use Flash Media Server.
    Thanks,
    Bob

    I am sure it is practically impossible to accomplish that on the client side. Although theoretically it is conceivable to use NetStream.appendBytes() but it requires an extremely complex implementation.
    I suggest you look into FMS DVR capacities:
    http://help.adobe.com/en_US/flashmediaserver/devguide/WS236AE81A-5319-4327-9E44-310A93CA09 C6Dev.html

  • How can I create a variable size array?

    How can I create a variable size array?

    ok then how can i create a new vector object?If you don't know that, you need to go back to your text book and study some more. Or read the tutorial on the basics of Java: http://java.sun.com/docs/books/tutorial/java/index.html
    After reading that you can move on to: http://java.sun.com/docs/books/tutorial/collections/index.html
    Anyway, the answer to your question is, of course:
    Vector v = new Vector();(But you should probably use ArrayList instead of Vector.)

  • Workflows: How to set a workflow variable that is the difference in hours between now and a created date

    I'm trying to create a variable that contains the number of hours between the item created date and Now.  When i use TODAY, it seems to set the time at 12:00 rather than the time now - so that throws the hours off.  Any ideas?
    ajw

    Hi ajw,
    According to your description, my understanding is that you want to calculate the hours between the item created date and now.
    It seems to be not an OOB way to implement your requirement, to get the current time, you need to create a custom workflow activity for SharePoint 2010 workflow. About creating custom workflow activity, you can refer to the links below:
    http://msdn.microsoft.com/en-us/library/hh872790(v=office.14).aspx
    http://blogs-sharepoint-ashutoshmisra.blogspot.in/2013/02/create-custom-workflow-action-for.html
    Or, you can use a third party solution to achieve your requriement.
    Here are some similar posts for you to take a look at:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/e93ea37a-df09-4cbf-a58d-5d4def3d3d42/how-to-compare-time-in-sharepoint-designer-2010sp-2010-workflow?forum=sharepointgeneralprevious
    http://blog-sharepoint.blogspot.in/2009/03/get-current-time-in-sharepoint-designer.html
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • How can i create "bind variable"

    How can i create "bind variable" in my DB to support any procedure in my DB.
    Thank you very much.

    In SQL*PLUS we can defined bind variable
    SQL>var x varchar2(250); -- Is x bind variable or i'm misunderstand ?
    and ... in my procedure i can used ' &x ' to pass valued of 'x' from sql prompt to my procedure.
    but i'm not sure variable x is still remain in DB because i need to pass variable
    " v_stmt := 'and employee_id between ..... ' " from FORM to PROCEDURE in DB
    how can i do

  • How do I create a new calendar for the current year, using last years calendar's birthday's/photos and comments from the lower pages?

    Each year for the past 5 years I make a family calendar and send copies to all he family members around the globe.  I hate that I have to recreate all the birthdays and special occasions from scratch, and re-drag all the photos onto these dates, in the lower half of the page of each month on the new calendar.  How can I create a new calendar for the current year and port all of these photos/comments into the new calendar from last years calendar, to save having to redo all this work!!  I am not talking about the upper half page of the photos only...I am referring to the calendar page of each month.
    Thanks in advance. 
    Colin

    Welcome to the Apple Discussions. Open iWeb so you see your original site in the left hand pane. Use the File->New Site menu option to create a new site. Give it the name you want.
    Now select a page in your original site and type Command+D. That will duplicate the page. Drag the duplicate page down to the new site and rename it as needed. Do that for the other pages you need in the original site.
    OT

  • If variable name is the same as the column name in procedure ?

    If variable name is the same as the column name in procedure , What should i do?
    For Example :
    CREATE OR REPLACE PROCEDURE "TEST_PROC" (MIN_SALARY in UMBER)
    as
    begin
    INSERT INTO TEST SELECT JOB_ID,MIN_SALARY FROM JOBS WHERE MIN_SALARY = MIN_SALARY;
    end;

    You could follow a better naming convention and have the parameters to the procedures named in a way so as not to be confused with column names.
    You could prefix the variable names with the name of the procedure they appear in but then what if your have procedure names same as table names?
    SQL> create or replace procedure test_proc(sal in number) is
      2    cnt number ;
      3  begin
      4    select count(*) into cnt from scott.emp where scott.emp.sal = test_proc.sal ;
      5    dbms_output.put_line('cnt='||cnt) ;
      6  end ;
      7  /
    Procedure created.
    SQL> set serveroutput on
    SQL> exec test_proc(800) ;
    cnt=1
    PL/SQL procedure successfully completed.
    SQL>If you search you can find several posts here itself on naming convention to avoid such issues in first place.

  • How can i create multiple accounts but use the same itunes?

    how can i create multiple accounts but use the same itunes?

    Hi iCloud is Making Me Go Crazy,
    You will need to create a new Apple ID for your GameCenter and iCloud services.  You can continue to use the current Apple ID you share with your Mom for access to iTunes Store purchases if you wish. 
    Using your Apple ID for Apple services
    http://support.apple.com/kb/HT4895
    Frequently asked questions about Apple ID
    http://support.apple.com/kb/HT5622
    Cheers,
    - Judy

  • How-can-i-remove-my-skype-name-from-the-sign-in-sc...

    Guys this is absolute rubbish feature of the login application where people's login names get recorded in the dropdown menu. Is there any more permanent way of getting rid of this annoying privacy intrusive "feature"? I would like to have a profile with a username that is not going to appear at airports and my grandma's laptop after I log out of skype and no I do not want to go digging for app files to remove my entire history on each and every machine I use as suggested by your help files. Could you please advise if I'm missing something here?
    https://support.skype.com/en-gb/faq/FA11070/how-can-i-remove-my-skype-name-from-the-sign-in-screen-i...

    Unfortunately, the option to remove that feature is not available.  
    IF YOU FOUND OUR POST USEFUL THEN PLEASE GIVE "KUDOS". IF IT HELPED TO FIX YOUR ISSUE PLEASE MARK IT AS A "SOLUTION" TO HELP OTHERS. THANKS!
    ALTERNATIVE SKYPE DOWNLOAD LINKS | HOW TO RECORD SKYPE VIDEO CALLS | HOW TO HANDLE SUSPICIOS CALLS AND MESSAGES
    SEE MORE TIPS, TRICKS, TUTORIALS AND UPDATES in
    | skypefordummies.blogspot.com | 

  • How can i create a new item in the app "health"?

    how can i create a new item in the app "health"? I need a field for documentation of "Waist-to-height ratio", exactly for "circumference".
    It's a matter of common knowledge, that the Waist-to-height ratio (WHtR) has more significance then the Body-Mass-Index (BMI).

    If you mean you want to change a color of a calendar category or create a new one, you cannot do that, what is pre-loaded is what you get and cannot be edited.

  • How do I create a Public Group on the Calendar Server?

    How do I create a Public Group on the Calendar Server?
    <P>
    Anyone can create Private Groups or Member Only Groups. You must be given
    administrative rights to create Public Groups on the Calendar Server. The
    Calendar Server Admin (SYSOP) can give anyone rights to create Public Groups by
    using the uniadmrights tool.
    <P>
    Go to /users/unison/bin/
    and run the uniadmrights
    tool. Some sample syntax:
    <P>
    To list all users with administrative rights:<P>
    % uniadmrights -ls -host yourhostname
    <P>
    To give John Smith, a user on node 10000, rights to administer Public Groups:<P>
    % uniadmrights -e "S=Smith/G=John" -add -pgrp -n 10000
    <P>
    In Calendar Server 4.0, you also have the option of using the Admin Server GUI
    to assign Administrative
    rights (instead of using the command-line method) by going to User Management,
    Administration Rights.
    <P>
    With the proper administrative rights, log into the Calendar Client. Go to Options,
    Manage Groups to create a new group. Choose PUBLIC from the dropdown window,
    add your users and/or resources and click OK to create the Public Group which
    can be seen by all users on the local Calendar Server.

    The following is info that I found in another post that I have been trying to follow.
    MrHoffman      New England
    Re: Configure DNS - OS X Server Next Steps
    Feb 13, 2011 6:36 AM (in response to Jimbooooooo)
    You're setting up internal DNS services, you referenced your ISP DNS servers and you should not have, and now those servers have no translations for your hosts. This is a common misconfiguration.
    See [configuring DNS on Mac OS X Server|http://labs.hoffmanlabs.com/node/1436] for how to set up your internal DNS server.
    And if there are any references to your ISP DNS servers here (within your client settings, within your server settings, your Airport settings, etc), then you're usually going to have DNS and connectivity problems. You're running a server now, so you'll be running your own services, and (particularly because of NAT here) referencing only your own DNS server(s).
    You may be setting up external DNS (if and when you need that), but that should happen after you set up your internal DNS. The above article has a link to setting up external DNS, when you get around to that, if/when you need in-bound connections into your LAN.

  • How do i create a mail box in the SMTP server thru a java program

    How do i create a mail box in the SMTP server thru a java program. If it is possible thru a java program.pls suggest a mail server compatible for the above possibility to work.
    pls help ....

    Please let me know if it is not at all possible to
    create a user account automatically thru a program
    (java) in a mail server... how does yahoo work
    then..does he manually add a user to the mail
    server...By talking to a web server not a mail server.
    >
    Is not there any mail server that will allow us to
    create mailboxes for my java program.. how do the
    other web account services work..
    As I said mail servers do have management interfaces. You need to find one and then determine what the management interface is.

  • How do I create a filter that bypasses the in page and goes directly to spam rather to delete?

    How do I create a filter that bypasses the in page and goes directly to spam rather than to delete?

    From your question I'm going to guess you are talking about Mac Mail.
    If you are talking about a RULE then the "Perform the following actions:" would be to select "Move Message" to mailbox "Junk" instead of "Delete Message."
    If you are talking about something else then please give more information.

Maybe you are looking for