I am having issues generating the results I need when I enter a name to be converted into the Name Game; when a user click the Generate Button it is to display the results. I commented out the section that is giving me the issue. Any suggestions?
[code=java]
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package thegame;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
/**
*
*
@author SecretofGod
*/
public class TheGame extends JFrame{
private JLabel label;
private JTextField usertext;
private JButton button;
private JButton clear;
String name, name2;
public TheGame () {
setLayout(new FlowLayout());
label = new JLabel("Enter Your Name For Shirley");
add(label);
usertext = new JTextField(12);
add(usertext);
button = new JButton("Generate Lyric");
add(button);
clear = new JButton("Clear Text");
add(clear);
buttonButtonHandler buttonListener = new buttonButtonHandler();
button.addActionListener(buttonListener);
clearButtonHandler clearListener = new clearButtonHandler();
clear.addActionListener(clearListener);
}
private class buttonButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent e){
/*for (int x = 0; x < list.size(); x++)
{
name = list.get(x);
name2 = "";
for (int y = 1; y < name.length(); y++)
{
name2 += name.charAt(y);
}
if (!name2.equals("uck") && !name2.equals("hit") && !name2.equals("itch"))
JOptionPane.showMessageDialog(null, name+"!
"+name+", "+name+" bo
B"+name2+" Banana fanna fo F"+name2+"
Fee fy mo M"+name2+",
"+name+"!");
else
JOptionPane.showMessageDialog(null, "Error!
The name "+name+" cannot be used"+" for some vague reason.");
}*/
}
}
private class clearButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent e){
usertext.setText("");
}
}
/**
*
@param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
TheGame gui = new TheGame();
gui.setSize(400,150);
gui.setTitle("I wanna play a Name Game");
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setVisible(true);
}
}
[/code]