Change Highscore list from ASC to DSC. Urgent

Hi guys. I need help with changing the sort type of this code.
I write the output in an jTextArea Field with Descending order. it looks like
Viktor = 40
Thomas=65
Emil=30
Alfred=120
so you see that the names are sorted. i want the points (score) to be sorted.
The data is saved into an properties file which looks so
#Highscore-Properties
#Mon Jan 22 22:12:48 CET 2007
Viktor=80
Dora=90
Hans=200
Bertie=1000
Sepp=400
public HighScore()
        throws Exception
            myScore.load(new FileInputStream(System.getProperty("user.dir") + File.separator + "score.properties"));
    /* returns Sortedmap mit key = Playername & Value-Score */
    public SortedMap getScoreList()
        SortedMap score = new TreeMap();
        Enumeration keys = myScore.keys();
        if (keys != null)
            while (keys.hasMoreElements())
                String tname = keys.nextElement().toString();
                score.put(tname, myScore.getProperty(tname));
// HOW TO CHANGE THIS PIECE OF CODE?
            return score;
        return null;
    /* If player is in properties list and score is higher than the new
     * then it writes the higher score in the file.
     *@param nickname = player
     *@param score = Highscore
    public void setnewScore(String nickname, int score)
    throws Exception
        if (myScore.getProperty(nickname) != null && Integer.parseInt(myScore.getProperty(nickname).toString()) < score)
            myScore.setProperty(nickname,""+score);
            myScore.store(new FileOutputStream(System.getProperty("user.dir") + File.separator + "score.properties"),"Highscore-Properties");
        else if (myScore.getProperty(nickname) == null)
            myScore.setProperty(nickname, ""+score);
            myScore.store(new FileOutputStream(System.getProperty("user.dir") + File.separator + "score.properties"),"Highscore-Properties");
I wrote the main method in my other visual class when the window is activated
instead of the system.out.println i wrote
jTextArea2.setText("Spieler: " + player + " Score: " + sm.get(player)+"\n"+jTextArea2.getText());
writes all players who are in the score list (alphabetical ordered)
     *@param args
    public static void main(String[] args)
        try {
            HighScore hs = new HighScore();
            SortedMap sm = hs.getScoreList();
            Iterator ene = sm.keySet().iterator();           
            while (ene.hasNext())
                Object player = ene.next();
                   System.out.println("Player: " + player +" Score: " +sm.get(player));
        } catch (Exception e)
            e.printStackTrace();
}       I am sorry for my bad english.
It would be very nice if someone could tell me what to change in my code.
ty
Message was edited by:
Shadowli

yes... the set and get scorelist is not from me.
the tipp is good, but i can not code it because i am extreme java newbie.
so it would be very nice if i get the pieces of code i need because i need the highscore list till tomorrow.
in the meantime i tried other way round. set from nickname=score to score=nickname but because of the enumeration it sorts like
50 hans
30 thomas
20 emil
205 name
19 name
1394 emil
0 name
so please help me.

Similar Messages

  • When i go to artist/albums how do i change the list from new2old to a-z

    hi i have a 64gb iphone 5 running ios 7.0.3 an sins i updated to ios7 the music app has all change.
    when i go on to artist like ac/dc it give me the list of albums in date order jailbreak so on an so on to live at river plate.
    HOW do i change it so it goes A-Z NOT OLD-NEW even if it NEW-OLD i dont care
    if anyone know how to change it plz plz tell me coz i hate it
    and i hate the fact that is shows the album cover on the list it take for ever to get to the new albums
    thanks shaun

    - Apps are locked to the account that purchased them.
    - To update apps you have to sign into the account that purchased the apps. If you have apps that need updating purchased from more than one account (which may be your case) you have to update them one at a time until the remaining apps were purchased from one account.

  • While Changing ABAP List from Spool to PDF Whole List is not displaying

    Hi,
    There is Z Program to convert Payslip ABAP List to PDF, when it is generating in PDF from Spool, I cannot view whole Payslip.
    Previously it is dislpaying fully in PDF file, But not Now.
    Please Help me...............
    With Regards,
    Gaurav.

    Hi,
    Thank you very much. My problem has been solved
    Thanks & Regards,
    Gaurav Mittal

  • Change a drop down list from read only/invisable on a radiobutton value

    Hi All i am new to all this and need a few pointers?
    I have a form which was made using Livecycle Designer 8.
    On this form are a set of radio buttons (yes/no/NA).
    Is there a way to change the state of a drop down list from read only or invisible and display a message after 'no' has been selected on a set of radio buttons?
    Thanks in advance.

    No being in a table shoudl not affect it.....but you will more than likely have to include the path to the object. Without seeing your form it is impossible to tell you what it should be. You can place your cursor in the script editor where you want the reference to the DDList. Then hold down the Ctrl key and move your mouse to point to the field you want to reference. When the cursor hits the canvas it will change to a V. When you get to the field you want click the mouse button and the expression that you need will be placed in the script editor. This is path relative to where the context in which the script will be run. Now you can simply add the "." and whatever method/property that you want to reference.
    Hope that helps
    Paul

  • How do I copy a list from one site to another that has a column that appends changes to existing text?

    I want to move a list from one SharePoint site to another, within the same collection. I have created a template and included the content but the column that is selected to append changes to existing text, has not copied in all cases, although it has for
    some items.
    I have a limited knowledge so won't be able to implement any solutions that require the use of code.

    Hi,
    According to your post, my understanding is that you wanted to copy a list from one site to another that has a column that appends changes to existing text.
    I recommend to use the custom workflow activity  Copy List Item Extended Activityto
    copy list items and files cross site.
    You can do this with codeless SharePoint Designer workflows as long as you can install the
    Codeplex Custom SharePoint Designer Workflow Activities. 
    These activities are also built-in to SPD2010.
    To install the custom activities, please follow the steps as below:
    Download the solution file form
    Useful Sharepoint Designer Custom Workflow Activities
    Copy the wps file to the Disk C.
    Open the SharePoint 2010 Management Shell.
    Run the command: add spsolution c:\ dp.sharepoint.workflow.wsp
    Open the Center Administration, click System Setting->Manage Farm Solution-> dp.sharepoint.workflow.wsp->Deploy to one or more Web Application.
    Open the SharePoint designer, add action from Custom Actions.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Our picture transfer from iphone, ipads and or Sony DSC-W150 camera ended when we changed int providers from xfinity to frontier. All attempts to troubleshoot have not corrected problem, HELP!!

    Our picture transfer from iphone, ipads and or Sony DSC-W150 camera ended when we changed int providers from xfinity to frontier. All attempts to troubleshoot have not corrected problem. The only changes to the system that was functioning properly are Fios int service and router. All apple components are using the fios router. Can anyone Help get us up and running again? Thanks

    How have you been making the physical connection from:
    iPhone
    iPads
    Sony DSC-W150 camera
    ...to your Mac?
    If WiFi, have you changed the WiFi encryption method or WiFi password? If so, each device need the new information netered into it manually to get onto your "new" WiFi Network.

  • URGENT,FRM-41337: Cannot populat the list from record group

    Hi all:
    Can anyone help me in that problem?
    I have a database item in the block as a list item with combo box style and I use this code in WHEN-NEW-RECORD-INSTANCE at the form module level to populate that combo box list:
    DECLARE
         group_id RECORDGROUP := FIND_GROUP('group');
         list_id ITEM := FIND_ITEM('employees.job_id');
         x number;
    BEGIN
    IF NOT ID_NULL (group_id) THEN
              DELETE_GROUP (group_id);
         END IF;
              group_id := CREATE_GROUP_FROM_QUERY ('group','select name,TO_CHAR(id) job from cmn_jobs where job_type_id = 4720 ');
         x := POPULATE_GROUP (group_id);
         POPULATE_LIST (list_id, group_id);
         EXCEPTION
    WHEN NO_DATA_FOUND THEN
    null;
         END;
    That code worked very well and without any problem, but when I change the list item from combo box style to poplist style then the forms give that error:
    FRM-41337: Cannot populat the list from record group
    And an additional null/blanke element appears in the poplist with original element that come from RECORDGROUP.
    So can anyone help me to solve that problem please?

    First, how I can assign a default or initial value DYNAMICALLY to my poplist.Set the default-value to a parameter like :PARAMETER.MYPARAMETER then you can assign the desired default-value to the parameter.
    second, if I have popliste say X for example depend on another poplist say Y ,so when I put the code to populate popliste X on WHEN-LIST-CHANGED on popliste Y and make query then the >forms return FRM-40301 Query caused no records to be retrieved ,but when I have a copy for that code in WHEN-LIST-CHANGED and put it in WHEN-NEW-FORM-INSTANCE at the form >module the form work and returns records, so is it any error or exception in what I did.Can't answer that, you should check :SYSTEM.LAST_QUERY to see why the query does not returnany records.
    At the last, which better to put the code for popliste in PRE-FORM trigger at the form module or in WHEN-NEW-FORM-INSTANCE at the form module.I would use the PRE-FORM-trigger

  • Change calendar view from list to week

    Hi
    I imported company holidays into the calendar of about 40 users. I did it using a pst with the corresponding holidays, and I imported this pst using new-mailboximportrequest.
    Now all users reported, that their calendar view has changed the view from week to list. I need to change this view back from list to week, but if possible without user interaction. Is there a possibility?
    Regards
    Peter

    Hi Peter,
    In which calendar view did you create the holidays pst?
    What if we import the pst from Outlook side, will it still show in the List view?
    Meanwhile, please try to create a new holidays pst file and make sure it in the week view before you export it into a pst, and then test the issue again.
    Please let me know the result.
    A similar problem here:
    http://social.technet.microsoft.com/Forums/exchange/fr-FR/2a5596a8-6236-4345-a684-66cf46d0c484/import-calendar-entries-to-exchange-2013-causes-outlook-calendar-view-problems?forum=exchangesvrgeneral
    Regards,
    Steve Fan
    TechNet Community Support

  • TS3274 When viewing pick lists from different web sites my iPad2 selects the first choice on the list and loads it without allowing me to pick my option; is there a way to change this default?

    When viewing pick lists from different web sites my iPad 2 (safari) selects the first choice on the list and loads it without allowing me to pick my option; is there a way to change this default?

    With your playhead over the clip in the timeline and that V track's 'track selector' as the only one active...hit the 'f' key.
    This will load the original clip into the viewer at the matching point of the frame in the timeline.
    K

  • Urgent: How to permenently remove favorit list from a user ?

    We have a need to remove the favorit list from some users.
    Also we need to disable the users ability to create/mantain the favorit
    list.
    Please advise how to do it.
    Points guaranteed. Thanks!

    As you said you need this only for some user , you have to create a new framework page by copying the default one , then create new portal desktop and the new display rules as per your requirement.
    If you need the details for this
    Portal How-to Guides for SAP NetWeaver 2004
    Open the guide........
    How to Modify the Portal Framework Page in SAP Enterprise Portal 6.0
    Priyabrata

  • Changing a 'Reminder list' from iCloud to Exchange

    Hello there Genius'!
    I am so accustomed to apple products, that I actually have a reverse-apple related question: I started a new job in a PC environment and was provided an iPhone for work. Being that I am all Apple at home, I created several  Reminder lists (tasks) in iOS7 and instinctively synced them with iCloud. What I actually need to do is change those lists to Exchange. I have that option when I create a new List, but is it possible to change the List destination once it is created? I cannot copy/paste all the list contents and would really not enjoy re-entering all the lists I have spent so much time on!
    My goal is to have it sync with my Outlook Tasks so I have a centralized resource on for my work tasks.
    Thoughts and feedback are greatly appreciated!!

    Check the Calendars & Remindars box in the iCloud preference pane. You should then have an iCloud category in the Reminders window. Drag the items to it.

  • Extract Attachment list from FDO3

    Hi Experts
    How can I extract the attachment list from FD03 and based on the attachment list where can I get the data of change note pad , I have a requirement to extract the change note for the customer by created on as a parameter ie when I highlight the attachment and click the pencil icon it is displaying the note I need that information?
    can anyone tell me which table or function module it is present ?
    urgent issue
    regards
    Piroz

    Hi Guys
    Problem solved, Thread is closed
    Regards
    Moderator message : It is not mandatory to put comments while closing old threads (unless it add some value). This brings old questions to the top of current list.
    Edited by: Vinod Kumar on Oct 17, 2011 9:49 AM

  • Error in creating invoice list from VF21 transaction

    Hi,
    i am craetin a sales order fro VA01 transaction and for the perticular sales order number I am generating the billing document number.when I take this number and try to create a invoice list from vf21 transaction,it gives an error message as no invoice list can be created.and the processing status of the document becomes invalid.
    what can be the reasons?plz sugges....

    Hello all,
    We are facing the same issue.  While creating ZMHF (custom Urgent Change) users "sometime" receive error "There is no active task list in the associated project"
    Hi Mateus , the document is you mentioned is currently expired / unavailable.  Can you kindly upload the same again please?
    Thanks in advance,
    Shaji Narayanan

  • How to populate a sharepoint 2010 list from the active directory. How to populate a sharepoint 2010 list with all sharepoint user profiles

    How to populate a sharepoint 2010 from the active directory.
    I want a list of all the computers in the active directory,
    another one with all users.
    I want also to populate a sharepoint 2010 list from the sharepoint user profiles.
    Thanks
    sz

    While
    the contacts list is usually filled out for contacts that are outside the company, there are times when you would use a contacts list to store internal and external resources.  Wouldn’t it be nice if you didn’t have to re-type your internal contacts’
    information that are already in the system?  Now you can with a little InfoPath customization on the contacts list. 
    Here’s our plan:
    Create the contacts list, and open in InfoPath
    Create a data connection to the User Profile web service
    Customize the form adding some text, a people picker and a button
    Create InfoPath rules that will populate the contact fields from the user fields in the User Profile store
    Let’s get going!  Before we begin, make sure you have InfoPath 2010 installed locally on your computer.  I also want to give credit Laura
    Rogers and Darvish Shadravan’s book Using
    Microsoft InfoPath 2010 with Microsoft SharePoint 2010 Step by Step.  I know it looks like a lot of steps, but it’s easy once you get the hang of it.
    So obviously we need a contacts list.  If you don’t already have one, go to the SharePoint site where it will live, and create a contacts list.
    From the list, click the List tab on the ribbon, then click Customize form:
    So now we have our form open in InfoPath 2010.  Let’s add our elements to the form. 
    Above all the fields, let’s add some text instructing users what to do with the the field we’re about to add (.e.g To enter an existing user’s information, choose the user below).
    Insert a people picker control by clicking the Person/Group Picker control in the Controls section of the ribbon.  This will add a column to the contacts list called group.
    Below the people picker, insert a button control from the same section of the ribbon as above.  With the button still highlighted, click the Control Tools|Properties tab on the ribbon. 
    Then in the Label box, change the text to something more appropriate to our task (e.g. Click here to load user data!).
    You can drag the button control a little larger to account for the text.
    We should end up with something like this:
    Before we can populate the fields with user data, we need to create a connection to the User Profile Service.
    Add a data connection to the User Profile Service
    Click the Data tab on the ribbon, and click the option From Web Service, and From SOAP Web Service.
    For the location, enter the URL of your SharePoint site in the following format – http://<site url>/_vti_bin/UserProfileService.asmx?WSDL.  Click Next.
    Note - for the URL, it can be any SharePoint site URL, not just to the site where your list is.
    For the operation, choose GetUserProfileByName.  Click Next.
    Click Next on the next two screens.
    On the final screen, uncheck the box for “Automatically retrieve data when form is opened”. This is because we are going to retrieve the data when the button is clicked, also for performance reasons.
    Now we need to wire up the actions on our button to populate the fields with the information for the user in the people picker control.
    Tell the form to read the user from the people picker control
    Click the Home tab on the ribbon.
    Click the button control we created, and under the Rules section of the ribbon, click Manage Rules. Notice the pane appear on the far right.
    In the Rules pane, click New –> Action. Change the name to something like “Query and load user data”.
    Leave the condition to default (none – rule runs when button is clicked).
    Click the Add button next to “Run these actions:”, and choose “Set a field’s value”.
    For Field, click the button on the right to load the select a field dialog.  Click the Show advanced view on the bottom.  At the top, click the drop down and choose the GetUserProfileByName
    (Secondary) option.  Expand myFields and queryFields to the last option and highlightAccountName.  Click ok. 
    For Value, click the formula icon. On the formula screen, click the Insert Field or Group button. Again click the show advanced view link, but this time leave the data
    connection as Main. Expand dataFields, then mySharePointListItem_RW.  At the bottom you should see a folder called group (the people picker control we just added to the form).  Expand this, then pc:Person,
    and highlightAccountId.  Click Ok twice to get back to the Rules pane.
    If we didn’t do this and just queried the user profile service, it would load the data of the currently logged in user.  So we need to tell the form what user to load the data for.  We take the AccountID field from the people
    picker control and inject into the AccountName query field of the User Profile Service data connection. 
    Load the user profile service information for the chosen user
    Click the Add button next to “Run these actions:”, and choose Query for data.
    In the popup, for Data connection, click the one we created earlier – GetUserProfileByName and clickOk.
    We’re closing in on our goal.  Let’s see our progress.  We should see something like this:
    Now that we have the user’s data read into the form, we can populate the fields in the contact form.  The number of steps to complete will depend on how many fields you want to populate.  We need to add an action step for
    each field.  I’ll show you one example and then you will just repeat the steps for the other fields.  Let’s update the Job Title field.
    Populate the contact form fields with existing user’s data
    Click the Add button next to “Run these actions:”, and choose “Set a field’s value”.
    For Field, click the button on the right to load the select a field dialog.  Highlight the field Job Title.
    For Value, click the formula icon. On the formula screen, click the Insert Field or Group button.  Click the Show advanced view on the bottom. At the top, click the
    drop down and choose theGetUserProfileByName (Secondary) option.  Expand the fields all the way down until you see the Value field.  Highlight it but don’t click ok, but click the Filter
    Data button, then Add. 
    For the first dropdown that says Value, choose Select a field or group.   The value field will be highlighted, but click the field Name field
    under PropertyData.  Click Ok. 
    In the blank field after “is equal to”, click in the box and choose Type text.  Then type the text Title. 
    Click ok until you get back to the Manage Rules pane.  The last previous screen will look like this.
    We’re going to update common fields that are in the user’s profile, and likely from Active Directory.  You can update fields like first and last name, company, mobile and work phone number, etc.  For the other fields, the
    steps are the same except the Field you choose to update from the form, and the very last step where you enter the text will change.  Here’s what the rules look like when we’re done:
    We’re all done, good work!  You can preview the form and try it now.  Click Ctrl+Shift+B to preview the form.  Once you’re satisfied, you can publish the form back to the library.  Click File –> Quick
    Publish.  Once it’s done, you will get confirmation:
    Now open your form in SharePoint.  From the contact list, click Add new item.  Type in a name, and click the button and watch the magic happen!

  • I am trying to export only an individual list from my address book. I can only export the entire address book. No way to decipher it once in Excel either.

    I hate to admit how much time I have spent on this issue. I have been trying to separate just the "lists" from within my T-Bird address book, and export them (again, just the names on those individual lists) into a csv or tab delimited file, so I can import it into one of the newer mail programs.
    Honestly I have been trying to figure out my way around this for years. "Lists" have always been clunky and difficult to work with. Lots of unpredictablity, and you can only go so long in the list before it will no longer send, and you need to create a new one. I send these out for a business, with some customers going back ten years or more.
    Since I have never been able to figure it out, I just keep using T-Bird for this, even though its never worked reliably.
    Recently I have been forced into a change. The "lists" will no longer send emails that are received by recipients. Probably some new spam or security things out there. No emails send. Now I have to do something, but to retype hundreds of names from scratch is just not the kind of thing that gives me joy.
    I would be eternally grateful to the person who can help...
    Paul Kamp, Chicago

    This add-on may help:
    https://nic-nac-project.org/~kaosmos/morecols-en.html
    I've had this add-on for so long that I can't remember what it does and does not provide.
    If you select a List in your Address Book, so that its contents display at the right, does "Export" not write just the Lists's member Contacts out to the csv file?
    It does here, but this may be thanks to the above-mentioned add-on.

Maybe you are looking for

  • Using CFFILE To Upload a Full Directory

    I am attempting to build a process to load multiple files from a directory. It is easy enough to use looping processes with multiple <input type="file".... tags (or even a single tag looped over multiple times) in both the form and the action page. H

  • IDVD won't make disc image

    Dear all, many thanks for all the advice on installing iDVD. The software is back on my computer but the origginal problem stays: Whenever I attempt to "save as disk image" or click on "burn" the application "unexpctedly quits". Everything else goes

  • Can't publish from VS 2013 to Azure

    I am trying to publish a website to Azure.  I have a valid Azure account that I can log into using a browser.  But when I try to publish my website from VS 2013 with Update 4 it fails.  If I right click on my project in VS 2013 and choose publish, a

  • Latest Firefox doesn't show google adds on my pages.

    On www.alternativa.hr no Google adss are shown and Facebook and Google+ extensions doesn't work as well.... On other browsers and on older versions of Firefox, no such problem - everything works just fine. Can you help me out here?

  • IPod touch with iPhone 5s improvements

      Does anyone know if Apple has any plans to update the iPod Touch to has the specifications of the iPone 5S without the cellular components?