diff --git a/src/view/CharityCardWindow.java b/src/view/CharityWindow.java similarity index 75% rename from src/view/CharityCardWindow.java rename to src/view/CharityWindow.java index 0bc006e..99f61e2 100644 --- a/src/view/CharityCardWindow.java +++ b/src/view/CharityWindow.java @@ -4,21 +4,22 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; -public class CharityCardWindow { +public class CharityWindow { private JFrame mainFrame; private JLabel headerLabel; private JLabel statusLabel; private JPanel controlPanel; - public CharityCardWindow(){ + public CharityWindow(){ prepareGUI(); } public static void main(String[] args){ - CharityCardWindow CharityCardWindow = new CharityCardWindow(); - CharityCardWindow.showButtonDemo(); + CharityWindow CharityWindow = new CharityWindow(); + CharityWindow.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)); @@ -28,38 +29,32 @@ public class CharityCardWindow { System.exit(0); } }); - headerLabel = new JLabel("", JLabel.CENTER); + + 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 static ImageIcon createImageIcon(String path, String description) { - java.net.URL imgURL = CharityCardWindow.class.getResource(path); - if (imgURL != null) { - return new ImageIcon(imgURL, description); - } else { - System.err.println("Couldn't find file: " + path); - return null; - } - } + private void showButtonDemo(){ headerLabel.setText("Charity!"); statusLabel.setText("Charity description"); //resources folder should be inside SWING folder. - ImageIcon icon = createImageIcon("/resources/java_icon.png","Java"); JButton Donate = new JButton("Donate"); - JButton DontDonate = new JButton("Don't Donate", icon); + JButton DontDonate = new JButton("Don't Donate"); DontDonate.setHorizontalTextPosition(SwingConstants.LEFT); Donate.addActionListener(new ActionListener() {