I understand that but that is what im having trouble with. I cannot find the correct logic for the loop i know im close but cannot find the one i need. The logic i have right now is working only...
Type: Posts; User: miller4103
I understand that but that is what im having trouble with. I cannot find the correct logic for the loop i know im close but cannot find the one i need. The logic i have right now is working only...
Thats what i tried to do with the else statment but the else will not trigger for that to happen.
btnPrevious.addActionListener(new ActionListener() {
private int b = 4;
...
it shows 3,2,1,0 so its going thru all of them but then it throws an error of -1. like this:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
I fixed my next button with adding a i=0 to restart form the beggining when the else is activated.
but now i cannot get my previous button else to activate when it reaches 0 it throws an error...
This is the code from beggining to end were it stops. After the last output it repeats that same output. What it should do after it reaches that last variable is go to the first one and repeat the...
their are 4 array's. The reason i ask is when i use the next button it doesnt matter which array im on it goes from the second integer to the first one then stops. That is hwy im asking.
Ok to do all of that i need to figure out how to get the code to know what loops its at right? ok lets get some pseudocode:
if currentArray[] +1
output
else at end of array start at 0.
so how...
Thank you. veriable b is not changing value and i dont know why. It is equal to my array[0]. I guess my logic is wrong. My next button seems to stop at my last array but how do i get an infinite loop...
can i get a short example to fully understand what you mean. I do understand but having trouble seeing how to implement this into my own code to use println as a debugger.
O ok. so the println should be inside the if statment to see if its doing what i need it to? if i get the println statment to work correclty i can just implement that into the gui code? That seems...
I dont know how to do that. i know how to add a println statment but thats it. How do i make one tell me whats wrong?
sorry about the bad formatting im still learning that. Also i know it doesnt compile i have class ink. If you are trying to get it to run i can post that code to. And the previous button should be...
This is my code:
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import javax.swing.*;
public class Stapler extends Ink{