Ok I corrected the problem with my apps not compiling but now they will not run I get this error in the command line:
C:\Users\William McKeever\Documents\Created Programs\Java Programs>java . -cp Form
Exception in thread "main" java.lang.NoClassDefFoundError: /
this is the code for the app:
import javax.swing.*; //imports all the J class components
import javax.swing.ButtonGroup.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
public class Form extends JFrame implements ActionListener
{
JLabel user = new JLabel("Username:");
JTextField name = new JTextField();
JLabel pwd = new JLabel("Password:");
JTextField pass = new JTextField();
JLabel con = new JLabel("Confirm Password:");
JTextField cpwd = new JTextField();
JLabel eml = new JLabel("E-Mail:");
JTextField email = new JTextField();
JLabel cc = new JLabel("Credit Card Number:");
JTextField num = new JTextField();
JLabel type = new JLabel("Credit Card Type:");
JRadioButton Visa = new JRadioButton("Visa");
JRadioButton MC = new JRadioButton("Master Card");
JRadioButton Amerx = new JRadioButton("American Express");
ButtonGroup BG = new ButtonGroup();
//JLabel emon = new JLabel("Expiration Month");
//JLabel eyr = new JLabel("Expiration Year");
String[] expmonths = {"Experation Month", "Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
JComboBox em = new JComboBox(expmonths);
String[] expyear = {"Experation Year", "2006", "2007", "2008", "2009",
"2010" };
JComboBox ey = new JComboBox(expyear);
JLabel trms = new JLabel("Terms And Conditions");
JTextArea terms = new JTextArea(10, 50);
JCheckBox agree = new JCheckBox("I agree to the terms");
JButton sub = new JButton("Submit");
JButton clr = new JButton("Clear");
JButton ret = new JButton("Retrieve");
JButton sav = new JButton("Save");
JMenuBar bar = new JMenuBar();
JMenu menu = new JMenu("File");
JMenuItem open = new JMenuItem("Open");
JMenuItem save = new JMenuItem("Save");
JMenuItem exit = new JMenuItem("Exit");
public Form()
{
BG.add(Visa);
BG.add(MC);
BG.add(Amerx);
terms.setText("You must agree to the terms and conditions...");
Container c = getContentPane();
c.setLayout(new BorderLayout());
terms.setBorder(new TitledBorder("TERMS"));
JPanel jpn = new JPanel();
jpn.setLayout(new GridLayout(1, 3));
JPanel jpn1 = new JPanel();
jpn1.setLayout(new GridLayout(4, 0));
jpn1.add(user);
jpn1.add(pwd);
jpn1.add(con);
jpn1.add(eml);
JPanel jpn2 = new JPanel();
jpn2.setLayout(new GridLayout(4, 0));
jpn2.add(name);
jpn2.add(pass);
jpn2.add(cpwd);
jpn2.add(email);
JPanel jpn3 = new JPanel();
jpn3.setLayout(new FlowLayout());
jpn.add(jpn1);
jpn.add(jpn2);
jpn.add(jpn3);
JPanel jpc = new JPanel(new BorderLayout());
JPanel jpce = new JPanel(new GridLayout(4, 1));
jpce.add(type);
jpce.add(Visa);
jpce.add(MC);
jpce.add(Amerx);
JPanel jpcw = new JPanel(new GridLayout(4, 1, 10, 10));
jpcw.add(cc);
jpcw.add(num);
//jpcw.add(emon);
jpcw.add(em);
//jpcw.add(eyr);
jpcw.add(ey);
JPanel bordr = new JPanel(new GridLayout(2, 1));
bordr.setBorder(new TitledBorder("CreditCard Information"));
jpc.add(bordr);
JPanel jpcb = new JPanel(new GridLayout(3, 1));
jpcb.add(trms);
jpcb.add(terms);
jpcb.add(agree);
JPanel jps = new JPanel(new FlowLayout());
jps.add(sub);
jps.add(clr);
jps.add(sav);
jps.add(ret);
JPanel bordrtop = new JPanel(new GridLayout(1, 2));
bordrtop.add(jpce);
bordrtop.add(jpcw);
JPanel bordrBottom = new JPanel(new BorderLayout());
bordrBottom.add(jpcb);
bordr.add(bordrtop);
bordr.add(bordrBottom);
JPanel main = new JPanel(new BorderLayout());
main.add(jpn, BorderLayout.NORTH);
main.add(jpc, BorderLayout.CENTER);
main.add(jps, BorderLayout.SOUTH);
this.setJMenuBar(bar);
bar.add(menu);
menu.add(open);
menu.add(save);
menu.addSeparator();
menu.add(exit);
c.add(main);
agree.addActionListener(this);
sub.addActionListener(this);
sav.addActionListener(this);
clr.addActionListener(this);
ret.addActionListener(this);
open.addActionListener(this);
save.addActionListener(this);
exit.addActionListener(this);
}
public static void main(String args[])
{
Form c = new Form();
c.setSize(450, 459);
c.setTitle("Credit Card Form");
c.setVisible(true);
c.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e)
{
String AC = e.getActionCommand();
if((AC).equals("Clear"))
{
name.setText("");
pass.setText("");
cpwd.setText("");
email.setText("");
num.setText("");
Visa.setSelected(false);
MC.setSelected(false);
Amerx.setSelected(false);
agree.setSelected(false);
ey.setSelectedIndex(0);
em.setSelectedIndex(0);
}
else if((AC).equals("Submit"))
{
String Username = name.getText();
String Password = pass.getText();
String Mail = email.getText();
String CCType;
if(Visa.isSelected())
CCType = Visa.getText();
else if(MC.isSelected())
CCType = MC.getText();
else
CCType = Amerx.getText();
//String expmon = StringValueOf(em.getSelectedItem());
//String expyr = StringValueOf(ey.getSelectedItem());
String message = Username + "," + Password + "," + Mail + "," + CCType;
JOptionPane.showMessageDialog(null, message);
}
}
}