473,511 Members | 15,364 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete Button is not working properly it will not delete entry

1 New Member
I'm trying to get my delete button in my GUI to work but its not wanting to work the way it needs to. its suppose to remove my current selected ArrayList item from the list but all it does is move to the next item.

What am I doing wrong?

My product class:
Expand|Select|Wrap|Line Numbers
  1. import java.util.ArrayList;
  2.  
  3. public class product {
  4.  
  5. @SuppressWarnings("all")
  6.     ArrayList <extendedDVD> product() {
  7.  
  8.     ArrayList<extendedDVD> dvd = new ArrayList<extendedDVD>(); //New Array Constructor
  9.  
  10.          dvd.add(new extendedDVD("The Change Up", 12, 11.86, 10452));  //Index
  11.  
  12.          dvd.add(new extendedDVD("Wall-E", 15, 9.05, 10356));     //Index
  13.  
  14.          dvd.add(new extendedDVD("Flubber", 13, 7.01, 13698));        //Index
  15.  
  16.          dvd.add(new extendedDVD("Daddy Day Care", 14, 9.15, 15496));    //Index
  17.  
  18.          return dvd;
  19.     }
  20.  
  21.     public static void main(String [] args) //Main Method
  22.     {
  23.  
  24.         GUI mainbox = new GUI();
  25.         mainbox.setVisible(true);
  26.  
  27.     }//end main method
  28. }// end class Product
  29.  
  30.  
My DVD class:
Expand|Select|Wrap|Line Numbers
  1. class DVD {
  2.  
  3.     String dvdTitle; //Variable
  4.     int dvdStock;    //Variable
  5.     double dvdPrice; //Variable
  6.     int dvdItem;     //Variable
  7.  
  8.     public DVD(String title, int stock, double price, int item) //Method Constructor
  9.     {
  10.  
  11.         dvdTitle = title;
  12.         dvdStock = stock;
  13.         dvdPrice = price;
  14.         dvdItem = item;
  15.     } //end four-argument constructor
  16.  
  17.     public DVD() //Method
  18.     {
  19.  
  20.         dvdTitle = ""; //Value Type
  21.         dvdStock = 0;  //Value Type
  22.         dvdPrice = 0.0; //Value Type
  23.         dvdItem = 0;  //Value Type
  24.     } //end four-argument constructor
  25.  
  26.     // set DVD name
  27.     public void setDvdTitle(String title) //Method
  28.     {
  29.         dvdTitle = title;
  30.     } //end method  setDvdTitle
  31.  
  32.     //return DVD Title
  33.     public String getDvdTitle() //Method
  34.     {
  35.         return dvdTitle;
  36.     } //end method getDvdTitle
  37.  
  38.     //set DVD Stock
  39.     public void setDvdStock(int stock) //Method
  40.     {
  41.         dvdStock = stock;
  42.     } //end method setDvdStock
  43.  
  44.     //return DvdStock
  45.     public int getDvdStock() //Method
  46.     {
  47.         return dvdStock;
  48.     } //end method getDvdStock
  49.  
  50.     public void setDvdPrice(double price) //Method
  51.     {
  52.         dvdPrice = price;
  53.     } //end method setDvdPrice
  54.  
  55.     //return dvdPrice
  56.     public double getDvdPrice() //Method
  57.     {
  58.         return dvdPrice;
  59.     } //end method getDvdPrice
  60.  
  61.     public void setDvdItem(int item) //Method
  62.     {
  63.         dvdItem = item;
  64.     } //end method setdvdItem
  65.  
  66.     //return DVD item
  67.     public int getDvdItem() //Method
  68.     {
  69.         return dvdItem;
  70.     } //end  method getDvdItem
  71.  
  72.     //calculate inventory value
  73.     //    v v v v v v v 
  74.     public double value() //Method
  75.     {
  76.         return dvdPrice * dvdStock;
  77.     } //end method value
  78.  
  79.     /*    public double valueTotal(extendedDVD[] item) //Method
  80.     {
  81.     double iTotal = 0.0;
  82.     for (int i = 0; i < item.length; i++) // "for" Argument
  83.     {
  84.     iTotal = iTotal + item[i].value();
  85.     }
  86.     return iTotal;
  87.     } //end method value*/
  88.  
  89.     public int compareTo(DVD d) //Method
  90.     {
  91.         int lastCmp = dvdTitle.compareTo(d.dvdTitle);
  92.         return (lastCmp != 0 ? lastCmp : dvdTitle.compareTo(d.dvdTitle));
  93.     }// end method value
  94.  
  95. } //end class DVD
  96.  
  97.  
My extendedDVD class:
Expand|Select|Wrap|Line Numbers
  1. class extendedDVD extends DVD {
  2.     public extendedDVD(String title, int stock, double price, int item) //Method
  3.     {
  4.         super(title, stock, price, item);
  5.     } // end method value
  6.  
  7.     public double restockFee() //Method
  8.     {
  9.         return getDvdPrice() * .05;
  10.     }//end method value
  11.  
  12.     public double totalRestock() //Method
  13.     {
  14.         return restockFee() + getDvdPrice();
  15.     } // end method value
  16.  
  17. }// end class extendedDVD 
  18.  
My main application/GUI code:
Expand|Select|Wrap|Line Numbers
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Toolkit;
  4. import java.awt.event.ActionEvent;
  5. import java.awt.event.ActionListener;
  6. import java.util.Scanner;
  7.  
  8. import javax.swing.ImageIcon;
  9. import javax.swing.JButton;
  10. import javax.swing.JFrame;
  11. import javax.swing.JLabel;
  12. import javax.swing.JOptionPane;
  13. import javax.swing.JTextPane;
  14. import javax.swing.SwingConstants;
  15.  
  16.  
  17. @SuppressWarnings("serial")
  18. public class GUI extends JFrame {
  19.  
  20.  
  21.     int Index = 0;
  22.     private final JTextPane textTitle;
  23.     private final JTextPane textItem;
  24.     private final JTextPane textStock;
  25.     private final JTextPane textPrice;
  26.     private final JTextPane textFee;
  27.     private final JTextPane textTpro;
  28.  
  29.     product mainBox = new product();
  30.  
  31.  
  32.  
  33.     public GUI() {
  34.         setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\Margaret\\workspace\\FinalGUI\\ResImgs\\CenterLogo.png"));
  35.         getContentPane().setBackground(Color.DARK_GRAY);
  36.         setTitle("UniMedia:        DVD Inventory");
  37.         setSize(900, 450);
  38.         setLocationRelativeTo(null);
  39.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  40.         setResizable(false);
  41.         getContentPane().setLayout(null);
  42.  
  43.         JButton btnFirst = new JButton("");
  44.         btnFirst.setToolTipText("Go to First DVD");
  45.         btnFirst.setIcon(new ImageIcon("C:\\Users\\Margaret\\workspace\\FinalGUI\\ResImgs\\FirstArrow.png"));
  46.         btnFirst.setContentAreaFilled(false);
  47.         btnFirst.setFocusPainted(false);
  48.         btnFirst.setBorderPainted(false);
  49.         btnFirst.addActionListener(new ActionListener() {
  50.             @Override
  51.             public void actionPerformed(ActionEvent click) {
  52.                 Index = 0;
  53.                 setValues();//refreshes values to new index
  54.             }
  55.         });
  56.         btnFirst.setBounds(10, 360, 38, 40);
  57.         getContentPane().add(btnFirst);
  58.  
  59.         JButton btnPrevious = new JButton("");
  60.         btnPrevious.setIcon(new ImageIcon("C:\\Users\\Margaret\\workspace\\FinalGUI\\ResImgs\\PreviousArrow.png"));
  61.         btnPrevious.setContentAreaFilled(false);
  62.         btnPrevious.setFocusPainted(false);
  63.         btnPrevious.setBorderPainted(false);
  64.         btnPrevious.setToolTipText("Go to Previous DVD");
  65.         btnPrevious.addActionListener(new ActionListener() {
  66.             @Override
  67.             public void actionPerformed(ActionEvent click) {
  68.                 if(Index == 0) {
  69.                     Index = mainBox.product().size() - 1;
  70.                     setValues();//refreshes values to new index
  71.                 } else {
  72.                     Index--;//index - 1
  73.                     setValues();//refreshes values to new index
  74.                 }
  75.             }
  76.         });
  77.         btnPrevious.setBounds(135, 359, 38, 40);
  78.         getContentPane().add(btnPrevious);
  79.  
  80.         JButton btnNext = new JButton("");
  81.         btnNext.setToolTipText("Go to Next DVD");
  82.         btnNext.setIcon(new ImageIcon("C:\\Users\\Margaret\\workspace\\FinalGUI\\ResImgs\\Next Arrow.png"));
  83.         btnNext.setContentAreaFilled(false);
  84.         btnNext.setFocusPainted(false);
  85.         btnNext.setBorderPainted(false);
  86.         btnNext.addActionListener(new ActionListener() {
  87.             @Override
  88.             public void actionPerformed(ActionEvent click) {
  89.                 if(Index == mainBox.product().size() - 1) {
  90.                     Index = 0;
  91.                     setValues();//refreshes values to new index
  92.                 } else {
  93.                     Index++;//index + 1
  94.                     setValues();//refreshes values to new index
  95.                 }
  96.             }
  97.         });
  98.         btnNext.setBounds(209, 359, 38, 40);
  99.         getContentPane().add(btnNext);
  100.  
  101.         JButton btnLast = new JButton("");
  102.         btnLast.setToolTipText("Go to Last DVD");
  103.         btnLast.setIcon(new ImageIcon("C:\\Users\\Margaret\\workspace\\FinalGUI\\ResImgs\\LastArrow.png"));
  104.         btnLast.setContentAreaFilled(false);
  105.         btnLast.setFocusPainted(false);
  106.         btnLast.setBorderPainted(false);
  107.         btnLast.addActionListener(new ActionListener() {
  108.             @Override
  109.             public void actionPerformed(ActionEvent click) {
  110.                 Index = mainBox.product().size() - 1;
  111.                 setValues();//refreshes values to new index
  112.             }
  113.         });
  114.         btnLast.setBounds(353, 360, 34, 35);
  115.         getContentPane().add(btnLast);
  116.  
  117.         JLabel lblNewLabel = new JLabel("Title:");
  118.         lblNewLabel.setForeground(new Color(0, 206, 209));
  119.         lblNewLabel.setFont(new Font("Segoe UI", Font.ITALIC, 13));
  120.         lblNewLabel.setBounds(602, 23, 46, 14);
  121.         getContentPane().add(lblNewLabel);
  122.  
  123.         JLabel lblNewLabel_1 = new JLabel("Item #:");
  124.         lblNewLabel_1.setForeground(new Color(0, 206, 209));
  125.         lblNewLabel_1.setFont(new Font("Segoe UI", Font.ITALIC, 13));
  126.         lblNewLabel_1.setBounds(602, 58, 46, 14);
  127.         getContentPane().add(lblNewLabel_1);
  128.  
  129.         JLabel lblNewLabel_2 = new JLabel("Stock:");
  130.         lblNewLabel_2.setForeground(new Color(0, 206, 209));
  131.         lblNewLabel_2.setFont(new Font("Segoe UI", Font.ITALIC, 13));
  132.         lblNewLabel_2.setBounds(602, 93, 46, 14);
  133.         getContentPane().add(lblNewLabel_2);
  134.  
  135.         JLabel lblNewLabel_3 = new JLabel("Price:");
  136.         lblNewLabel_3.setForeground(new Color(0, 206, 209));
  137.         lblNewLabel_3.setFont(new Font("Segoe UI", Font.ITALIC, 13));
  138.         lblNewLabel_3.setBounds(602, 127, 46, 14);
  139.         getContentPane().add(lblNewLabel_3);
  140.  
  141.         textTitle = new JTextPane();
  142.         textTitle.setFont(new Font("Eras Light ITC", Font.ITALIC, 15));
  143.         textTitle.setForeground(Color.WHITE);
  144.         textTitle.setBackground(Color.DARK_GRAY);
  145.         textTitle.setEditable(false);
  146.         textTitle.setBounds(746, 15, 124, 20);
  147.         getContentPane().add(textTitle);
  148.  
  149.  
  150.         textItem = new JTextPane();
  151.         textItem.setForeground(Color.WHITE);
  152.         textItem.setFont(new Font("Segoe UI Light", Font.PLAIN, 15));
  153.         textItem.setBackground(Color.DARK_GRAY);
  154.         textItem.setEditable(false);
  155.         textItem.setBounds(746, 52, 124, 20);
  156.         getContentPane().add(textItem);
  157.  
  158.  
  159.         textStock = new JTextPane();
  160.         textStock.setForeground(Color.WHITE);
  161.         textStock.setFont(new Font("Segoe UI Light", Font.PLAIN, 15));
  162.         textStock.setBackground(Color.DARK_GRAY);
  163.         textStock.setEditable(false);
  164.         textStock.setBounds(746, 87, 124, 20);
  165.         getContentPane().add(textStock);
  166.  
  167.  
  168.         textPrice = new JTextPane();
  169.         textPrice.setForeground(Color.WHITE);
  170.         textPrice.setFont(new Font("Segoe UI Light", Font.PLAIN, 15));
  171.         textPrice.setBackground(Color.DARK_GRAY);
  172.         textPrice.setEditable(false);
  173.         textPrice.setBounds(746, 121, 124, 20);
  174.         getContentPane().add(textPrice);
  175.  
  176.  
  177.         JLabel lblNewLabel_4 = new JLabel("Restock Fee : 5%");
  178.         lblNewLabel_4.setForeground(new Color(0, 206, 209));
  179.         lblNewLabel_4.setFont(new Font("Segoe UI", Font.ITALIC, 13));
  180.         lblNewLabel_4.setBounds(602, 183, 110, 14);
  181.         getContentPane().add(lblNewLabel_4);
  182.  
  183.         JLabel lblNewLabel_5 = new JLabel("Total:");
  184.         lblNewLabel_5.setForeground(new Color(0, 206, 209));
  185.         lblNewLabel_5.setFont(new Font("Segoe UI", Font.ITALIC, 13));
  186.         lblNewLabel_5.setBounds(602, 232, 46, 14);
  187.         getContentPane().add(lblNewLabel_5);
  188.  
  189.         textFee = new JTextPane();
  190.         textFee.setForeground(Color.WHITE);
  191.         textFee.setFont(new Font("Segoe UI Light", Font.PLAIN, 15));
  192.         textFee.setBackground(Color.DARK_GRAY);
  193.         textFee.setEditable(false);
  194.         textFee.setBounds(761, 183, 109, 20);
  195.         getContentPane().add(textFee);
  196.  
  197.  
  198.         textTpro = new JTextPane();
  199.         textTpro.setForeground(Color.WHITE);
  200.         textTpro.setFont(new Font("Segoe UI Light", Font.PLAIN, 15));
  201.         textTpro.setBackground(Color.DARK_GRAY);
  202.         textTpro.setEditable(false);
  203.         textTpro.setBounds(761, 232, 109, 20);
  204.         getContentPane().add(textTpro);
  205.  
  206.  
  207.         JLabel lblTotalInventoryValue = new JLabel("Total Inventory Value ->");
  208.         lblTotalInventoryValue.setForeground(Color.LIGHT_GRAY);
  209.         lblTotalInventoryValue.setFont(new Font("Segoe UI", Font.ITALIC, 11));
  210.         lblTotalInventoryValue.setBounds(685, 382, 139, 29);
  211.         getContentPane().add(lblTotalInventoryValue);
  212.  
  213.  
  214.         setValues();
  215.         /* Set outside of the other method to avoid infinite adding cycle with next/previous/last/first buttons */
  216.         //textTinv.setText(String.format("$%.2f", valueTotal()));
  217.  
  218.         JButton btnTotalInv = new JButton("");
  219.         btnTotalInv.setIcon(new ImageIcon("C:\\Users\\Margaret\\workspace\\FinalGUI\\ResImgs\\TotalInventory.png"));
  220.         btnTotalInv.setContentAreaFilled(false);
  221.         btnTotalInv.setFocusPainted(false);
  222.         btnTotalInv.setBorderPainted(false);
  223.         btnTotalInv.addActionListener(new ActionListener() {
  224.             public void actionPerformed(ActionEvent arg0) {
  225.                 JOptionPane.showMessageDialog(null, "The Inventory Total Is:     " + String.format("$%.2f",valueTotal()),null, JOptionPane.INFORMATION_MESSAGE);
  226.  
  227.             }
  228.         });
  229.         btnTotalInv.setBounds(824, 371, 46, 40);
  230.         getContentPane().add(btnTotalInv);
  231.  
  232.  
  233.  
  234.         JLabel lblNewLabel_6 = new JLabel("");
  235.         lblNewLabel_6.setIcon(new ImageIcon("C:\\Users\\Margaret\\workspace\\FinalGUI\\ResImgs\\CenterLogo.png"));
  236.         lblNewLabel_6.setBounds(108, 58, 100, 100);
  237.         setVisible(true);
  238.         getContentPane().add(lblNewLabel_6);
  239.  
  240.         JLabel lblNewLabel_7 = new JLabel("");
  241.         lblNewLabel_7.setIcon(new ImageIcon("C:\\Users\\Margaret\\workspace\\FinalGUI\\ResImgs\\UniMedia.gif"));
  242.         lblNewLabel_7.setBounds(59, 0, 200, 214);
  243.         getContentPane().add(lblNewLabel_7);
  244.  
  245.         JLabel lblUnimedia = new JLabel("UniMedia");
  246.         lblUnimedia.setFont(new Font("Eras Demi ITC", Font.ITALIC, 39));
  247.         lblUnimedia.setBounds(69, 202, 253, 58);
  248.         getContentPane().add(lblUnimedia);
  249.  
  250.         JButton btnSave = new JButton("");
  251.         btnSave.setContentAreaFilled(false);
  252.         btnSave.setFocusPainted(false);
  253.         btnSave.setBorderPainted(false);
  254.         btnSave.setIcon(new ImageIcon("C:\\Users\\Margaret\\workspace\\FinalGUI\\ResImgs\\SaveData.png"));
  255.         btnSave.setBounds(845, 280, 25, 31);
  256.         btnSave.addActionListener(new ActionListener() {
  257.             public void actionPerformed(ActionEvent arg0) {
  258.             try{    
  259.                 cFile x = new cFile();
  260.                 x.openFile();
  261.                 x.addRecords();
  262.                 //x.closeFile();
  263.             }catch(Exception e){
  264.                 JOptionPane.showMessageDialog(null, "COULD NOT CREATE FILE OR DIRECTORY!",null,JOptionPane.ERROR_MESSAGE);
  265.                 }
  266.             }
  267.         });
  268.         getContentPane().add(btnSave);
  269.  
  270.         JButton btnEdit = new JButton("");
  271.         btnEdit.setIcon(new ImageIcon("C:\\Users\\Margaret\\workspace\\FinalGUI\\ResImgs\\EditData.png"));
  272.         btnEdit.setContentAreaFilled(false);
  273.         btnEdit.setFocusPainted(false);
  274.         btnEdit.setBorderPainted(false);
  275.         btnEdit.setBounds(735, 280, 25, 31);
  276.         getContentPane().add(btnEdit);
  277.  
  278.         JButton btnDelete = new JButton("");
  279.         btnDelete.setIcon(new ImageIcon("C:\\Users\\Margaret\\workspace\\FinalGUI\\ResImgs\\Delete.png"));
  280.         btnDelete.setContentAreaFilled(false);
  281.         btnDelete.setFocusPainted(false);
  282.         btnDelete.setBorderPainted(false);
  283.         btnDelete.setBounds(697, 283, 25, 23);
  284.         btnDelete.addActionListener(new ActionListener() {
  285.             public void actionPerformed(ActionEvent e) {
  286.                 JOptionPane.showMessageDialog(null,"Entry Deleted!");
  287.                  while (Index == 0) {
  288.                       try{
  289.                       if (Index >= 0){
  290.                           //Index = mainBox.product().remove(Index);
  291.                           Index = Index -1;
  292.                           Index = mainBox.product().size() - 1;
  293.                           setValues();
  294.                   }else 
  295.                               JOptionPane.showMessageDialog(null,"ENTRY COULD NOT BE DELETED!");
  296.                   }catch (Exception ex){
  297.                      JOptionPane.showMessageDialog(null,"Error Compiling! Fix your Code!");
  298.                   }
  299.                  }
  300.             }
  301.         });
  302.  
  303.         getContentPane().add(btnDelete);
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.         JLabel lblSearch = new JLabel("Search:");
  311.         lblSearch.setFont(new Font("Segoe UI Light", Font.ITALIC, 11));
  312.         lblSearch.setForeground(new Color(32, 178, 170));
  313.         lblSearch.setHorizontalAlignment(SwingConstants.CENTER);
  314.         lblSearch.setBounds(376, 23, 46, 14);
  315.         getContentPane().add(lblSearch);
  316.  
  317.         JButton btnSearch = new JButton("Search");
  318.         btnSearch.addActionListener(new ActionListener() {
  319.             Scanner a = new Scanner(System.in);
  320.             public void actionPerformed(ActionEvent e) {
  321.                 JOptionPane.showInputDialog(null,"Enter DVD Title");
  322.                 a.nextLine();
  323.  
  324.             }
  325.         });
  326.         btnSearch.setBounds(433, 20, 89, 23);
  327.         getContentPane().add(btnSearch);
  328.  
  329.  
  330.      }
  331.  
  332.  
  333.  
  334.     public void setValues() {
  335.  
  336.         extendedDVD col = mainBox.product().get(Index);
  337.  
  338.         textTitle.setText(String.valueOf(col.getDvdTitle()));
  339.         textItem.setText(String.valueOf(col.getDvdItem()));
  340.         textPrice.setText(String.format("$%.2f", col.getDvdPrice()));
  341.         textStock.setText(String.valueOf(col.getDvdStock()));
  342.  
  343.         textFee.setText(String.format("$%.2f", col.restockFee()));
  344.         textTpro.setText(String.format("$%.2f", col.value()));
  345.     }
  346.  
  347.     private double valueTotal() {
  348.         double tVal = 0;
  349.         for (extendedDVD col : mainBox.product()) {
  350.             tVal += col.value();
  351.         }
  352.         return tVal;
  353.     }
  354. }
Nov 9 '14 #1
1 1017
Frinavale
9,735 Recognized Expert Moderator Expert
In the following code:
Expand|Select|Wrap|Line Numbers
  1. btnDelete.addActionListener(new ActionListener() {
  2.   public void actionPerformed(ActionEvent e) {
  3.     JOptionPane.showMessageDialog(null,"Entry Deleted!");
  4.     while (Index == 0) {
  5.       try{
  6.         if (Index >= 0){
  7.           //Index = mainBox.product().remove(Index);
  8.           Index = Index -1;
  9.           Index = mainBox.product().size() - 1;
  10.           setValues();
  11.         }else{
  12.           JOptionPane.showMessageDialog(null,"ENTRY COULD NOT BE DELETED!");
  13.         }
  14.       }catch (Exception ex){
  15.         JOptionPane.showMessageDialog(null,"Error Compiling! Fix your Code!");
  16.       }
  17.     }
  18.   }
  19. });
Shouldn't you simply be checking that the index is within the boundaries of the product list, removing the item at the index and then setting the index to something appropriate (like the previous item in the list)?

I'm not sure why you have a while loop...and it looks like you commented out the line of code that actually does the work to remove the item from the list:

Expand|Select|Wrap|Line Numbers
  1. btnDelete.addActionListener(new ActionListener() {
  2.   public void actionPerformed(ActionEvent e) {
  3.     JOptionPane.showMessageDialog(null,"Entry Deleted!");
  4.     try{
  5.       if (Index >= 0 && Index < mainBox.product().size()){
  6.         Index = mainBox.product().remove(Index);
  7.         // The following commented out code
  8.         // will move the index back 2 items because
  9.         // once you remove the item at the index, another item will then move to that index position'
  10.         // so, if you just leave the index alone  you should be fine... 
  11.         // unless the deleted item is the Only item in your list...then you need to do something
  12.         // Index = Index - 1;
  13.  
  14.         setValues();
  15.        // please note that your set values will crash if 
  16.        // the item index is set to a negative number...
  17.        // because your setValues method doesn't take negative 
  18.        // indexes into consideration.
  19.        // Likewise, your setValues method does take into consideration the case when the index is set to something greater than the size of the list
  20.       }else{
  21.         JOptionPane.showMessageDialog(null,"ENTRY COULD NOT BE DELETED!");
  22.       }
  23.     }catch (Exception ex){
  24.       // actually this isn't a compile error it is a runtime error when something unexpected occurs... figure out why this is required and make necessary changes
  25.       // for example, this code will compile but you will see this message when you delete the only item left in your list because your index will end up being outside of the boundaries of the array (position 0 larger than the array size)
  26.       JOptionPane.showMessageDialog(null,"Error Compiling! Fix your Code!");
  27.     }
  28.   });
  29.  
Nov 10 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
1979
by: weasel | last post by:
Why is the Farenheit to Celsius part not working properly? Instead of showing a similar range of what the farenheit is listing, the celsius portion is showing half the range of farenheit. print...
8
8038
by: Randy Yates | last post by:
I'm using mingw/g++ 3.3.3. When I use pos = tellg(), getline(), setg(pos), then the next getline() does NOT get from the original position. I've tried doing a clear() before the seekg() to no...
9
5912
by: Toralf Kirsten | last post by:
Hi, we installed db2 v8.1 on red hat linux 9. Unfortunately, the backspace and the delete button doesn't work in the right way. Instead of deleting chars, control characters are inputed. That...
3
4347
by: Niranjan | last post by:
Windows 2000 Access 2000 I have the standard Delete button code. This has been working for over 3-4 years and now it gives me an error message of 2465 everytime I delete a record. Here is...
3
2774
by: vcornjamb | last post by:
Hello, I am developing a web form that contains some buttons and a data grid which has as its last column link buttons that will delete the data associated with that row. Everything works fine,...
5
2775
by: Nita Raju | last post by:
Hi, I have to validate a textbox for date without using the validation controls. So i had to use IsDate(). It's not working properly when i give "11//2004". When i enter the above date it...
3
13725
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
5
6676
by: Jeff User | last post by:
Hello ..NET 1.1, VS 2003, C# & asp.net I have tried to follow msdn instructions and samples but I can not get an event to fire for this button on the datagrid. There has to be something obvious...
4
3234
by: Charleees | last post by:
GIFS not working properly in JavaScript PopUps Hi all, I have a button and when i click tha button it redirects to another page..... I have also added a java script for the button that...
7
6906
by: ITAutobot25 | last post by:
My delete button is not working in my GUI and my due date is today before midnight. Can anyone show me how to correct this error? My assignment statement is below as well as 5 classes. InventoryGUI...
0
7353
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5662
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.