Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package shopshoe2;
- import java.awt.*;
- import javax.swing.*;
- import java.awt.event.*;
- /**
- *
- * @author Jay Christian Fabregas
- */
- public class Shopshoe2 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- //Main Frame
- JFrame mainFrame = new JFrame("ShopShoe");
- mainFrame.setVisible(true);
- mainFrame.setSize(900, 600);
- mainFrame.setLocationRelativeTo(null);
- mainFrame.setResizable(false);
- mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(null);
- mainPanel.setBackground(Color.DARK_GRAY);
- JLabel welcome = new JLabel("Welcome back!");
- welcome.setBounds(550,100,300,50);
- welcome.setForeground(Color.orange);
- welcome.setFont(new Font("Seriff", Font.PLAIN,25));
- JLabel info = new JLabel("We're so Excited to see you again!");
- info.setBounds(510,140,300,50);
- info.setForeground(Color.gray);
- info.setFont(new Font("Seriff", Font.PLAIN,18));
- JLabel fullname = new JLabel("Name");
- fullname.setBounds(500,285,300,50);
- fullname.setForeground(Color.white);
- fullname.setFont(new Font("Seriff", Font.ITALIC,15));
- JLabel email = new JLabel("Email");
- email.setBounds(500,200,300,50);
- email.setForeground(Color.white);
- email.setFont(new Font("Seriff", Font.ITALIC,15));
- JTextField emailText = new JTextField();
- emailText.setBounds(500,320,300,50);
- JTextField userText = new JTextField();
- userText.setBounds(500,235,300,50);
- JButton mainFrameButton = new JButton("Shop Now!");
- mainFrameButton.setBounds(500,400,300,50);
- JLabel mainFrameLabel = new JLabel("ShopShoe");
- mainFrameLabel.setBounds(70,100,350,50);
- mainFrameLabel.setFont(new Font("Seriff", Font.ITALIC,55));
- mainFrameLabel.setForeground(Color.ORANGE);
- mainFrame.add(mainPanel);
- mainPanel.add(welcome);
- mainPanel.add(mainFrameButton);
- mainPanel.add(mainFrameLabel);
- mainPanel.add(info);
- mainPanel.add(fullname);
- mainPanel.add(email);
- mainPanel.add(userText);
- mainPanel.add(emailText);
- //Action on Button Click
- mainFrameButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- JFrame secondFrame = new JFrame ("ShopShoe");
- secondFrame.setVisible(true);
- secondFrame.setSize(900, 600);
- secondFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- mainFrame.dispose();
- secondFrame.setLocationRelativeTo(null);
- JPanel secondPanel = new JPanel();
- secondPanel.setLayout(null);
- secondPanel.setBackground(Color.DARK_GRAY);
- JPanel secondPanel2= new JPanel ();
- secondPanel2.setBounds(15,65,30,30);
- secondPanel2.setBackground(Color.DARK_GRAY);
- JCheckBox shoe1 = new JCheckBox();
- shoe1.setBackground(Color.DARK_GRAY);
- JPanel secondPanel2A= new JPanel ();
- secondPanel2A.setBounds(50,55,300,40);
- secondPanel2A.setBackground(Color.DARK_GRAY);
- secondPanel.add(secondPanel2A);
- JLabel shoeLabel = new JLabel ("Air Force 1 Nike");
- shoeLabel.setBounds(30,65,30,30);
- shoeLabel.setFont(new Font("Seriff", Font.BOLD, 30));
- shoeLabel.setForeground(Color.ORANGE);
- // JPanel secondPanel2B = new JPanel ();
- // secondPanel2B.setBounds(700,45,150,120);
- // secondPanel.add(secondPanel2B);
- // ImageIcon img1 = new ImageIcon(getClass().getResource("shoe1.jpg"));
- // JLabel imgLabel1 = new JLabel (img1);
- // secondPanel2B.add(imgLabel1);
- JPanel secondPanel3= new JPanel();
- secondPanel3.setBounds(15,208,30,30);
- secondPanel3.setBackground(Color.DARK_GRAY);
- JCheckBox shoe2 = new JCheckBox();
- secondPanel.add(secondPanel3);
- shoe2.setBackground(Color.DARK_GRAY);
- JPanel secondPanel3A= new JPanel ();
- secondPanel3A.setBounds(50,198,300,40);
- secondPanel3A.setBackground(Color.DARK_GRAY);
- secondPanel.add(secondPanel3A);
- JLabel shoeLabel2 = new JLabel ("Air Force 2 Nike");
- shoeLabel2.setBounds(30,65,30,30);
- shoeLabel2.setFont(new Font("Seriff", Font.BOLD, 30));
- shoeLabel2.setForeground(Color.ORANGE);
- // JPanel secondPanel3B = new JPanel();
- // secondPanel3B.setBounds(700,178,150,120);
- // secondPanel.add(secondPanel3B);
- JPanel secondPanel4= new JPanel ();
- secondPanel4.setBounds(15,351,30,30);
- secondPanel4.setBackground(Color.DARK_GRAY);
- secondPanel.add(secondPanel4);
- JCheckBox shoe3 = new JCheckBox();
- shoe3.setBackground(Color.DARK_GRAY);
- JPanel secondPanel4A= new JPanel ();
- secondPanel4A.setBounds(50,341,300,40);
- secondPanel4A.setBackground(Color.DARK_GRAY);
- secondPanel.add(secondPanel4A);
- JLabel shoeLabel3 = new JLabel ("Air Force 3 Nike");
- shoeLabel3.setBounds(30,65,30,30);
- shoeLabel3.setFont(new Font("Seriff", Font.BOLD, 30));
- shoeLabel3.setForeground(Color.ORANGE);
- // JPanel secondPanel4B = new JPanel();
- // secondPanel4B.setBounds(700,321,150,120);
- // secondPanel.add(secondPanel4B);
- JButton secondFrameButton1 = new JButton("Buy");
- secondFrameButton1.setBounds(530,500,100,30);
- JButton secondFrameButton2 = new JButton("Cancel");
- secondFrameButton2.setBounds(680,500,100,30);
- secondFrame.add(secondPanel);
- secondPanel.add(secondFrameButton1);
- secondPanel.add(secondFrameButton2);
- secondPanel.add(secondPanel2);
- secondPanel2.add(shoe1);
- secondPanel2A.add(shoeLabel);
- secondPanel3A.add(shoeLabel2);
- secondPanel4A.add(shoeLabel3);
- secondPanel3.add(shoe2);
- secondPanel4.add(shoe3);
- secondFrameButton1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- JFrame thirdFrame = new JFrame ("Thank You!");
- thirdFrame.setVisible(true);
- thirdFrame.setSize(700, 200);
- thirdFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- secondFrame.dispose();
- thirdFrame.setLocationRelativeTo(null);
- JPanel thirdPanel = new JPanel();
- thirdPanel.setLayout(null);
- thirdPanel.setBackground(Color.DARK_GRAY);
- JLabel thirdFrameLabel = new JLabel("Thank You For Your Purchase!!",SwingConstants.LEFT);
- thirdFrameLabel.setBounds(20,50,700,50);
- thirdFrameLabel.setFont(new Font("Seriff", Font.ITALIC, 45));
- thirdFrameLabel.setForeground(Color.ORANGE);
- thirdFrame.add(thirdPanel);
- thirdPanel.add(thirdFrameLabel);
- }
- });
- secondFrameButton2.addActionListener ( new ActionListener () {
- public void actionPerformed(ActionEvent e){
- secondFrame.dispose();
- mainFrame.setVisible(true);
- }
- });
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement