Advertisement
Guest User

Untitled

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