Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update FSWindow.java
  • Loading branch information
vip14008 committed Apr 19, 2017
1 parent c5ad376 commit ab97e55
Showing 1 changed file with 135 additions and 18 deletions.
153 changes: 135 additions & 18 deletions src/view/FSWindow.java
@@ -1,5 +1,6 @@
package view;
import java.awt.*;
import java.awt.Window;
import java.awt.event.*;
import javax.swing.*;

Expand All @@ -19,11 +20,126 @@ public class FSWindow {
FSWindow.showButtonDemo();
}
private void prepareGUI(){
mainFrame = new JFrame("Charity");

JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(150);

JTabbedPane tabbedPane = new JTabbedPane();
ImageIcon icon = createImageIcon("images/middle.gif");

String[] columnNames = {"First Name", "Last Name"};
Object[][] data = {
{"Kathy", "Smith"},
{"John", "Doe"},
{"Sue", "Black"},
{"Jane", "White"},
{"Joe", "Brown"}
};

JTable table = new JTable(data, columnNames);

tabbedPane.addTab("Total CashFlow", table);
tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

String[] incomeColumns = {"Description", "CashFlow"};
Object[][] income = {
{"Salary",""/**salary of user*/},
{"Interest/dividends", ""/**call interest of user*/},
{"Real Estate/Business",""/**business of user*/},
{"Real Estate/Business",""/**business of user*/},
{"Real Estate/Business",""/**business of user*/},
{"Real Estate/Business",""/**business of user*/},
};

JTable incomeTable = new JTable(income, incomeColumns);

tabbedPane.addTab("Income", incomeTable);
tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);


String[] expenseColumns = {"Description", "CashFlow"};
Object[][] expense = {
{"Taxes",""/**user variable*/},
{"Home Mortgage Payment", ""/**user variable**/},
{"School Loan Payment",""/**user variable**/},
{"Car Loan Payment",""/**user variable**/},
{"Credit Card Payment",""/**user variable**/},
{"Other Expenses",""/**user variable**/},
{"Bank Loan Payment",""/**user variable**/},
{"Per Child Expense",""/**user variable**/},

};

JTable expenseTable = new JTable(expense, expenseColumns);

tabbedPane.addTab("Expenses", expenseTable);
tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);


String[] assetColumns = {"Description", "CashFlow"};
Object[][] asset = {
{"Savings",""/**user variable*/},
{"Precious Metals", ""/**user variable**/},
{"Stocks",""/**user variable**/}, //total stocks number and total money
};

JTable assetTable = new JTable(asset, assetColumns );

String[] assetColumns2 = {"Description", "Down Payment", "Cost"};
Object[][] asset2 = {
{"Name",""/**user variable*/,""},
{"Name", ""/**user variable**/,""},
{"Name",""/**user variable**/, ""/**user variable**/,""}, //total stocks number and total money
};

JTable assetTable2 = new JTable(asset2, assetColumns2 );

tabbedPane.addTab("Assets", assetTable2);

tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);

String[] liabiltiesColumns = {"Description", "Liabilities"};
Object[][] liabilties = {
{"Home Mortgage",""/**user variable*/},
{"School Loans", ""/**user variable**/},
{"Car Loans",""/**user variable**/, ""/**user variable**/},
{"Credit Card Debt", ""/**user variable**/},
{"Bank Loans", ""/**user variable**/},


};

JTable liabiltiesTable = new JTable(liabilties, liabiltiesColumns );


String[] liabiltiesColumns2 = {"Real Estate/Business", "Mortgage/Liability"};
Object[][] liabilties2 = {
{"Name",""/**user variable*/},
{"Name", ""/**user variable**/},
{"Name",""/**user variable**/, ""/**user variable**/},
{"Name", ""/**user variable**/},
{"Name", ""/**user variable**/},


};

JTable liabiltiesTable2 = new JTable(liabilties2, liabiltiesColumns2 );


Component panel5 = (JComponent) makeTextPanel("Panel #5");
tabbedPane.addTab("Liabilities", panel5);
tabbedPane.setMnemonicAt(4, KeyEvent.VK_5);

incomeTable.setPreferredSize(new Dimension(410, 250));
expenseTable.setPreferredSize(new Dimension(410, 250));
assetTable.setPreferredSize(new Dimension(410, 250));
assetTable2.setPreferredSize(new Dimension(410, 250));
mainFrame = new JFrame("CashFlow");
mainFrame.getContentPane().setBackground(new Color(149, 32, 216));
mainFrame.setSize(400,250);
//need to set this to null and position everything manually
mainFrame.setLayout(new GridLayout(3, 1));
mainFrame.setLayout(new FlowLayout());

mainFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent){
Expand All @@ -45,23 +161,24 @@ public class FSWindow {
mainFrame.add(controlPanel);
mainFrame.add(statusLabel);
mainFrame.setVisible(true);
mainFrame.add(splitPane);
splitPane.add(tabbedPane);

}
private ImageIcon createImageIcon(String string) {
// TODO Auto-generated method stub
return null;
}
protected Component makeTextPanel(String text) {
JPanel panel = new JPanel(false);
JLabel filler = new JLabel(text);
filler.setHorizontalAlignment(JLabel.CENTER);
panel.setLayout(new GridLayout(1, 1));
panel.add(filler);
return panel;
}

private void showButtonDemo(){
headerLabel.setText("Charity!");
statusLabel.setText("Charity description");

//resources folder should be inside SWING folder.

JButton SomeButton = new JButton("SomeButton");

SomeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub

}
});

mainFrame.setVisible(true);
mainFrame.setVisible(true);
}
}

0 comments on commit ab97e55

Please sign in to comment.