Forums Register Login

can't I take a single array for JTextField and JTextArea as both are derived from JTextComponent

+Pie Number of slices to send: Send
Below is the piece of code I am trying

The program compiles well but throws java.lang.ArrayStoreException: javax.swing.JTextArea
I know the reason is I am storing two different object JTextFiled and JTextArea to single array it is coming like that but both JTextField and JTextArea are derived from JTextComponent can't I take a single array
, why to take two different array for them.
Is there any alternate way to do it in a single array .
+Pie Number of slices to send: Send
There's the problem. You have declared it as an array of JTextComponents, but in reality it's an array of JTextFields. Change the initialization to new JTextComponent[...] and you should be fine.
+Pie Number of slices to send: Send
Dear Rob Prime , I am really sorry for doing such silly mistake , and I am really thankful to you for replying and giving your time to me , It was such a silly mistake .

Thanks a lot ,God Bless

+Pie Number of slices to send: Send
You're welcome
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1159 times.
Similar Threads
Clip Board Problem
Why is this Image being painted?
why i am not getting the proper format of the following code
Mock exam by sreenivasa kumar majji - Q21
Clip Board Problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:18:40.