So here I'm switching one frame to another, called "redigeraProjekt". Now in this class, I want the value from .getSelectedIndex() pass over to that class. I've tried to use the variable "valIListan" but it cannot find it. Probably because it's "private" (?)
valIListan = listaAllaSpelProjekt.getSelectedIndex();
redigeraProjekt npj = new redigeraProjekt(); // "switching" to another frame
I hope you understand what I'm saying
Thanks in advance!
Olof Sturesson wrote:I hope you understand what I'm saying
Not really, because the code you've supplied won't compile as it stands.
What is the type of valIListan? Are you getting an error when you run your program? If so, what does it say?
However, in general terms (and if redigeraProjekt is a class that you wrote) you could possibly pass it in a constructor, viz something like:
int valIListan = listaAllaSpelProjekt.getSelectedIndex();
redigeraProjekt npj = new redigeraProjekt(valIListan);
but without more information, it's very difficult to know.
BTW: Class names should always start with a CAPITAL letter, so it should be RedigeraProjekt