Err: invalid method declaration; return type required
I dunno what i am doing wrong.... i know it saying i need to put in a return type, but im kinda new and i dont see where it is supposed to go or what it is supposed to be.
Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Hw09_msj extends JFrame
{
private Container cont;
private JRadioButton uCase;
private JRadioButton lCase;
private ButtonGroup buttonGroup;
private JLabel label;
public changeCase()
{
super("Case Changer");
cont = getContentPane();
cont.setLayout(new FlowLayout());
uCase = new JRadioButton("UPPERCASE", true);
lCase = new JRadioButton("lowercase");
label = new JLabel("WATCH ME CHANGE CASE");
cont.add(uCase);
cont.add(lCase);
cont.add(label);
buttonGroup = new ButtonGroup();
buttonGroup.add(uCase);
buttonGroup.add(lCase);
changeCase.RadioButtonHandler rbh = new changeCase.RadioButtonHandler(null);
uCase.addItemListener(rbh);
lCase.addItemListener(rbh);
setSize(300, 200);
setVisible(true);
}
public static void main(String[] args)
{
changeCase cc = new changeCase();
cc.setDefaultCloseOperation(3);
}
private class RadioButtonHandler
implements ItemListener
{
private RadioButtonHandler()
{
}
public void itemStateChanged(ItemEvent ie)
{
if (ie.getSource() == changeCase.uCase)
changeCase.label.setText(changeCase.label.getText().toUpperCase());
else if (ie.getSource() == changeCase.lCase)
changeCase.label.setText(changeCase.label.getText().toLowerCase());
}
}
}