Can you Dynamically Name Objects

I am trying to create a new object for every line of a text file, that i read in.
The problem is that i need to dynamically name this object because i dont know the number of lines in the file.
I tried using a varible as the object name but it errors as it sais that varible is already declared as a diffrent type.
String newObject = "object1";
myObject newObject = new myObject();
If this is not posible can i rename an object after it is created.
Thanks for any help.
Rob

hi!
I know this problem..but it's not a problem of java, it's a problem of your thinking! I had it too when I started programming in java, because I came from programming in PL/1... ;-)
and the answer I think is NO, it's impossible.
you think you have to create and rename an object..probably you have an object james and you want to rename it into joseph.. but if you have a class person and a method calles setName(String name), you can change the name in this way..
if you want to create a lot of new objects use an array or better a Vector.
I hope this helps..
http://www.menzsoft.ch

Similar Messages

  • How can you move the objects from one server to another?

    how can you move the objects from one server to another?

    Hi,
    Collecting objects for Transporting
    1. rsa1->transport connection
    2. left panel choose 'object type', middle panel choose 'infocube' and 'select objects'
    3. then choose your infocube and 'transfer'
    4. will go to right panel, choose collection mode 'manual' and grouping only 'necessary objects'
    5. after objects collection finished, create request
    6. If they are $TMP, then change the package.
    7. When you click the Save on the change package, it will prompt for transport. Here you can provide an existing open transport request number, or if you like here itself you can create a new one.
    8. You can check the request in SE09 to confirm.
    Releasing Transport Request  
    Lets say you are transporting from BWD to BWQ
    Step 1: In BWD go to TCode SE10
    Step 2: Find the request and release it (Truck Icon or option can be found by right click on request #)
    Note: First release the child request and then the parent request
    Steps below are to import transport (generally done by basis )
    Step 1: In BWQ go to Tcode STMS
    Step 2: Click on Import queue button
    Step 3: Double Click on the line which says BWQ (or the system into which transport has to be imported)
    Step 4: Click on refresh button
    Step 5: High light the trasnport request and import it (using the truck icon)
    Transport
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b5/1d733b73a8f706e10000000a11402f/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/0b/5ee7377a98c17fe10000009b38f842/frameset.htm
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/224381ad-0701-0010-dcb5-d74236082bff
    Hope this helps.
    thanks,
    JituK

  • Converting Video to iPod, can you change name of file

    When you convert Video to iPod format, can you change name of the new file or put some "marker" so one can tell which is the orginal and which is the new file?
    Currently it is difficult to tell between the orignal and the new file.
    thanks in advance
    Rohit

    You'd probably be better off doing this sort of editing in iTunes, and letting it move the files appropriately.
    Go to the preferences, Advanced tab, and check the box to 'Keep iTune Music folder organized'. Then any changes you make to song names or other info (within iTunes) will automatically be applied.

  • Can you dynamically resize a graphic

    In AW 7, can you dynamically resize a graphic (jpg, or
    whatever) that's already on the screen, with some sort of code.
    Need help. Trying to build a piece, but having issues w/ space.
    Thanks for any help.

    Juice21 wrote:
    > In AW 7, can you dynamically resize a graphic (jpg, or
    whatever) that's already
    > on the screen, with some sort of code. Need help. Trying
    to build a piece,
    > but having issues w/ space. Thanks for any help.
    >
    Not as such. You can:
    - have multiple copies of the same image and flip between
    them (there's
    a Show Me on it)
    - use Flash
    - use alPicView
    <url:
    http://www.apixel.com/page0203.htm#alpicview
    >
    Andrew Poulos

  • Can you dynamically change an LOV on the parameter form based on other params?

    Can you dynamically change an LOV on the parameter form based on other parameters? For example, based on a entered purchase order number, create an LOV of the purchase order lines that belong to the entered PO #.

    Hi
    Accouding to my knoledge you can't do it.
    If you want to build lov for that particular
    value, you can do it in Forms.
    Vijay

  • Pages-when using template for envelopes can you import names/address from address book

    When using templates for envelopes can you import names/address from the address book?

    Drag the VCard from Address Book onto the open envelope template.
    If you want mutiple addresses make a Group of those in Address Book and drag the Group icon onto the Pages template.
    Peter

  • Can you add names to face on photoshop11

    Can you add names to faces on photoshop11

    Yes.
    Open the picture file
    Access the type tool, and type the name with horizontal or vertical type

  • Where can you download NAM 5.1 for windows7?

    Where can you download NAM 5.1 for windows7? it seems that i cannot find it, the ones on the web are all for Linux,
    thanks,
    Han

    Hi,
    Do you mean NAM for Network Analysis Module? As that is a module/appaliance which requires a specialized designed hardware and cannot be installed on Softwares like for Windows/Linux.
    NAM is a Hardware module/appliance that monitors and analyzes the traffic coming/going from network devices. Currently, there are multiple variations of the NAM, software and hardware, such as the NME-NAM for the Branch Integrated Services Routers (ISRs), NAM-1/NAM-2 for the Cisco Catalyst® 6500 Series Switches, and Cisco NAM 2200 appliances. Also, there is Cisco NAM Virtual Blade supported on the Cisco WAVE-574 and WAE-674 appliances.
    For more details please check :
    Cisco Network Analysis Module (NAM) Deployment Guide
    Network Analysis Module (NAM) Products
    Let me know if I did not understood the issue properly and you meant somthing else.
    -Thanks

  • Can you destroy an object?

    I have been looking around for an answer to this question a little while and have also posted on the Java .net forums too.
    But Im writing a little game where things appear on the screen, then because of user interaction, they dissapear. simple enough, I have my objects stored in a sequence, that I bind to a Group{} in my main Frame.
    The issue is that each of these objects get removed from the game via the *delete sequence* code segment and because they have their own timelines which does its own collision detection, the object never seems to get de-referenced and after a while I get out of memory exceptions and the game slows down to a halt.
    Firstly, I added functions to stop all timelines in each element before deleting it from the sequence, but it didnt appear to work as the game still slows down.
    So my question is, can you destroy an object? I just need it gone completly, and if there is a work-around, how can I be sure that it works? Currently the netbeans profiler isnt too easy to read, but that just maybe me (anyone else having issues reading the results of a JavaFX profiled app?)
    Thanks for any help that you can think of...
    Mark

    Are you 100% certain that there are no references to the object left after you remove it from the sequence? There is no way to explicitly destroy objects in Java; and this behavior extends to JavaFX. If you check the code and you're 100% sure that no references are left hanging out there, check Jira.
    [http://openjfx.java.sun.com/jira/|http://openjfx.java.sun.com/jira/]

  • Can you Manipulate 3D object in Director Dynamically?

    Greetings,
    I am looking for some way to dynamically manipulate a 3d
    object and am wondering if Director 3d has the ability to do this
    and if so, if any of you want to take this on as a freelance
    project? (this is a serious request on a cool project, not some
    hokey offer)
    I had first hoped that Flash could do it since I am more
    familiar with flash, but I was wondering if Director can update a
    3d object on the fly as it gathers new values for a number of
    points in the 3d object. Can Director do this?
    If you know of any person, any business that knows how to do
    this PLEASE contact me to discuss more. It has been difficult for
    me to understand the capabilites of Director 3D without speaking to
    someone who is talented and competent as I am sure most of you are.
    Cheers,
    -i

    model position, model rotation, model location, model scale,
    model shader, etc. are all easily modified. the actual mesh that
    makes up the model's shape can be changed with the meshdeform
    modifier. however, these changes won't be permanent. the entire 3d
    scene will be in it's original state everytime the movie starts. if
    you want to save state you'll have to store the data defining the
    attributes externally in some way and apply them at runtime.

  • How do you dynamically find objects

    I'm creating sprites dynamically on a button event.  So for example there is a sprite with a name of "parent_X" where X is a sequential number starting at 1...  So in theory I may have parent_1, parent_2, parent_3, and so on depending on how many times you press this button.
    Each sprite has a textField child also with a dynamic name, like textChild_1, textChild_2, textChild_3 and so on.
    User can remove a parent and child from the stage... what I do is remove the sprite and then delete it ... so if the parent name is loaded into a string called "textParent" I do:
    var target:DisplayObject = getChildByName(textParent);
    removeChild(target);
    delete getChildByName(textParent);
    This seems to work.  Question 1: by deleting the parent are both objects destroyed?  What I mean is that if you simple removeChild(myChild) and later do addChild(myChild) the child is returned to the stage... so if delete the parent and later, I'm assuming the child and parent are gone for good unless they are re-established?  Is this correct thinking?
    Moving on, what I need to do is determine what parent(s) and child(s) are still accessible in code after some have been removed / deleted.
    Not sure if you understand what I mean, but at some point I need to know what "parent_X" and "child_X" items (objects?) exist? 
    I'm trying something like this:
    x = 1;
    var target:DisplayObject = new DisplayObject();
    while(x <= textAreas) {   // textAreas is the counter to assign next parent_X number it is an int
      var target:DisplayObject = getChildByName("parent_" + String(x));
      removeChild(target);
      x++;
    This fails, I think if a parent_X was removed (deleted) .. it seems to only remove the first target if more than one were previousy created and then destroyed.
    Am I going about this correctly?
    Thanks for any help.

    1.  target isn't destroyed with that code. it still exists and can be re-added to the display list at any time.  you should assign target to null when you want to ready target for gc.  when target is gc'd the child may or may not be gc'd depending on how it's created.  my guess is the child will not be gc'd.
    2.  use an array to store and track your existing parent objects.

  • Can You Change 3D Object Rotation Axis?

    Greetings. I have created a 3d object using repousse in Photoshop (CS5 extended). The original 2d image was created in Illustrator. I have found that in both Photoshop and After Effects, when I rotate this object in 3D space, either rotating the object itself or the camera, that the axis upon which it rotates is not the 3D center of the 3D object, but rather somewhere behind it. The result is that it is rotating like the moon rotates around the earth, rather than rotating in place, like an eye moving (rotating) in an eye socket; i want the eye ball to stay in one place, but see the pupil move up and down and all around like a real eye would.
    I have had no luck changing anchor points or positions of the object, even though I do have the X, Y, Z coordinates to manipulate.
    Can you tell me how to adjust this anchor point, or rotation axis point, or whatever this would be called?
    Thanks.

    Not really true...
    Yes it is limited but it can be altered.
    I believe that photoshops 3d center point is based on the world center and not the objects center. This means that it is possibloe to move the object to the world center to fix the rotation of your object.
    Open window>3d panel and just below the layers in that panel are some icon at the left side of the panel. Third icon down is the mesh tool, hold down the mouse button to bring up the pop up menu. Select the slide mesh tool. This will let you move the mesh adjust the pivot point.
    The problem that I see with this, is that it is trial by error, I do not see away to visually see where the world center is.
    Scratch that, at the bottom of the panel are three icons. The left of the three will turn on the ground plane. The plane does show world center.(where the red and green lines intersect is world zero)
    To understand which axis is which, sinse it does not specify.  Select the 3d pan tool, then in the top tool bar, type in a value one axis at a time to see which direction the object is moving. Then repeat the process for the rotate tool and see how the object rotates around each axis.

  • Can you set arraycollection objects to certain states?

    hey guys.. so in my application, i need to setup rules and permissions for certain users...
    so basically my applicaion initially displays a login screen, on login success its going to get a variable from the server which says if the user has all or video access
    the way i have my "login success" component setup is i have an array collection and i have states
    basically if the user has "all" access then the user shoudl be able to see everythign in that array collection. and if the user has "video" access the the user shoudl onlly see the video option in the list
    the code i have is
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
              <s:ArrayCollection id="webCoreSourceData">
                   <fx:Object label="Content Group" stackId="contentGroup" />
                   <fx:Object label="Images" stackId="images" />
                   <fx:Object label="Image Renderer" stackId="imageRender" />
                   <fx:Object label="Videos" stackId="videos" />
                   <fx:Object label="Flash Objects" stackId="flashObjects" />
                   <fx:Object label="Story Editor" stackId="storyEditor" />
                   <fx:Object label="Tag Management" stackId="tagManagement" />
                   <fx:Object label="Image and Video Format" stackId="format" />
                   <fx:Object label="Rules And Permissions" stackId="rulesAndPermissions" />
              </s:ArrayCollection>
         </fx:Declarations>
         <s:states>
              <s:State name="all" />
              <s:State name="videoUpload" />
              <s:State name="imageUpload" />
              <s:State name="contentGroup" />
              <s:State name="flashObjects" />
         </s:states>
            <list dataprovider="webCoreSourceData" />
    i need to set each one of these arraycollection objects to a certain state, so when i set "currentState=videoUpload" then only video displays in the list component
    and when i set my "currentState="all"" then i want to be able to all the objects in the arraycollection
    any help is greatly appretiated!! thank you...

    Hi,
    There are a few things you can do, one is to filter the array on change of state you could have it that your dataprovider is different for each state then you do something like below. This might give you some sort of direction anyway..
    David
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
    <![CDATA[
    import mx.events.FlexEvent;
    ]]>
    </fx:Script>
    <s:states>
    <s:State name="State1"/>
    <s:State name="ImageState"/>
    <s:State name="VideoState"/>
    <s:State name="OtherState"/>
    </s:states>
    <fx:Declarations>
    <s:ArrayCollection id="Videos">
    <fx:Object label="Video1" />
    <fx:Object label="Video2" />
    <fx:Object label="Video3" />
    <fx:Object label="Video4" />
    </s:ArrayCollection>
    <s:ArrayCollection id="Images">
    <fx:Object label="Image1" />
    <fx:Object label="Image2" />
    <fx:Object label="Image3" />
    <fx:Object label="Image4" />
    </s:ArrayCollection>
    <s:ArrayCollection id="OtherStuff">
    <fx:Object label="OtherStuff1" />
    <fx:Object label="OtherStuff2" />
    <fx:Object label="OtherStuff3" />
    <fx:Object label="OtherStuff4" />
    </s:ArrayCollection>
    <s:RadioButtonGroup id="radiogroup1"/>
    </fx:Declarations>
    <s:List id="myList" x="163" y="85" width="271" height="386"
    dataProvider.VideoState="{Videos}"
    dataProvider.ImageState="{Images}"
    dataProvider.OtherState="{OtherStuff}"/>
    <s:Button y="15" label="Video" x="160" click="currentState='VideoState'"/>
    <s:Button y="15" label="Image" x="240" click="currentState='ImageState'"/>
    <s:Button y="15" label="Other" x="320" click="currentState='OtherState'"/>
    </s:Application>

  • How Can you dynamically change a canvas frame title?

    I am looking for a way to dynamically change the title of a frame on a canvas.

    Jim,
    frames on a canvas are graphic objects that cannot be controlled using properties. To obtain dynamic frame labels, all you can do is to have a Display Item instead of the frame label.
    Frank

  • Can you create an object from a string

    I have been working on creating a dynamic form, creating the
    form items from an xml file. I am getting very close to conquering
    this task. I will share it when it's complete.
    However, I am stuck at the moment trying to create an object
    from a string. For example, if the xml item is an HBox I want to
    create an HBox. Like this: parentObject = new arrayOfFormItems[
    index ]..type ()
    This isn't working. First, is this possible using some syntax
    I am unaware of in Flex? I don't want to use a large if or case
    statement if possible.
    Thanks in advance for your help!

    Thank you very much. Indeed that did solve the one problem. I
    missed the casting as a Display Object. That is awesome!
    I do still however, have to instantiate one of every item I
    want to dynamically create or I get the following error when I try
    to create a dynamic object that I have not instantiated before.
    ReferenceError: Error #1065: Variable HBox is not defined.
    at global/flash.utils::getDefinitionByName()
    at MyForm/buildForm()
    at DynamicForm/::onComplete()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    I read that you have no choice but to instantiate one of each
    type to force the linker to link the code for that class into the
    .swf. Unless you know another way to force it.
    This is what I have in my Application mxml to get it to work:
    <mx:HBox>
    <mx:Text visible="false"/>
    <mx:TextArea visible="false"/>
    <mx:TextInput visible="false"/>
    <mx:DateField visible="false"/>
    </mx:HBox>
    And those are the types I'm using to test with. . . I will
    have to add all the others I want to use as well . . .

Maybe you are looking for