I have a list that I use as a line counter. pressing [ENTER] the list increases by 1 value and I just need to make pressing [BACKSPACE] or delete the last item in the list. and I do not know how to get the last object you know how to do it? This is part of my code
int texto = 11;
int resultado = texto+1;
public void agregarvalores() {
texto = texto + 1;
modelolista.addElement(texto);
}
public void eliminarvalores(){
texto = texto - 1; // la funcion que resta un numero para poder seguir sumando
// AQUI! FALTA la funcion para eliminar el ultimo objeto de una lista
}
private void editorKeyReleased(java.awt.event.KeyEvent evt) {
if(evt.getKeyCode() == KeyEvent.VK_ENTER){
//texto++;
agregarvalores();
}
else if(evt.getKeyCode() == KeyEvent.VK_BACK_SPACE ) {
eliminarvalores();
}
}
the values in the table begin at number 11 THANK YOU: v