|
| 1 | +package Stedium_Management; |
| 2 | + |
| 3 | + |
| 4 | +import java.awt.EventQueue; |
| 5 | +import java.awt.event.ActionEvent; |
| 6 | +import java.awt.event.ActionListener; |
| 7 | +import java.sql.DriverManager; |
| 8 | +import java.sql.*; |
| 9 | +import javax.swing.JFrame; |
| 10 | +import javax.swing.JPanel; |
| 11 | +import javax.swing.JRadioButton; |
| 12 | +import javax.swing.JTextArea; |
| 13 | +import javax.swing.JTextField; |
| 14 | +import javax.swing.border.EmptyBorder; |
| 15 | + |
| 16 | +import com.mysql.cj.xdevapi.Statement; |
| 17 | + |
| 18 | +import Hariom.Connection; |
| 19 | + |
| 20 | +import javax.swing.JMenuBar; |
| 21 | +import javax.swing.JMenu; |
| 22 | +import javax.swing.JMenuItem; |
| 23 | +import javax.swing.JOptionPane; |
| 24 | + |
| 25 | +import java.awt.Font; |
| 26 | +import java.awt.Toolkit; |
| 27 | + |
| 28 | +import javax.swing.JButton; |
| 29 | +import javax.swing.JLabel; |
| 30 | +import javax.swing.ImageIcon; |
| 31 | + |
| 32 | +public class Add_events extends JFrame { |
| 33 | + |
| 34 | + private JPanel contentPane; |
| 35 | + private JTextField textPromo; |
| 36 | + |
| 37 | + public static void main(String[] args) { |
| 38 | + EventQueue.invokeLater(new Runnable() { |
| 39 | + public void run() { |
| 40 | + try { |
| 41 | + Add_events frame = new Add_events(); |
| 42 | + frame.setVisible(true); |
| 43 | + } catch (Exception e) { |
| 44 | + e.printStackTrace(); |
| 45 | + } |
| 46 | + } |
| 47 | + }); |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Create the frame. |
| 52 | + */ |
| 53 | + public Add_events() { |
| 54 | + setIconImage(Toolkit.getDefaultToolkit().getImage("C:\\Users\\Soumyadeep\\Desktop\\STDM.jpg")); |
| 55 | + //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
| 56 | + setBounds(458, 319, 1000, 460); |
| 57 | + setResizable(false); |
| 58 | + contentPane = new JPanel(); |
| 59 | + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
| 60 | + setContentPane(contentPane); |
| 61 | + contentPane.setLayout(null); |
| 62 | + |
| 63 | + JLabel lblNewLabel = new JLabel("Date"); |
| 64 | + lblNewLabel.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 65 | + lblNewLabel.setBounds(104, 79, 53, 29); |
| 66 | + contentPane.add(lblNewLabel); |
| 67 | + |
| 68 | + JTextArea textArea = new JTextArea(); |
| 69 | + ///textArea.setText("DD-MM-YY"); |
| 70 | + textArea.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 71 | + textArea.setBounds(169, 78,166, 37); |
| 72 | + contentPane.add(textArea); |
| 73 | + |
| 74 | + JLabel lblNewLabel_1 = new JLabel("Events"); |
| 75 | + lblNewLabel_1.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 76 | + lblNewLabel_1.setBounds(584, 76, 56, 34); |
| 77 | + contentPane.add(lblNewLabel_1); |
| 78 | + |
| 79 | + |
| 80 | + JLabel lblNewLabel_2 = new JLabel("(dd-mm-yy)"); |
| 81 | + lblNewLabel_2.setBounds(93, 111, 68, 16); |
| 82 | + contentPane.add(lblNewLabel_2); |
| 83 | + |
| 84 | + JTextArea textEvents = new JTextArea(); |
| 85 | + textEvents.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 86 | + textEvents.setBounds(657, 78,166, 37); |
| 87 | + contentPane.add(textEvents); |
| 88 | + |
| 89 | + JLabel lblSeats = new JLabel("Seats"); |
| 90 | + lblSeats.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 91 | + lblSeats.setBounds(104, 196, 56, 36); |
| 92 | + contentPane.add(lblSeats); |
| 93 | + |
| 94 | + JTextArea textSeats = new JTextArea(); |
| 95 | + textSeats.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 96 | + textSeats.setBounds(169, 196, 166, 37); |
| 97 | + contentPane.add(textSeats); |
| 98 | + |
| 99 | + JTextArea textTime = new JTextArea(); |
| 100 | + textTime.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 101 | + textTime.setBounds(657, 199, 166, 37); |
| 102 | + contentPane.add(textTime); |
| 103 | + |
| 104 | + JLabel lblTime = new JLabel("Time"); |
| 105 | + lblTime.setFont(new Font("Segoe UI", Font.PLAIN, 20)); |
| 106 | + lblTime.setBounds(584, 200, 56, 29); |
| 107 | + contentPane.add(lblTime); |
| 108 | + |
| 109 | + JRadioButton rdbtnAddPromo = new JRadioButton("Add promo"); |
| 110 | + rdbtnAddPromo.addActionListener(new ActionListener() { |
| 111 | + public void actionPerformed(ActionEvent e) { |
| 112 | + if(rdbtnAddPromo.isSelected()) |
| 113 | + { |
| 114 | + textPromo.setEnabled(true); |
| 115 | + } |
| 116 | + else |
| 117 | + { |
| 118 | + textPromo.setEnabled(false); |
| 119 | + } |
| 120 | + |
| 121 | + } |
| 122 | + }); |
| 123 | + rdbtnAddPromo.setBounds(412, 226, 127, 25); |
| 124 | + contentPane.add(rdbtnAddPromo); |
| 125 | + |
| 126 | + textPromo = new JTextField(); |
| 127 | + textPromo.setEnabled(false); |
| 128 | + textPromo.setBounds(412, 254, 116, 29); |
| 129 | + //textField.setEnabled(false); |
| 130 | + contentPane.add(textPromo); |
| 131 | + textPromo.setColumns(10); |
| 132 | + |
| 133 | + JButton btnNewButton = new JButton("Add\r\n\r\n"); |
| 134 | + btnNewButton.addActionListener(new ActionListener() { |
| 135 | + public void actionPerformed(ActionEvent e) { |
| 136 | + int a=JOptionPane.showConfirmDialog(btnNewButton,"Are you sure?"); |
| 137 | + //JOptionPane.setRootFrame(null); |
| 138 | + if(a==JOptionPane.YES_OPTION){ |
| 139 | + String date=textArea.getText(); |
| 140 | + String seats=textSeats.getText(); |
| 141 | + String time=textTime.getText(); |
| 142 | + String event=textEvents.getText(); |
| 143 | + if(rdbtnAddPromo.isSelected()) |
| 144 | + { |
| 145 | + String promo=textPromo.getText(); |
| 146 | + } |
| 147 | + |
| 148 | + /* try{ |
| 149 | + Class.forName("oracle.jdbc.driver.OracleDriver"); |
| 150 | + Connection con=(Connection) DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","soumya","1234"); |
| 151 | + String query="select date yo event "; |
| 152 | + Statement st=con.createStatement(); |
| 153 | + int x=st.executeUpdate(query); |
| 154 | + |
| 155 | + con.close(); |
| 156 | + } |
| 157 | + catch(Exception f) |
| 158 | + { |
| 159 | + System.out.println(f); |
| 160 | + } |
| 161 | + JOptionPane.showMessageDialog(btnNewButton, "Event is successfully added"); |
| 162 | + //System.exit(0);*/ |
| 163 | + } |
| 164 | + } |
| 165 | + }); |
| 166 | + btnNewButton.setFont(new Font("Segoe UI", Font.PLAIN, 27)); |
| 167 | + btnNewButton.setBounds(412, 309, 127, 61); |
| 168 | + contentPane.add(btnNewButton); |
| 169 | + } |
| 170 | +} |
| 171 | + |
0 commit comments