Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.96 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package shopshoe2;
  7.  
  8. import java.awt.*;
  9. import javax.swing.*;
  10. import java.awt.event.*;
  11.  
  12.  
  13.  
  14. /**
  15. *
  16. * @author Jay Christian Fabregas
  17. */
  18. public class Shopshoe2 {
  19.  
  20.  
  21.  
  22. /**
  23. * @param args the command line arguments
  24. */
  25. public static void main(String[] args) {
  26. //Main Frame
  27. JFrame mainFrame = new JFrame("ShopShoe");
  28. mainFrame.setVisible(true);
  29. mainFrame.setSize(900, 600);
  30. mainFrame.setLocationRelativeTo(null);
  31. mainFrame.setResizable(false);
  32. mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  33.  
  34. JPanel mainPanel = new JPanel();
  35. mainPanel.setLayout(null);
  36. mainPanel.setBackground(Color.DARK_GRAY);
  37.  
  38. JLabel welcome = new JLabel("Welcome back!");
  39. welcome.setBounds(550,100,300,50);
  40. welcome.setForeground(Color.orange);
  41. welcome.setFont(new Font("Seriff", Font.PLAIN,25));
  42.  
  43. JLabel info = new JLabel("We're so Excited to see you again!");
  44. info.setBounds(510,140,300,50);
  45. info.setForeground(Color.gray);
  46. info.setFont(new Font("Seriff", Font.PLAIN,18));
  47.  
  48. JLabel fullname = new JLabel("Name");
  49. fullname.setBounds(500,285,300,50);
  50. fullname.setForeground(Color.white);
  51. fullname.setFont(new Font("Seriff", Font.ITALIC,15));
  52.  
  53. JLabel email = new JLabel("Email");
  54. email.setBounds(500,200,300,50);
  55. email.setForeground(Color.white);
  56. email.setFont(new Font("Seriff", Font.ITALIC,15));
  57.  
  58.  
  59. JTextField emailText = new JTextField();
  60. emailText.setBounds(500,320,300,50);
  61.  
  62.  
  63. JTextField userText = new JTextField();
  64. userText.setBounds(500,235,300,50);
  65.  
  66.  
  67. JButton mainFrameButton = new JButton("Shop Now!");
  68. mainFrameButton.setBounds(500,400,300,50);
  69.  
  70.  
  71. JLabel mainFrameLabel = new JLabel("ShopShoe");
  72.  
  73. mainFrameLabel.setBounds(70,100,350,50);
  74. mainFrameLabel.setFont(new Font("Seriff", Font.ITALIC,55));
  75. mainFrameLabel.setForeground(Color.ORANGE);
  76.  
  77. mainFrame.add(mainPanel);
  78. mainPanel.add(welcome);
  79. mainPanel.add(mainFrameButton);
  80. mainPanel.add(mainFrameLabel);
  81. mainPanel.add(info);
  82. mainPanel.add(fullname);
  83. mainPanel.add(email);
  84. mainPanel.add(userText);
  85. mainPanel.add(emailText);
  86.  
  87.  
  88.  
  89.  
  90. //Action on Button Click
  91.  
  92. mainFrameButton.addActionListener(new ActionListener() {
  93.  
  94. public void actionPerformed(ActionEvent e) {
  95. JFrame secondFrame = new JFrame ("ShopShoe");
  96. secondFrame.setVisible(true);
  97. secondFrame.setSize(900, 600);
  98. secondFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  99. mainFrame.dispose();
  100. secondFrame.setLocationRelativeTo(null);
  101.  
  102.  
  103. JPanel secondPanel = new JPanel();
  104. secondPanel.setLayout(null);
  105. secondPanel.setBackground(Color.DARK_GRAY);
  106.  
  107. JPanel secondPanel2= new JPanel ();
  108. secondPanel2.setBounds(15,65,30,30);
  109. secondPanel2.setBackground(Color.DARK_GRAY);
  110. JCheckBox shoe1 = new JCheckBox();
  111. shoe1.setBackground(Color.DARK_GRAY);
  112.  
  113. JPanel secondPanel2A= new JPanel ();
  114. secondPanel2A.setBounds(50,55,300,40);
  115. secondPanel2A.setBackground(Color.DARK_GRAY);
  116. secondPanel.add(secondPanel2A);
  117. JLabel shoeLabel = new JLabel ("Air Force 1 Nike");
  118. shoeLabel.setBounds(30,65,30,30);
  119. shoeLabel.setFont(new Font("Seriff", Font.BOLD, 30));
  120. shoeLabel.setForeground(Color.ORANGE);
  121.  
  122. // JPanel secondPanel2B = new JPanel ();
  123. // secondPanel2B.setBounds(700,45,150,120);
  124. // secondPanel.add(secondPanel2B);
  125. // ImageIcon img1 = new ImageIcon(getClass().getResource("shoe1.jpg"));
  126. // JLabel imgLabel1 = new JLabel (img1);
  127. // secondPanel2B.add(imgLabel1);
  128.  
  129.  
  130.  
  131.  
  132. JPanel secondPanel3= new JPanel();
  133. secondPanel3.setBounds(15,208,30,30);
  134. secondPanel3.setBackground(Color.DARK_GRAY);
  135. JCheckBox shoe2 = new JCheckBox();
  136. secondPanel.add(secondPanel3);
  137. shoe2.setBackground(Color.DARK_GRAY);
  138.  
  139. JPanel secondPanel3A= new JPanel ();
  140. secondPanel3A.setBounds(50,198,300,40);
  141. secondPanel3A.setBackground(Color.DARK_GRAY);
  142. secondPanel.add(secondPanel3A);
  143. JLabel shoeLabel2 = new JLabel ("Air Force 2 Nike");
  144. shoeLabel2.setBounds(30,65,30,30);
  145. shoeLabel2.setFont(new Font("Seriff", Font.BOLD, 30));
  146. shoeLabel2.setForeground(Color.ORANGE);
  147.  
  148. // JPanel secondPanel3B = new JPanel();
  149. // secondPanel3B.setBounds(700,178,150,120);
  150. // secondPanel.add(secondPanel3B);
  151.  
  152. JPanel secondPanel4= new JPanel ();
  153. secondPanel4.setBounds(15,351,30,30);
  154. secondPanel4.setBackground(Color.DARK_GRAY);
  155. secondPanel.add(secondPanel4);
  156. JCheckBox shoe3 = new JCheckBox();
  157. shoe3.setBackground(Color.DARK_GRAY);
  158.  
  159. JPanel secondPanel4A= new JPanel ();
  160. secondPanel4A.setBounds(50,341,300,40);
  161. secondPanel4A.setBackground(Color.DARK_GRAY);
  162. secondPanel.add(secondPanel4A);
  163. JLabel shoeLabel3 = new JLabel ("Air Force 3 Nike");
  164. shoeLabel3.setBounds(30,65,30,30);
  165. shoeLabel3.setFont(new Font("Seriff", Font.BOLD, 30));
  166. shoeLabel3.setForeground(Color.ORANGE);
  167.  
  168. // JPanel secondPanel4B = new JPanel();
  169. // secondPanel4B.setBounds(700,321,150,120);
  170. // secondPanel.add(secondPanel4B);
  171.  
  172.  
  173. JButton secondFrameButton1 = new JButton("Buy");
  174. secondFrameButton1.setBounds(530,500,100,30);
  175.  
  176.  
  177. JButton secondFrameButton2 = new JButton("Cancel");
  178. secondFrameButton2.setBounds(680,500,100,30);
  179.  
  180. secondFrame.add(secondPanel);
  181. secondPanel.add(secondFrameButton1);
  182. secondPanel.add(secondFrameButton2);
  183. secondPanel.add(secondPanel2);
  184.  
  185. secondPanel2.add(shoe1);
  186.  
  187. secondPanel2A.add(shoeLabel);
  188.  
  189. secondPanel3A.add(shoeLabel2);
  190.  
  191. secondPanel4A.add(shoeLabel3);
  192.  
  193. secondPanel3.add(shoe2);
  194.  
  195.  
  196. secondPanel4.add(shoe3);
  197.  
  198.  
  199. secondFrameButton1.addActionListener(new ActionListener() {
  200.  
  201. public void actionPerformed(ActionEvent e) {
  202. JFrame thirdFrame = new JFrame ("Thank You!");
  203. thirdFrame.setVisible(true);
  204. thirdFrame.setSize(700, 200);
  205. thirdFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  206. secondFrame.dispose();
  207. thirdFrame.setLocationRelativeTo(null);
  208. JPanel thirdPanel = new JPanel();
  209. thirdPanel.setLayout(null);
  210. thirdPanel.setBackground(Color.DARK_GRAY);
  211.  
  212. JLabel thirdFrameLabel = new JLabel("Thank You For Your Purchase!!",SwingConstants.LEFT);
  213. thirdFrameLabel.setBounds(20,50,700,50);
  214. thirdFrameLabel.setFont(new Font("Seriff", Font.ITALIC, 45));
  215. thirdFrameLabel.setForeground(Color.ORANGE);
  216.  
  217. thirdFrame.add(thirdPanel);
  218. thirdPanel.add(thirdFrameLabel);
  219. }
  220. });
  221.  
  222. secondFrameButton2.addActionListener ( new ActionListener () {
  223.  
  224. public void actionPerformed(ActionEvent e){
  225. secondFrame.dispose();
  226. mainFrame.setVisible(true);
  227. }
  228. });
  229.  
  230. }
  231. });
  232.  
  233. }
  234.  
  235.  
  236. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement