Code explanation sort

Dear Everyone,
I am using some really neat code to listen to a group of JComboBoxes.
The four JComboBoxes in question sit on a JFrame and each of the boxes presents the program user with ten numberical choices, namely 0-9.
The Listener method for one of the JComboBoxes, named Millennia is shown below:
Millennia.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent e){
Millenniaxx = Millennia.getSelectedIndex();
If anybody can explain to me what the above code does it would be greatly appreciated.
Thanks

This code adds a listener to listen to a seelction of an item in the JComboBox, when a selection is made the int Millenniaxx will be equal to the number of the selected item.
Noah

Similar Messages

  • Improvements to status code explanations requested

    There are some status code explanations in the 9.0.4.x
    CSDK that could probably use some refinement to be more
    useful to application developers.
    Two examples:
    1."CAPI_STAT_LIBRARY_INTERNAL_DATA = There was a corruption of data in the library."
    This might not always indicate that data in the
    calendar store is corrupted - which is the way we
    initially interpreted this error - but rather that
    data provided to be stored is in some way invalid.
    Example: calling storeEvents() with an
    iCalendar whose DTSTART property was after
    DTEND (i.e. start date after ending date),
    returned the status "CAPI_STAT_LIBRARY_INTERNAL_DATA".
    Example: calling Session.storeEvents() with an iCalendar
    whose start and end dates are in a non-UTC TZ in a format
    similar to "DTSTART;TZID=US/Pacific:20040517T101500",
    that method returned "CAPI_STAT_LIBRARY_INTERNAL_DATA".
    Fix: include an appropriate VTIMEZONE component
    for that timezone in the submitted iCalendar.
    2. Any of the explanations below, which begin with
    "Information about ..."
    These often seem to indicate that a data format error
    has occurred, and that the application developer
    needs to modify the format of the data to have it
    accepted. The "Information about ..." explanation
    doesn't adequately convey that.
    Examples:
    When calling storeEvents() with an iCalendar with a
    missing CR/LF between VEVENT components, that method
    returned the status "CAPI_STAT_DATA_ICAL".
    Some of the relevant status explanations include:
    CAPI_STAT_DATA_COOKIE = Information about the supplied cookie.
    CAPI_STAT_DATA_DATE = Information about a date.
    CAPI_STAT_DATA_EMAIL = Information about email.
    CAPI_STAT_DATA_ENCODING = Information about the encoding of supplied data.
    CAPI_STAT_DATA_HOSTNAME = Information about a hostname.
    CAPI_STAT_DATA_ICAL = Information about iCalendar data.
    CAPI_STAT_DATA_MIME = Information about MIME data.
    CAPI_STAT_DATA_UID = Information about a UID.
    CAPI_STAT_DATA_USERID = Information about a userID.
    In contrast, explanations like the following are much
    clearer:
    CAPI_STAT_DATA_USERID_FORMAT = The format of the UserId string was wrong.
    CAPI_STAT_DATA_USERID_ID = There was a problem with the Id part of the UserId string.
    Any improvements such as these in the status code
    explanations returned would be welcome, and might help
    save debugging time for those new to the CSDK.

    Thanks Aaron,
    Some notable improvements are coming in the next version of the Oracle Calendar application developer's guide, and your comments will be added for consideration.
    Best regards,
    Product Management

  • DSEE 7 error code 12 - Sort Response Control for server side sort

    I am using Sun DSEE 7, My application works fine for small data set (e.g. 1000) and gives me correct sorted result, but same code fails for large data set (e.g. 656000). I find that for large data set, I am getting the error "*javax.naming.OperationNotSupportedException: [LDAP: error code 12 - Sort Response Control];*". I have changed the look-throught-limit, size-limit and time-limit values to unlimited using dsconf utility. I changed db cache size, entry cache size to appropriate values and also i increased all-id-threshold, all-ids-threshold-eq, all-ids-threshold-pres to the max possible value (2147483646) for one index attribute which i am using in my query but still exception is coming. If i change my client code (Java code using JNDI) to use Context.NONCRITICAL for SortControl, the sorted result is coming fine for small data set (access log shows query as indexed) but result is not sorted for large dataset and also i see the query is now unindexed. I am using only one attribute for sorting. Please help me out what configuration i am missing here.

    Exactly. There is no reason to have the LDAP server sort the
    results during the retrieval.
    Query of Query can be used such as:
    <cfldap name="ldapResults" .....> <!--- Do the LDAP
    query first --->
    <cfquery dbtype="query" name="sortedResults">
    SELECT
    FROM
    ldapResults
    ORDER BY
    sprintcompany
    ,sprintpocrole
    ,sn
    </cfquery>
    Then, use the "sortedResults" query for the rest of your
    processing.

  • Need code explanation

    //I have the following code I am trying to understand, mainly how its calling the other classes. Any explanation would be great. Thanks Rick
    import javax.swing.*;
    import java.util.*;
    //I know this is the class after compiled...
    public class Assignment4Driver
         //I am trying to understant how this calling works
         public static void main(String[] args)
              ReadInput input2 = new ReadInput();
              int gradeCount = input2.readInput();
              GetGrade grade2 = new GetGrade();
              char grade = grade2.getGrade(gradeCount);     
              WriteOutput output2 = new WriteOutput();
              output2.writeOutput (gradeCount, grade);
    //ReadInput.java file
    public class ReadInput
         public int readInput()
              int gradeCount = 0;
              int counter = 0;
              while (counter < 5)
                   String gradeString = JOptionPane.showInputDialog("Enter grade from 0 to 20:");
                   gradeCount = gradeCount + Integer.parseInt(gradeString);
                   counter++;
              return gradeCount;
    //Get Grade.java file
    public class GetGrade
         public char getGrade(int gradeCount)
              char grade;
              if (gradeCount >= 90) grade = 'A';
              else if (gradeCount >= 80) grade = 'B';
              else if (gradeCount >= 70) grade = 'C';
              else if (gradeCount >= 60) grade = 'D';
              else grade = 'F';
              return grade;
    import javax.swing.*;
    import java.util.*;
    Here is the WriteOutput.java file
    public class WriteOutput
         public void writeOutput(int gradeCount, char grade)
              JOptionPane.showMessageDialog(null, "The total points awarded is " + gradeCount + ",\n"
                        + "which makes your final grade a " + grade);
    //Thanks a bunch.

    Basically I included four files and want to know about this.
    I think it looks like you are calling your class ReadInput, then it looks like you are assigning whatever value is there when you first call it to "input2", then you are saying that the "new" value is equivalent to input2 after the ReadInput file is read.
    ReadInput input2 = new ReadInput();
    after that you are saying the the variable gradeCount from the ReadInput file is equal to the input2.readInput, but I can't explain the input2.readInput below.
    int gradeCount = input2.readInput();
    portion of the code....
    I am not a big coder, and have been only working with one file at a time. I am trying to understand how you can have one class and call another class. I will study some more and see if I can post a question that makes more sense to you. I will see if I can access this site from work so I can keep looking at this thread.

  • Designerd does not generate Order BY code for Sort Order on a lookup tabel column.

    I am setting the Sort Order on a column which is based on a lookup table.
    When generate the the module, designer does not generate the code for the Sort Order that I set on the lookup table column.
    Is there a work around for this problem or is there some thing else that needs to be done in designer to make it generate the order by clause?
    I will very much appreciate help.
    Regards
    Prasad.

    A bound lookup item, will be generated as a NON-database item in Forms. Designer generates an ORDER BY CLAUSE (a Forms Block property) for the ordering. But a NON-database item cannot be included in the ORDER BY CLAUSE.
    I used a stored function for ordering the lookup item.
    Best regards
    Harm van Zoest

  • Code to sort un-common elements in arrays

    the code which i made so far
    class ArraySetExample
         public static void main (String [] args)
              String rainbow [] = {"red","orange","yellow","green","blue","indigo","violet"};
              String flag [] = {"red","white","blue"};
              // To printout the set of common colours in flag and rainbow
              System.out.println("the set of rainbow colours in the national flag");
              for (int i=0; i<flag.length;i++)
                 for (int j=0; j<rainbow.length;j++)
                         if (flag.equals(rainbow[j])) System.out.println(flag[i]);
    now i want to add String flagcolours[] // colours which are in flag but not in rainbow
              String rainbowcolours[] // colours which are in rainbow but not flagthe logic which i thought isflagcolours.addAll(rainbow);
              flagcolours.removeAll(flag);
                        rainbowcolours.addAll(flag);
                        rainbowcolours.removeAll(rainbow);but i want a code in arrays. can someone sort my missing code or anything if I have done wrongclass ArraySetExample
         public static void main (String [] args)
              String rainbow [] = {"red","orange","yellow","green","blue","indigo","violet"};
              String flag [] = {"red","white","blue"};
              String flagcolours[]; // colours which are in flag but not in rainbow
              String rainbowcolours[]; // colours which are in rainbow but not flag
              // To printout the set of colours in flag and rainbow
              System.out.println("the set of rainbow colours in the national flag");
              for (int i=0; i<flag.length;i++)
              for (int j=0; j<rainbow.length;j++)
                   if (flag[i].equals(rainbow[j])) System.out.println(flag[i]);
                   //............MISSING CODE.............
    Edited by: crystalarun on Oct 21, 2007 8:13 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Then you will probably need to create a new array for each intersection and using nested for loops add items to your arrays depending on whether they are in one array and not in another by checking in an if-block. First work out what you would do on paper, then translate this to java. It's not hard once you see the solution on paper.
    Good luck.

  • Mechanism to return status code explanations?

    Does Oracle provide an mechanism in the SDK to return longer and presumably more end-user understandable explanations of SDK status codes, such as (for instance) "Logon authentication failed." when provided with the integer value of the status code whose string representation is 'CAPI_STAT_SECUR_LOGON_AUTH'?
    In other words, is an integral lookup table of this type already present in the SDK -- even if the explanations are currently provided only in the English language and perhaps even are not customizable -- or would we need to build our own?
    (This question could also be extended to apply to the status codes emitted by the Calendar Web Services ...)

    No, there is no corresponding message (English or otherwise) for the status codes in the Calendar SDK today.
    However you should be able to find descriptions of the status codes in the SDK documentation.
    Graham

  • Code explanation

    In a recent question the fix was:
    select 'update TABLE_NAME SET [' + name + '] = 0 where [' + name + '] is NULL'
    from sys.columns
    WHERE object_id = OBJECT_ID(N'[dbo].[TABLE_NAME]')
    The code worked great. I am trying to understand and learn more about exactly what is happening. Is there a link where I can go that will teach me what ['+name+'] is doing. I know that it is getting the information from the WHERE statement, but cannot
    figure out exactly how it works. I seem to learn and retain more when I understand what is happening, and not merely cutting and pasting some code that works.
    Your attention in this matter is greatly appreciated,
    Bruce

    You are building a dynamic string with the query. "name" is one of the columns in sys.columns
    select name from sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[TABLE_NAME]')
    If you have a string as one of your select fields then that exact string will be returned for every row in the result set.
    select 'is the column name' from sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[TABLE_NAME]')
    if you include a string along with columns you will get the column value(s) and the string will be repeated as as column in the result set.
    select name,'is the column names'
    from sys.columns
    WHERE object_id = OBJECT_ID(N'[dbo].[TABLE_NAME]')
    And finally, you can add columns together is they are compatible types. In this case the name column is compatible with the string.
    select name+' is the column name'from sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[TABLE_NAME]')
    Here is a pretty comprehensive post abouts dynamic sql
    http://www.sommarskog.se/dynamic_sql.html

  • Requirement of Locale Specific Code in sorting

    I need to sort a list of items that can come in different languages. Do I require to use any Locale Object with it somewhere?
    Wont that be automatically taken care by java as it is done on the basis of Unicode characters(i believe). Please help me.

    See java.text.Collator

  • Flash Builder autogenerated service code explanation

    Hi
    When you connect to some backend via the Flash Builder "service inspector", it autogenerates alot of code, which seems to be giving you some additionel intellisense. I'm very interested in some documents that describe whats actually being autogenerated and for what reasons. Because when you don't use the service helper, you can connect to a backend in like 2-3 lines of code.
    Best Regards
    Martin Andersen

    Generally, the more specific you can be in programming the more efficient and less error prone the code is. The downside is that explicit declarations require much more typing.
    The auto generator attempts to generate code that is as specific as possible, and provides you some strongly typed methods to wrap the calls in. The VO objects probably look the most strange, but I think a lot of that is just explicit binding declarations. There is also some functionality added for advanced server setups (like lazy loading and such).

  • Math.atan2 Code Explanation Help

    Hello guys
    This is a piece of code from AS3 Making Things Move
    I tried to understand how this code works, but failed
    Please explain this code
    Thanks in advance

    There are two fetches to deal with the no records found situation.
    the basic idea is
    fetch
    while found loop
    ... do some processing ...
    fetch
    end loop
    If the first fetch doesn't result in a record the loop is not being executed,inside the loop the %notfound situation doesn't have to be trapped anymore.
    This is why the if inside the loop is redundant.
    Other than that this code is an example of slow by slow processing, introducing 3GL techniques, processing records, instead of SETS.
    The person responsible for this code ought to be fired.
    Sybrand Bakker
    Senior Oracle DBA

  • HotSpot source code explanation

    Hi!!
    I am new in this, so I will try to be as clear as I am able :)
    I need to modify the source code of the hotspot, and I do not find any information about the meaning of each file in the directory tree. I have tried to do it by myself, but it is a bit complicated for me ;P
    Any suggestion, WP, idea or anything about the meaning or the content of each file (as many as you can) will be of a huge help :D:D:D
    Thx!! :D:D:D:D

    Hi!!!
    I am doing a project about improving certains features in the JVM ;) so I need to modify the source code of the hotspot :)
    Thx!! :D

  • Java Graph code explanation

    Hi all,
    im new to java and have some trouble drawing a graph i looked up some code but dont quite understand it
    can someone explain the following code please. I understand swing and painting and basic java.
    Q1) Can please explain the flow of execution ?
    Q2)
    What i would also specifically like to understand about the code
    is how does the graph keep going and looks like it scrolls across and not off the frame and how can i add this to a frame i already have
    without covering over my other objects i have displayed.
    Any help would be greatly appreciated.
    Thanks
    import java.awt.*;*
    *import javax.swing.*;
    import java.awt.event.*;*
    *import javax.swing.event.*;
    import java.awt.image.BufferedImage;
    import java.awt.geom.*;*
    *import java.math.*;
    import java.util.*;*
    *public class ecg extends JFrame*
    *     myView view = new myView();*
    *     Vector vr   = new Vector();*
    *     int    ho   = 0;*
    *public ecg()* 
    *     addWindowListener(new WindowAdapter()*
        *{     public void windowClosing(WindowEvent ev)*
    *          {     dispose();*
    *               System.exit(0);}});*
    *     for (int i=0; i < 5000; i++)*
    *          int p = (int)(Math.random()*  260);
              vr.add(new Point(0,p-130));
         setBounds(3,10,625,350);
         view.setBounds(10,10,600,300);
         getContentPane().add(view);
         getContentPane().setLayout(null);
         setVisible(true);
         while (ho < 500-300)
              try
                   Thread.sleep(110);
                   ho = ho  +1;+
    +               repaint();+
    +          } catch (InterruptedException e) {}+
    +     }+
    +}+
    +public class myView extends JPanel+
    +{+
    +     BufferedImage I;+
    +     Graphics2D    G;+
    +public myView()+
    +{+ 
    +}+
    +public void paint(Graphics g)+
    +{+
    +     if (I == null)+
    +     {+
    +          I = new BufferedImage(getWidth(),getHeight(),BufferedImage.TYPE_INT_ARGB);+
    +          G = I.createGraphics();+
    +     }+
    +     G.setColor(Color.white);+
    +     G.fillRect(0,0,getWidth(),getHeight());+
    +     G.setColor(Color.gray);+
    +     Point p1,p2;+
    +     p1 = (Point)vr.get(ho);+
    +     int x = 0;+
    +     for (int y=1; y < 600; y++)
              p2 = (Point)vr.get(y+ho);
              G.drawLine(x,p1.y+150,x+6,p2.y+150);
              p1 = (Point)vr.get(y+ho);
              x = x + 6;
         g.drawImage(I,0,0,null);
    public static void main (String[] args) 
         new ecg();
    }

    Compiling your posted code gives a compiler warning:
    C:\jexp>javac ecg.java
    Note: ecg.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    C:\jexp>javac -Xlint:unchecked ecg.java
    ecg.java:31: warning: [unchecked] unchecked call to add(E) as a member of the raw type jav
    a.util.Vector
                vr.add(new Point(0,p-130));
                      ^
    1 warningWe can eliminate this by changing this
        Vector vr   = new Vector();to this
        Vector<Point> vr   = new Vector<Point>();The best way to understand things like this is to start a new file and slowly build it up so you can see what's going on, step-by-step. I've put in some comments and print statements to give you a start.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.awt.image.BufferedImage;
    import java.awt.geom.*;
    import java.math.*;
    import java.util.*;
    public class ECG extends JFrame
        myView view = new myView();
        Vector<Point> vr = new Vector<Point>();
        int    ho   = 0;
        public ECG()
            addWindowListener(new WindowAdapter()
                @Override
                public void windowClosing(WindowEvent ev)
                    dispose();
                    System.exit(0);
            // Initialize data in Vector.
            for (int i=0; i < 5000; i++)
                int p = (int)(Math.random() * 260); // range: (0    - 260]
                vr.add(new Point(0, p-130));        // range: (-130 - 130]
            System.out.println("Total number of data points: " + vr.size());
            setBounds(3,10,625,350);
            // Component drawing space is 600 wide by 300 high.
            view.setBounds(10,10,600,300);
            getContentPane().add(view);
            getContentPane().setLayout(null);
            setVisible(true);
            // Animate up thru the first 200 of 5000 data points.
            int millisPerSecond = 1000;
            long delay = 110;
            long framesPerSecond = millisPerSecond/delay;
            System.out.printf("Frames per second: %d%n", framesPerSecond);
            int paintSteps = 600;
            int dataIndex = 200;
                            //5000 -1 - paintSteps;  // max possible index
            System.out.printf("Expected animation time: %f seconds%n",
                               (double)dataIndex/framesPerSecond);
            long start = System.currentTimeMillis();
            // Animation loop.
            while (ho < dataIndex)
                try
                    Thread.sleep(delay);
                    // Increment "ho" which will step us through the Vector data.
                    // Each new value draws the Vector graph data starting at
                    // index "ho" placed at the left edge of the image/component.
                    ho = ho + 1;
                    long end = System.currentTimeMillis();
                    double elapsedTime = (double)(end - start)/millisPerSecond;
                    if(ho % 100 == 0)
                        System.out.printf("ho: %d  time: %.2f%n", ho, elapsedTime);
                    // Update the image in the paint method.
                    repaint();
                } catch (InterruptedException e) {
                    System.out.println("animation interrupted");
            long end = System.currentTimeMillis();
            double elapsedTime = (double)(end - start)/millisPerSecond;
            System.out.printf("Total animation loop time: %f%n", elapsedTime);
        public class myView extends JPanel
            BufferedImage I;
            Graphics2D    G;
            public void paint(Graphics g)
                if (I == null)  // initializw image
                    I = new BufferedImage(getWidth(),getHeight(),
                                          BufferedImage.TYPE_INT_ARGB);
                    G = I.createGraphics();
                // Update image to show current state of animating graph.
                // Fill Background color.
                G.setColor(Color.white);
                G.fillRect(0,0,getWidth(),getHeight());
                // Set graph line color.
                G.setColor(Color.gray);
                // Draw next data segment to newly-erased image.
                // Get two points in data to draw the next line.
                Point p1,p2;
                // "ho" is a simple counter with range [0 - n-1]
                // [0 - 200-1] in the animation loop above.
                // Get the next data point at "ho" which will be drawn at
                // the beginning, ie, left edge (x = 0), of the image.
                p1 = vr.get(ho);
                int x = 0;
                // Since each frame starts at zero_x relative to the image:
                // x = 0.
                // Draw all graph data for this one 600 by 300 image frame
                // with data beginning at index "ho".
                for (int y=1; y < 600; y++)
                    // Get the next point out ahead.
                    p2 = vr.get(y+ho);
                    // Draw a line from the last point, p1, to the next point, p2,
                    // which will be spaced (x +=) 6 apart along the image/component
                    // width of 600 (setBounds). Translate the y values down onto
                    // the component by 150 pixels (the range of y values from
                    // above is from -129 to 130). The "+150" shifts the y values
                    // to the approximate center of the component.
                    G.drawLine(x, p1.y+150, x+6, p2.y+150);
                    // Save the current point to/in p1 for the next iteration.
                    p1 = vr.get(y+ho);
                    // Move along to the right in the image.
                    x = x + 6;
                // Draw image in component.
                g.drawImage(I,0,0,null);
        public static void main (String[] args)
            new ECG();
    }

  • Some code explanation.

    dear all,
    can u please tell me what does     month = SOURCE_FIELDS-fiscper+5(2). does? what exactly does +5(2) does? thanks.

    Offset
    month = SOURCE_FIELDS-fiscper+5(2).
    the above code will populate the month from the  SOURCE_FIELD field fiscper
    fiscper+5(2)
    +5 "from 5th position(character 6 and character 7) , 2 means 2 characters(char 6, char 7)
    will be taken .
    Read the help on Offest.

  • Java Code explanation

    Iam new in java and on going learning, iam puzzle with this code, based on this code why the value x1 change when value x2 is set to different time? please do explain to me.. TQ
    class MyTime {
         public static void main(String[] args) {
              Time x1, x2;
              x1 = new Time();
              x1.setTime(1, 00);
              x2=x1;
              System.out.print("x1: ");
              x1.whatTime();
              System.out.println();
              System.out.print("x2: ");
              x2.whatTime();
              System.out.println();
              x2.setTime(3, 00);
              System.out.print("x1: ");
              x1.whatTime();
              System.out.println();
              System.out.print("x2: ");
              x2.whatTime();
              System.out.println();
    }

    What you have to realiuse is that x1 and x2 are not Time objects. They are just pointers that point to the same Time object. So for example say you have two people called x1 and x2 standing and pointing at stuff written on a blackboard, the same blackboard. So if you get person x1 to make any changes to what is written on the blackboard, person x2 is still pointing to the same stuff on that same blackboard.

Maybe you are looking for

  • Internal sound stopped working

    My internal sound suddenly stopped working. I can still hear sound with headphones, but the internal speakers are not functioning. The trademark start-up sound (Beatles Day in the Life rip off) is the only sound that comes out of the MacBook. Within

  • All design programs running extremely slow and takes forever to save and sometimes shuts down randomly?

    Ok so  I'm a design student at a community college (about to graduate soon and will be continuing on getting my BFA) I have all of the creative cloud suite. I have Illustrator, Photoshop, Lightroom, InDesign, etc. Recently I started having problems w

  • Transporting problem gui_status to live system

    Hi gurus, I have a problem transporting  gui status to live system.In development system area(se80),I see the gui_status folder but when I'm transporting the all program to live system,gui_status is missing.Can I get request only for this gui_status?

  • Security Propogation in MDB

    Hi all, I have a doubt : Now the requirement is like below : A user logins with his credentials and he belongs to a Role ABC. Does a UI Action -> This in turn posts a message to a Queue -> MDB reiceves the message and posts the message to a Topic( Se

  • ConnectionString using ADO for Oracle 8

    Hi, Is is possible to connect to Oracle 8 using ADO? This connection string works using DAO: connect_string = "ODBC;DSN=DSN_NAME;UID=USERID;PWD=PASSWORD;APP=APP_NAME;DB=DATABASE;SRVR=SERVER" . Do you need an Oracle 10 database to use ADO? Thanks in A