Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Read / Write / Display problem

  Asked By: Donna    Date: Sep 15    Category: Java    Views: 985
  

Problem--------------------------------------------------------------

application must store values to a file called client.dat.
once done, user must be able to read and display contents of file.
MY problem is that it doesn't seem to display. Can any1 explain why ?
If it is a problem with my code can any1 explain what it is ?
Thanks

Peter

Frame1.Java----------------------------------------------------------
import javax.swing.UIManager;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.text.*;
import java.beans.*;
import javax.swing.border.*;
import java.io.*;

public class Frame1 extends JFrame implements ActionListener {
private MenuItem about, exit, store, load, done, read;
private MenuBar bar;
private Menu helpMenu, fileMenu;
private DataOutputStream output;
private DataInputStream input;
MessageBox information;
MessageBox errorBox;
JPanel contentPane;
JLabel employerInfolabel = new JLabel();
TitledBorder employerInfoBorder;
JTextField sinField = new JTextField();
JLabel sinLabel = new JLabel();
TitledBorder sinBorder;
TitledBorder incomeTaxBorder;
JLabel yearLabel = new JLabel();
JTextField yearField = new JTextField();
JLabel T4Label = new JLabel();
JTextField employeeIncomeField = new JTextField();
JTextField incomeTaxField = new JTextField();
JLabel employeeIncomeLabel = new JLabel();
TitledBorder employeeIncomeBorder;
JLabel incomeTaxLabel = new JLabel();
JTextField provinceField = new JTextField();
JLabel provinceLabel = new JLabel();
TitledBorder provinceBorder;
TitledBorder CppContributionBorder;
JTextField cppContributionField = new JTextField();
JTextField qppContributionField = new JTextField();
JTextField unionDuesField = new JTextField();
JLabel cppContributionLabel = new JLabel();
TitledBorder QppContributionBorder;
JLabel qppContributionLabel = new JLabel();
JLabel unionDuesLabel = new JLabel();
TitledBorder unionDuesBorder;
JLabel employeeInfoLabel = new JLabel();
TitledBorder employeeInfoBorder;
JLabel renLabel = new JLabel();
JTextArea EmployerInfoTextArea = new JTextArea();
JTextArea EmployeeInfoTextArea = new JTextArea();


public static void main(String[] args)
{
Frame1 window = new Frame1();
window.setTitle("Tax Return Paper");
window.setVisible(true);
}

//Construct the frame
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
contentPane = (JPanel) this.getContentPane();


//create help menu
helpMenu = new Menu( "Help" );
helpMenu.add(about);
about = new MenuItem( "About" );
about.addActionListener(this);

//create file menu
fileMenu = new Menu( "File" );
store = new MenuItem( "Store to File" );
store.addActionListener(this);
read = new MenuItem("Get Information");
read.addActionListener(this);
fileMenu.add(read);
fileMenu.add(store);
fileMenu.addSeparator();
exit = new MenuItem( "Exit" );
exit.addActionListener(this);
fileMenu.add(exit);

//setup MenuBar
bar = new MenuBar();
bar.add(fileMenu);
bar.add(helpMenu);
bar.setHelpMenu(helpMenu);
setMenuBar( bar );
//create About dialog
information = new MessageBox(this, "About", "Program was created by :
Fabrice Bloncourt");

employerInfoBorder = new TitledBorder("Employer's Name & Address");
sinBorder = new TitledBorder("Social Insurance Number");
employeeIncomeBorder = new TitledBorder("Employees Income - line
101");
incomeTaxBorder = new TitledBorder ("Income Tax deducted - 437");

provinceBorder = new TitledBorder("Province of employment");

CppContributionBorder = new TitledBorder("Employee's CPP
contributions - line 308");
QppContributionBorder = new TitledBorder("Employee's QPP
contributions - line 308");

unionDuesBorder = new TitledBorder("Union dues - line 212");
employeeInfoBorder = new TitledBorder("Employee's Name & Address");

contentPane.setLayout(null);

this.setSize(new Dimension(613, 600));
this.setTitle("Frame Title");
//contentPane.setBackground(new Color(185, 200, 225));
contentPane.setPreferredSize(new Dimension(400, 300));

employerInfolabel.setBorder(employerInfoBorder);
employerInfolabel.setText("");
employerInfolabel.setVerticalAlignment(SwingConstants.TOP);
employerInfolabel.setVerticalTextPosition(SwingConstants.CENTER);
employerInfolabel.setBounds(new Rectangle(20, 20, 233, 137));
EmployerInfoTextArea.setBorder(BorderFactory.createLoweredBevelBorder
());
EmployerInfoTextArea.setText("");
EmployerInfoTextArea.setBounds(new Rectangle(31, 416, 268, 131));

sinField.setText("");
sinField.setBounds(new Rectangle(42, 187, 169, 30));
sinLabel.setBorder(sinBorder);
sinLabel.setText("");
sinLabel.setBounds(new Rectangle(20, 170, 212, 58));

yearLabel.setText("Year");
yearLabel.setBounds(new Rectangle(258, 108, 31, 15));
yearField.setText("");
yearField.setBounds(new Rectangle(295, 106, 82, 19));

T4Label.setFont(new java.awt.Font("Dialog", 1, 16));
T4Label.setText(" T4");
T4Label.setBounds(new Rectangle(403, 81, 160, 23));

employeeIncomeField.setText("");
employeeIncomeField.setBounds(new Rectangle(269, 185, 151, 33));
employeeIncomeLabel.setBorder(employeeIncomeBorder);
employeeIncomeLabel.setText("");
employeeIncomeLabel.setBounds(new Rectangle(258, 166, 168, 62));

incomeTaxField.setBounds(new Rectangle(443, 185, 151, 33));
incomeTaxField.setText("");
incomeTaxLabel.setBorder(incomeTaxBorder);
incomeTaxLabel.setBounds(new Rectangle(436, 165, 168, 62));

provinceField.setText("");
provinceField.setBounds(new Rectangle(244, 288, 42, 24));
provinceLabel.setBorder(provinceBorder);
provinceLabel.setText("");
provinceLabel.setBounds(new Rectangle(204, 271, 128, 57));

cppContributionField.setText("");
cppContributionField.setBounds(new Rectangle(388, 289, 160, 21));
cppContributionLabel.setBorder(CppContributionBorder);
cppContributionLabel.setText("");
cppContributionLabel.setBounds(new Rectangle(371, 264, 198, 67));

qppContributionLabel.setBorder(QppContributionBorder);
qppContributionLabel.setText("");
qppContributionLabel.setBounds(new Rectangle(371, 339, 198, 67));
qppContributionField.setText("");
qppContributionField.setBounds(new Rectangle(388, 363, 160, 21));

unionDuesField.setText("");
unionDuesField.setBounds(new Rectangle(388, 435, 160, 21));
unionDuesLabel.setBorder(unionDuesBorder);
unionDuesLabel.setText("");
unionDuesLabel.setBounds(new Rectangle(371, 414, 198, 67));

renLabel.setFont(new java.awt.Font("Dialog", 1, 11));
renLabel.setText("STATEMENT OF RENUMERATION PAID");

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Read / Write / Display problem Or get search suggestion and latest updates.




Tagged: