|
1 | | -package Textbook_selling_system; |
2 | | - |
3 | | -import java.awt.BorderLayout; |
4 | | -import java.awt.EventQueue; |
5 | | -import java.awt.Font; |
6 | | - |
7 | | -import javax.swing.JFrame; |
8 | | -import javax.swing.JInternalFrame; |
9 | | -import javax.swing.JLabel; |
10 | | -import javax.swing.JOptionPane; |
11 | | -import javax.swing.JPanel; |
12 | | -import javax.swing.JTextArea; |
13 | | -import javax.swing.border.EmptyBorder; |
14 | | -import javax.swing.JEditorPane; |
15 | | -import javax.swing.JButton; |
16 | | -import javax.swing.JScrollBar; |
17 | | -import javax.swing.JScrollPane; |
18 | | -import java.awt.ScrollPane; |
19 | | -import java.awt.Toolkit; |
20 | | -import java.awt.event.ActionListener; |
21 | | -import java.util.Random; |
22 | | -import java.awt.event.ActionEvent; |
23 | | - |
24 | | -public class Address extends JFrame { |
25 | | - |
26 | | - private JPanel contentPane; |
27 | | - public String name; |
28 | | - public String pin; |
29 | | - public String addl; |
30 | | - public String landmark; |
31 | | - /** |
32 | | - * Launch the application. |
33 | | - */ |
34 | | - public static void main(String[] args) { |
35 | | - EventQueue.invokeLater(new Runnable() { |
36 | | - public void run() { |
37 | | - try { |
38 | | - Address frame = new Address(); |
39 | | - frame.setVisible(true); |
40 | | - } catch (Exception e) { |
41 | | - e.printStackTrace(); |
42 | | - } |
43 | | - } |
44 | | - }); |
45 | | - } |
46 | | - |
47 | | - /** |
48 | | - * Create the frame. |
49 | | - */ |
50 | | - public Address() { |
51 | | - // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
52 | | - setBounds(650, 319, 514, 460); |
53 | | - setResizable(false); |
54 | | - contentPane = new JPanel(); |
55 | | - contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
56 | | - setContentPane(contentPane); |
57 | | - contentPane.setLayout(null); |
58 | | - |
59 | | - |
60 | | - JLabel name = new JLabel("Full Name :- "); |
61 | | - name.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
62 | | - name.setBounds(26, 13, 117, 41); |
63 | | - contentPane.add(name); |
64 | | - |
65 | | - JTextArea namet = new JTextArea(); |
66 | | - namet.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
67 | | - namet.setBounds(155, 15, 325, 39); |
68 | | - contentPane.add(namet); |
69 | | - |
70 | | - JLabel label = new JLabel("Pincode :- "); |
71 | | - label.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
72 | | - label.setBounds(26, 74, 117, 41); |
73 | | - contentPane.add(label); |
74 | | - |
75 | | - JTextArea pint = new JTextArea(); |
76 | | - pint.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
77 | | - pint.setBounds(155, 79, 165, 41); |
78 | | - contentPane.add(pint); |
79 | | - |
80 | | - JLabel label_1 = new JLabel("Address :- "); |
81 | | - label_1.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
82 | | - label_1.setBounds(26, 150, 117, 41); |
83 | | - contentPane.add(label_1); |
84 | | - |
85 | | - JEditorPane editorPane = new JEditorPane(); |
86 | | - editorPane.setBounds(155, 133, 325, 124); |
87 | | - contentPane.add(editorPane); |
88 | | - |
89 | | - JLabel label_2 = new JLabel("Landmark :- "); |
90 | | - label_2.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
91 | | - label_2.setBounds(26, 282, 117, 41); |
92 | | - contentPane.add(label_2); |
93 | | - |
94 | | - JTextArea landmarkt = new JTextArea(); |
95 | | - landmarkt.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
96 | | - landmarkt.setBounds(155, 287, 165, 41); |
97 | | - contentPane.add(landmarkt); |
98 | | - setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\Soumyadeep\\Desktop\\Book Hub\\0 (Custom).jpg")); |
99 | | - |
100 | | - |
101 | | - JButton btnAdd = new JButton("Add"); |
102 | | - btnAdd.addActionListener(new ActionListener() { |
103 | | - public void actionPerformed(ActionEvent e) { |
104 | | - |
105 | | - dispose(); |
106 | | - int a=JOptionPane.showConfirmDialog(btnAdd, "Are you ready to process your order?"); |
107 | | - if(a==JOptionPane.YES_OPTION) |
108 | | - { |
109 | | - String name=namet.getText(); |
110 | | - String pin=pint.getText(); |
111 | | - String add=editorPane.getText(); |
112 | | - String landmark=landmarkt.getText(); |
113 | | - |
114 | | - |
115 | | - Random rand=new Random(); |
116 | | - int i=rand.nextInt(9999999); |
117 | | - String tktno=String.valueOf(i); |
118 | | - tktno+="\n"; |
119 | | - String n="\n"; |
120 | | - //seatb+=")\n"; |
121 | | - |
122 | | - String id=String.valueOf(i); |
123 | | - |
124 | | - |
125 | | - JOptionPane.showMessageDialog(btnAdd,"Congratulations,"+n+"Your order is successfully placed"+n+"Your Order Id is "+i+n+"Thankyou."); |
126 | | - |
127 | | - |
128 | | - //JOptionPane.showMessageDialog(btnAdd, "Cogratulations,Your order is successfully placed"); |
129 | | - } |
130 | | - } |
131 | | - }); |
132 | | - btnAdd.setBounds(148, 338, 172, 74); |
133 | | - contentPane.add(btnAdd); |
134 | | - } |
135 | | -} |
| 1 | +package Textbook_selling_system; |
| 2 | + |
| 3 | +import java.awt.BorderLayout; |
| 4 | +import java.awt.EventQueue; |
| 5 | +import java.awt.Font; |
| 6 | + |
| 7 | +import javax.swing.JFrame; |
| 8 | +import javax.swing.JInternalFrame; |
| 9 | +import javax.swing.JLabel; |
| 10 | +import javax.swing.JOptionPane; |
| 11 | +import javax.swing.JPanel; |
| 12 | +import javax.swing.JTextArea; |
| 13 | +import javax.swing.border.EmptyBorder; |
| 14 | +import javax.swing.JEditorPane; |
| 15 | +import javax.swing.JButton; |
| 16 | +import javax.swing.JScrollBar; |
| 17 | +import javax.swing.JScrollPane; |
| 18 | +import java.awt.ScrollPane; |
| 19 | +import java.awt.Toolkit; |
| 20 | +import java.awt.event.ActionListener; |
| 21 | +import java.util.Random; |
| 22 | +import java.awt.event.ActionEvent; |
| 23 | + |
| 24 | +public class Address extends JFrame { |
| 25 | + |
| 26 | + private JPanel contentPane; |
| 27 | + public String name; |
| 28 | + public String pin; |
| 29 | + public String addl; |
| 30 | + public String landmark; |
| 31 | + /** |
| 32 | + * Launch the application. |
| 33 | + */ |
| 34 | + public static void main(String[] args) { |
| 35 | + EventQueue.invokeLater(new Runnable() { |
| 36 | + public void run() { |
| 37 | + try { |
| 38 | + Address frame = new Address(); |
| 39 | + frame.setVisible(true); |
| 40 | + } catch (Exception e) { |
| 41 | + e.printStackTrace(); |
| 42 | + } |
| 43 | + } |
| 44 | + }); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Create the frame. |
| 49 | + */ |
| 50 | + public Address() { |
| 51 | + // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
| 52 | + setBounds(650, 319, 514, 460); |
| 53 | + setResizable(false); |
| 54 | + contentPane = new JPanel(); |
| 55 | + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
| 56 | + setContentPane(contentPane); |
| 57 | + contentPane.setLayout(null); |
| 58 | + |
| 59 | + |
| 60 | + JLabel name = new JLabel("Full Name :- "); |
| 61 | + name.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 62 | + name.setBounds(26, 13, 117, 41); |
| 63 | + contentPane.add(name); |
| 64 | + |
| 65 | + JTextArea namet = new JTextArea(); |
| 66 | + namet.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 67 | + namet.setBounds(155, 15, 325, 39); |
| 68 | + contentPane.add(namet); |
| 69 | + |
| 70 | + JLabel label = new JLabel("Pincode :- "); |
| 71 | + label.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 72 | + label.setBounds(26, 74, 117, 41); |
| 73 | + contentPane.add(label); |
| 74 | + |
| 75 | + JTextArea pint = new JTextArea(); |
| 76 | + pint.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 77 | + pint.setBounds(155, 79, 165, 41); |
| 78 | + contentPane.add(pint); |
| 79 | + |
| 80 | + JLabel label_1 = new JLabel("Address :- "); |
| 81 | + label_1.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 82 | + label_1.setBounds(26, 150, 117, 41); |
| 83 | + contentPane.add(label_1); |
| 84 | + |
| 85 | + JEditorPane editorPane = new JEditorPane(); |
| 86 | + editorPane.setBounds(155, 133, 325, 124); |
| 87 | + contentPane.add(editorPane); |
| 88 | + |
| 89 | + JLabel label_2 = new JLabel("Landmark :- "); |
| 90 | + label_2.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 91 | + label_2.setBounds(26, 282, 117, 41); |
| 92 | + contentPane.add(label_2); |
| 93 | + |
| 94 | + JTextArea landmarkt = new JTextArea(); |
| 95 | + landmarkt.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 96 | + landmarkt.setBounds(155, 287, 165, 41); |
| 97 | + contentPane.add(landmarkt); |
| 98 | + setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\Soumyadeep\\Desktop\\Book Hub\\0 (Custom).jpg")); |
| 99 | + |
| 100 | + |
| 101 | + JButton btnAdd = new JButton("Add"); |
| 102 | + btnAdd.addActionListener(new ActionListener() { |
| 103 | + public void actionPerformed(ActionEvent e) { |
| 104 | + |
| 105 | + dispose(); |
| 106 | + int a=JOptionPane.showConfirmDialog(btnAdd, "Are you ready to process your order?"); |
| 107 | + if(a==JOptionPane.YES_OPTION) |
| 108 | + { |
| 109 | + String name=namet.getText(); |
| 110 | + String pin=pint.getText(); |
| 111 | + String add=editorPane.getText(); |
| 112 | + String landmark=landmarkt.getText(); |
| 113 | + |
| 114 | + |
| 115 | + Random rand=new Random(); |
| 116 | + int i=rand.nextInt(9999999); |
| 117 | + String tktno=String.valueOf(i); |
| 118 | + tktno+="\n"; |
| 119 | + String n="\n"; |
| 120 | + //seatb+=")\n"; |
| 121 | + |
| 122 | + String id=String.valueOf(i); |
| 123 | + |
| 124 | + |
| 125 | + JOptionPane.showMessageDialog(btnAdd,"Congratulations,"+n+"Your order is successfully placed"+n+"Your Order Id is "+i+n+"Thankyou."); |
| 126 | + |
| 127 | + |
| 128 | + //JOptionPane.showMessageDialog(btnAdd, "Cogratulations,Your order is successfully placed"); |
| 129 | + } |
| 130 | + } |
| 131 | + }); |
| 132 | + btnAdd.setBounds(148, 338, 172, 74); |
| 133 | + contentPane.add(btnAdd); |
| 134 | + } |
| 135 | +} |
0 commit comments