public void actionPerformed(ActionEvent e) { String t = fid.getText(); // char[] t2=fpass.getPassword(); String t2 = fpass.getText(); try { DriverManager.registerDriver(new oracle.jdbc.OracleDriver()); Connection con = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:xe", "system", "9696030257"); Statement st = con.createStatement(); ResultSet rs = st.executeQuery( "select * from database where userid='" + t + "' AND password='******'"); rs.next(); String g = rs.getString("userid"); String h = rs.getString("password"); String i = rs.getString("mob"); String j = rs.getString("dob"); if (g.equals(t) && h.equals(t2)) { // JOptionPane.showMessageDialog(null,"WoW !! You Are a Valid User"); JFrame jf1 = new JFrame("About Saras"); jf1.setBounds(500, 40, 500, 500); jf1.setVisible(true); jf1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf1.setLayout(null); String ab = "\n\nHis Name is Saraswatendra Singh.\nHe is pursuing B.Tech from ABES Engineering College(032) Ghaziabad U.P.\nHe is belong from VARANASI which is also called BANARAS.\nHis Email and Facebook id is <*****@*****.**>\n\n\n \t\t\tTHANK YOU"; String bc = "\n\n\nABOUT YOU:-\n\n\t UserId is < " + g + " >\n\t Password is <" + h + " > \n\t Mobile No is < " + i + " >\n\t Date Of Birth(dd/mm/yyyy) is < " + j + " >\n \n\nABOUT DEVELOPER:-" + ab; JTextArea about = new JTextArea(bc); jf1.add(about); about.setBounds(0, 0, 500, 500); JButton rest = new JButton("ResetPassword"); about.add(rest); rest.setBounds(30, 400, 150, 20); Cursor k1 = new Cursor(Cursor.HAND_CURSOR); rest.setCursor(k1); rest.addActionListener(new ResetPassword()); JButton restmob = new JButton("ResetMobileNo"); about.add(restmob); restmob.setBounds(230, 400, 150, 20); Cursor k2 = new Cursor(Cursor.HAND_CURSOR); restmob.setCursor(k2); restmob.addActionListener(new ResetMob()); } } catch (Exception ex) { System.out.print(ex); JOptionPane.showMessageDialog( null, "UserId or Password MissMatched !!! please Enter Valid UserId and Password"); } }
public Container StockSearchScreen() { StockSScreen.setLayout(new GridLayout(4, 0)); // Font for the title Font newFont = new Font("Aerial", Font.BOLD, 32); // Panels for the different parts of the screen. JPanel SearchP = new JPanel(); JPanel buttonP = new JPanel(); JPanel ResultP = new JPanel(); // ResultP.setLayout(new GridLayout(2,0)); SearchP.setLayout(new GridLayout(5, 0)); // Search text area // JTextField Searching = new JTextField("Input Search"); Days = new JTextField("number of days"); JLabel title = new JLabel("Rental"); title.setFont(newFont); // details.setPreferredSize(new Dimension(20,30)); // Results are put into textarea JTextArea results = new JTextArea("Results Displayed here"); results.setEditable(false); results.setSize(50, 2500); JLabel resultsa = new JLabel(); scroll = new JScrollPane(Films); Films.setLayoutOrientation(JList.VERTICAL); Films.setVisibleRowCount(5); Films.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); scroll.setPreferredSize(new Dimension(650, 150)); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); results.add(resultsa); // SearchP.add(Searching); SearchP.add(Searched); SearchP.add(Display_instock); ResultP.add(scroll); ResultP.add(Days); buttonP.add(confirm); buttonP.add(goBack); // Set the action listeners for the buttons Searched.addActionListener(this); cancel.addActionListener(this); goBack.addActionListener(this); confirm.addActionListener(this); Display_instock.addActionListener(this); StockSScreen.add(title); // ,BorderLayout.NORTH); StockSScreen.add(SearchP); // ,BorderLayout.CENTER); StockSScreen.add(ResultP); // ,BorderLayout.CENTER); StockSScreen.add(buttonP); // ,BorderLayout.SOUTH); return StockSScreen; }