This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I seem to have two major problems leaning Java. I am using only a single window. I call a medthod from 'main' like addButtons(contentPane); it works, but if I call it from:
private void writeButtons(){ //read the string of all three buttons String button0 =""; String button1 =""; String button2 =""; String filestring =""; Container contentPane;
contentPane = getContentPane(); button0 = JOptionPane.showInputDialog(null, "Enter Left buttons name");
button1 = JOptionPane.showInputDialog(null, "Enter Center buttons name");
button2 = JOptionPane.showInputDialog(null, "Enter Right buttons name"); //write them to the root directory filename. try { FileWriter writer = new FileWriter("c:/buttons.txt"); //JOptionPane.showMessageDialog(null, button0 + "\n" + button1 + "\n" + button2); filestring = ( button0 + "\n" + button1 + "\n" + button2); writer.write(filestring); writer.close(); } catch(IOException ex) { ex.printStackTrace(); } addButtons(contentPane); /* here is the PAIN */ }
Justin Fox
Ranch Hand
Joined: Jan 24, 2006
Posts: 802
posted
0
i have no idea what is going on, what are you trying to do?
read button names from a file?
then create them?
-Justin-
You down with OOP? Yeah you know me!
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
posted
0
It would probably help if you showed the code for the addButtons() method. And when positng code, please use code tags. It increases the legibility of the code and increases the chance that someone who knows the answer to your question won't skip over your post.
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
I'm trying to feel your "PAIN". It would help if you could explain.
What would help the most is a minimal example program deomstrating your problem that forum members could run. This cuts down on the wild speculation we have to go thought when you write about an unspecified method of yours that doesn't work. Can you see our point of view?
Vincent Delane
Greenhorn
Joined: May 09, 2006
Posts: 2
posted
0
Sorry guys i;m new, but love this Java.
1. I have to read a file from disk to and array to "name" the buttons. 2. I've done the read and writes. 3. I've checked the file and array and it is correct 4. The problem is how do I "refresh' the buttons new text??