Results 1 to 1 of 1
- 03-10-2009, 01:52 PM #1
IndexOutOfBoundsException with AWT-EventQueue-0
I'm writing a calculator and for some reason whenever I hit the + sign this error gets thrown
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.remove(Unknown Source)
at gui.LongInteger.addition(LongInteger.java:78)
at gui.Calculator$3.actionPerformed(Calculator.java:1 42)
My addition listener is this
the code within my addition method that messes up isJava Code://textField is a TextField object //output is a StringBuilder object buttonPlus.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ currentEntry = new LongInteger(output.toString()); currentValue = currentValue.addition(currentEntry); textField.setText(currentValue.toString()); output.delete(0, output.length()); } });
and here is the constructor for a LongIntegerJava Code:num1 = Integer.parseInt(this.arrayIntList.remove(0).toString());
can anybody explain why this is happening?Java Code:LongInteger(String input){ if((input.charAt(0) == '-') || (input.charAt(0) == '+')){ if(input.charAt(0) == '-') isPositive = false; input = input.substring(1); } for(int i = 0; i < input.length(); i++){ char temp = input.charAt(i); String tempString = new String(temp+""); this.arrayIntList.add(Integer.parseInt(tempString.trim())); } this.size = arrayIntList.size(); }Liberty has never come from the government.
Liberty has always come from the subjects of government.
The history of liberty is the history of resistance.
The history of liberty is a history of the limitation of governmental power, not the increase of it.
Similar Threads
-
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException:
By satishkumar_lskin in forum AWT / SwingReplies: 2Last Post: 12-14-2009, 01:46 AM -
IndexOutOfBoundsException
By aldo1987 in forum New To JavaReplies: 6Last Post: 04-30-2008, 03:48 AM -
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
By hemanthjava in forum AWT / SwingReplies: 3Last Post: 01-29-2008, 01:37 AM -
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException
By leonard in forum New To JavaReplies: 1Last Post: 08-06-2007, 06:04 PM -
AWT-EventQueue-0 java.lang.NullPointerException
By susan in forum NetBeansReplies: 2Last Post: 07-16-2007, 06:21 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks