From 0f23b82a15281d9274cb6e7411afb9e1bcee4a09 Mon Sep 17 00:00:00 2001 From: Sara S Saulat Date: Fri, 7 Apr 2017 14:45:37 -0400 Subject: [PATCH] Create FSWindow.java Ignore everything. I just threw stuff from the other classes as a reference code for now. --- src/view/FSWindow.java | 67 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/view/FSWindow.java diff --git a/src/view/FSWindow.java b/src/view/FSWindow.java new file mode 100644 index 0000000..4b00bdb --- /dev/null +++ b/src/view/FSWindow.java @@ -0,0 +1,67 @@ +package view; +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +public class FSWindow { + + //please ignore all of this. It's mostly my reference code. I'm going to work on it later. + private JFrame mainFrame; + private JLabel headerLabel; + private JLabel statusLabel; + private JPanel controlPanel; + + public FSWindow(){ + prepareGUI(); + } + public static void main(String[] args){ + FSWindow FSWindow = new FSWindow(); + FSWindow.showButtonDemo(); + } + private void prepareGUI(){ + mainFrame = new JFrame("Charity"); + 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.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent windowEvent){ + System.exit(0); + } + }); + + headerLabel = new JLabel("", JLabel.CENTER); + headerLabel.setFont(headerLabel.getFont().deriveFont(Font.BOLD, 16f)); + statusLabel = new JLabel("",JLabel.CENTER); + //new statuslabel of "10% of your whatever is XX dollars" + statusLabel.setSize(350,100); + + controlPanel = new JPanel(); + controlPanel.setLayout(new FlowLayout()); + controlPanel.setBackground(new Color(149, 32, 216)); + + mainFrame.add(headerLabel); + mainFrame.add(controlPanel); + mainFrame.add(statusLabel); + mainFrame.setVisible(true); + } + + 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); + } +}