Hey Guys , can i just get some help with my dialog box , a sterr in the right direction wil be brillant . Thanks guys
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.UIManager;
import net.miginfocom.swing.MigLayout;
public class Fines extends JFrame {
private JMenuBar menuBar = new JMenuBar();
private JMenu fines = new JMenu("Fines");
private JMenuItem setRegistrationMenuItem = new JMenuItem("Set Registration...");
private JMenuItem setlocationMenuItem = new JMenuItem("Set Location...");
private JMenuItem setDateAndTimeMenuItem = new JMenuItem("Set Date + Time...");
private JLabel regNumber = new JLabel("Registration No.");
private JLabel location = new JLabel("Location");
private JLabel dateAndTime = new JLabel("Date and Time");
private JLabel paymentMethod = new JLabel("PaymentMethod");
private JLabel paymentAmount = new JLabel("Payment Amount");
private JLabel date = new JLabel("Date");
private JLabel time = new JLabel("Time");
private JTextField regNumberTextField = new JTextField(20);
private JTextField locationTextField = new JTextField(20);
private JTextField dateAndTimeTextField = new JTextField(20);
private JTextField paymentAmountTextField = new JTextField(20);
private JTextField paymentMethodTextField = new JTextField(20);
private JCheckBox paymentCheckBox = new JCheckBox("Payment Received");
private JTextField dateTextField = new JTextField(20);
private JTextField timeTextField = new JTextField(20);
private JButton updateButton = new JButton("Update...");
public Fines(){
this.setLayout(new MigLayout());
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setJMenuBar(menuBar);
menuBar.add(fines);
fines.add(setRegistrationMenuItem);
setRegistrationMenuItem.addActionListener(new ActionDialogue());
fines.add(setlocationMenuItem);
fines.add(setDateAndTimeMenuItem);
// labels + Text Fields
this.add(regNumber);
this.add(regNumberTextField, "wrap");
this.add(location);
this.add(locationTextField, "wrap");
this.add(dateAndTime);
this.add(dateAndTimeTextField, "wrap");
this.add(paymentCheckBox, "wrap, span 2");
paymentCheckBox.addActionListener(new Action());
this.add(paymentMethod);
this.add(paymentMethodTextField, "wrap, span 2");
this.add(paymentAmount);
this.add(paymentAmountTextField);
paymentMethod.setEnabled(false);
paymentAmount.setEnabled(false);
paymentMethodTextField.setEnabled(false);
paymentAmountTextField.setEnabled(false);
this.add(updateButton, " span 1, tag ok");
updateButton.setEnabled(false);
}
private class Action implements ActionListener{
public void actionPerformed(ActionEvent e){
if(paymentCheckBox.isSelected()){
paymentMethod.setEnabled(true);
paymentAmount.setEnabled(true);
paymentMethodTextField.setEnabled(true);
paymentAmountTextField.setEnabled(true);
updateButton.setEnabled(true);
}
else
{
paymentMethod.setEnabled(false);
paymentAmount.setEnabled(false);
paymentMethodTextField.setEnabled(false);
paymentAmountTextField.setEnabled(false);
updateButton.setEnabled(false);
}
}
}
private class ActionDialogue implements ActionListener{
public void actionPerformed(ActionEvent e){
if(setRegistrationMenuItem.isSelected()){
JFrame frame2 = new JFrame();
frame2.setSize(100, 100);
frame2.setVisible(true);
}
}
}
public static void main(String[] args) {
String systemLookAndFeelClassName = UIManager.getSystemLookAndFeelClassName();
try {
UIManager.setLookAndFeel(systemLookAndFeelClassName);
}
catch (Exception e) {
}
Fines window = new Fines();
window.setTitle("Parking Fines Administartion");
window.pack();
window.setLocationRelativeTo(null);
window.setVisible(true);
}
}