View Single Post
Old 03-22-2005, 02:42 AM   #1 (permalink)
1fast6
Registered User
 
Join Date: Mar 2005
Posts: 1
1fast6 is on a distinguished road
problem with adding/removing JPanels.Help!

Hi All,

Just started learning java GUI but am having a few issues.
I want to be able to add and remove components to my JPanels but each time i try and invoke remove() or removeAll i get a null pointer exception. I don't understand why because i made the jpanels global.

Infact the only function that works is getContentPane().removeAll().
but i dont want to have to add all the panels all over again just to display it slightly differently.

Another issue i have is i cannot call functions from my jpanels within nested methods. the compiler says " local variable ... is being accessed from within inner class must be declared final".
However i don't want to declare it final!

i am really stuck and i cant do anymore work until i sort this out.

Thanks for any help i'd really appriciate it
1fast6 is offline   Reply With Quote