Need to add shape to array

I am currently making a game using a 2D array, the game only has little blocks moving around on the screen and my idea was to make a 2D array from these blocks! BUT the api really confuses me with making shapes and looking at the rectangle sections I thought this was the best option but no when I try to make a 2D array from it nothing works (the array works fine, ive tried it with JLabels) what is the best way to make a square shape? this code looks way too basic and I can't figure out what else I need to do
public Shape(int x, int y, int width, int height)
    x = 1;
    y = 1;
    width = 1;
    height = 1; // 1 is used as an example!
}

From examples of 2D arrays that ive seen people make them out of JLabels mostly and I thought about making a class that makes a square(rectangle) and make the array out of the rectangle. But that method I found on the api doesn't seem to work when it comes to making an array.
Is that a good way to do it? or should I just stick to JLabels? as I can get those to work(apart form setting their size, I need to look into that).
I also need to make one of the squares/lables (call it what you will) a certain colour and so when the user presses a button(keylistener) the "player" moves up or down. And I need to have other squares move across the screen (right to left) in another color.

Similar Messages

  • Add element to array of cluster

    I have an array of cluster. Cluster contains two elements. How to add an element in cluster at run time on the second position efficiently? In other words dont want another copy of cluster which contains three elements and copy the original two elements plus the new element. 
    Original array of cluster lets say has two element Temp1 and Pressure 1.
    Need to add another element in cluster and now the array of cluster will be Temp1, Volt1 and Pressure 1. So Volt 1 is added to all cluster elements at second order throughout the array of clusters programatically. 
    CLD,CTD
    Attachments:
    TestAddElementToCluster.vi ‏10 KB

    It is unclear from your original post what the problem you need to solve actually is.  Are you trying to create a user interface?  Do you need to dynamically add arbitrary data to a data set, or is it a fixed set of functionality that can be dynamically changed in predetermined ways?
    Having done it, I will recommend you not try the scripting and subpanels approach.  There are almost always better ways.
    Remember that your data structures do not need to mirror your user interface.  If you were trying to display the temperature, voltage, and pressure data to the user, a multicolumn listbox may be more appropriate than a raw cluster in an array.  Internally, this would allow you to maintain the temperature, voltage, and pressure as separate arrays and only display the ones you want in the listbox.
    Please give us a more information on the problem so we can help you with an easier solution.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Do I need to add Base Station MAC address to list?

    Hi, If I choose to use MAC address filtering on my Airport Extreme Time Capsule, do I need to add the wireless MAC address of the Base Station to the list of allowed MAC addresses???  I'd feel real bad if I set up a list, didn't include the base station's MAC address and then could never get in to the network again because I, in effect, locked myself out???  I doubt that address needs to be included but I would like some feedback on that.
    Second, does the one MAC address filter list apply to the Guest Network as well if I should choose to turn it on???  If that was the case, I would just turn off MAC address filtering why guests were present.
    thanks..  bob

    If I choose to use MAC address filtering on my Airport Extreme Time Capsule, do I need to add the wireless MAC address of the Base Station to the list of allowed MAC addresses???
    No. Timed Access would be for wireless devices....computers, mobile devices, printer, etc., that are connecting to the Time Capsule. The Time Capsule does not connect to itself in this regard.
    I'd feel real bad if I set up a list, didn't include the base station's MAC address and then could never get in to the network again because I, in effect, locked myself out???
    Sometimes, users lock themselves out by mistake by entering incorrect times for devices to connect, and they often forget that they can connect to the base station using an Ethernet connection and get back in that way.....since Timed Access only applies to devices that connect using wireless.
    does the one MAC address filter list apply to the Guest Network as well if I should choose to turn it on???
    Yes

  • VA01 Sales order - Header-- Accounting tab need to add a field

    Dear All,
    The requirement is,
    1. I need to add a field in Sales order.
    Path for the same is as follows:
    VA01> Goto> Header--> Accounting tab
    2. The field will be a date field that needs to calculate date on.
    a)create a new field. ex - zchdt (chq due date)
    b)when customers enters value in Assignment,
    i.e vbak-zuonr
    after that trigger logic is
    3.vabk-kunnr = knvv-kunnr
    a)sy-date + knvv-kvgr2 (exclude sundays)
    example - 14 sept + 30 days = 14th october
    should populate value - 14th october i.e. field (zchdt)
    4. This activity needs to be triggered before the sales order is saved.
    kindly know whether this is possible or not.
    if possible how & which exit & also with example code.
    if you could give me your contact(cell no).
    Regards,
    Nagendra D.S.
    Mobile - +91 9819899082

    Hi All,
    VA01 Sales order - Header--> Accounting tab need to add a field. field name - zchdt(cheque due date)
    when customer enters value in Assignment i.e zuonr & after that trigger logic is
       1.     vbak-kunnr = knvv-kunnr
       2.     sysdat + knvv-kvgr2 (exclude sundays)
    example - 16 sept + 30days = 16 oct
    in field zchdt value 16 oct as to populate
    Pls help me in the code.
    Regards
    Nagendra

  • Need to add number of days to users end date.

    Hi,
    I have a code where we are adding number of days(30) to current date and then updating user's end date in IDM DB.
    Now we have a requirement where we need to add number of days(30) to existing end date of user instead of adding to current date.
    *public String incrementDate(int daysToAdd)
         // Start date
         log.info("NotifyLastDayOfService::incrementDate(): Enter");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
         Calendar c = Calendar.getInstance();
         c.add(Calendar.DATE, daysToAdd); // number of days to add
         String newDate = sdf.format(c.getTime());
         log.info("NotifyLastDayOfService::incrementDate(): Exit");
         return newDate;
    Have any body implemented this scenario?
    Please suggest.
    Thanks,
    Kalpana.

    Hi Nayan,
    Here is the code:
    System.out.println("----inside increment date method-----");     
              HashMap<String, String> hm = new HashMap<String, String>();
              HashMap<String,Date> modifyMap=new HashMap<String,Date>();
              SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
              tcResultSet usrList = null;
         String enddate = null;
         hm.put("Users.Key",usrKey );
         try {
         usrList = this.usrIntf.findUsers(hm);
         usrList.goToRow(0);
         Date endDate =usrList.getDate("Users.End Date");
         System.out.println("-----users end date-----"+endDate);
         String userEndDate=sdf.format(endDate);
         System.out.println("-----String value of users end date-----"+userEndDate);
         Calendar cal=null;
         System.out.println("-----Calender date-----"+cal);
         cal.setTime(endDate);
         System.out.println("-----end date-----"+endDate);
    cal.add(Calendar.DATE, Integer.parseInt(daysToAdd)); // number of days to add
    Date newEnddate = cal.getTime();
    System.out.println("-----new end date-----"+newEnddate);
    //usrList.setEndDate(Edate);
    modifyMap.put(userEndDate,newEnddate);
    usrIntf.updateUser(usrList, modifyMap);
    System.out.println("updated user's end date in OIM DB");
    //System.out.println("-----updated user's end date in OIM DB-----");
    logger.info("NotifyLastDayOfService::incrementDate(): Exit");
         System.out.println("-----new date-----");
         } catch (tcAPIException e) {
         logger.error("Error in finding end date for user" + e);
         } catch (tcColumnNotFoundException e) {
         logger.error("Error in finding end date for user" + e);
    In th log file, I can see that the code is not executing this line:
    cal.setTime(endDate);
    end date is of type Date and stores users end date from DB. Please help in resolving this issue.
    Thakns,
    Kalpana.

  • Mail from RVADOR01 need to add body of the mail

    Hi Experts,
    How to add mail body for the below case?please look
    I am using output tupe Zmail attached to Program ZRVADOR01 and script form ZRVORDER01.
    The Program ZRVADOR01 and the script ZRVORDER01are copied from standard prog RVADOR01  and standard script RVORDER01.
    And this output type is attached to VA02.
    In the Zprogram i could able to give mail subject in OPEN_FORM function module in OPTIONS parameter.
    And i am sending to the exterid which is outlook.
    For giving the email id i have added some code from the note .357137 before calling the OPEN_FORM function module in the program..
    mail is coming with subject line and attachment of script document .
    But the only thing needed is , add body text for the mail.
    How can i do this?
    Regards
    Ramakrishna

    Hi Rama, I am trying to do the same and noticed that your comments/question appears as "ANSWERED" at the top of the thread.
    Were you able to accomplish this?
    Jacob

  • I need to add a program to my laptop, but I have forgotten my password.  How can I reset it?

    need to add a program to my laptop, but I have forgotten my password.  How can I reset it?

    Solution may be found if you search in the "More Like This" section over in the right column.

  • I need to add check whether 21 fields of a internal table are empty or not.

    Hello,
    I need to add check whether 21 fields of a internal table are empty or not.How can we write a code for the same wand what would be the correct syntax for it.
    I tried entering all the fields in the IF loop with AND condition but its giving syntax error.Perhaps this is because the lenght of the IF condition would be more than the allowed one.

    Hi,
    After the select quiery.
    If not itab is initial.
    Message 'Table is not empty'    type 'I'.
    Endif.
    Regards,
    Jagadish.

  • Need to add special characters in sap scripts

    Hi All,
       I need to add special characters in sap script.
    I have used them as it is my script,but in the print preview i am able to see '#' instead of those special characters.Can anybody please tell me the way in which we can add special characters in the scripts.
    eg. 'Shlesha' i.e. name in inverted colons.
    Thanks

    Hi
    If # is coming means, that is the problem with the printer. I think u might have used your local printer to see the print preview.
    Don't use LOCL or LP01. Our local printer won't recognize those characters.
    Just change the printer name to client printer name. It will work.

  • I want to attach more then 1 photo at a time like i can in IE do i need an add on?

    I want to add more the one photo at a time in hotmail. I can do it in IE but wanted to know if i needed an add on to do it in forefox or change settings? if i do need an add on which one would be best?
    Kind regards

    Wich version of iPhoto do you have? You need iPhoto '09 or '11 to order prints.
    Make an album of all photos you want to order in the same order.
    Then select all photos at once, when you use Share > order prints.
    You should see a panel like this, where you can mark the quantities. The screenshot is from iPhoto 9.6:

  • How to find end of the Page in Crystal ? or I need to add one Horizontal line at the end of the page.--- URGENT HELP NEEDED

    Hi friends,
    I need to add one horizontal line  for the detail section at the end of the page.
    I tried to put that line in page footer and i tried with Box also. Both are not properly working. Some space problem is coming.
    Is there any feature to find end of the Page.
    I want report format like this.
    set id  |  set name |  date  Name
      1         x           dddd   vijay
                            dddd   sarathi
                            dddd    reddy
    (End of the page)
    Thanks in advance...
    vijay.

    Do you know how many detail records are showing up per page?
    If you do - you could create a Details B section that is suppressed except for on Record N (where N is a counter, and N is the last Detail record that will show up on a page).
    The Page footer is indeed built so that it will be rendered at the bottom of your physical page of paper.

  • Need to add a new row at the end of the table

    Experts,
    working jdev 11.1.1.3.0
    i am adding row programetically, my requirement need to add the row at after last row.
    i tried different ways.
    Row newLastRow = getPWBBidLaneVO().last();
    int lastRowIndex = getPWBBidLaneVO().getRangeIndexOf(newLastRow);
    getPWBBidLaneVO().insertRowAtRangeIndex(lastRowIndex - 1,
    laneRow);
    this is giving --- java.lang.ArrayIndexOutOfBoundsException: 0
    and
    http://kohlivikram.blogspot.com/2008/10/add-new-row-in-adf-table-on-button.html --- its giving index out of bound because vo.getRangeSize() is 25. We set this value at vo for performance improment suggestions.
    is there a way to add a new row at the end of the table?

    Add this to the view row impl class
           public void insertRow(Row row) {
               //go to the end of Rowset if it has rows
               Row lastRow = this.last();
               if (lastRow !=null){
                    //insert new row at the end and make it current
                   int indx = this.getRangeIndexOf(lastRow)+1;
                   this.insertRowAtRangeIndex(indx,row);
                   this.setCurrentRow(row);
               }else { // empty Rowset
               super.insertRow(row);
               }

  • The Web application at could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application

    Hi,
    I have created on windows service to fetch sharepoint list ad update the list items.
    when i run this service in sharepoint server(where the sharepoint site is hosted),it is working fine. If i run the same service in another machine(sharepoint installed in this machine also). it is giving the below error
    The Web application at [URL] could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
    Code snippet
    SPSite sharepointSite = null;
                SPWeb rootWeb = null;
                try
                    //SPList current = null, previous = null;
                    string colmId = ConfigurationManager.AppSettings[ID_COLM];
                    List<TaskEntity> list = new List<TaskEntity>();
                    sharepointSite = new SPSite(URL);
                    rootWeb = sharepointSite.OpenWeb();
                    SPList current = rootWeb.Lists[ConfigurationManager.AppSettings[OMEGA_REGISTRATION_LIST]];
                    WriteEventLog("current" + current.Items.Count.ToString());
                catch (Exception ex)
                    ExceptionMethod(ex);
                finally
                    sharepointSite = null;
                    rootWeb = null;
    I have pointed .net framework to 3.5 version and target palform as Any CPU. Please suggest me

    Hi mallela1,
    I also had similar issue couple of months back when I was trying to access a remote URL from a Windows service when the site does not exists in the server where service resides.
    You cannot access a remote url (even though it is SharePoint server and also in same network ) from server object model.
    SPSite can look in the current server only. here what is happening is SPSite will look for this in the current server DB and it is not finding this errror.
    So please dont use ServerObject model for accessing remote sites. You can use Client Object model for the code /requirement you have stated above.
    I wasted lot of time in finding a work around to make to work. It did not. So look for other options.
    Regards,
    Nandini

  • What are the roles need to add for webservice user in SAP ECC 6.0

    Dear SDNS,
    Can you please help me to understand , what are the roles needed to add while creating a webservice user in ABAP STACK.
    Really appreciate your immediate help and response.
    Thanks and Regards.
    Suraj

    Hi Suraj,
    Please refer to this link & apply the role/s as per the requirements for the web service user:
    [http://help.sap.com/saphelp_nwpi71/helpdata/en/2b/07074155bcf26fe10000000a1550b0/content.htm]
    Best Regards, Trevor

  • Need to add two activities in Purchase order workflow template

    Hello,
    I got a requirement for purchase order at workflow template level need to add two activities like below
    a) p.o changed
    b) p.o cancelled.
    once p.o changed based on agent determination agent will receive the mail in his inbox same functionality for p.o cancelled. 
    also at work item level need to add attributes .
    but currently standard workflow for PO release it WS200000075  have only release activity   .
    how to add activity types to be available workflow template also please let me how to do binding for above activities once created?

    Hi vinoth,
    yes this p.o workflow based on release strategy. i was copied the standard workflow template added activities
    one is for changed and another is rejection.
    once functional guy rejected the purchase order rejection  activity  not working properly
    also same problem faced for changed step also while change the p.o value at item level.
    i am using business object BUS2012 adding attributes for work item.
    please guide me how to achieve above functionality also how to do binding for changing and rejection activities?

Maybe you are looking for