Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Combining two classes

 
Jason Newman
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two classes(?) that I am trying to combine into one. I am basically trying to pull sentences from an array randomly, and place them into the JOptionPane. I have been trying to do this for a few hours, and it's late and I'd like to finish soon. Here is the code, if this helps answer my question.

Sentence gen part:


And the Other part:


OptionPane.showMessageDialog(SetenceGenerator.JOptionPane.PLAIN_MESSAGE ); //see here I tried to incorporate the sentence gen, hoping that having it in the main method along with this part of the code it would work. It did not.

Please, any help that you can contribute would be amazing!
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseAMeaningfulSubjectLine. Do you really think "Help?" is going to attract any viewers? You can edit your post to change it.
 
Jason Newman
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better?
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep.

As for the issue, you will need to create an instance of SentenceGenerator, then call generateRandomSentence(), then show that inside the JOptionPane.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic