Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Updated names. edited background colors and font
  • Loading branch information
sss13010 committed Apr 7, 2017
1 parent 0f23b82 commit c77cbf9
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/view/CharityCardWindow.java → src/view/CharityWindow.java
Expand Up @@ -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));
Expand All @@ -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() {
Expand Down

0 comments on commit c77cbf9

Please sign in to comment.