Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
forgot to make this before
  • Loading branch information
sss13010 committed Apr 7, 2017
1 parent 16f71f7 commit f8e322c
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions src/view/DownSizeWindow
@@ -0,0 +1,75 @@
package view;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class DownSizeWindow {
private JFrame mainFrame;
private JLabel headerLabel;
private JLabel statusLabel;
private JPanel controlPanel;

public DownSizeWindow(){
prepareGUI();
}
public static void main(String[] args){
DownSizeWindow DownSizeWindow = new DownSizeWindow();
DownSizeWindow.showButtonDemo();
}
private void prepareGUI(){
mainFrame = new JFrame("Doodad");
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);
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("Downsize");
statusLabel.setText("You lose 3 turns.");
//resources folder should be inside SWING folder.

JButton Downsize = new JButton("Downsize");
// Downsize.setLayout(null);
// Downsize.setLocation(10,220);
Downsize.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//run downsize update method
System.exit(0);
}
});

controlPanel.add(Downsize);
mainFrame.setVisible(true);
}
}

0 comments on commit f8e322c

Please sign in to comment.