What am I doing wrong on this interactive SVG? Please help.

I watched the tutorial on youtube on creating the svg and making an interactive color changing character. I have tried to implement it but I’m not doing something right and am a little lost on the code.  I was wondering if anyone could tell me what I am doing wrong.
The SVG File
Has 18 groups that can color change each in a different layer but not grouped within the layers
The layer names are as follows
Owl_Wing_Spots
Owl_Wings
Owl_Belly
Owl_Body
Trunk
Leaf_Outline
Leaf_1
Leaf_2
Leaf_3
E2_Ear_Spots
E2_Ear_Tail
E2_Body
E1_Ear_Spots
E1_Ear_Tail
         15.  E1_Body
     16. Wall_Color
     17. Bird_Body
     18.   Bird_Butterfly_Wing
I put the notify(this, "select"); on each layer
I referenced http://cdn.edgecommons.org/an/1.0.0/js/min/EdgeCommons.js for the javascript file in AI and I also created a js file that is the same as the one in the video named svg.js (but neither made a difference)
The Edge Animate File
I added the SVG file named “elephant_tree2” and then added the following code to the CompositionReady Area
// Load Edge Commons
yepnope({
load: "http://cdn.edgecommons.org/an/1.0.0/js/min/EdgeCommons.js",
complete: function() {
                        // Enable SVG access
                        EC.accessSVG(sym.$("elephant_tree2")).done(
                                        function(svgDocument){
                                                        // add event listener
                                                        svgDocument.addEventListener("select", function(event) {
                                                                        // Remember selected part
                                                                        sym.setVariable("selectedPart", event.target);
                                                                        // show the id of the selected part in the textfield
                                                                        sym.$("selectedPartTxt").html( event.target.id );
// insert code to be run when the composition is fully loaded here
I added a selectedPartTxt text box and named it that too.
None of the groups on the SVG are recognized and the selectedPartTxt does not change.  I suspect it may have something to do with the fact there are groups instead of one part but I don’t know how to fix it.
I was also wondering if someone could tell me how to use an SVG for the color chart too instead of recreating it in Edge Animate.  I haven't tried to to the color part of the SVG because I still can't get the mouse click to work when on a group that changes.
Any help would be appreciated.
Thanks!
Cherie

Hi, I had a similar problem and this fixed it.
You know how in the illustrator file, you need to reference a file called svg.js from the edge commons library? Download that file, or write the code in a text editor and save it in a .js file and then make sure that the file is in the same folder as your images called by the adobe edge file.
I hope this works!
Liz

Similar Messages

  • What i'm doing wrong in this small pl/sql statement ?

    Hi All,
    I'm happy to write in this forum for the first time. Can anyone help me to show What i'm doing wrong in this small statement :
    create or replace procedure augmente_salaire(p1 IN employees.employee_id%type, p2 IN number(3))
    is
    update employees set salary = salary + salary*p2/100 where employee_id=p1;
    end  augmente_salaire;
    begin
    augmente_salaire(1001,20);
    end;
    I'm using pl/sql developer.
    Any help would be much appreciated.
    Best Regards.

    Welcome to the forum!!
    Point 1:
    > create or replace procedure augmente_salaire(p1 IN employees.employee_id%type, p2 IN number(3))
    The code in red is the one causing trouble. You cant specify LENGTH for the data type in parameter of a Procedure/Function. Oracle will define it based on the passing value.
    So your code must be just.
    create or replace procedure augmente_salaire(p1 IN employees.employee_id%type, p2 IN number)
    Point 2:
    BEGIN is missing after the IS key word.
    Following is a corrected code.
    create or replace procedure augmente_salaire
        p1 IN employees.employee_id%type
      , p2 IN number
    is
    begin
       update employees
          set salary = salary + salary*p2/100
        where employee_id=p1;
    end  augmente_salaire;
    show err

  • What am i doing wrong with this class please help

    What am i doing wrong with this class? I'm trying to create a JFrame with a JTextArea and a ScrollPane so that text can be inserted into the text area. however evertime i run the program i cannot see the textarea but only the scrollpane. please help.
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Instructions extends JFrame{
    public JTextArea textArea;
    private String s;
    private JScrollPane scrollPane;
    public Instructions(){
    super();
    textArea = new JTextArea();
    s = "Select a station and then\nadd\n";
    textArea.append(s);
    textArea.setEditable(true);
    scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    this.getContentPane().add(textArea);
    this.getContentPane().add(scrollPane);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setTitle("Instructions");
    this.setSize(400,400);
    this.setVisible(true);
    }//end constructor
    public static void main(String args[]){
    new Instructions();
    }//end class

    I'm just winging this so it might be wrong:
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Instructions extends JFrame{
    public JTextArea textArea;
    private String s;
    private JScrollPane scrollPane;
    public Instructions(){
    super();
    textArea = new JTextArea();
    s = "Select a station and then\nadd\n";
    textArea.append(s);
    textArea.setEditable(true);
    scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    // Here you already have textArea in scrollPane so no need to put it in
    // content pane, just put scrollPane in ContentPane.
    // think of it as containers within containers
    // when you try to put them both in at ContentPane level it will use
    // it's layout manager to put them in there side by side or something
    // so just leave this out this.getContentPane().add(textArea);
    this.getContentPane().add(scrollPane);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setTitle("Instructions");
    this.setSize(400,400);
    this.setVisible(true);
    }//end constructor
    public static void main(String args[]){
    new Instructions();
    }//end class

  • I am at starbucks and when I try to download my free music on itunes, my password is always rejected, even when i am forced to create a new one!!!  what am I doing wrong, who do I ask for help

    I am at starbucks and when I try to download my free music on itunes, my password is always rejected, even when i am forced to create a new one!!!  what am I doing wrong, who do I ask for help?

    Due to recent security issues and identify theft (mostly due to phishing scams), the iTunes Store seems to be requiring more frequent verification of credit card information when a card is registered in your account, even if you have a balance from a prepaid card. Either just go through the verification process or, if you have a credit card entered and you don't expect to need the card anytime soon, go into the Payment information in your account and set the payment method to "none" which should then stop the regular requirements for verification  (it may still ask - mine does - but you should just be able to click through the buttons without problems).
    Hope this helps.

  • What am I doing wrong with this filter (counter/frequency issue), probably another newb question.

    I extracted the part of my VI that applies here.  I have a 6602 DAQ board reading a counter for frequency, using a Cherry Corp proximity sensor.  Getting a lot of noise and errant ridiculously high readings.  Speed of shaft which it's measuring is currently 2400rpm with one pulse per revolution so 40hz. 
    Trying to use the express filter VI to clean up the signal and ignore anything over, say, 45hz and under 35hz.  No matter what setting I choose I continually get the  20020 error, Analysis:  The cut-off frequency, fc, must meet:  0 <= fc <= fs/2.  I know this relates to sample period somehow, but for the life of me I can't understand what I'm doing wrong. 
    I used this VI without filtering on bench tests with a hand-drill and got perfect output every time.  Now it's on the machine and being erratic.  Any help here will ease my stress level significantly, thanks.
    VI attached
    Still confused after 8 years.
    Attachments:
    RPM.vi ‏92 KB

    Hello Ralph,
    I'm not sure about mounting your sensor to your rig, but I can provide a couple ideas about the filtering. Depending on the type of noise, the digital filters on the PCI-6602 could help eliminate the behavior you are seeing. If the noise manifests as a "glitches" or a bouncing signal, you could use another counter with a minimum period to help eliminate the noise. This concept is discussed in greater detail in this KnowledgeBase. I noticed that you are using NI-DAQmx; the practical application of the digital filters on the PCI-6602 in NI-DAQmx is discussed in this KnowledgeBase. A more detailed description of the behavior of these filters is provided in the NI-DAQmx Help (Start>>All Programs>>National Instruments>>NI-DAQ) in the book entitled "Digital Filtering Considerations for TIO-Based Devices".
    I also wanted to comment on your original post and explain why you were receiving error -20020. For convenience, I have copied the text of the error code below.
    Error -20020 occurred at an unidentified location
    Possible reason(s):
    Analysis:  The cut-off frequency, fc, must meet:  0 <= fc <= fs/2.
    I think you may have misunderstood exactly what the Filter express VI does. The Filter express VI takes a series of values in a waveform and performs filtering on those signals. So, it will look at a waveform made up of X and Y values and apply the defined filter to this waveform. Specifically in your application, the cut-off frequency (fc) is the Upper Cut-Off level that you specified in the Filter express VI; any frequency components of the waveform outside of the range you have defined will be filtered. The fs is the sample rate based on the data that you wire to the Signal input of the Filter express VI. In your VI, this data is coming from the DAQ Assistant. So, fs will be the sample rate of the DAQ Assistant and is associated with the rate at which points are acquired. The sample rate does NOT relate to the bandwidth of the signal, except that the Nyquist theorem tells us that the sample rate must be at least twice the signal bandwidth in order to determine periodicity of the signal. So, in this case, the sample rate of the DAQ Assistant would need to be at least double the high cut-off frequency.
    However, you are performing a frequency measurement using a counter. I think this is where the confusion comes in. For the frequency measurement using a counter, the DAQ Assistant returns a decimal value which represents the rate of the pulse train being measured by the counter. It does not return the actual waveform that is being read by the counter. It is this waveform that would be band-pass filtered to eliminate frequency content outside of the filter's bandwidth. Instead of the Filter express VI, I would recommend that you simply discard values that are outside the range you specify. I have modified the code you posted earlier to perform this operation. The image below shows the changes that I made; rather than using the Filter express VI, I simply compare the frequency to the "Low Threshold" and "High Threshold". I use a Case structure to display the value on if it is within the limits. Otherwise, I display a "NaN" value. I have also attached the modified VI to this post.
    Message Edited by Matt A on 09-04-2007 07:58 PM
    Matt Anderson
    Hardware Services Marketing Manager
    National Instruments
    Attachments:
    RPM (Modified).JPG ‏17 KB
    RPM (modified).vi ‏72 KB

  • What am I doing wrong with this method?

    Ok I tried this for two hours and for some reason my variables from one method wont work with the other method what am I doing wrong?
    public class Testing
    private static void storage(String[] storage){
    String retval= "";
    for(int i=0;i!=storage.length;i++){
    String getstorage= storage[i]+retval;
    return storage[i]+retval;
    }//for
    }//storage
    public static int[] find(String[] str){
    for(int i=0;i!=str.length;i++){
    if(str.equals (storage[i].substring(0,2))){
    return indexOf(str[i], str[i].length);
    else If(str[i].substring(indexOf(str[i]),str[i].length)>storage.substring(indexOf(storage[i]),storage[i].length)){
    return {0,0};
    };//elseif
    }//if
    }//for
    }//find
    }//StrStore

    Thanks got that part fixed and I even kinda learned how to make it so that I can establish the variable somewhere else lemme show you:
    public class StrStore
       private static String[] storage(String[] storage){
                for (int i=0; i!=storage.length; i++);
                  String retval="";
                  return storage[i] +retval;
               }//for
             }//storage
       public static String[] getStorageArray()
         String[] temp= new String[storage.length];
         for (int i=0; i!=storage.length; i++){
                  temp= storage[i];
    return temp;
    }//for
    }//getStorageArray
    public static int[] find(String[] str){
    for(int i=0;i!=str.length;i++){
    if(str[i].equals (storage[i].substring(0,2))){
    return {indexOf(str[i], str[i].length};
    else if(str[i].substring(indexOf(str[i]),str[i].length>storage.substring(indexOf(storage[i]),storage[i].length)){
    return {0,0};
    }//elseif
    }//if
    }//for
    }//find
    public static int[] encode(String str){
    for(int i=0;i!=str.length;i++){
    if(str[i].length>storage[i].length);
    return str[i]+storage[i];
    else{
    find(storage[i]);
    }//elseif
    }//if
    }//for
    }//encode
    public static Int[] decode(int[] code){
    for(int i=0;i!=str.length;i++){
    return find(storage[i]);
    }//for
    }//decode
    public static void main(String[] args)
    int[][] codes = new int[args.length][];
    for(int i=0;i!=args.length;i++){
    codes[i]=encode(args[i]);
    }//for
    storage(getstorage);
    System.out.println("storage = "+ getStorage);
    for(int i=0;i!=args.length;i++){
    System.out.println(decode(codes[i]));
    }//for
    }//main()
    }//StrStore
    however Im still coming up with 5 errors now one is stating that in this section:
    public static String[] getStorageArray()
         String[] temp= new String[storage.length];
         for (int i=0; i!=storage.length; i++){
                  temp= storage[i];
    return temp;
    }//for
    }//getStorageArray
    that a class is expected but I thought I had the class defined? I get that also here:
       public static int encode(String str){
               for(int i=0;i!=str.length;i++){
                 if(str.length>storage[i].length);
    return str[i]+storage[i];
    else{
    find(storage[i]);
    }//elseif
    }//if
    }//for
    }//encode
    but instead of the beginning I get it at the very last line of that snippet
    then I get that these two variables are incompatible
    private static String[] storage(String[] storage){
                for (int i=0; i!=storage.length; i++);
                  String retval="";
                  return storage[i] +retval;
               }//for
             }//storage

  • What is wrong with this!! please help

    Hello friends,
    I'm a learner and I have done lot of JDBC connectivity with Acess database, and now I want to connect java program with oracle database, but the problem is I have downloaded the oracle driver, set the classpath, and I have created the DataSource Name with MS-ODBC, I could able to compile but I'm getting run time exception, please help me with this. regards, shabeer.
    the program is
    import java.sql.*;
    public class ShabeerJdbc {
    public static void main(String args[]) {
    // String url = "jdbc:oracle:thin:@imran:3339:shabeerjdbc";
    Connection con;
    String createString;
    createString = "create table COFFEES " +
    "(COF_NAME VARCHAR(32), " +
    "SUP_ID INTEGER, " +
    "PRICE FLOAT, " +
    "SALES INTEGER, " +
    "TOTAL INTEGER)";
    Statement stmt;
    try {
    System.out.println("shabeer1");
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    System.out.println("shabeer2");
    } catch(java.lang.Exception e) {
    System.out.println("shabeer3");
    System.err.print("ClassNotFoundException: ");
    System.out.println("shabeer4");
    System.err.println(e.getMessage());
    try {
    System.out.println("shabeer55");
    con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:shabeerjdbc", "system", "mehar");
    System.out.println("shabeer6");
    stmt = con.createStatement();
    System.out.println("shabeer7");
    stmt.executeUpdate(createString);
    stmt.close();
    con.close();
    } catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    the run time error is ......
    C:\JavaPractice>java ShabeerJdbc
    shabeer1
    shabeer2
    shabeer55
    Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/Savepoint
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
    va:468)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at ShabeerJdbc.main(ShabeerJdbc.java:38)
    ****************************************

    HI Deriderj, thanks for your response, well I have changed the Datasourse name to SID which is "Imran" and still it is not working....do I need to download anymore driver or whether they be bundled with the ojdbc.jar, please advice me. What if I want to use another driver as you mentioned...not to use thin: what other drivers will be available for the Oracle9.2.0.1.0 please advice me, thanks a lot
    My SID name is "Imran"
    listening port is is 1521
    odbc datasource name is "shabeerjdbc"
    I'm a very biginner and I'm facing too much problem, please help me. Well I have got Oracle9.2.0.1.0 loaded as the database and soon after I intstalled it I have copied ojdbc14.jar into my java classpath and I'm trying to connect to this data base. I dont know what driver I should use, neither I downloaded any. I'm just mentioning thin: in my URL. But It is giving error, can u please tell me what driver should I mention in the URL, and why I'm getting this error, Here is the code that is compiling without errors.
    import java.sql.*;
    public class ShabeerJdbc {
    public static void main(String args[]) {
    Connection con;
    String createString;
    createString = "create table COFFEES " +
    "(COF_NAME VARCHAR(32), " +
    "SUP_ID INTEGER, " +
    "PRICE FLOAT, " +
    "SALES INTEGER, " +
    "TOTAL INTEGER)";
    Statement stmt;
    try {
         System.out.println("shabeer1");
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
         System.out.println("shabeer2");
    } catch(java.lang.Exception e) {
         System.out.println("shabeer3");
    System.err.print("ClassNotFoundException: ");
         System.out.println("shabeer4");
    System.err.println(e.getMessage());
    try {
         System.out.println("shabeer55");
    con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:Imran", "system", "mehar");
         System.out.println("shabeer6");
         stmt = con.createStatement();
         System.out.println("shabeer7");
         stmt.executeUpdate(createString);
    stmt.close();
    con.close();
    } catch(SQLException ex) {
    System.err.println("Sql Exception" + ex.getMessage());
    ************The runtime Error it is giving is *********************
    C:\JavaPractice>java ShabeerJdbc
    shabeer1
    shabeer2
    shabeer55
    Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/Savepoint
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
    va:468)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at ShabeerJdbc.main(ShabeerJdbc.java:38)
    ***************************** please help me....

  • What am I doing wrong on this SQL file???

    Here is the file I have been working on all night and keep getting error messages incuding errors:
    line 8: name already used by an existing constraint
    line 10: missing right perenthesis (what am I missing?)
    line 1: name already used by an existing object
    line 5: invalid identifier
    Only one table created
    Thanks in advance because I am so very new to this stuff its 4:36AM and I have not gone to bed yet.
    Canaan
    create table game
    (game_id number(5) not null,
    game_title varchar2(35),
    version char(5),
    genre char(10),
    platform char(11),
    publisher char(15),
    constraint pk_game primary key (game_id));
    create table customer
    (cust_id number(9) not null,
    first_name varchar2(30),
    last_name varchar2(30),
    phone_no char(10),
    st_address varchar2(50),
    zip_code char(5),
    city varchar2(20),
    state char(2)     
    contact varchar2(40),
    constraint pk_cust primary key (cust_id)
    constraint fk_account foreign key (fk_acc_no) references account
    create table cust_rental
    (cust_id number(9) not null,
    Date_Rented date not null,
    Date_Returned date,
    constraint pk_cust primary key (cust_id)
    create table game_rental
    (game_id number(5) not null,
    Date_Rented date not null,
    Date_Returned date,
    constraint pk_cust primary key (cust_id)
    create table account
    (acc_no number(7) not null,
    charges number(10),
    acct_change number(10),
    constraint pk_acc primary key (acc_no)
    Message was edited by:
    Canaan639

    in oracle constraints are a separate object in itself. and you cannot have 2 different objects with the same name.
    in your first create table statement you have given the name for the primary key constraint as pk_cust. and the same name is given in the second create table statement also, which is causing the error.
    give unique names for each constraint.

  • What am I doing wrong with this simple array?

    I have an array that I need to add single characters to slowly.
    So the array is wordToCheck and I have some "drop places" to check and see if a letter has been "dropped off." Each drop point is assigned an index and I just want to add the letter to the proper index of the array so that I can push it into a string.
    This is my code:
    wordToCheck[currentBlank.register] = currentLetter.letter.toLowerCase();
    So you can see that if "A" was dropped at the blank spot with the register 2 it would return "- - A".
    The problem is that it's deleting it every time I add a letter. So if I put "A" in register 2 and then "M" in register 3 it returns "- - - M".
    How do I get it to not override itself each time?

    I tried making it an object but I guess I'm confused how that is supposed to work.
    When I tried to parse my array to a string it had a bunch of ","'s in it. So if I got it to be myArray["a" "b" "c"] it returns the string "a,b,c" instead of "abc."
    Why is that? Would using an object fix it? How is using an object different than using an array?
    I've read dozens of forums on this and I just can't figure out the difference except that in an object you are allowed to use a letter as the reference instead of a number.

  • What is wrong with this class? Please help

    I'm trying to sort a dynamically created JComboBox into Alphabetical order. However, the class below is the result of my coding and there is a problem. the code can sort only two(2) item in the JComboBox and no more which is wrong. I do not know where i'm going wrong in the selectionSort(JComboBox cmb) method. the getLargest(JComboBox cmb) method works perfectly because i have tried it. Can somebody please take a look at my codes and help me modify it.
    Thanks
    James
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class SortCombo extends JFrame implements ActionListener{
    JButton btnAdd, btnSort;
    JComboBox cmbItems;
    JTextField text1;
    public SortCombo(){
    super("Sorting Demo");
    this.getContentPane().setLayout(new GridLayout(4,1));
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    btnAdd = new JButton("Add Item to Combo Box");
    btnSort = new JButton("Sort Items in ComboBox");
    text1 = new JTextField(20);
    cmbItems = new JComboBox();
    btnAdd.addActionListener(this);
    btnSort.addActionListener(this);
    this.getContentPane().add(cmbItems);
    this.getContentPane().add(text1);
    this.getContentPane().add(btnAdd);
    this.getContentPane().add(btnSort);
    this.pack();
    this.show();
    public void actionPerformed(ActionEvent e){
    if(e.getSource() == btnAdd){
    String s = text1.getText();
    if (!s.equals("") && !isDuplicate(s,cmbItems))
    cmbItems.addItem(text1.getText());
    }else if(e.getSource() == btnSort){
    selectionSort(cmbItems);
    // int i = getLargest(cmbItems);
    // System.out.println(i);
    public boolean isDuplicate(String stationName, JComboBox cmb){
    int j = cmb.getItemCount();
    boolean result = false;
    for (int i = 0; i < j; i++){
    String s = (String)cmb.getItemAt(i);
    if (stationName.trim().equalsIgnoreCase(s.trim()))
    result = true;
    return result;
    public int getLargest(JComboBox cmb){
    int indexSoFar = 0;
    int size = cmb.getItemCount();
    for(int currIndex = 1; currIndex < size; currIndex++){
    String strSoFar = (String)cmb.getItemAt(indexSoFar);
    String currStr = (String)cmb.getItemAt(currIndex);
    char charSoFar = strSoFar.charAt(0); charSoFar = Character.toUpperCase(charSoFar);
    char currChar = currStr.charAt(0); currChar = Character.toUpperCase(currChar);
    if(currChar > charSoFar){
    indexSoFar = currIndex;
    return indexSoFar;
    public void selectionSort(JComboBox cmb){
    int n = cmb.getItemCount();
    for (int last = n-1; last >=1; last--){
    int largest = getLargest(cmb);
    String temp = (String)cmb.getItemAt(largest);
    String temp2 = (String)cmb.getItemAt(last);
    cmb.removeItemAt(largest);
    cmb.insertItemAt(temp2,largest);
    cmb.removeItemAt(last);
    cmb.insertItemAt(temp,last);
    public static void main(String[] args){
    new SortCombo();
    }

    I beleive what is wrong is that your getLargest method returns the largest to your selection sort.The selectionSort places the largest at the end.On the next iteration it finds the largest again. this time at the end where you put it.Now it just does the same thing over again placing the same item at the end until the loop runs out.What you are left with is only one item it the right spot(sometimes 2).I could not get it to work the way you had it here so I tried a rewrite.It seems to work ok but it won't sort two words that start with the same letter properly.You may have to insert an algorithm to fix this.I got rid of the getLargest method and did everything in the selectionSort method.I used what I think is called a bubble sort but I'm not sure.
    I hope this is what you were looking for:)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class SortCombo extends JFrame implements ActionListener{
         JButton btnAdd, btnSort;
         JComboBox cmbItems;
         JTextField text1;
         public SortCombo(){
              super("Sorting Demo");
              getContentPane().setLayout(new GridLayout(4,1));
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              btnAdd = new JButton("Add Item to Combo Box");
              btnSort = new JButton("Sort Items in ComboBox");
              text1 = new JTextField(20);
              cmbItems = new JComboBox();
              btnAdd.addActionListener(this);
              btnSort.addActionListener(this);
              Container pane = getContentPane();
              pane.add(cmbItems);
              pane.add(text1);
              pane.add(btnAdd);
              pane.add(btnSort);
              pack();
              show();
         public void actionPerformed(ActionEvent e){
              if(e.getSource() == btnAdd){
              String s = text1.getText();
              if (!s.equals("") && !isDuplicate(s,cmbItems))
              cmbItems.addItem(text1.getText());
              }else if(e.getSource() == btnSort){
              selectionSort(cmbItems);
         public boolean isDuplicate(String stationName, JComboBox cmb){
              int j = cmb.getItemCount();
              boolean result = false;
              for (int i = 0; i < j; i++){
                   String s = (String)cmb.getItemAt(i);
                   if (stationName.trim().equalsIgnoreCase(s.trim()))
                   result = true;
              return result;
         public void selectionSort(JComboBox cmb){
              int count = cmb.getItemCount();
              for(int start = 0;start < count;start++){
                   for(int x = start;x < count-1;x++){
                        String first = (String)cmb.getItemAt(start);
                        String next = (String)cmb.getItemAt(x+1);
                        char charFirst = first.charAt(0);
                               charFirst = Character.toUpperCase(charFirst);
                        char charNext = next.charAt(0);
                        charNext = Character.toUpperCase(charNext);
                             if(charFirst > charNext){
                                  String temp  = (String)cmb.getItemAt(start);
                                  String temp2 = (String)cmb.getItemAt(x+1);
                                  cmb.removeItemAt(start);
                                  cmb.insertItemAt(temp2,start);
                                  cmb.removeItemAt(x+1);
                                  cmb.insertItemAt(temp,x+1);
         public static void main(String[] args){
              new SortCombo();
    }p.s.(I removed the "this" references from your constructor when I rewrote it because they are implied anyway)
    [email protected]

  • What could possibly be wrong with this Ipod? Major help needed

    I got my girlfriend a Nano for christmas, the 2gb, she bought a case, said she never did anything wrong with it. I let her install the Itunes and such by herself on her computer and magically the next day the **** Ipod is almost completely dead.
    It's been a week and I've just now got time to work on it, but when I first heard something was wrong with it whenever we plugged the Ipod in it would show the Apple logo and then a battery with the lightning symbol to it's left. I read I should let the battery drain, then charge it, did that, I am trying to reinstall Itunes on my ocmputer but doesn't even seem to see the **** Ipod.
    The Ipod doesn't even turn on and is making a pretty bad buzzing noise, absolutely nothing happens, computer doesn't see it, it doesn't turn on, it's just overall broke and I don't want to send it back to apple and pay the full retail price to get it fixed.

    Same thing happened with a friend of mines Nano. The unit is defective. Check your warranty. Hopefully she registered it so that you qualify to have it replaced. Bummer!
    ibook   Mac OS X (10.4.4)   Windows

  • What is wrong with this code? please help

    Hello,
    Please pardon if you find my question too simple. I have the following
    code
    <form method=get action="page1.jsp">
    <input type=hidden name=Id value="<%= rs.getInt("id")%>" >
    <input type=hidden name=Title value="<%= rs.getString("title") %>" >
    <input type=hidden name=Price value="<%= rs.getDouble("price")%>" >
    <input type=submit name=operation value="Add">
    </form>
    i think they may be a problem here but i don't really know where .
    please could someone help me?
    Thank you.

    <%@page language = "java" import = "java.sql.*,java.lang.String"%>
    <html>
    <jsp:useBean id="userr" class="temp.Modifier" scope="session"/>
    <jsp:setProperty name="userr" property="*"/>
    <link href="../style/bleed.css" type="text/css" rel="stylesheet">
    <BODY text="#ffffff" link="#00CC66">
    <form name="form1" method="post" action="change.jsp">
    <table class=Mtable width="81%" border="0">
    <%
    try {
    userr.getConnect();
    String sql_stmt = null;
    String stu_no = request.getParameter( "stu_no");//get the value that inputed by the operator
    String subj_no = request.getParameter("subj_no");
    String teacher = request.getParameter("teacher");
    String term = request.getParameter("term");
    String year = request.getParameter("year");
    String stu_class = request.getParameter("class");
    String stu_name = request.getParameter("stu_name");
    String subj_name = request.getParameter("subj_name");
    if(!stu_no.equals("")){
    out.println("Stu_no = " + stu_no + ";<br>");
    if(!subj_no.equals("")){
    out.println("subj_no = " + subj_no + ";<br>");
    if(!teacher.equals("")){
    out.println("teacher = " + teacher + ";<br>");
    if(!term.equals("")){
    out.println("term = " + term + ";<br>");
    if(!year.equals("")){
    out.println("Year = " + year + ";<br>");
    if(!stu_class.equals("")){
    out.println("Class = " + stu_class + ";<br>");
    if(!stu_name.equals("")){
    out.println("Stu_name = " + stu_name + ";<br>");
    if(!subj_name.equals("")){
    out.println("subj_name = " + subj_name + ";<br>");
    out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br>the role is :" + userr.getRole());
    %>
    <tr>
    <td width="11%"><div align="center"></div><font color="#3366ff">��  ��</font></div></td>
    <td width="11%"><div align="center"><font color="#3366ff">������</font></div></td>
    <td width="11%"><div align="center"><font color="#3366ff">��  ��</font></div></td>
    <td width="11%"><div align="center"><font color="#3366ff">��  ��</font></div></td>
    <td width="11%"><div align="center"><font color="#3366ff">��  ��</font></div></td>
    <td width="11%"><div align="center"><font color="#3366ff">��������</font></div></td>
    <td width="11%"><div align="center"><font color="#3366ff">��������</font></div></td>
    </tr>
    <%
    sql_stmt = userr.getSqlsentance_search(stu_no,subj_no,teacher, term, year, stu_class, stu_name, subj_name);
    ResultSet rrs = userr.stmt.executeQuery(sql_stmt);
    //check out how many content the resultset has
    int i = 1;
    for(i = 1;rrs.next();i++){
    userr.setArraylength(i);
    rrs.close();
    userr.stu_no =new int;//initialize these arrays
    userr.sub_no = new int[i];
    userr.score = new int[i];
    userr.year = new String[i];
    userr.teacher = new String[i];
    userr.term = new int[i];
    userr.status = new int[i];
    ResultSet rs = userr.stmt.executeQuery(sql_stmt);//start request the records from the DB
    for(i = 1 ;rs.next();i++){
    userr.setSub_no(i,rs.getInt(1));
    userr.setStu_no(i,rs.getInt(2));
    userr.setTerm(i,rs.getInt(3));
    userr.setYear(i,rs.getString(4));
    userr.setTeacher(i,rs.getString(5));
    userr.setStatus(i,rs.getInt(6));
    userr.setScore(i,rs.getInt(7));
    %>
    <tr>
    <td><font color="#3366ff"><%out.println(userr.getStu_no(i));%></font></td>
    <td><font color="#3366ff"><%out.println(userr.getRole());%></font></td>
    <%
    if(userr.getRole().equals("admin")){
    %>
    <td><input class=textfielda type="text" size = 11 name=<%out.println("score_changed"+i);%>size = 10 value = <%=userr.getScore(i)%>></td>
    <td><input class=textfielda type="text" size = 11 name=<%out.println("term_changed"+i);%>size = 10 value = <%=userr.getTerm(i)%>></td>
    <td><input class=textfielda type="text" size = 11 name=<%out.println("year_changed"+i);%>size = 10 value = <%=userr.getYear(i)%>></td>
    <td><input class=textfielda type="text" size = 11 name=<%out.println("status_changed"+i);%>size = 10 value = <%=userr.getStatus(i)%>></td>
    <td><input class=textfielda type="text" size = 11 name=<%out.println("teacher_changed"+i);%>size = 10 value = <%=userr.getTeacher(i)%>></td>
    </tr>
    <%
    }else if(userr.getRole().equals("opera")){
    if(userr.getScore(i) == 0){
    %>
    <td><input class=textfielda type="text" size = 11 name=<%out.println("score_changed"+i);%>size = 10 value = <%=userr.getScore(i)%>></td>
    <%
    }else{
    %>
    <td><%out.println(userr.getScore(i));%></td>
    <%
    %>
    <td><%out.println(userr.getTerm(i));%></td>
    <td><%out.println(userr.getYear(i));%> </td>
    <td><%out.println(userr.getStatus(i));%> </td>
    <td><%out.println(userr.getTeacher(i));%></td>
    </tr>
    <%
    }else{
    out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!norole!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    rs.close();
    if(!userr.getClose()){
    out.println("!!!!!!!!!!!!!!!!!!!DB close failed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    } catch (SQLException e) {
    e.printStackTrace();
    %>
    </table>
    <input class=botton name="button" type=submit value=" �� �� ">
    </form>
    </body>
    </html>
    I pardon you because I was worse when began, <%= %> instead of "<%= %>"

  • My iPod is stuck on "waiting for changes to be applied" when I am syncing it. I can't sync my iPod what can I do to fix this problem? Please help.

    I need HELP

    "Waiting for changes to be applied": Apple Support Communities
    Did you restore the iPod? Including restoring to factory settings/new iPod.
    Did you:
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    or              
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    Have you tried on another computer?

  • I am trying to re-install ITunes on Windows XP.  When I do this, all I get is the "save" or "cancel" message, not "run".  What am I doing wrong?

    Because of  getting the message that I had to uninstall Apple Mobile Support Device and ITunes, in order to get my ITunes to be usable, I did that.  While trying to re-install ITunes, all I get on the message is the choice to "save" or "cancel".  It will not give me the "run" choice.  What am I doing wrong?  This should be fairly simple to reinstall, I thought.
    I am running Windows XP on a desktop computer using Firefox.

    Thanks so much.  This definitely worked.  I'm sorry I did  not think of using IE.  I use Foxfire exclusively so seldom even think of IE as an alternative.

  • My Top Rated songs, when I synch my iP4S - comes up with an error message saying it can't find all the songs. When I check, library has songs listed but with a "!" bubble next to them. When I click on them they play. What am I doing wrong?

    When synching, itcomes up with an error message saying it can't find all the songs. When I check, library has songs listed but with a "!" bubble next to them. When I click on them they play. What am I doing wrong? This happens every time so I click them and it sorts them (boring with 200 odd). How can I prevent this?

    Once you successfully add you iTunes library to iTunes Match, you go to Settings>iTunes & App Store on your iOS device and turn on iTunes Match.  Your iTunes Match library will then appear on your iOS device.

Maybe you are looking for