The concept of Object Arrays

for example, I have this code:
String[] notItems = { "", "NOT" };
//First 'Not' ComboBox
          notCombo = new JComboBox(notItems);
          notCombo.setPreferredSize(new Dimension(95, 40));
          notCombo.setBackground(new Color(241, 239, 240));
          notCombo.setForeground(new Color(93, 58, 64));
          notCombo.setFont(boxFont);
          notCombo.setEnabled(true);
//Second 'Not' ComboBox
          notComboTwo = new JComboBox(notItems);
          notComboTwo.setPreferredSize(new Dimension(95, 40));
          notComboTwo.setBackground(new Color(241, 239, 240));
          notComboTwo.setForeground(new Color(93, 58, 64));
          notComboTwo.setFont(boxFont);
          notComboTwo.setEnabled(true);
//Third 'Not' ComboBox
          notComboThree = new JComboBox(notItems);
          notComboThree.setPreferredSize(new Dimension(95, 40));
          notComboThree.setBackground(new Color(241, 239, 240));
          notComboThree.setForeground(new Color(93, 58, 64));
          notComboThree.setFont(boxFont);
          notComboThree.setEnabled(true);
//Fourth 'Not' ComboBox
          notComboFour = new JComboBox(notItems);
          notComboFour.setPreferredSize(new Dimension(95, 40));
          notComboFour.setBackground(new Color(241, 239, 240));
          notComboFour.setForeground(new Color(93, 58, 64));
          notComboFour.setFont(boxFont);
          notComboFour.setEnabled(true);
//Fifth 'Not' ComboBox
          notComboFive = new JComboBox(notItems);
          notComboFive.setPreferredSize(new Dimension(95, 40));
          notComboFive.setBackground(new Color(241, 239, 240));
          notComboFive.setForeground(new Color(93, 58, 64));
          notComboFive.setFont(boxFont);
          notComboFive.setEnabled(true);
...I understand that I can replace the five different 'notCombo' JComboBoxes with a single array of new ComboBoxes, and I could do notCombo[i] = new JComboBox(); in a for loop.
I tried the following to test it out and it compiled ok (which I wasn't expecting because of the JComboBox[], but I got a null pointer exception on the line notCombo[0] = new JComboBox(notItems);
private JComboBox[] notCombo;
//First 'Not' ComboBox
          String[] notItems = { "", "NOT" };
          notCombo[0] = new JComboBox(notItems);
          notCombo[0].setPreferredSize(new Dimension(95, 40));
          notCombo[0].setBackground(new Color(241, 239, 240));
          notCombo[0].setForeground(new Color(93, 58, 64));
          notCombo[0].setFont(boxFont);
          notCombo[0].setEnabled(true);Plus further code to do with layouts and adding it to the Frame and getting values and resetting values etc. All works fine and I replaced every occurrence of the single notCombo with notCombo[0].
Can anyone explain how this concept works and how I go about coding it in examples like this?
Cheers.

An array has to be created before you use it.
This creates a reference (notCombo) variable. It is not initialised.
private JComboBox[] notCombo;This creates an array of references to JComboBox objects, and assigns it to notCombo. Note that the references in the array are not initialized.
notCombo = new JComboBox[10];This initialises the first reference in the array to point at a JComboBox object:
notCombo[0] = new JComboBox(notItems);You omitted the middle step.

Similar Messages

  • Displaying the contents of an array of objects

    Hello All,
    My Java teacher gave us a challenge and I'm stumped. The teacher wants us to display the contents of the array in the main menthod. The original code is as follows:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
    }I understand that the elements of the array are objects, and each one has a value assigned to it. The following code was my first attempt at a solution:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
                                    for ( int i = 0; i < thingArray.length; i++)
                                       System.out.println( thingArray );                         
    }To which I'm given what amounts to garbage output. I learned from reading about that output that its basically displaying the memory location of the array, and the the contents of the array. There was mention of overriding or bypassing a method in System.out.println, but I don't believe that we're that far advanced yet. Any thoughts? I know I have to get at the data fields in the objects of the array, but i'm not having an easy time figuring it out. Thanks very much in advance!

    robrom78 wrote:
    public class TestObjects
         public static void main ( String args[] )
              Thing[] thingArray = { new Thing(4), new Thing(7) };
    for ( int i = 0; i < thingArray.length; i++)
    System.out.println( thingArray );                         
    Note that you're trying to print the entire array at every loop iteration. That's probably not what you meant to do.
    You probably meant to do something more like
                                 System.out.println( thingArray[i] );Also, note that the java.util.Arrays class has a toString method that might be useful.
    To which I'm given what amounts to garbage output. It's not garbage. It's the default output to toString() for arrays, which is in fact the toString() defined for java.lang.Object (and inherited by arrays).
    I learned from reading about that output that its basically displaying the memory location of the array, and the the contents of the array.It displays a default result that is vaguely related to the memory, but probably shouldn't be thought of us such. Think of it as identifying the type of object, and a value that differentiates it from other objects of the same type.
    By the way I assume you mean "+not+ the contents of the array" above. If so, that is correct.
    There was mention of overriding or bypassing a method in System.out.println, but I don't believe that we're that far advanced yet. Any thoughts? No, you don't override a method in println; actually methods don't contain other methods directly. You probably do need to override toString in Thing.
    I know I have to get at the data fields in the objects of the array, but i'm not having an easy time figuring it out. You can get to the individual objects in the array just by dereferencing it, as I showed you above.
    But I suspect that won't be sufficient. Most likely, Thing doesn't have a toString method defined. This means that you'll end up with very similar output, but it will say "Thing" instead of "[Thing" and the numbers to the right of the "@" will be different.
    You'll need to override the toString() method in Thing to get the output you want.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Trying to understand the basic concept of object oriented programming.

    I am trying to understand the basic concept of object oriented programming.
    Object - a region of storage that define is defined by both state/behavior.
    ( An object is the actual thing that behavior affects.)
    State - Represented by a set of variables and the values they contain.
    (Is the location or movement or action that is the goal that the behavior is trying to accomplish.)
    Variables- (What does this mean?)
    Value - (What does this mean?)
    Behavior - Represented by a set of methods and the logic they implement.
    ( A set of methods that is built up to tell's the how object to change it's state. )
    Methods - A procedure that is executed when an object receives a message.
    ( A very basic comand.For example the method tells the object to move up, another method tells the method to go left. Thus making the object move up/left that combination is the behavior.)
    Class - A template from which the objects are created.
    ( I am very confused on what classes are.)
    - The definitions of the words I obtained from the "Osborne Teach Yourself Java". The () statements are how I interperate the Mechanisms (I do not know if Thats what you call them.) interact with each other. I understand my interpretation may be horribly wrong. I will incredibly appreciate all the support I may get from you.
    Thank you

    Object oriented programming is a replacement for the older idea of procedural programming (you can research procedural programming in google). As I understand it, in procedural programming, you have a step by step set of function calls to accomplish some task. Each function receives a data structure, manipulates it, and passes it to the next function. The problem with this is that each function preforms some action for the overall task and can't easily be reused by some other task. Its also harder to read the flow of what is happening with raw data structures flying all over the place.
    In object oriented programming, an object calls a function of another object and receives back, not a data structure, but another object. Objects contain a data structure that can only be accessed by its functions. An object is not so much a sub component of a bigger task, as it is a service that any other task can use for any purpose. Also, when you pass an object to the caller, the caller can ask questions about the data structure via its functions. The developer doesnt have to know what the previous function did to the data by reading up on any documentation, or having to reverse engineer the code.
    I suggest the best way of learning this is to code something like a library object.
    A library object contains a collection of book objects
    A book object contains a collection of chapter objects
    A chapter object contains a collection of paragraph objects
    A paragraph object contains a collection of sentence objects
    A sentence object contains a collection of word objects.
    Add functions to each object to provide a service
    Example: A library object should have a:
    public void addBook(Book book)
    public Book getBook(String title)
    public boolean isBookInLibrary(String title)
    The key is to add functions to provide a service to anyone who uses your object(s)
    For example, what functions (service) should a paragraph object provide?
    It shouldn't provide a function that tells how many words there are in a sentence. That function belongs to a sentence object.
    Lets say you want to add a new chapter to a book. The task is easy to read
    if you write your objects well:
    Sentence sentence1=new Sentence("It was a dark and stormy night");
    Sentence sentence2=new Sentence("Suddenly, a shot ran out");
    Paragraph paragraph=new Paragraph();
    paragraph.addSentence(sentence1);
    paragraph.addSentence(sentence2);
    Paragraphs paragraphs=new Paragraphs();
    paragraphs.addParagraph(paragraph);
    Library library= new Library();
    library.getBook("My Novel").addChapter("Chapter 1",paragraphs).
    Now, lets say you want to have a word count for the entire book.
    The book should ask each chapter how many words it contains.
    Each chapter should ask its paragraphs, each paragraph should ask
    its sentences. The total of words should ripple up and be tallied at each
    stage until it reaches the book. The book can then report the total.
    Only the sentence object actually counts words. The other objects just tallies the counts.
    Now, where would you assign a librarian? What object(s) and functions would you provide?
    If written well, the project is easily extensible.

  • Need to sort an object array using an element in the object.

    hi all,
    i need to sort an object array using an element in the object.can someone throw some light on this.
    Edited by: rageeth on Jun 14, 2008 2:32 AM

    [http://java.sun.com/docs/books/tutorial/collections/interfaces/order.html]

  • Access the object array from client.

    I'm trying to access the object array from client.
    it's throwing the following error,
    RemoteException Ocuredjava.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
         java.rmi.MarshalException: CORBA BAD_PARAM 0x4f4d0006 Maybe; nested exception is:
         java.io.NotSerializableException: oracle.jdbc.driver.OracleResultSetImpl is not serializable
    how to resolve it?
    thanx in advance,
    Ilam.

    Don't send a ResultSet back as the result of an RMI call. Extract the data from the ResultSet on the server and send that back instead.

  • Points and discussion about the concepts behind making a 2D game

    Hi all. I'm currently trying my hand at a 2D RPG style game. I have a few questions open for discussion, however, regarding the general points of implementation behind it.
    1. Tiles vs static background argument aside, am I right in the thinking the best way of implementing movement across a big background map is actually to move the background and other sprites in relation to the player, giving the illusion of player movement although he in fact never moves from the center of the screen? Is there a way of actually creating a large map, populating it with sprites, and then moving the player across it and panning the screen after him?
    2. Collision detection. If we go with the idea of moving everything in relation to the player rather than the player himself, woudln't this mean a large amount of calculations when collision detection occurs. Example, u want the player to stop moving when he hits a brick wall so you have to tell every entity sprite to stop moving in response to key presses (because remember, pressing up moves everything else up, not the player character).
    3. Isometric. Is the easiest way of implementing an isometric style game just to develop isometric graphics and sprites?
    4. Tiles. I've been doing a lot of reading into tiles but I'm not sure what's a better implementation: a tile system which consists of the entire background and things like houses split into tiles or a simple big background which can be scrolled around and is populated by house sprites which are all moved in relation to the player and their collision detections done individually. Tiles certainly seem like a nice innovation but I feel like the graphics suffer as a consequence and u end up with a 8bit NES looking game!
    I'm just getting to grips with the concepts behind a lot of game design and all of this are some interesting points which I thought would be insightful to discuss. Opinions please!
    Cheers.

    Everything I'm about to say is based off of a tile-based Maze game I made.
    1. Using a big background map is a bit lazy if you ask me, but graphically it would be easier to create a nice-looking game. You also have to think about memory. Let's say you manage to get an 800x600 background image at the size of 200kb with JPEG compression. That 200kb jpg image you use as a background is not 200kb when loaded into memory. I dont remember exactly how much bigger it gets in memory, so this next statement is probably wrong. But I heard that: 4bytes per pixel for the ARGB data, and there are 800x600 (480,000) pixels. That's 480000*4 (1920000) bytes if that statement is right. But it's probably wrong, so hopefully Abuse or someone will correct it :)
    2. Move EVERYTHING up? I think you're a little mixed up. When the background (and all objects with it) is scrolled, their actual X,Y data is not changed. It is simply drawn according to the scroll offset. The only thing that is being calclulated for movement is the character/scroll offset. Think of it as a camera. The entire world is not moving, just the location of where you're viewing it. Quick example:
    You have a Tree who's location is (10,10). If the scroll offset is (0,0), then that Tree will be drawn at (10,10). But let's say your character moves up 5 pixels. You say you want him centered, so the scroll offset also moves up 5 pixels, making the offset (0,-5). When it's time to draw again, that Tree can't be at the same place it was, because the character moved. If the character moved up, the Tree would appear as if it moved DOWN. So you'd draw it like:
    g.drawImage(tree.getImage(),tree.x-scrollOffsetX,tree.y-scrollOffsetY,null);With that math, the Tree is actually drawn at (10,15), which is lower than before the character moved. You don't actually loop through all of your objects and change each and every X and Y value, you just change the global scroll offset
    Speaking of collision detection, this is where TileMaps have a large advantage. In a TileMap, you don't have to check through each and every object in the world for collision. You can just grab the 4 surrounding tiles (north,west,east,south) from the Tile array. This means there are only 4 collision detections no matter where the character is in any situation on the map.
    If you used an image for background instead of tiles, you'd have to check each object in the world for collision because it's harder to tell how close it is to the character. One thing you could do is just grab all of the object currently visible on screen and check their collision, but, depending on where you are on the map, this could easily cause an inconsistent frame rate (you could be in a field of grass that has no collision or a forest of 50 trees each screen- LOTS of collision!).
    3. I dont got much to say about isometric :P
    4. an 8bit NES game, eh? That is the common misconception that you have to use images that are the same size of the tiles. Have you seen the game "The Legend of Zelda: Four Swords"? That's a tile-based game, but on several occasions you see trees that are 10 times bigger than the 20x20 tiles. They mixed it up, they used a TileMap for the basic ground, and put good looking large images on top. The large images (such as a large tree) uses 4 or 5 "base" tiles that are used for collision. That way the character will only collide with the bottom-half of the tree, giving the appearance of going "behind" the tree when the Y value is above the middle line of the tree. This is far away from looking like an 8bit NES game :)
    I hope that was more helpful than it was confusing, but I tend to babble, so.. anyway. Hope it helps :o

  • Returning an Object Array

    I am unable to figure out the way in which I can return an object
    array from a cpp file to java. Is there any obvious error which you can spot in
    my CPP file?
    When I try to return a single object in the native function,
    it works fine but when I try to extend it and return an array of the object, it
    throws an error.
    Please find below the details
    h1. Java Class
    public class Flight {
    public String ID;
    public class InterfaceClass {
    private native Flight[] GetFlights();
    public static void main(String[] args)
    Flight[] objFlight = new
    InterfaceClass().GetFlights();
    System.+out+.println(objFlight[0].ID);
    static {
    System.+loadLibrary+("main");
    h1. CPP File
    JNIEXPORT jobjectArray JNICALL Java_InterfaceClass_GetFlights(JNIEnv env, jobject obj)
    //1. ACCESSING THE FLIGHT CLASS
    jclass cls_Flight = env->FindClass("LFlight;");
    //2. CONSTRUCTOR FOR FLIGHT CLASS
    jmethodID mid_Flight = env->GetMethodID(cls_Flight,"<init>", "()V");
    //3. CREATING AN OBJECT OF THE FLIGHT CLASS
    jobject objFlight = env->NewObject(cls_Flight, mid_Flight);
    //4. ACCESSING THE FLIGHT's "ID" FIELD
    jfieldID fid_ID = env->GetFieldID(cls_Flight, "ID","Ljava/lang/String;");
    //5. SETTING THE VALUE TO THE FLIGHT's "ID" FIELD
    env->SetObjectField(objFlight,fid_ID, env->NewStringUTF("ABC"));
    //6. ACCESSING THE FLIGHT ARRAY CLASS
    jclass cls_Flight_Array = env->FindClass("[LFlight;");
    if(cls_Flight_Array == NULL)
    printf("Error-1");
    //7. CREATING A NEW FLIGHT ARRAY OF SIZE 1 jobjectArray arrFlightArray = env->NewObjectArray(1,cls_Flight_Array,NULL);
    if(arrFlightArray == NULL)
    printf("Error-2");
    //8. INSERTING A FLIGHT BJECT TO THE ARRAY
    env->SetObjectArrayElement(arrFlightArray,0,objFlight);
    return arrFlightArray;
    h1. Error
    # A fatal error has been detected by the Java Runtime Environment:
    # EXCEPTION_ACCESS_VIOLATION
    (0xc0000005) at pc=0x6d9068d8, pid=1804, tid=3836
    # JRE version: 6.0_18-b07
    # Java VM: Java HotSpot(TM) Client VM (16.0-b13 mixed mode, sharing
    windows-x86
    # Problematic frame:
    # V [jvm.dll+0x1068d8]
    # An error report file with more information is saved as:
    # C:\Users\Amrish\Workspace\JNI Test\bin\hs_err_pid1804.log
    # If you would like to submit a bug report, please visit:
    http://java.sun.com/webapps/bugreport/crash.jsp
    C:\Users\Amrish\Workspace\JNI Test\bin>java -Djava.library.path=.
    InterfaceClass
    Exception in thread "main" java.lang.ArrayStoreException
    at
    InterfaceClass.GetFlights(Native Method)
    at
    InterfaceClass.main(InterfaceClass.java:6)
    C:\Users\Amrish\Workspace\JNI Test\bin>java -Djava.library.path=.
    InterfaceClass
    Exception in thread "main" java.lang.ArrayStoreException
    at
    InterfaceClass.GetFlights(Native Method)
    at
    InterfaceClass.main(InterfaceClass.java:6)
    Edited by: amrish_deep on Mar 18, 2010 7:40 PM
    Edited by: amrish_deep on Mar 18, 2010 7:40 PM

    //6. ACCESSING THE FLIGHT ARRAY CLASS
    jclass cls_Flight_Array = env->FindClass("[LFlight;");The argument to NewObjectArray is the +element+ class of the array you're about to create, not the +array+ class itself.

  • Whats the difference between records & arrays?

    hi,
    Im very new to JAVA... and one thing I dont seem to understand is the difference between a record and an array!
    Any help would be much appreciated..
    Thanx!

    an array is sort of like a group of records with one column. A two dimensional array is like an array of arrays and starts to look a little like a record (in that there are a number of "rows" each of which has a group of values. The concept is pretty far away from the idea of records like in a relational database though. For instance a java array can look like this:
    int[][] table =
    {   { 2, 2, 4, 3, 1, 2},
    { 1, 3, 3, 0, 0, 9},
    {12,9 ,1, -2, 5, 7},
    { 3, 5, 7, 2, 9, 1} };
    each row sort of being like a record. But a java array can also look like this, where the number of "columns" in each "row" is different
    int table[][] = { {1, 2, 3, 0, 3},
    {3, 8},
    {2, 1, 7, 9},
    {4, 6, 2, 8, 7, 0, 7, 8} };

  • Java Null Pointer Exception when assigning a value to an Object Array

    I am working on a webservice where the request can contain a dynamic array of SingleOwnerRequestNodeDetail objects. I need to read these objects in and sort them according to an orderNbr that is contained in the object.
    I am attempting to read these object into a Comparable class and sort them. I am having problems when I try to insert the objects into my object array ComparableBO[]. I get the following error: Exception during processing: java.lang.NullPointerException
    Any assistance would be greatly appreciated.
    Here's my class:
    public class ComparatorBO  implements Comparable {
         private SingleOwnerRequestNodeDetail nodeDetailInfo;
         private int orderNbr;
         public SingleOwnerRequestNodeDetail getNodeDetailInfo() {
              return nodeDetailInfo;
         public void setNodeDetailInfo(SingleOwnerRequestNodeDetail nodeDetailInfo) {
              this.nodeDetailInfo = nodeDetailInfo;
         public int getOrderNbr() {
              return Integer.parseInt(nodeDetailInfo.getSingleOwnerRequestOrderNbr());
         public void setOrderNbr (int orderNbr) {
              this.orderNbr = orderNbr;
         public int compareTo(Object anotherNodeDetailInfo)throws ClassCastException {
              if (!(anotherNodeDetailInfo instanceof ComparatorBO))
                   throw new ClassCastException ("An single owner request node detail object is expected");
              int anotherNodeDetailOrderNbr = ((ComparatorBO)anotherNodeDetailInfo).getOrderNbr();
              return this.orderNbr - anotherNodeDetailOrderNbr;
    }Here's the code where I read in the objects and attempt to place them in the comparableBO[]
    ComparatorBO[] comparatorBOArray = null;
    comparatorBOArray = new ComparatorBO[requestInfo.length];
              for (int i=0; i < requestInfo.length; i++)
                   SingleOwnerRequestNodeDetail nodes = new SingleOwnerRequestNodeDetail();
                   ComparatorBO comparatorBO = new ComparatorBO();
                   nodes.setSingleOwnerRequestNodeID(requestInfo.getSingleOwnerRequestNodeID());
                   nodes.setSingleOwnerRequestNodeType(requestInfo[i].getSingleOwnerRequestNodeType());
                   nodes.setSingleOwnerRequestOpCode(requestInfo[i].getSingleOwnerRequestOpCode());
                   nodes.setSingleOwnerRequestOrderNbr(requestInfo[i].getSingleOwnerRequestOrderNbr());
                   comparatorBO.setNodeDetailInfo(nodes);                         
                   *comparatorBOArray[i].setNodeDetailInfo(comparatorBO.getNodeDetailInfo());*
                   comparatorBOArray[i].setOrderNbr(Integer.parseInt(nodes.getSingleOwnerRequestOrderNbr()));

    imadeveloper wrote:
    I am working on a webservice where the request can contain a dynamic array of SingleOwnerRequestNodeDetail objects. I need to read these objects in and sort them according to an orderNbr that is contained in the object.
    I am attempting to read these object into a Comparable class and sort them. I am having problems when I try to insert the objects into my object array ComparableBO[]. I get the following error: Exception during processing: java.lang.NullPointerException
    Any assistance would be greatly appreciated.
    Here's my class:
    public class ComparatorBO  implements Comparable {
         private SingleOwnerRequestNodeDetail nodeDetailInfo;
         private int orderNbr;
         public SingleOwnerRequestNodeDetail getNodeDetailInfo() {
              return nodeDetailInfo;
         public void setNodeDetailInfo(SingleOwnerRequestNodeDetail nodeDetailInfo) {
              this.nodeDetailInfo = nodeDetailInfo;
         public int getOrderNbr() {
              return Integer.parseInt(nodeDetailInfo.getSingleOwnerRequestOrderNbr());
         public void setOrderNbr (int orderNbr) {
              this.orderNbr = orderNbr;
         public int compareTo(Object anotherNodeDetailInfo)throws ClassCastException {
              if (!(anotherNodeDetailInfo instanceof ComparatorBO))
                   throw new ClassCastException ("An single owner request node detail object is expected");
              int anotherNodeDetailOrderNbr = ((ComparatorBO)anotherNodeDetailInfo).getOrderNbr();
              return this.orderNbr - anotherNodeDetailOrderNbr;
    }Here's the code where I read in the objects and attempt to place them in the comparableBO[]
    ComparatorBO[] comparatorBOArray = null;
    comparatorBOArray = new ComparatorBO[requestInfo.length];
              for (int i=0; i < requestInfo.length; i++)
                   SingleOwnerRequestNodeDetail nodes = new SingleOwnerRequestNodeDetail();
                   ComparatorBO comparatorBO = new ComparatorBO();
                   nodes.setSingleOwnerRequestNodeID(requestInfo.getSingleOwnerRequestNodeID());
                   nodes.setSingleOwnerRequestNodeType(requestInfo[i].getSingleOwnerRequestNodeType());
                   nodes.setSingleOwnerRequestOpCode(requestInfo[i].getSingleOwnerRequestOpCode());
                   nodes.setSingleOwnerRequestOrderNbr(requestInfo[i].getSingleOwnerRequestOrderNbr());
                   comparatorBO.setNodeDetailInfo(nodes);                         
                   *comparatorBOArray[i].setNodeDetailInfo(comparatorBO.getNodeDetailInfo());*
                   comparatorBOArray[i].setOrderNbr(Integer.parseInt(nodes.getSingleOwnerRequestOrderNbr()));
    Well normally when someone wont tell me what line the error occured in I copy paste their code into my compiler and find out. But you have other classes which you have not shown us so I cannot help you.
    Incase you missed my point, please tell us where the error occured!

  • Calling a method that returns an object Array

    Hello.
    During a JNICALL , I wish to call a method which returns an object array.
    ie my java class has a method of the form
    public MyObject[] getSomeObjects(String aString){
    MyObject[] theObjects=new MyObject[10];
    return theObjects
    Is there an equivalent to (env)->CallObjectMethod(...
    which returns a jobjectArray instead of a jobject, and if not could somebody suggest a way around this.
    Thanks,
    Neil

    I believe an array oj jobjects is also a jobject. You can then cast it to another class.

  • What is the concept of multiple projects

    Hi All,
    We have multiple development projects and support as well. Now my problem is say in Project1 we are working on OBJECT1, simultaneously the support team is also working on the same object (which is unknown to us). Now while transporting OBJECT1 as part of Project1 it has a dependent objects of support team, thus resulting in transportation errors and object conflicts. From SAP help I read about the concept of using multiple project assignment in transportation. Can anyone clearly explain what is multiple project concept in terms of transportation.
    One most important thing I would like to know is how, whilst transportation how SAP is identifying the missing object. For example I am trying to transport a request number, but while transporting it has given an error something like object 'XXXX' is missing. Now my question is how SAP is identifying that object 'XXXX' is missing?
    I would really appreciate any useful information.
    Thanks,
    Venkat
    Edited by: putcha venkatesh on Feb 4, 2009 12:14 PM

    Multiple projects in terms of transportation should make it possible to have a better overview of your transports. This way, a transport request can be assigned to a certain project, making it easier for logging purposes.
    During import of the transport request, a check is done on the database (for example if a data element is available) to find out if a certain object is available or not. If not, an error is generated.
    So it would be wise, before releasing the transport, to check if all objects you are using are part of another transport as well and if these transports have already been imported before your transport. Check all possible dependencies. It would be better though, to check this before making use of objects which you haven't created yourself in your development objects.

  • Question about the concept of RMI reverse calls.

    Hello guys.
    I'd appreciate if someone could clarify something to me. As far as I understand , RMI reverse call in concept, is the mean thought witch a server can remotely call a method belonging to the client.
    I've done that like this: the client called a method from to the server(classic rmi) , method that had the particularity to received as a parameter an instance of a serialized .class belonging to client. Through that received remote object it seems the server can call specific methods belonging to the client .class.
    I'm not sure it's the correct way to do reverse calls, but what puzzles me is that shouldn't the server be able to call a client method without first needing to receive that instance of the client's .class and implicitly being dependent on that client initial call (maybe to get that .class in a different way)?

    I'm not sure it's the correct way to do reverse callsIt's not. If the object passed to the server is serializable, the server can call methods on it, but they will execute at the server.
    The object you pass to the server must be an exported remote object. Then the server callbacks will execute at the client.
    but what puzzles me is that shouldn't the server be able to call a client method without first needing to receive that instance of the client's .classNo, why?
    and implicitly being dependent on that client initial call (maybe to get that .class in a different way)?When you get the exported remote object part right, the remote method via which the client passes the callback to the server will declare the callback as a remote interface, not as the implementing class at the client.

  • Object Array problem in Websphere WebServices

    Hi,
    Can someone help me out with a situation that I am stuck with in WebServices.
    I have a WebService which returns a DTO which has a getter and setter for an array of another type of DTO object.
    Sample:-
    public class MyDTO extends AnotherDTO implements Serializable {
    private InnerDTO qcDtoList[] = new InnerDTO[0];
    public MyDTO() {
    public InnerDTO[] getQcDtoList() {
    return qcDtoList;
    public void setQcDtoList(InnerDTO[] resEDXDTOs) {
    qcDtoList = resEDXDTOs;
    But when I generate the WSDL for the webservice using WSAD 5.1 that uses the above DTO, the server side generated skeleton file looks like:-
    public class MyDTO extends AnotherDTO implements java.io.Serializable {
    private InnerDTO[] qcDtoList;
    public MyDTO() {
    public InnerDTO[] getQcDtoList() {
    return qcDtoList;
    public void setQcDtoList(InnerDTO[] qcDtoList) {
    this.qcDtoList = qcDtoList;
    As you can see from above, my initialization info is not available in the generated skeleton. I also tried putting the initialization in the constructor, with no effect.
    What could be the reason for this? And is it possible to initialize my InnerDTO without losing it in the generated skeleton?
    I simply want to initialize the object array.
    If I need to modify my WSDL, what additional annotations should I add on the WSDL to get the desired effect?
    I use WSAD's (Websphere Studio App Developer) IBM Websphere Webservices protocol and the JDK version is 1.3.1 and WSAD version is 5.1.
    I would really appreciate if you can throw light on this?
    Thanx and Regds,
    Prashanth.

    Thank you for the quick response. I looked at the example you suggested and made the following changes. Now I'm receiving an "Invalid datatype" error on the "SELECT column_value FROM TABLE(CAST(tbl_cat AS tbl_integer))" statement. I must be missing something simple and I just can't put my finger on it.
    PROCEDURE SEL_SEARCH_RESULTS (v_term IN VARCHAR2,
    v_categories IN ARCHIVE.integer_aat,
    rs OUT RSType)
    AS
    /* PURPOSE: Return Search Results for the Category and Keyword Provided
    VARIABLES:
    v_categories = Document Categories array entered
    v_term = Keyword entered
    rs = Result Set
    TYPE tbl_integer IS TABLE OF INTEGER;
    tbl_cat tbl_integer;
    BEGIN
    FOR i IN 1 .. v_categories.COUNT
    LOOP
    tbl_cat.EXTEND(1);
    tbl_cat(i) := v_categories(i);
    END LOOP;
    OPEN rs FOR
    SELECT A.ID,
    B.CATEGORY,
    A.FILENAME,
    A.DISPLAY_NAME,
    A.COMMENTS
    FROM TBL_ARCHIVE_DOCUMENTS A,
    TBL_ARCHIVE_DOC_CAT B,
    TBL_ARCHIVE_DOC_KEYWORDS C
    WHERE A.ID = B.ID
    AND A.ID = C.ID
    AND B.CATEGORY IN (SELECT column_value FROM TABLE(CAST(tbl_cat AS tbl_integer)))
    AND C.KEYWORD = v_term
    ORDER BY A.ID;
    END SEL_SEARCH_RESULTS;

  • How can i change the label of an array controller in the xib file

    I have seven instances of NSArrayController in my main xib file; they are all labled 'Array Controller' and I cannot change the label in the list of objects.  I can change the label in the identity inspector, but the label still remains 'Array Controller' in the list of objects.  If I double-click on the label that is in the list and change the label its value changes in the identity inspector when I tab out of the label field but the label reverts to 'Array Controller' in the list of objects.  I'll never be able to keep the seven controllers straight in my head.  Is there a solution?

    The problem is was in Xcode, while editing the xib file.  After many back and forth jumps (between Xcode and this composer for the discussion) and many attempts to relabel the array controllers over two hours, the changes have appeared just as I want.  I hate it when that happens (who likes egg on their face?)
    I'm sorry for wasting your time.  Thanks for your input.

  • Trouble writing to object array

    Hi I did a semester of java 2 years ago and I'm trying to remember what I knew so please bear with me...
    I am extracting data from an xml file and then writing that information to an object array called files containing 4 string and 1 array. This files array is in turn an element in another object array containing 400 files arrays called records.
    It appeared to be working but when I want it to print out which ever record I have selected it only prints out the last record! It seems to be overwriting each files array with the next?
    Another problem I can only print out an element of the array not the entire thing?
    Please help have spent weeks on this
    Here is the code:
    Object[] Records = new Object[400];
    Object files[] = new Object[5];
    NodeList records = doc.getElementsByTagName("record");
    for( int i = 0; i < records.getLength();i++)
    Element record = (Element) records.item(i);
    NodeList headers = record.getElementsByTagName("header");
    Element header = (Element) headers.item(0);
    NodeList ids = header.getElementsByTagName("identifier");
    for(int j = 0; j < ids.getLength(); j++){
    Element id = (Element) ids.item(j);
    String ID = getText(id);
    files[0] = ID;
    NodeList metadatas = record.getElementsByTagName("metadata");
    Element metadata = (Element) metadatas.item(0);
    NodeList citeseers = metadata.getElementsByTagName("oai_citeseer:oai_citeseer");
    Element citeseer = (Element) citeseers.item(0);
    NodeList titles = citeseer.getElementsByTagName("dc:title");
    for(int k = 0; k < titles.getLength(); k++){
    Element title = (Element) titles.item(k);
    String TITLE = getText(title);
    files[1] = TITLE;
    NodeList subjects = citeseer.getElementsByTagName("dc:subject");
    for(int m = 0; m < subjects.getLength(); m++){
    Element subject = (Element) subjects.item(m);
    String SUBJECT = getText(subject);
    files[2] = SUBJECT;
    NodeList descriptions = citeseer.getElementsByTagName("dc:description");
    for(int n = 0; n < descriptions.getLength(); n++){
    Element description = (Element) descriptions.item(n);
    String DESCRIPTION = getText(description);
    files[3] = DESCRIPTION;
    String[] Names = new String[20];
    NodeList authors = citeseer.getElementsByTagName("oai_citeseer:author");
    for(int l = 0; l < authors.getLength(); l++){
    Element author = (Element) authors.item(l);
    Names[l] = author.getAttribute("name");
    files[4] = Names;
    System.out.println("The id is "+files[0]);
    System.out.println("The title is "+ files[1]);
    System.out.println("The Subject is "+ files[2]);
    System.out.println("The Description is "+ files[3]);
    for(int q=0; q < authors.getLength(); q++){
    System.out.println("The Names are "+ ((String[])files[4])[q]);
    //Records[i] = files;
    System.out.println(((Object[])Records[0])[0]);

    I'm afraid I'm not going to make you a millionaire but I feel so relieved at the moment that if I had a million I'd give it to you!!Yeah, I know you won't make me a millionaire, but I can dream... :)
    thanks for all your helpYou are welcome. Do you understand why you needed to move the creation of the "files" array.

Maybe you are looking for

  • Bootcamp and WIndows 7 Pro 64 bit

    Hello, I've restored my system and got Boot Camp to make a partition the size of 150 GB. I try to install Windows 7 Pro 64 bit and I get the message that the BOOTCAMP partition cannot be installed because it's not an NTFS file system. Is there a way

  • Wont play songs on ITunes

    I cant play songs on Itunes because it says File cant be found and a lot of the songs like this have a ! next to them. Can anyone help?

  • Get text content from Linked TextFrames in order

    Hi, How can I get the text content out one by one in order for a linked textframes? Thanks. Henry

  • Pictures - why are some pictures visible and some not?

    Why is it that some of the pics I transfered from my digital camera to my Macbook, iPad, from windows-system or from external drives and vs. are not visible on my Macbook. In this case my Macbook opens iPhoto and a while later indicates, that I will

  • Oracle 9.2.0.6; query hangs if partition doesn't exist

    Hallo all, this is the first time I post on this forum. I work in a group of PL\SQL developers in Italy. Few day ago we had a problem with a query and like to find out what the problem is. We have an Oracle DB version 9.2.0.6 (old I know) in a produc