import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.Number.*;
public class taxSystemGUI implements ActionListener {
static JPanel cards = new JPanel(new CardLayout());
static JTextField username = new JTextField();
static JTextField password = new JPasswordField();
static JTextField accUser = new JTextField();
static JTextField accPass = new JPasswordField();
static JTextField emailAdd = new JTextField();
static JTextField firstname = new JTextField();
static JTextField lastname = new JTextField();
static JTextField socialNum = new JTextField();
static JTextField address = new JTextField();
static JTextField apartNum = new JTextField();
static JTextField city = new JTextField();
static JTextField state = new JTextField();
static JTextField zipCode = new JTextField();
static JTextField userForgotPass= new JTextField();
static User currentUser = null;
static TaxForm currentTaxForm = null;
static String gotPass= null;
static JRadioButton decline = new JRadioButton("Decline");
static JRadioButton accept = new JRadioButton("Accept");
static JRadioButton married = new JRadioButton("Married");
static JRadioButton single = new JRadioButton("Single");
static JRadioButton you = new JRadioButton("You");
static JRadioButton spouse = new JRadioButton("Spouse");
static JTextField fieldPane = new JTextField();
static JTextField fieldPane1 = new JTextField();
static JTextField fieldPane2 = new JTextField();
static JTextField fieldPane3 = new JTextField();
static JTextField fieldPane7 = new JTextField();
static JTextField fieldPane8 = new JTextField();
static String creditCardNumber= null;
static String bankAcctNumber= null;
static JRadioButton no = new JRadioButton("NO");
static JRadioButton yes = new JRadioButton("YES");
static JTextField nameInput = new JTextField();
static JTextField creditInput = new JTextField();
static JTextField zipInput = new JTextField();
static JTextField expInput = new JTextField();
static JTextField bankNum = new JTextField();
static JTextField routeNum = new JTextField();
private static void createAndShowGUI() {
//Make sure we have nice window decorations.
initLookAndFeel();
JFrame.setDefaultLookAndFeelDecorated(true);
//Create and set up the window
JFrame frame = new JFrame("ABCD Tax System");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel("Welcome to the ABCD Tax System", JLabel.CENTER);
label.setFont(new Font("Times New Roman", Font.PLAIN, 20));
label.setForeground(new Color(0x00AA00));
label.setBorder(BorderFactory.createEmptyBorder(10,30,10,30));
frame.getContentPane().add(label, BorderLayout.NORTH);
JButton cont = new JButton("Continue");
cont.setMnemonic(KeyEvent.VK_C);
cont.addActionListener(new taxSystemGUI());
ButtonGroup group = new ButtonGroup();
group.add(decline);
group.add(accept);
decline.setSelected(true);
JPanel buttonPanel = new JPanel(new GridLayout(1,3));
buttonPanel.add(decline);
buttonPanel.add(accept);
buttonPanel.add(Box.createHorizontalGlue());
buttonPanel.add(cont);
buttonPanel.setBorder(BorderFactory.createEmptyBorder(5,70,5,70));
JTextArea textArea = new JTextArea(createMessage(),10,75);
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
JLabel areaTitle = new JLabel("Use this service if:");
areaTitle.setFont(new Font("Times New Roman", Font.PLAIN, 16));
JPanel panel = new JPanel(new BorderLayout());
panel.add(areaTitle, BorderLayout.NORTH);
panel.add(scrollPane, BorderLayout.CENTER);
panel.add(buttonPanel, BorderLayout.SOUTH);
panel.setBorder(BorderFactory.createEmptyBorder(10, 30, 10, 30));
cards.add(panel, "Welcome");
cards.add(createLoginPane(), "Login");
cards.add(createAccountPane(), "Account");
cards.add(createAccountSubmitPane(), "Account Submit");
cards.add(createForgotPane(), "Forgot");
cards.add(createFormA(), "FormA");
cards.add(processPayment(), "Payment");
cards.add(showAdvisors(),"Advisors");
cards.add(showReturnTime(),"Display");
frame.getContentPane().add(cards, BorderLayout.CENTER);
//Display the window.
frame.pack();
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
CardLayout cl = (CardLayout)(cards.getLayout());
if(command=="Continue") {
username.setText("");
password.setText("");
if(accept.isSelected()) {
cl.show(cards, "Login");
}
else if(decline.isSelected()) {
System.exit(0);
}
}
else if(command=="New User?") {
cl.show(cards, "Account");
}
else if(command=="Next") {
cl.show(cards, "Account Submit");
}
else if(command=="Back") {
username.setText("");
password.setText("");
cl.show(cards, "Login");
}
else if(command=="Back_For") {
username.setText("");
password.setText("");
cl.show(cards, "Login");
}
else if(command=="Forgot") {
gotPass=forgotPassword(userForgotPass.getText());
if(gotPass!=null) {
cards.add(createForgot2Pane(), "Password");
cl.show(cards, "Password");
}
else
cl.show(cards, "Forgot");
}
else if(command=="Forgot Password?") {
cl.show(cards, "Forgot");
}
else if(command=="Log In") {
currentUser = loginUserAccount(username.getText(),password.getText());
if(currentUser!=null) {
cl.show(cards, "FormA");
}
}
else if(command=="Submit") {
username.setText("");
password.setText("");
currentUser = createUserAccount();
cl.show(cards, "Login");
}
else if(command=="Back to Info") {
cl.show(cards, "Account");
}
else if(command=="Process") {
currentTaxForm = createTaxForm();
if(currentTaxForm != null){
cards.add(overUnderPayment(), "OverUnder");
cl.show(cards, "Advisors");
}
}
else if(command=="Payment") {
cl.show(cards, "Payment");
}
else if(command=="Payment2") {
cl.show(cards, "Payment2");
}
else if(command=="List") {
if(no.isSelected()){
cl.show(cards, "Payment");
}
if(yes.isSelected()){
cl.show(cards, "List");
}
}
else if(command=="Advisors") {
cl.show(cards, "List");
}
else if(command=="Display") {
cl.show(cards, "Display");
}
else if(command=="OverUnder") {
currentTaxForm.filename=currentUser.getUserName()+"_tax.txt";
currentTaxForm.writeToFile();
cl.show(cards, "OverUnder");
}
else if(command=="Logout") {
username.setText("");
password.setText("");
cl.show(cards, "Login");
}
}
private static JPanel createLoginPane() {
username.setText(null);
password.setText(null);
JPanel loginPane = new JPanel(new BorderLayout());
JLabel login = new JLabel("Login:");
login.setFont(new Font("Times New Roman", Font.PLAIN, 16));
loginPane.add(login, BorderLayout.NORTH);
JPanel userPass = new JPanel(new GridLayout(3,1));
JPanel name = new JPanel(new GridLayout(1,3));
JLabel user = new JLabel("Username:");
name.add(user);
name.add(username);
name.add(Box.createHorizontalGlue());
name.setBorder(BorderFactory.createEmptyBorder(8,0,8,0));
userPass.add(name);
JPanel pass = new JPanel(new GridLayout(1,3));
JLabel passLabel = new JLabel("Password:");
pass.add(passLabel);
pass.add(password);
pass.add(Box.createHorizontalGlue());
pass.setBorder(BorderFactory.createEmptyBorder(8,0,8,0));
userPass.add(pass);
JPanel submitPanel = new JPanel();
JButton loginSubmit = new JButton("Log In");
loginSubmit.addActionListener(new taxSystemGUI());
submitPanel.add(Box.createHorizontalGlue());
submitPanel.add(loginSubmit);
submitPanel.add(Box.createHorizontalGlue());
userPass.add(submitPanel);
loginPane.add(userPass, BorderLayout.CENTER);
JPanel buttons = new JPanel(new GridLayout(1,2));
JButton newUser = new JButton("New User?");
newUser.addActionListener(new taxSystemGUI());
newUser.setForeground(new Color(0x0000FF));
buttons.add(newUser);
buttons.add(Box.createHorizontalGlue());
JButton forgot = new JButton("Forgot Password?");
forgot.addActionListener(new taxSystemGUI());
forgot.setForeground(new Color(0x0000FF));
buttons.add(forgot);
loginPane.add(buttons, BorderLayout.SOUTH);
loginPane.setBorder(BorderFactory.createEmptyBorder(30,160,30,160));
return loginPane;
}
private static JPanel createAccountPane() {
JPanel wholePane = new JPanel(new BorderLayout());
JLabel message = new JLabel("Please Enter the following information:", JLabel.CENTER);
wholePane.add(message, BorderLayout.NORTH);
JPanel accountPane = new JPanel(new GridLayout(8,2));
JLabel first = new JLabel("First Name:");
accountPane.add(first);
accountPane.add(firstname);
JLabel last = new JLabel("Last Name:");
accountPane.add(last);
accountPane.add(lastname);
JLabel SSN = new JLabel("Social Security Number:");
accountPane.add(SSN);
accountPane.add(socialNum);
JLabel hAddress = new JLabel("Home Address:");
accountPane.add(hAddress);
accountPane.add(address);
JLabel aptNum = new JLabel("Apt. no.:");
accountPane.add(aptNum);
accountPane.add(apartNum);
JLabel cityname = new JLabel("City:");
accountPane.add(cityname);
accountPane.add(city);
JLabel statename = new JLabel("State:");
accountPane.add(statename);
accountPane.add(state);
JLabel zip = new JLabel("Zip Code:");
accountPane.add(zip);
accountPane.add(zipCode);
accountPane.setBorder(BorderFactory.createEmptyBorder(30,75,30,75));
wholePane.add(accountPane, BorderLayout.CENTER);
//accountPane.add(Box.createHorizontalGlue());
JButton next = new JButton("Next");
next.addActionListener(new taxSystemGUI());
JPanel nextPane = new JPanel(new GridLayout(5,1));
nextPane.add(Box.createHorizontalGlue());
nextPane.add(Box.createHorizontalGlue());
nextPane.add(next);
nextPane.add(Box.createHorizontalGlue());
nextPane.add(Box.createHorizontalGlue());
wholePane.add(nextPane, BorderLayout.EAST);
JButton back = new JButton("Back");
back.addActionListener(new taxSystemGUI());
JPanel backPane = new JPanel(new GridLayout(5,1));
backPane.add(Box.createHorizontalGlue());
backPane.add(Box.createHorizontalGlue());
backPane.add(back);
backPane.add(Box.createHorizontalGlue());
backPane.add(Box.createHorizontalGlue());
wholePane.add(backPane, BorderLayout.WEST);
return wholePane;
}
private static JPanel createAccountSubmitPane() {
JPanel wholePane = new JPanel(new BorderLayout());
JLabel message = new JLabel("Please Enter the following information:", JLabel.CENTER);
wholePane.add(message, BorderLayout.NORTH);
JPanel accountPane = new JPanel(new GridLayout(4,2));
JLabel username = new JLabel("Username:");
accountPane.add(username);
accountPane.add(accUser);
JLabel password = new JLabel("Password:");
accountPane.add(password);
accountPane.add(accPass);
JLabel email = new JLabel("Email Address:");
accountPane.add(email);
accountPane.add(emailAdd);
accountPane.setBorder(BorderFactory.createEmptyBorder(30,160,30,160));
JButton backToInfo = new JButton("Back to Info");
backToInfo.addActionListener(new taxSystemGUI());
JPanel backPanel = new JPanel(new GridLayout(1,2));
backPanel.add(backToInfo);
backPanel.add(Box.createHorizontalGlue());
JButton submit = new JButton("Submit");
submit.addActionListener(new taxSystemGUI());
JPanel submitPanel = new JPanel(new GridLayout(1,2));
submitPanel.add(Box.createHorizontalGlue());
submitPanel.add(submit);
accountPane.add(backPanel);
accountPane.add(submitPanel);
wholePane.add(accountPane, BorderLayout.CENTER);
return wholePane;
}
private static JPanel createForgotPane() {
JPanel forgot = new JPanel(new GridLayout(3,1));
JLabel info= new JLabel("Enter your username and hit enter, your password will be provided to you", JLabel.CENTER);
info.setFont(new Font("Times New Roman", Font.PLAIN, 16));
info.setForeground(Color.WHITE);
forgot.add(info, BorderLayout.NORTH);
JPanel forgotPass = new JPanel(new GridLayout(3,1));
JPanel name = new JPanel(new GridLayout(1,3));
JLabel user = new JLabel("Username:", JLabel.CENTER);
user.setForeground(Color.WHITE);
name.add(user);
name.add(userForgotPass);
name.add(Box.createHorizontalGlue());
name.setBorder(BorderFactory.createEmptyBorder(8,0,8,0));
name.setBackground(Color.BLUE);
forgotPass.add(name, BorderLayout.CENTER);
forgotPass.setBackground(Color.BLUE);
forgot.add(forgotPass, BorderLayout.CENTER);
JButton next = new JButton("Next");
next.setActionCommand("Forgot");
next.addActionListener(new taxSystemGUI());
JButton back = new JButton("Back");
back.setActionCommand("Back_For");
back.addActionListener(new taxSystemGUI());
JPanel nextPane = new JPanel();
nextPane.add(Box.createHorizontalGlue());
nextPane.add(back, BorderLayout.EAST);
nextPane.add(next, BorderLayout.WEST);
nextPane.add(Box.createHorizontalGlue());
nextPane.setBackground(Color.BLUE);
forgot.add(nextPane, BorderLayout.SOUTH);
forgot.setBackground(Color.BLUE);
return forgot;
}
private static JPanel createForgot2Pane() {
//Create another Panel that displays the password
JPanel forgot2 = new JPanel(new GridLayout(3,1));
JLabel passText= new JLabel("Your password is: ", JLabel.CENTER);
JLabel passw= new JLabel(gotPass, JLabel.CENTER);
passText.setFont(new Font("Times New Roman", Font.PLAIN, 16));
passw.setFont(new Font("Times New Roman", Font.PLAIN, 16));
passText.setForeground(Color.WHITE);
passw.setForeground(Color.WHITE);
forgot2.add(passText, BorderLayout.NORTH);
forgot2.add(passw, BorderLayout.CENTER);
JButton returnLogin = new JButton("Return to Login Page");
returnLogin.setActionCommand("Continue");
returnLogin.addActionListener(new taxSystemGUI());
JPanel forgPane = new JPanel();
forgPane.add(Box.createHorizontalGlue());
forgPane.add(returnLogin);
forgPane.add(Box.createHorizontalGlue());
forgPane.setBackground(Color.BLUE);
forgot2.add(forgPane, BorderLayout.SOUTH);
forgot2.setBackground(Color.BLUE);
return forgot2;
}
private static String forgotPassword(String user){
File userFile = new File(user+".txt");
if(userFile.exists()) {
BufferedReader input = null;
String password=null;
try {
input = new BufferedReader(new FileReader(userFile));
password=input.readLine();
}
catch (FileNotFoundException ex) {
ex.printStackTrace();
}
catch (IOException ex){
ex.printStackTrace();
}
return password;
}
else {
System.err.println("Invalid username");
return null;
}
}
private static User createUserAccount() {
User newUser = new User();
if(firstname.getText()!=null &&
lastname.getText()!=null &&
socialNum.getText()!=null &&
address.getText()!=null &&
city.getText()!=null &&
state.getText()!=null &&
zipCode.getText()!=null &&
emailAdd.getText()!=null &&
accUser.getText()!=null &&
accPass.getText()!=null) {
newUser.setFirstName(firstname.getText());
newUser.setLastName(lastname.getText());
newUser.setSSNum(socialNum.getText());
newUser.setAddress(address.getText());
newUser.setCity(city.getText());
newUser.setState(state.getText());
newUser.setZipCode(zipCode.getText());
newUser.setEmail(emailAdd.getText());
newUser.setUserName(accUser.getText());
newUser.setPassword(accPass.getText());
newUser.writeToFile();
return newUser;
}
else {
System.err.println("Information is incomplete, make sure all fields are filled out");
return null;
}
}
private static User loginUserAccount(String user, String pass) {
File userFile = new File(user+".txt");
if(userFile.exists()) {
User loginUser = new User();
loginUser.readFromFile(userFile);
if(loginUser.getPassword().equals(pass)&&!user.equals("")){
System.err.println("Login successful");
return loginUser;
}
else{
System.err.println("Invalid username and password.");
return null;
}
}
else {
System.err.println("Invalid username and password.");
return null;
}
}
private static String createMessage() {
String text ="-Your filing status is single or married filing jointly.\n";
text += "-You (and your spouse if married filing jointly) were under age 65 and\n";
text += " not blind at the end of 2005. If you were born on January 1, 1941, you\n";
text += " are considered to be age 65 at the end of 2005.\n";
text += "-You do not claim any dependents.\n";
text += "-Your taxable income is less than $100,000.\n";
text += "-You do not claim any adjustments to income.\n";
text += "-The only tax credit you can claim is the earned income credit.\n";
text += "-You had only wages, salaries, tips, taxable scholarship or fellowship\n";
text += " grants, unemployment compensation, or Alaska Permanent Fund dividends,\n";
text += " and your taxable interest was not over $1,500. But ifyou earned tips,\n";
text += " includign allocated tips, that are not included in box 5 and box 7 of\n";
text += " your Form W-2, you may not be able to use Form 1040EZ.\n";
text += "-You did not receive any advance earned income credit payments.";
return text;
}
private static JPanel createFormA() {
JPanel wholePane = new JPanel(new BorderLayout());
JPanel formPane = new JPanel(new GridLayout(10,1));
ButtonGroup marital = new ButtonGroup();
marital.add(single);
marital.add(married);
single.setSelected(true);
JPanel buttonPane2 = new JPanel(new GridLayout(1,2));
buttonPane2.add(Box.createHorizontalGlue());
buttonPane2.add(single);
buttonPane2.add(married);
buttonPane2.add(Box.createHorizontalGlue());
wholePane.add(buttonPane2, BorderLayout.NORTH);
JLabel question1 = new JLabel("Wages, salaries, and tips. This should be shown in box 1 of your Form(s) W-2.");
formPane.add(question1);
formPane.add(fieldPane1);
JLabel question2 = new JLabel("Taxable interest. If the total is over $1,500, you cannot use Form 1040EZ");
formPane.add(question2);
formPane.add(fieldPane2);
JLabel question3 = new JLabel("Unemployment compensation and Alaska Permanent Fund dividends");
formPane.add(question3);
formPane.add(fieldPane3);
JPanel buttonPane3 = new JPanel(new GridLayout(1,1));
JLabel box1 = new JLabel("Can be claimed as dependent?");
buttonPane3.add(box1);
buttonPane3.add(you);
buttonPane3.add(spouse);
wholePane.add(buttonPane3, BorderLayout.EAST);
JLabel question7 = new JLabel("Federal income tax withheld from box 2 of your Form(s) W-2");
formPane.add(question7);
formPane.add(fieldPane7);
JLabel question8 = new JLabel("Nontaxable combat pay election");
formPane.add(question8);
formPane.add(fieldPane8);
formPane.setBorder(BorderFactory.createEmptyBorder(0,100,0,100));
wholePane.add(formPane, BorderLayout.CENTER);
JButton process = new JButton("Process Taxes");
process.setActionCommand("Process");
process.addActionListener(new taxSystemGUI());
JPanel buttonPanel = new JPanel();
buttonPanel.add(Box.createHorizontalGlue());
buttonPanel.add(process);
buttonPanel.add(Box.createHorizontalGlue());
wholePane.add(buttonPanel, BorderLayout.SOUTH);
return wholePane;
}
private static TaxForm createTaxForm() {
TaxForm newTaxForm = new TaxForm();
if(!fieldPane1.getText().equals("") &&
!fieldPane2.getText().equals("") &&
!fieldPane3.getText().equals("") &&
!fieldPane7.getText().equals("") &&
!fieldPane8.getText().equals(""))
{
newTaxForm.fields[0]=Double.valueOf(fieldPane1.getText()).doubleValue();
newTaxForm.fields[1]=Double.valueOf(fieldPane2.getText()).doubleValue();
newTaxForm.fields[2]=Double.valueOf(fieldPane3.getText()).doubleValue();
newTaxForm.fields[6]=Double.valueOf(fieldPane7.getText()).doubleValue();
newTaxForm.fields[7]=Double.valueOf(fieldPane8.getText()).doubleValue();
if(single.isSelected()){
newTaxForm.status[0]=true;
}
else{
newTaxForm.status[0]=false;
}
if(you.isSelected()){
newTaxForm.status[1]=true;
}
else{
newTaxForm.status[1]=false;
}
if(spouse.isSelected()){
newTaxForm.status[2]=true;
}
else{
newTaxForm.status[2]=false;
}
newTaxForm.processTaxes();
return newTaxForm;
}
else {
System.err.println("Information is incomplete, make sure all fields are filled out");
return null;
}
}
public static JPanel overUnderPayment(){
JPanel overUnder= new JPanel(new BorderLayout());
overUnder.setBorder(BorderFactory.createEmptyBorder(30,160,30,160));
overUnder.setBackground(Color.GREEN);
String text="Based on the information you have provided you ... \n ";
if(currentTaxForm.fields[10]==0){
text += "owe the IRS $"+currentTaxForm.fields[11];
}
else {
text += "the IRS owes you $"+currentTaxForm.fields[10];
}
JTextArea textArea = new JTextArea(text,4,11);
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
scrollPane.setBackground(Color.BLUE);
textArea.setBackground(Color.BLUE);
textArea.setForeground(Color.ORANGE);
JPanel priceText = new JPanel(new BorderLayout());
priceText.add(scrollPane);
priceText.setBackground(Color.BLUE);
overUnder.add(priceText, BorderLayout.NORTH);
JPanel panel = new JPanel();
JButton display = new JButton("Expected Return Time");
panel.add(display);
panel.setBackground(Color.GREEN);
display.addActionListener(new taxSystemGUI());
display.setActionCommand("Display");
overUnder.add(panel,BorderLayout.SOUTH);
return overUnder;
}
public static JPanel processPayment(){
JPanel payPane= new JPanel(new BorderLayout());
payPane.setBorder(BorderFactory.createEmptyBorder(30,160,30,160));
payPane.setBackground(Color.BLUE);
String text="For the use of the ABCD Tax Software, a fee of $29.99 including tax is required.\n";
text += "Enter either your credit card number or bank account information below.\n" ;
text += "You will only be allowed to continue if correct information is provided";
JTextArea textArea = new JTextArea(text,3,10);
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
scrollPane.setBackground(Color.BLUE);
scrollPane.setForeground(Color.ORANGE);
JPanel priceText = new JPanel(new BorderLayout());
priceText.add(textArea);
priceText.setBackground(Color.BLUE);
payPane.add(priceText, BorderLayout.NORTH);
//Create fields for the user to enter the credit card or bank account number
JLabel name= new JLabel("Name: ");
JPanel credit = new JPanel();
JPanel creditNum = new JPanel(new GridLayout(6,1));
name.setForeground(Color.WHITE);
creditNum.add(name);
creditNum.add(nameInput);
creditNum.add(Box.createHorizontalGlue());
credit.add(creditNum);
JLabel creditCardNumber= new JLabel("Card Number:");
creditCardNumber.setForeground(Color.WHITE);
creditNum.add(creditCardNumber);
creditNum.add(creditInput);
creditNum.add(Box.createHorizontalGlue());
JLabel zip= new JLabel("Zip Code:");
zip.setForeground(Color.WHITE);
creditNum.add(zip);
creditNum.add(zipInput);
creditNum.add(Box.createHorizontalGlue());
JLabel exp= new JLabel("Expiration Date:");
exp.setForeground(Color.WHITE);
creditNum.add(exp);
creditNum.add(expInput);
creditNum.add(Box.createHorizontalGlue());
JLabel bankAcctLabel = new JLabel("Bank Account Number:");
bankAcctLabel.setForeground(Color.WHITE);
creditNum.add(bankAcctLabel);
creditNum.add(bankNum);
creditNum.add(Box.createHorizontalGlue());
JLabel routeLabel = new JLabel("Routing Number:");
routeLabel.setForeground(Color.WHITE);
creditNum.add(routeLabel);
creditNum.add(routeNum);
creditNum.add(Box.createHorizontalGlue());
creditNum.setBorder(BorderFactory.createEmptyBorder(10,0,10,0));
creditNum.setBackground(Color.BLUE);
credit.setBackground(Color.BLUE);
credit.add(creditNum);
payPane.add(credit, BorderLayout.CENTER);
//Create the continue button and add it to the panel
JPanel contPanel= new JPanel();
JButton cont = new JButton("Continue");
cont.setActionCommand("Payment2");
cont.addActionListener(new taxSystemGUI());
cont.setBackground(Color.BLUE);
contPanel.add(cont);
contPanel.setBackground(Color.BLUE);
payPane.add(contPanel, BorderLayout.SOUTH);
payPane.setBorder(BorderFactory.createEmptyBorder(30,160,30,160));
//Create the panel that the continue button links to when one of the fields are completed
JPanel payPane2= new JPanel(new BorderLayout());
payPane2.setBorder(BorderFactory.createEmptyBorder(30,160,30,160));
payPane2.setBackground(Color.BLUE);
JPanel message= new JPanel();
JLabel confirm = new JLabel("The credit card number or bank account number was accepted", JLabel.CENTER);
confirm.setFont(new Font("Times New Roman", Font.PLAIN, 20));
confirm.setForeground(Color.YELLOW);
payPane2.add(confirm, BorderLayout.NORTH);
JLabel confirmNum = new JLabel("The confirmation number is " + (int)(100* (1000000* Math.random())), JLabel.CENTER);
confirmNum.setFont(new Font("Times New Roman", Font.PLAIN, 20));
confirmNum.setForeground(Color.YELLOW);
payPane2.add(confirmNum, BorderLayout.CENTER);
JPanel cont2Panel= new JPanel();
JButton cont2 = new JButton("Continue");
cont2.setActionCommand("OverUnder");
cont2.addActionListener(new taxSystemGUI());
cont2.setBackground(Color.BLUE);
cont2Panel.add(cont2);
cont2Panel.setBackground(Color.BLUE);
payPane2.add(cont2Panel, BorderLayout.SOUTH);
//Add the panel to the set of cards
cards.add(payPane2, "Payment2");
return payPane;
}
private static void initLookAndFeel() {
String lookAndFeel = null;
lookAndFeel = UIManager.getSystemLookAndFeelClassName();
try {
UIManager.setLookAndFeel(lookAndFeel);
} catch (Exception e) {
System.err.println("Couldn't get specified look and feel ("
+ lookAndFeel
+ "), for some reason.");
System.err.println("Using the default look and feel.");
e.printStackTrace();
}
}
private static JPanel showAdvisors(){
//prompt user about using Advisor
JPanel prompt= new JPanel(new BorderLayout());
prompt.setBorder(BorderFactory.createEmptyBorder(30,160,30,160));
String question="For an additional fee of $15.00, would you like to have an advisor \nreview your form before submission? \n";
question +="\n \nIf so, please select yes and proceed. A list of advisors will be provided.\n";
question +="\nIf not, please select no and proceed. Your from will be sumbitted as is.\n";
JTextArea textArea = new JTextArea(question,10,10);
JScrollPane scrollPane3 = new JScrollPane(textArea);
scrollPane3.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
JPanel promptText = new JPanel(new BorderLayout());
promptText.add(textArea);
prompt.add(promptText, BorderLayout.NORTH);
ButtonGroup group = new ButtonGroup();
group.add(no);
group.add(yes);
decline.setSelected(true);
JPanel buttonPanel = new JPanel(new GridLayout(1,3));
buttonPanel.add(no);
buttonPanel.add(yes);
buttonPanel.add(Box.createHorizontalGlue());
//create the proceed button
JButton proceed = new JButton("Proceed");
proceed.setActionCommand("List");
proceed.addActionListener(new taxSystemGUI());
buttonPanel.add(proceed);
prompt.add(buttonPanel, BorderLayout.SOUTH);
buttonPanel.setBorder(BorderFactory.createEmptyBorder(5,70,5,70));
JLabel areaTitle = new JLabel("Here is the list of available advisors:");
areaTitle.setFont(new Font("Times New Roman", Font.PLAIN, 16));
JPanel advisorPane = new JPanel(new BorderLayout());
advisorPane.add(areaTitle, BorderLayout.NORTH);
advisorPane.setBorder(BorderFactory.createEmptyBorder(10, 30, 10, 30));
String list ="\nCannon & Company \n5605 Murray Avenue \nMemphis, TN 38119 \n901-761-1710 \n";
list += "\nDKAdvisors \n2151 E. Broadway Rd., Ste. 111 \nTempe, AZ 85282 \n866-467-5809 \n";
list += "\nFlorida Property Tax Advisors \n5655 S. Indian River Dr. \nFt. Pierce, FL 34982-7752 \n772-460-0107 \n";
list += "\nInternational Tax Advisors, Inc. \n1250 Barclay Blvd. \nBuffalo Grove, IL 60089 \n847-495-3070 \n";
list += "\nLenox Advisors, Inc \n530 Fifth Avenue \n11th Floor \nNew York, NY 10036 \n212-536-8700 \n";
list += "\nMichael Gray, CPA \n1265 South Bascom Avenue, Suite 106 \nSan Jose, CA 95128-3533 \n408-918-3161 \n";
list += "\nPremier Tax Advisors, P.C. \nThe Candler Building, Suite 720 \n127 Peachtree Street \nAtlanta, GA 30303 \n404-475-1670 \n";
list += "\nSales Tax Advisors, Inc. \n9168 Village Lane \nOzawkie, KS 66070-6102 \n866-688-9472 \n";
list += "\nTax Advisors Group \n5728 LBJ Freeway, Suite 210 \nDallas, TX 75240 \n972-503-7506 \n";
list += "\nTax Advisors, PLLC \n201 NE Park Plaza Drive, Suite 244 \nVancouver, WA 98684-5873 \n888-230-5906 \n";
JTextArea textArea2 = new JTextArea(list,10,75);
JScrollPane scrollPane2 = new JScrollPane(textArea2);
scrollPane2.setBorder(BorderFactory.createEmptyBorder(5,50,5,50));
advisorPane.add(scrollPane2, BorderLayout.CENTER);
JPanel cont2Panel= new JPanel();
JButton cont2 = new JButton("Continue");
cont2Panel.add(cont2);
cont2.setActionCommand("Payment");
cont2.addActionListener(new taxSystemGUI());
advisorPane.add(cont2Panel, BorderLayout.SOUTH);
cards.add(advisorPane, "List");
return prompt;
}
private static JPanel showReturnTime(){
JPanel display= new JPanel(new BorderLayout());
display.setBorder(BorderFactory.createEmptyBorder(30,160,30,160));
String time="Please allow up to 4 weeks for you tax form to be processed.\n";
time +="\nIf you chose to have an advisor review your form, the return date will \n";
time +="\ndependent on when the advisor receives your form\n";
JTextArea textArea = new JTextArea(time,10,10);
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
JPanel displayText = new JPanel(new BorderLayout());
displayText.add(textArea);
display.add(displayText, BorderLayout.NORTH);
JPanel panel = new JPanel();
JButton logout = new JButton("Logout");
panel.add(logout);
logout.addActionListener(new taxSystemGUI());
logout.setActionCommand("Logout");
display.add(panel,BorderLayout.SOUTH);
return display;
}
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}