I am having trouble with my program, I have been compiling it repeatedly and has all work fine until I wrote the class attempting to acess my action listener for the calculation this is when the errors have started. I have remade all my buttons and class several times to make sure datatypes do not conflict but the same errors continue to occure so please exaime my source code and help me debug
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.Character.*;
public class upperTolower extends JFrame
{
private static final int WIDTH = 400;
private static final int HEIGHT = 300;
private JLabel upperCaseL, lowerCaseL;
private JTextField upperCaseTF, lowerCaseTF;
private JButton calcUpperB, calcLowerB, exitB;
ExitButtonHandler exitHandler;
CalculateLButtonHandler calculateLHandler;
CalculateUButtonHandler calculateUHandler;
public upperTolower()
{
setTitle("Character Conversion");
upperCaseL = new JLabel("Enter Upper Case Values: ", SwingConstants.CENTER);
lowerCaseL = new JLabel("Enter Lower Case Values: ", SwingConstants.CENTER);
upperCaseTF = new JTextField(15);
lowerCaseTF = new JTextField(15);
calcUpperB = new JButton("Upper");
calculateUHandler = new CalculateUButtonHandler();
calcUpperB.addActionListener(calculateUHandler);
calcLowerB = new JButton("Lower");
calculateLHandler = new CalculateLButtonHandler();
calcLowerB.addActionListener(calculateLHandler);
exitB = new JButton("Exit");
exitHandler = new ExitButtonHandler();
exitB.addActionListener(exitHandler);
Container pane = getContentPane();
pane.setLayout(new GridLayout(3,2));
pane.add(upperCaseL);
pane.add(upperCaseTF);
pane.add(lowerCaseL);
pane.add(lowerCaseTF);
pane.add(calcUpperB);
pane.add(calcLowerB);
pane.add(exitB);
setSize(WIDTH,HEIGHT);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
}
public class CalculateUButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
char LowerCaseValues, UpperCaseValues;
LowerCaseValues = Character.parseChar(lowerCaseTF.getText());
upperCaseTF.setText(""+ Character.toUpperCase(+LowerCaseValues));
}
}
public static void main(
String[] args)
{
upperTolower upperTolowerObject = new upperTolower();
}
}