Adding elemants of an array together

I have an array storing numbers. I have a combo box with choices in it, when a choice is made a number from the array is displayed in a text field. I want to add the numbers together that have been selected. I created a variable called total and used the code.
total = code + code;
i get the error, operator + cannot be applied to int[],int[]
any suggestions please.

I have implemented the loop that the nice dr meant. The program compiles ok and seems to work except the output is not being displayed and when i click the sum total button(but4) i get the following message:
--------------------Configuration: MySuperMktPro - JDK version 1.6.0_01 <Default> - <Default>--------------------
Starting My Supermarket Project...
Action performed from: comboBoxChanged
Action performed from: Buy
Action performed from: comboBoxChanged
Action performed from: Buy
Action performed from: Sum Total
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at CheckoutView.actionPerformed(MySuperMktPro.java:213)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
I will post my full code as i am now absolutely out of ideas and i need to do so much more to this program.
Thankyou
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Observer;  //new
import java.util.Observable;//new
import javax.swing.BorderFactory;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
public class MySuperMktPro {
    public MySuperMktPro() {
        CheckoutView Check1 = new CheckoutView(1,0,0);
        CheckoutView Check2 = new CheckoutView(2,300,0);
        CheckoutView Check3 = new CheckoutView(3,600,0);
        CheckoutView Check4 = new CheckoutView(4,0,350);
        CheckoutView Check5 = new CheckoutView(5,600,350);
        OfficeView off111 = new OfficeView();
    public static void main(String[] args) {
        System.out.println("Starting My Supermarket Project...");
        MySuperMktPro startup = new MySuperMktPro();
class CheckoutView implements  ActionListener {
    private OfficeView off1;
    private JFrame chk1;
    private Container cont1;
    private Dimension screensize,tempDim;
    private JPanel pan1,pan2,pan3,pan4,pan5;
    private JButton buyBut,prodCode;
    private JButton purchase,cashBack,manual,remove,disCo;
    private JButton but1,but2,finaLi1,but4,but5,but6;
    private JTextArea tArea1,tArea2;
    private JTextField tf1,tf2,tf3,list2;
    private JComboBox prodList;
    private JLabel lab1,lab2,lab3,lab4,lab5,lab6,lab7;
    private int checkoutID; //New private int for all methods of this class
    private int passedX,passedY,counter;
    private String prods[];
    private JButton rb1,rb2,rb3,rb4;
    private double price[],total; // not used
    private int code[];
    public CheckoutView(int passedInteger, int passedX, int passedY) {
        checkoutID = passedInteger; //Store the int passed into the method
        this.passedX = passedX;
        this.passedY = passedY;
        drawCheckoutGui();
    public void drawCheckoutGui() {
        prods= new String[]{"Products","Beans", "Eggs", "bread", "Jam", "Butter",
                "Cream", "Sugar", "Peas", "Milk", "Bacon", "Spaghetti",
                "Corn Flakes", "Carrots", "Oranges", "Bananas", "Snickers",
                "Wine", "Beer", "Lager", "Cheese"};
        code = new int [21];
        for(int b = 0; b < code.length; b++) {
            code[b] = b+1;
        price = new double[]{0.0,0.65, 0.84, 0.98, 0.75, 0.45, 0.65,
                1.78, 1.14, 0.98, 0.99, 0.98, 0.65, 1.69, 2.99,
                0.99, 2.68, 0.89, 5.99, .54, 2.99};
                for(int i=0; i<price.length; i++)
                     total=total+price;
screensize = Toolkit.getDefaultToolkit().getScreenSize();
chk1 = new JFrame();
chk1.setTitle("Checkout #" + checkoutID); //Use the new stored int
chk1.setSize(300,350);
chk1.setLocation(passedX,passedY);
chk1.setLayout(new GridLayout(5,1));
//chk1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cont1 = chk1.getContentPane();
//chk1.setLayout(new BorderLayout());
pan1 = new JPanel();
pan2 = new JPanel();
pan3 = new JPanel();
pan4 = new JPanel();
pan5 = new JPanel();
//panel 1
pan1.setLayout(new FlowLayout());
pan1.setBackground(Color.black);
prodList = new JComboBox(prods);
prodList.setMaximumRowCount(2);
prodList.addActionListener(this);
but1 = new JButton("Buy");
but1.addActionListener(this);
lab1 = new JLabel("Products");
lab1.setForeground(Color.white);
lab1.setBorder(BorderFactory.createLineBorder(Color.white));
pan1.add(lab1);
pan1.add(prodList);
pan1.add(but1);
//panel 2
pan2 = new JPanel();
pan2.setLayout(new BorderLayout());
pan2.setBackground(Color.black);
lab3 = new JLabel(" Enter Product Code");
lab3.setForeground(Color.white);
tArea2 = new JTextArea(8,10);
tArea2.setBorder(BorderFactory.createLineBorder(Color.white));
lab5 = new JLabel(" Tesco's ");
lab5.setForeground(Color.white);
lab5.setBorder(BorderFactory.createLineBorder(Color.white));
lab6 = new JLabel("Checkout");
lab6.setForeground(Color.white);
lab6.setBorder(BorderFactory.createLineBorder(Color.white));
lab7 = new JLabel("Your preferred payment method is ");
lab7.setForeground(Color.cyan);
//lab7.setBorder(BorderFactory.createLineBorder(Color.white));
pan2.add(lab7,"North");
pan2.add(lab6,"East");
pan2.add(tArea2,"Center");
pan2.add(lab5,"West");
pan2.add(lab3,"South");
// panel 3
pan3 = new JPanel();
pan3.setLayout(new FlowLayout());
pan3.setBackground(Color.black);
manual = new JButton("Manual");
manual.addActionListener(this);
manual.setBorder(BorderFactory.createLineBorder(Color.white));
remove = new JButton("Remove");
remove.addActionListener(this);
remove.setBorder(BorderFactory.createLineBorder(Color.white));
tf1 = new JTextField(5);
pan3.add(manual);
pan3.add(tf1);
pan3.add(remove);
// panel 4
pan4 = new JPanel();
pan4.setLayout(new FlowLayout());
pan4.setBackground(Color.black);
finaLi1 = new JButton("Finalise");
// finaLi1.addActionListener(this);
cashBack = new JButton("Cashback");
JTextField list2 = new JTextField(5);
but4 = new JButton(" Sum Total");
but4.addActionListener(this);
but4.setBorder(BorderFactory.createLineBorder(Color.white));
cashBack.setBorder(BorderFactory.createLineBorder(Color.white));
pan4.add(cashBack);
pan4.add(list2);
pan4.add(but4);
// panel 5
pan5 = new JPanel();
pan5.setLayout(new GridLayout(2,3));
pan5.setBackground(Color.black);
disCo = new JButton("Discount");
disCo.addActionListener(this);
disCo.setBorder(BorderFactory.createLineBorder(Color.black));
but6 = new JButton("Finalise");
but6.addActionListener(this);
but6.setBorder(BorderFactory.createLineBorder(Color.black));
rb1 = new JButton("Cash");
rb1.addActionListener(this);
rb1.setBorder(BorderFactory.createLineBorder(Color.black));
rb2 = new JButton("Card");
rb2.addActionListener(this);
rb2.setBorder(BorderFactory.createLineBorder(Color.black));
rb3 = new JButton("Cheque");
rb3.addActionListener(this);
rb3.setBorder(BorderFactory.createLineBorder(Color.black));
rb4 = new JButton("Voucher");
rb4.addActionListener(this);
rb4.setBorder(BorderFactory.createLineBorder(Color.black));
pan5.add(disCo);
pan5.add(but6);
pan5.add(rb1);
pan5.add(rb2);
pan5.add(rb3);
pan5.add(rb4);
//add the panels to the container
cont1.add(pan1);
cont1.add(pan4);
cont1.add(pan2);
cont1.add(pan3);
cont1.add(pan5);
chk1.setContentPane(cont1);
chk1.setVisible(true);
public void actionPerformed(ActionEvent e) {
int index = prodList.getSelectedIndex();
if(counter==0)
setTextMethod(index);
counter =1;
if(counter==1)
Object source = e.getActionCommand();
System.out.println("Action performed from: " + source);
if (source.toString() == "Buy") {
setTextMethod(index);
if(e.getSource()==but4)
     list2.setText("?" + total);
public void setTextMethod(int index)
tArea2.setText(prods[index]
+ " ; Price is ?" + price[index]);
tf1.setText(""+code[index]);
class OfficeView {
private OfficeView off111;
private JFrame offMod1;
private JPanel pane1;
private JButton refill;
private Container cont11;
private Dimension screensize;
private JTextField tf11,tf12;
public OfficeView() {
drawOfficeGUI();
public void drawOfficeGUI() {
screensize = Toolkit.getDefaultToolkit().getScreenSize();
offMod1 = new JFrame("Office Control");
int frameWidth = 300;
int frameHeight = 250;
offMod1.setSize(frameWidth,frameHeight);
offMod1.setLocation(300,350);
offMod1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cont11 = offMod1.getContentPane();
pane1 = new JPanel();
pane1.setBackground(Color.cyan);
refill = new JButton("Refill");
tf11 = new JTextField(25);
tf12 = new JTextField(25);
pane1.add(tf11);
pane1.add(refill);
pane1.add(tf12);
cont11.add(pane1);
offMod1.setContentPane(cont11);
offMod1.setVisible(true);

Similar Messages

  • Adding two arrays together

    I am trying to add two arrays together, it does not seem as if the arrays are broken up into more than one index. I have attached my code. If the array is broken up into indexes I would like to add each corresponding index, but I think the array is all in just one index and if so I was wondering how would I break it into indexes. Thanks
    Attachments:
    SimpleTest x1.vi ‏336 KB

    Since you are "transposing" and later work with 1D array, I assume you want to read the first column of the file.
    Why do you need a sequence stacked 5 frames deep, local variables, 5 instances of the same boolean diagram constant and 5 path conststants of which some are identical??? None of this is needed!
    All you need is probably something along the lines of the following picture, which probably does something similar to what you want. Still, we are probably still jumping through too many flaming hoops. Note that the execution order is uniquely defined by the wiring alone, no sequence needed! Can you take a step back and tell us what you are actually trying to achieve with all this? How many columns are in the file? Only one?
    Message Edited by altenbach on 01-27-2009 04:02 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    AddArraysFromFile.png ‏13 KB

  • How to join two arrays together?

    I have the following type
        type TVarcharArr is table of varchar(4000) index by binary_integer;I have a procedure that passes in two separate arrays as:
        p_account_number                 in TVarcharArr,
        p_product_system_code          in TVarcharArrThese arrays are related (they will have the same number of elements), the contents would be as follows:
        Account Number    Product System Code
        123                      ABC
        456                      DEF
        789                      GHII can use TABLE(CAST to turn each of these arrays into a table, but how do I join these two arrays together so that they become a single table with two columns? Or if I CAST them as TABLEs, how can I join these two tables together - is there some way of using the index to facilitate the join?
    Cheers
    Richard

    You are right, I do need to convert the arrays first to use TABLE(CAST, and I do have my concerns about the use of rownum.
    Here's the test case I built to test what I'm doing, incorporating the rownum solution:
    declare
        type TVarcharArr is table of varchar(4000) index by binary_integer;
        v_arr   TVarcharArr;
        v_tab  tchartab := tchartab();
        v_arr2   TVarcharArr;
        v_tab2  tchartab := tchartab();   
    begin
        v_arr(1) := 'ABC';
        v_arr(2) := 'DEF';
        v_arr(3) := 'GHI';
        v_arr2(1) := '123';
        v_arr2(2) := '456';
        v_arr2(3) := '789';   
        v_tab.extend(v_arr.Count);   
        for i in v_arr.first .. v_arr.last
        loop
            v_tab(i) := v_arr(i);
        end loop;   
        v_tab2.extend(v_arr2.Count);   
        for i in v_arr2.first .. v_arr2.last
        loop
            v_tab2(i) := v_arr2(i);
        end loop;   
        for rec in (with w_acct as
                    (select rownum rn, a.column_value acol
                    from table(cast(v_tab as tchartab)) a
                         w_prod as
                    (select rownum rn, b.column_value bcol
                    from table(cast(v_tab2 as tchartab)) b
                    select acol,bcol
                    from w_acct a,
                         w_prod b
                    where a.rn = b.rn) loop
            DBMS_OUTPUT.PUT_LINE ( 'rec = ' || rec.acol || '|'|| rec.bcol );
            null;
        end loop;
    end;It does return the correct result - but can it be trusted to be consistent - does the rownum in an array suffer the same problems as the rownum from a regular select? I'm guessing it's too risky to find out.
    In essence, I'm getting two arrays and I'm trying to join them together so that I can CAST them as a table. (And I know the real question is why isn't it just one array of records with two elements - but sometimes you have to work with what you're given)

  • Adding to a string array

    hi,
    seem to be having some trouble adding to a string array of names
    im trying to take a name from a text field and add it to the array
    help would be much appreciated
    this is the string array
    String[] AuthorString =     {"John Grisham","Agatha Christie","Nick Coleman","Scott Sinclair"};which is loaded into
    public void fillArrayList(){
         for(int a=0; a<AuthorString.length; a++) {
         AuthorList.add((String)AuthorString[a]);
                         }i then try and add to this using
    public void AddMember(){
         String temp = (String)AuthorField.getSelectedItem();
         for(int a=0; a>AuthorList.size(); a++) {
         String temp = (String)AuhtorList.get(a);
              AuthorString .addItem(temp);
          }can anyone see any problem with this, or am i doing it the completely wrong way

    Also, your "for" loop's test condition is backwards. It should use "less than":
    a < AuthorList.size()

  • Exchange 2013 mailbox added to the CAS array

    We are upgrading to Exchange 2013 from Exchange 2010. Following the development guide, we have
    installed the first mailbox server in the Exchange 2010 environment which has 3 Exchange 2010 CAS server
    in the array. When installing the mailbox role, we did not choose the client access role but after
    the installation we can see that the Exchange 2013 Mailbox server is added to the CAS array and yet
    we did not choose the client access role. How does this happen, and to proceed ?

    I see the same thing in my lab:
    Get-ClientAccessArray | FL
    RunspaceId        : 16b992b3-270f-4ae1-a3c3-fa9e2ea73d69
    ExchangeLegacyDN  : /o=Wingtiptoys/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=Ou
                        tlook.wingtiptoys.ca
    Fqdn              : Outlook.wingtiptoys.ca
    Site              : wingtiptoys.ca/Configuration/Sites/Default-First-Site-Name
    SiteName          : Default-First-Site-Name
    Members           : {EXCH-2010, EXCH-2013}
    AdminDisplayName  :
    ExchangeVersion   : 0.1 (8.0.535.0)
    Name              : Outlook.wingtiptoys.ca
    DistinguishedName : CN=Outlook.wingtiptoys.ca,CN=Arrays,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administr
                        ative Groups,CN=Wingtiptoys,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=wingtiptoys,DC=ca
    Identity          : Outlook.wingtiptoys.ca
    Guid              : 27968af1-1624-4ff3-85c8-e38e68183afe
    ObjectCategory    : wingtiptoys.ca/Configuration/Schema/ms-Exch-Client-Access-Array-2
    ObjectClass       : {top, server, msExchExchangeServer, msExchClientAccessArray}
    WhenChanged       : 4/12/2014 12:51:18 PM
    WhenCreated       : 4/12/2014 12:51:18 PM
    WhenChangedUTC    : 4/12/2014 7:51:18 PM
    WhenCreatedUTC    : 4/12/2014 7:51:18 PM
    OrganizationId    :
    OriginatingServer : DC-1.wingtiptoys.ca
    IsValid           : True
    Cheers,
    Rhoderick
    Microsoft Senior Exchange PFE
    Blog:
    http://blogs.technet.com/rmilne 
    Twitter:   LinkedIn:
      Facebook:
      XING:
    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

  • Adding data to an array

    hi need help.. i need to add missing data for the array
    YY-Year
    MM-Month
    DD-Date
    mm-minutes
    ss-seconds
    Data  1YYMMDD mmss0 
    20.8 1090828 05050
    1.2   1090829 10150
    7.2   1090901 08400
    the above array is the data where i need to insert data for data til 090831
    as below
    Data  1YYMMDD mmss0 
    20.8 1090828 05050
    1.2   1090829 10150
    0      1090830 0
    0      1090831 0
    7.2   1090901 08400
    how to do this? and i need to check for every month is there data missing inbetween? Plz help
    Solved!
    Go to Solution.

    Yes.  You will need to iterate through your array.  Index out the current index and the index +1.  Translate the text into dates and use the date functions to determine if a date is missing.  If not, increase the index by 1 and repeat.  If a date is missing, insert a row and set the date to be the last date +1.  Repeat increasing your index which should make it the row you just added.

  • Finding objects in arrays, adding to a temp array and replace old with temp

    hi, I am currently modifying a hand analyser for a poker game. imagine a hand of a set of cards that can be from 5 up to whatever the game instructs, the analyser then has to match the hand to the rankings of best hands. so it has to map the hand to these possible besthands..
    Royal Flush (A,K,Q,J,10 of same suit)
    Straight flush(a running rank of same suit)
    4 of a kind(er... 4 of the same rank)
    full house(3 of a kind and a pair)
    flush(all same suit)
    straight(a running rank, A,2,3,4,5...,K)
    2 pair(a pair and a pair)
    1 pair(a pair)
    and a high Card(the highest card in a hand)
    the hand is sorted in ranks and suits to check for straights and flushes, and i have used a for loop to find any pairs, trips and quads for a hand. the problem i am having is the checking of two pairs. here is the loop i am using
    Hand temp = new Hand();//creates a temporary hand to place the matching cards into. hand is an array of cards.
          for (int i = 1; i < cards.size() - 1; i++) {//cards is the hand passed to be checked for two pairs
            if (cards.getCard(i).getRank() == cards.getCard(i + 1).getRank()) {
             /*checks if the card in i is the same as the next card, if true,
                then adds it to the temp hand.*/
              temp.addCard(cards.getCard(i));
              /*once the cards are passed to the temp hand,
                 it is removed from the cards hand.*/
              cards.removeCard(i);     
              temp.addCard(cards.getCard(i));
              cards.removeCard(i);
              System.out.println(temp + "check twopair");
              /*just a check to see if they are passed and removed from those hands
                 -- these work the first time around*/
              System.out.println(cards + "check remaining best hand");
            else if (temp.size() == 4) {
                /*if the temp hand as 4 cards, it means there are 2 pairs found,
                   it adds the next card in the cards hand as the kicker. since cards
                   is ranked by value, it will choose the highest card*/
              temp.addCard(cards.getCard(i));
    //a check to see if the card has been added to the hand
              System.out.println("adds the kicker to the 2 pair");
            if (temp.size() == 5) {
    //once the best cards have been dealt into temp, it is passed back to the hand, cards.
              kicker = (Card)temp.getCard(4);
              cards = temp;
              return true;
           /*if the check finds that there is no 2 pairs in the hands, the cards are set
              back to the original cards, and sorted by rank and passes over to the
              next test, which should be the check one pair*/
          cards = new Hand(originalCards);
          sortbyRank();
          return false;the loop finds the first pair alright, but coming around the second time, it doesnt seem to pick up on the second pair.
    in an example, consider a 7 card hand being passed to this analyser..
    3d, 7h, Ac, 3h, 6h, 7s, Kd. this gets sorted into ranks and become Ac, Kd, 7s, 7h, 6h, 3d, 3h. the first check would be the royal flush - lets ignore the way it works, and it fails anyway because the hand doesnt hold a royal flush, similarly, all the other tests will fail, from straight flush, 4 of a kind, full house, flush, straight, 3 of a kind and then we get to 2 pairs. in the first instance the loop will check Ac == K, it fails, and checks if the temp hand has 4, it fails and goes to i =2. it will check K to 7, fail and go to i = 3, 7h matches 7s, so puts that to temp, temp now equal 2, but not 4, so loops. this is where i messes up. it doesnt pick up the two pairs of 3s. any suggestions?

    I've never played poker so I had to look carefully at your question. This resulted in the following table. This suggests to me that any attempt at simplification will not be easy so I think I would have an analyser object with nine methods returning a boolean as to whether each test had been met. This seems a cleaner approach although it may be less efficient than your own.
                                                  Same   Same   Rank
                                                  Suit   Rank   Seq
    Royal Flush (A,K,Q,J,10 of same suit)           Y             Y
    Straight flush(a running rank of same suit)     Y             Y
    4 of a kind(er... 4 of the same rank)                  Y
    full house(3 of a kind and a pair)             0.5    0.5
    flush(all same suit)                            Y
    straight(a running rank, A,2,3,4,5...,K)                      Y
    2 pair(a pair and a pair)                              Y
    1 pair(a pair)                                         Y
    and a high Card(the highest card in a hand)

  • Is there a better way to add int arrays together?

    I'm working on a project that will add arrays of integer together...all element are nonnegative integers
    For example
    A = [0 1 2 3]
    I need to find an algorithm to find 2A= A + A, 3A = A+A+A....., hA = A +...A ( h times)
    For 2A, the result array will look like this
    2A = [ 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6]
    Then using Array.sort(2A) i will have 2A= [ 0 1 1 2 2 2 3 3 3 3 4 4 4 5 5 6].
    Lastly I will write another code to get rid of repetitions to get the desired array 2A = [ 0 1 2 3 4 5 6]
    public static int[] hA(int[] a, int h){
       // mon = null;
       //mon = MonitorFactory.start("myFirstMonitor");
           if (h==1) return a;
           if (h==2){          
                  int[] b = new int[(a.length)*(a.length)];
               int count = 0;
               int maxa = a.length,maxb=b.length;
               for (int i = 0 ; i < maxa; i++)
               for (int j=0 ; j <maxa; j++)
                 b[count]=a[i]+a[j];
                    count++;
                return b;
               else
               return hA(a,h-1);     
           }I still don't know how to write recursive code to get it to find 3A, 4A....hA....
    is there any better way to do this?

    sorry for not defining it better
    2A ={ a + a' | a,a' E A}
    that means for A = { 0 1 3} , 2A ={ 0 1 2 3 4 6}
    but to get to [ 0 1 2 3 4 6], i don't know of any better way to achieve it.
    Also to find 3A = { a+a'+a'' |a,a',a'' E A}
    that means for A = { 0 1 3} ,3A={ 0 1 2 3 4 5 6 7 9}
    the idea is simple but to put into java code is not...at least for me

  • Adding dynamically columns to array field

    hello..
    I am trying to create a window class with an ArrayField. The number of
    DataField s in the ArrayField s are known at run time.
    I created an nonWindow class (say Row )with an attribute FirstCol of type
    Textdata.
    I created a window class and using the window editor i created a datafield
    with
    name FirstCol which matches with the row class attribute.
    I made datafield into an arrayfield with properties, name = arfield and
    type = array of Row
    I created a datafield and named to TemplateField (used as a template for
    adding
    columns )
    On click of a button,I am able to add any number of DataField at run time
    to the ArrayField by any of the following two ways successfully.
    1) <TemplateField>.Parent = <arfield>;
    2)<arfield>.AddColumn(2,<TemplateField>);
    But i am failing both in adding data pragmatically to the added column and
    retrive data from the newly added field even after the field by the folling
    way
    <arfield>.children[2].Name='Column2';
    U can assume that all fields that are going to be added at run time are used
    to store string data.
    Please inform me if any one knows about this.
    Waiting for responance..
    Ramesh kumar reddy
    [email protected]
    PSI Data Syatems Ltd,
    Bangalore,
    INDIA.

    hello..
    I am trying to create a window class with an ArrayField. The number of
    DataField s in the ArrayField s are known at run time.
    I created an nonWindow class (say Row )with an attribute FirstCol of type
    Textdata.
    I created a window class and using the window editor i created a datafield
    with
    name FirstCol which matches with the row class attribute.
    I made datafield into an arrayfield with properties, name = arfield and
    type = array of Row
    I created a datafield and named to TemplateField (used as a template for
    adding
    columns )
    On click of a button,I am able to add any number of DataField at run time
    to the ArrayField by any of the following two ways successfully.
    1) <TemplateField>.Parent = <arfield>;
    2)<arfield>.AddColumn(2,<TemplateField>);
    But i am failing both in adding data pragmatically to the added column and
    retrive data from the newly added field even after the field by the folling
    way
    <arfield>.children[2].Name='Column2';
    U can assume that all fields that are going to be added at run time are used
    to store string data.
    Please inform me if any one knows about this.
    Waiting for responance..
    Ramesh kumar reddy
    [email protected]
    PSI Data Syatems Ltd,
    Bangalore,
    INDIA.

  • Adding data from an array to a table

    How can i add information from an array to a table via JDBC? I have tried:
    stmt.executeUpdate("INSERT INTO TEMP " + "VALUES (" + carData[0] + ", " + carData[1]);
    but i get the error:
    SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    Also, can i only add data to some columns of a row and not all?

    If your TEMP table has only two columns and both of
    them are of number
    types, and your array contains only numeric types
    (int[], long[] etc., it should not be a problem.
    If your table contains more than two columns (and the
    remaining columns are nullable) you need to list the
    column names in the insert statement. Check your table
    definition in the database and see SQL syntax for
    insert.
    If your columns are of string type, you need to
    enclose the values in quotes (alternatively, use
    PreparedStatement).I agree with this.
    Here is the syntax that he was talking about
    //if the values are numeric
    stmt.executeUpdate("INSERT INTO TEMP(<COLUMN NAME>,<COLUMN NAME>) "
    + "VALUES(" + carData[0] + "," + carData[1] + ")";
    //if the values are text
    stmt.executeUpdate("INSERT INTO TEMP(<COLUMN NAME>,<COLUMN NAME>) "
    + "VALUES('" + carData[0] + "','" + carData[1] + "')";
    Notice that the last part of your original query was incorrect. You forgot to put the bracket in quotes again.

  • Adding a javascript img array file to picture in dreamweaver

    Hi I am very new to Javascript but efficient in Dreamweaver. I use CS5 and a Macbook Pro. I'm trying to attach a Javascript file to a picture on my homepage. I wrote the code in text edit and saved it as an HTM file. When I open the file in Google Chrome, Safari or Firefox it works perfectly and the array displays all five pictures in a row. How do I attach this to dreamweaver? Also do I leave in the HTML tags in the javascript file? Here's how it looks when it plays right on a browser.
    <HTML>
    <HEAD>
    <TITLE>Please Work</TITLE>
    <SCRIPT>
    var imgArray = new Array(5);
    imgArray[0] = new Image;
    imgArray[0].src = "awesome.jpg";
    imgArray[1] = new Image;
    imgArray[1].src = "dadinforest.jpg";
    imgArray[2] = new Image;
    imgArray[2].src = "neatplant.jpg";
    imgArray[3] = new Image;
    imgArray[3].src = "greenlake.jpg";
    imgArray[4] = new Image;
    imgArray[4].src = "cattail.jpg";
    var index = 0;
    function cycle()
          document.banner.src = imgArray[index].src;
          index++;
          if (index == 5)
               index = 0;
          setTimeout("cycle()", 3000);
          return;
    </SCRIPT>
    </HEAD>
    <BODY onLoad="cycle()">
    <CENTER>
    <IMG NAME="banner" SRC="awesome.jpg">
    </CENTER>
    </BODY>
    </HTML>

    Kitty Collins3 wrote:
    I'm trying to attach a Javascript file to a picture on my homepage. I wrote the code in text edit and saved it as an HTM file. When I open the file in Google Chrome, Safari or Firefox it works perfectly and the array displays all five pictures in a row. How do I attach this to dreamweaver?
    What you have created is an HTML file with a block of JavaScript in the <head>. It's not a JavaScript file, so there's nothing to attach. Just put the <script> block in the <head> of the page where you want to use it, and make sure your image is named "banner".
    If you're just starting to learn JavaScript, you should be aware that JavaScript practices have changed radically in the past few years. Looking at the code you have written, it seems as though you are using an old book or an online script that was written many years ago. Several clues are the uppercase characters in the HTML tags, the <center> tag, the name attribute in the <img> tag, and the use of a string as the first argument to setTimeout().
    JavaScript can be quite difficult to master, so make sure you learn from a reliable, modern source. A book that I found very helpful is DOM Scripting by Jeremy Keith. A new edition of the book was published this week (http://friendsofed.com/book.html?isbn=9781430233893). I'm sure there are other good resources, but you should avoid anything written earlier than 2005.

  • Adding two 2-D Arrays to then save

    I am trying to build two 2-D arrays to then save as a spreadsheet file. This process happens in while loop and I need to enable indexing when I feed the wire out. When I do this I use the build array fucntion but then it creates a 3-D array which I cannot save.

    Ok. I've made an example that processes the whole file(s). Run the process file.vi, input a file pattern and select a directory of test files. Now you can click the process files button and it will produce files containing the results you wanted.
    In the example I have not included the option of selecting just a segment of the files. The files are named after their origin file, the name is not put into the file itself...and finally I assume that the files always contain complete sets (you can initialize an array to hold the results instead of reusing the incoming array to avoid this dependancy...).
    As you will see generating the result is quite simple, it's all done in the calculate VI. If you want to average across fil
    es as well (not just data within one and the same file) it will need modifications though...If you want to be able to select a sub-section of the file the easiest way to do it is to do it prior to feeding the array to the calculate VI...the most effective though would be to modify the logic of the calculation VI slightly so that it can work on a selection directly.
    If you sometimes need to be able to calculate the average and deviation of more values than the pairs, that's possible as well, but would require a modification of the calculation vi...
    Mads
    MTO
    Attachments:
    Process_files.zip ‏196 KB

  • Problems with adding something to an array

    I am trying to find out what I am doing wrong, I think I am way off...I am trying to take two different strings, compare the one to the other and see where the source is equal to the target at any place in the the source. Then I am to add that index to an array list, this is where I am having issues, after the AddArrayList() and putting the index of the match into the array. Please, I have been at this for a while...
    this is what eclipse tells me...
    Multiple markers at this line
    - Syntax error on tokens, Expression expected instead
    - Syntax error, insert "AssignmentOperator Expression" to complete Assignment
    - Syntax error, insert ";" to complete Statement
    - Syntax error on token "(", Expression expected after this token
    - The type of the expression must be an array type but it resolved to
    ArrayList<Integer>
    *Find all indices in <tt>source</tt> that are the start of a complete*
    match of <tt>target</tt>.
    *@param  source  != null, source.length() > 0*
    @param  target  != null, target.length() > 0
    *@return  an ArrayList that contains the indices in source that are the*
    start of a complete match of target. The indices are stored in
    *ascending order in the ArrayList.*
    public static ArrayList<Integer> matches(String source, String target) {
    // check preconditions
    assert (source != null) && (source.length() > 0)
    && (target != null) && (target.length() > 0): "matches: violation of precondition";
    ArrayList<Integer> result = new ArrayList<Integer>();
    int sLength=source.length();
    int tLength=target.length();
    int count=0;
    for(int x=0; x<sLength; x++ )
    if ((tLength+x)<(sLength))
    for (int y=0; y<tLength; y++)
    if(target.charAt(x+y)==source.charAt(x+y))
    if(y==tLength)
    AddArrayList();
    [ArrayList]<int>.add([x]);
    count++;
    return result;
    private static void AddArrayList() {
    ArrayList<Integer> result = new ArrayList<Integer>();
    int index = 0;
    result.add(index);Edited by: camdiggy on Sep 16, 2009 12:55 AM

    the problem i encounter is on if(y==tLength)
        public static ArrayList<Integer> matches(String source, String target) {
            // check preconditions
            assert (source != null) && (source.length() > 0)
                 && (target != null) && (target.length() > 0): "matches: violation of precondition";
            ArrayList<Integer> result = new ArrayList<Integer>();
            int sLength=source.length();
            int tLength=target.length();
            int count=0;
            for(int x=0; x<sLength; x++ )
                 if ((tLength+x)<(sLength))
                      for (int y=0; y<tLength; y++)
                           if(target.charAt(x+y)==source.charAt(x+y))
                                if(y==tLength)
                                     AddArrayList();
                                     [ArrayList]<int>.add([x]);
                                     count++;
            return result;
        private static void AddArrayList() {
             ArrayList<Integer> result = new ArrayList<Integer>();
             int index = 0;
             result.add(index);
    Edited by: camdiggy on Sep 16, 2009 1:12 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • "How would I add the rows of a 640 x 240 2D array together? I mean , the elements of row 1 to the element of row 2 and so on. I want to end up with a 1 d array of 640 elements in which each element is the sum of the other 240 elements in the rows."

    "For explaination , like this
    1 1 1 1 1 1 1 ....... to 640
    +2 2 2 2 2 2 2 .......
    +3 3 3 3 3 3 3 .......
    =6 6 6 6 6 6 6 ....... this is the final 1D array of summed elements."
    Appreciate the sample VI's but I can't open them ( I have Labview 5.01 )

    Here is Mikael solution, expanded to include rows and ready to use as a subVI. Now all is needed is the polymorphic version
    www.vartortech.com
    Attachments:
    Sum_rows_or_colums.vi ‏25 KB

  • Adding pictures into an Array?

    The following is a BlackJack Program my group and I made. So far, it seems to work and would likely net us a 100% when we hand it in. However, we wish to go that extra mile and add pictures, cards in particular, something that should obviously be in any card game! I've been fiddling around with ImageIcon and Image but I don't have a clue how to implement these or how to get them working correctly. Also, it would be best if the pictures could be loaded into an array, which would allow the program to function basically the same way with little editing.
    //Import various Java utilites critical to program function
    import java.awt.* ;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Random;
    import java.lang.String;
    public class BlackJackExtreme extends JFrame {  
      Random r = new Random();  //Assigning "r" to randomize
      int valueA;  //Numerical Value of player Cards
      int valueB;
      int valueC;
      int valueD;
      int valueE;
      int valueAC;  //Numerical Value of computer Cards
      int valueBC;
      int valueCC;
      int valueDC;
      int valueEC;
      int playerVal;  //Numerical total value of player cards
      int playerVal2;
      int playerValT;
      int compVal;  //Numerical total value of computer cards
      int compVal2;
      int compValT;
      int counter;  //A counter
      String playVal; //String value for Numerical total value of player cards
      String cVal;   //String value for Numerical total value of computer cards
      private JLabel YourCard;   //Initializing a title label
      private JLabel CCard;  //Initializing a title label
      private JLabel Total;   //Initializing a title label
      private JLabel CTotal;  //Initializing a title label
      private JLabel Win;   //Initializing a Win label
      private JLabel Lose;  //Initializing a Lose label
      private JLabel Bust;  //Initializing a Bust label
      private JButton Deal;   //Initializing a button
      private JButton Hit;   //Initializing a button
      private JButton Stand;   //Initializing a button
      private JButton Exit;   //Initializing a button
      private JTextArea TCompVal;     //Initializing textbox for computer values
      private JTextArea TotalVal;
      private JLabel CardOne;  //Initializing a label for player card 1
      private JLabel CardTwo;  //Initializing a label for player card 2
      private JLabel CardThree;  //Initializing a label for player card 3
      private JLabel CardFour;   //Initializing a label for player card 4
      private JLabel CardFive;   //Initializing a label for player card 5
      private JLabel CCardOne;   //Initializing a label for computer card 1
      private JLabel CCardTwo;   //Initializing a label for computer card 1
      private JLabel CCardThree;   //Initializing a label for computer card 1
      private JLabel CCardFour;   //Initializing a label for computer card 1
      private JLabel CCardFive;   //Initializing a label for computer card 1
      private JPanel contentPane;
      public BlackJackExtreme() {
        super();
        initializeComponent();     
        this.setVisible(true);
      private void initializeComponent() {   
        YourCard = new JLabel("These are your cards");
        CCard = new JLabel("These are the computers cards");
        Total = new JLabel("Your total is: ");
        CTotal = new JLabel("Computer total is: ");
        TCompVal = new JTextArea();  //Box for computer values
        TotalVal = new JTextArea();  //Box for player values
        Win = new JLabel("You win!");  //Label for a Win
        Lose = new JLabel("You lose!");  //Label for a Loss
        Bust = new JLabel("You both Bust!");  //Label for a Bust
        Deal = new JButton();  //Button
        Hit = new JButton();  //Button
        Stand = new JButton();  //Button
        Exit = new JButton();  //Button
        CardOne = new JLabel("");  //Label for Player Card 1
        CardTwo  = new JLabel("");  //Label for Player Card 2
        CardThree = new JLabel("");  //Label for Player Card 3
        CardFour = new JLabel("");  //Label for Player Card 4
        CardFive = new JLabel("");  //Label for Player Card 5
        CCardOne = new JLabel("");   //Label for Computer Card 1
        CCardTwo  = new JLabel("");  //Label for Computer Card 2
        CCardThree = new JLabel("");  //Label for Computer Card 3
        CCardFour = new JLabel("");  //Label for Computer Card 4
        CCardFive = new JLabel("");  //Label for Computer Card 5
        contentPane = (JPanel)this.getContentPane();
        //Assigns function and ability to the various buttons
        Deal.setText("Deal");
        Deal.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Deal_actionPerformed(e);
         Stand.setText("Stand");
        Stand.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Stand_actionPerformed(e);
            Exit.setText("Exit");
        Exit.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Exit_actionPerformed(e);
         Hit.setText("Hit");
        Hit.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Hit_actionPerformed(e);
        //Determines the arrangement of the various buttons, labels, and other GUI objects
        contentPane.setLayout(null);
        addComponent(contentPane, YourCard, 15,1,150,50);
        addComponent(contentPane, CCard, 325,1,200,50);
        addComponent(contentPane, Deal, 15,415,100,35);
        addComponent(contentPane, Hit, 125,415,100,35);
        addComponent(contentPane, Stand, 235 ,415,100,35);
        addComponent(contentPane, Exit, 435 ,415,100,35);
        addComponent(contentPane, CardOne, 25,35,50,50);
        addComponent(contentPane, CardTwo, 110,35,50,50);
        addComponent(contentPane, CardThree, 25,120,50,50);
        addComponent(contentPane, CardFour, 110,120,50,50);
        addComponent(contentPane, CardFive, 65,200,50,50);
        addComponent(contentPane, CCardOne, 350,35,50,50);
        addComponent(contentPane, CCardTwo, 450,35,50,50);
        addComponent(contentPane, CCardThree, 350,120,50,50);
        addComponent(contentPane, CCardFour, 450,120,50,50);
        addComponent(contentPane, CCardFive, 400,200,50,50);
        addComponent(contentPane, Win, 300,300,70,50);
        addComponent(contentPane, Lose, 300,300,70,50);
        addComponent(contentPane, Bust, 300,300,100,50);
        addComponent(contentPane, Total, 100,350,150,50);
        addComponent(contentPane, TotalVal, 200,365,25,25);
        addComponent(contentPane, CTotal, 300,365,150,25);
        addComponent(contentPane, TCompVal, 425,365,25,25);
        //Sets the "outcome" labels invisible on program execution
        Win.setVisible(false);
        Lose.setVisible(false);
        Bust.setVisible(false);
        //Determines size of program window
        this.setTitle("BlackJack");
        this.setLocation(new Point(220,185));
        this.setSize(new Dimension(555,500));
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
      private void addComponent(Container container, Component c, int x, int y, int width, int height){
        c.setBounds(x,y,width,height);
        container.add(c);
      //The DEAL button
      public void Deal_actionPerformed(ActionEvent e) {
        //Correctly resets the display after first round of use
        Hit.setVisible(true);
        Stand.setVisible(true);
        Win.setVisible(false);
        Lose.setVisible(false);
        Bust.setVisible(false);
        CardThree.setVisible(false);
        CardFour.setVisible(false);
        CardFive.setVisible(false);
        TotalVal.setText("");
        TCompVal.setText("");
        //Card Array - Values assigned to cards
        String[] cardnames = new String[15];
        cardnames[0] = "Error";
        cardnames[1] = "Error";
        cardnames[2] = "Two";
        cardnames[3] = "Three";
        cardnames[4] = "Four";
        cardnames[5] = "Five";
        cardnames[6] = "Six";
        cardnames[7] = "Seven";
        cardnames[8] = "Eight";
        cardnames[9] = "Nine";
        cardnames[10] = "Ten";
        cardnames[11] = "Jack";
        cardnames[12] = "Queen";
        cardnames[13] = "King";
        cardnames[14] = "Ace";
        //Randomize Card Values
        valueA = r.nextInt(13)+2;
        valueB = r.nextInt(13)+2;
        valueAC = r.nextInt(13)+2;
        valueBC = r.nextInt(13)+2;
        //Displays Card
        CardOne.setText(cardnames[valueA]);
        CardTwo.setText(cardnames[valueB]);
        CCardOne.setText(cardnames[valueAC]);
        CCardTwo.setText(cardnames[valueBC]);
        //Value Correction for Player Cards
        if (valueA == 11 || valueA == 12 || valueA == 13) {
          valueA = 10;  }
        if (valueA ==14){
          valueA = 11;    }
        if (valueB == 11 || valueB == 12 || valueB == 13) {
          valueB = 10;    }
        if (valueB ==14){
          valueB = 11;    }
        //Value Correction for Computer Cards
        if (valueAC == 11 || valueAC == 12 || valueAC == 13) {
          valueAC = 10;  }
        if (valueAC ==14){
          valueAC = 11;    }
        if (valueBC == 11 || valueBC == 12 || valueBC == 13) {
          valueBC = 10;    }
        if (valueBC ==14){
          valueBC = 11;    }
        //Computer Hand Value Calculations
        compVal = valueAC + valueBC;
        //Assigns addition cards to computer
        if (compVal <= 15) {
          valueCC = r.nextInt(13)+2;
          CCardThree.setText(cardnames[valueCC]);
          if (valueCC == 11 || valueCC == 12 || valueCC == 13) {
           valueCC = 10;    }
          if (valueCC ==14){
            valueCC = 11;    }
          compVal += valueCC;    }
        //Changes the Integer value of player and computer hands into a String value
        cVal = Integer.toString(compVal);  
        playerVal = valueA + valueB;
        playVal =  Integer.toString(playerVal);
        TotalVal.setText(playVal);
        Deal.setVisible(false);
        CCardOne.setVisible(false);
      //The HIT button
      public void Hit_actionPerformed(ActionEvent e) {
        //A counter that changes the specific function of the HIT button when it is pressed at different times
        counter++;
          if (counter ==3){
          Hit.setVisible(false);
        //Card Array - Values assigned to cards
        String[] cardnames = new String[15];
        cardnames[0] = "Error";
        cardnames[1] = "Error";
        cardnames[2] = "Two";
        cardnames[3] = "Three";
        cardnames[4] = "Four";
        cardnames[5] = "Five";
        cardnames[6] = "Six";
        cardnames[7] = "Seven";
        cardnames[8] = "Eight";
        cardnames[9] = "Nine";
        cardnames[10] = "Ten";
        cardnames[11] = "Jack";
        cardnames[12] = "Queen";
        cardnames[13] = "King";
        cardnames[14] = "Ace";
        //Randomize Card Values
        valueC = r.nextInt(13)+2;
        valueD= r.nextInt(13)+2;
        valueE = r.nextInt(13)+2;
        //Determines which card is being hit, as well as randomizing a value to that location
        if (counter == 1) {
          CardThree.setText(cardnames[valueC]);
          playerVal2 = 0 + (valueC);      
          CardThree.setVisible(true);    }
        if (counter == 2) {
          CardFour.setText(cardnames[valueD]);  
          playerVal2 += (valueD) ; 
          CardFour.setVisible(true);    }
        if (counter == 3) {
          CardFive.setText(cardnames[valueE]);
          playerVal2 += (valueE);
          CardFive.setVisible(true);    }
        //Value corrections for player cards
        if (valueC == 11 || valueC == 12 || valueC == 13) {
          valueC = 10;    }
        if (valueC ==14){
          valueC = 11;    }
        if (valueD == 11 || valueD == 12 || valueD == 13) {
          valueD = 10;    }
        if (valueD ==14){
          valueD = 11;    }
        if (valueE == 11 || valueE == 12 || valueE == 13) {
          valueE = 10;    }
        if (valueE ==14){
          valueE = 11;
        //Changes the Integer value of player and computer hands into a String value
        playerValT = playerVal + playerVal2;
        playVal =  Integer.toString(playerValT);
        TotalVal.setText(playVal);
        //The STAND button
        private void Stand_actionPerformed(ActionEvent e) {
          //Correctly assigns player value if HIT button is never pressed
          if (counter == 0){
            playerValT = playerVal; }    
          //Reveals the unknown computer card
          CCardOne.setVisible(true);
          //Determines the winner and loser
          if (playerValT <= 21 && compVal < playerValT) {
            Win.setVisible(true); }
          else if (playerValT <= 21 && compVal > 21) {
            Win.setVisible(true); }
          else if (playerValT >21 && compVal > 21) {
            Bust.setVisible(true); }
          else if (compVal <= 21 && playerValT < compVal){
            Lose.setVisible(true);}
          else if (compVal <= 21 && playerValT > 21) {
            Lose.setVisible(true); }
          else if (compVal == playerValT){
            Lose.setVisible(true); }
          //Configures program and display for next use
          Deal.setVisible(true);
          Stand.setVisible(false);
          Hit.setVisible(false);
          counter = 0;
          TCompVal.setText(cVal);
        //The EXIT button
          private void Exit_actionPerformed(ActionEvent e) {
            System.exit ( 0 );
      public static void main(String[]args) {   
        JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);   
        new BlackJackExtreme();
      Instead of having a JLabel with "Ace", "Eight", etc appear, how would one make pictures appear? How does one do this with an array?
    Edited by: Funkdmonkey on Jan 1, 2008 7:45 PM

    I guess an array or perhaps better a hashmap where the image is the value and the card (a great place for an enum!) is the key would work nicely. Oh, and you can find a great public domain set of card images here:
    http://www.eludication.org/playingcards.html
    Finally, your code appears to be suffering from the God-class anti-pattern. You would do well to refactor that beast.
    Edited by: Encephalopathic on Jan 1, 2008 8:09 PM

Maybe you are looking for