Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cmbAtdncStrm = new JComboBox(strm);
- cmbAtdncStrm.setForeground(new Color(0, 51, 102));
- cmbAtdncStrm.setFont(new Font("Tw Cen MT", Font.PLAIN, 13));
- cmbAtdncStrm.setBounds(10, 34, 103, 22);
- cmbAtdncStrm.setRenderer(new MyComboBoxRenderer(" Stream"));
- cmbAtdncStrm.setSelectedIndex(-1);
- panelAtdnc.add(cmbAtdncStrm);
- panelDt = new JPanel();
- panelDt.setLayout(null);
- panelDt.setOpaque(false);
- panelDt.setBorder(new TitledBorder(UIManager.getBorder("CheckBoxMenuItem.border"), "<html><font face='Tw Cen MT' size='3'>DATE </font><font color='red'></font></html>", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(109, 109, 109)));
- panelDt.setBounds(2, 136, 235, 46);
- panelAtdnc.add(panelDt);
- cmbDtDay = new JComboBox<Object>(days);
- cmbDtDay.setRenderer(new MyComboBoxRenderer(" Day"));
- cmbDtDay.setSelectedIndex(-1);
- cmbDtDay.setForeground(new Color(0, 51, 102));
- cmbDtDay.setFont(new Font("Tw Cen MT", Font.PLAIN, 13));
- cmbDtDay.setBounds(8, 18, 60, 22);
- panelDt.add(cmbDtDay);
- cmbDtMnth = new JComboBox<Object>(mnth);
- cmbDtMnth.setRenderer(new MyComboBoxRenderer(" Month"));
- cmbDtMnth.setSelectedIndex(-1);
- cmbDtMnth.setForeground(new Color(0, 51, 102));
- cmbDtMnth.setFont(new Font("Tw Cen MT", Font.PLAIN, 13));
- cmbDtMnth.setBounds(75, 18, 82, 22);
- panelDt.add(cmbDtMnth);
- cmbDtYr = new JComboBox<Object>(year);
- cmbDtYr.setRenderer(new MyComboBoxRenderer(" Year"));
- cmbDtYr.setSelectedIndex(-1);
- cmbDtYr.setForeground(new Color(0, 51, 102));
- cmbDtYr.setFont(new Font("Tw Cen MT", Font.PLAIN, 13));
- cmbDtYr.setBounds(164, 18, 65, 22);
- panelDt.add(cmbDtYr);
- cmbAtdncSem = new JComboBox<Object>(sem);
- cmbAtdncSem.setRenderer(new MyComboBoxRenderer(" Semester"));
- cmbAtdncSem.setSelectedIndex(-1);
- cmbAtdncSem.setForeground(new Color(0, 51, 102));
- cmbAtdncSem.setFont(new Font("Tw Cen MT", Font.PLAIN, 13));
- cmbAtdncSem.setBounds(130, 34, 103, 22);
- panelAtdnc.add(cmbAtdncSem);
- JLabel lblAtdncStatus = new JLabel("NO. OF DAYS PRESENT TILL NOW :-");
- lblAtdncStatus.setForeground(new Color(0, 51, 102));
- lblAtdncStatus.setFont(new Font("Tw Cen MT", Font.PLAIN, 13));
- lblAtdncStatus.setBounds(16, 213, 205, 14);
- panelAtdnc.add(lblAtdncStatus);
- txtAtdncNo = new JTextField();
- txtAtdncNo.setOpaque(false);
- txtAtdncNo.setForeground(Color.RED);
- txtAtdncNo.setFont(new Font("Tw Cen MT", Font.PLAIN, 13));
- txtAtdncNo.setColumns(10);
- txtAtdncNo.setBorder(new MatteBorder(0, 0, 1, 0, (Color) Color.LIGHT_GRAY));
- txtAtdncNo.setBounds(232, 208, 72, 22);
- panelAtdnc.add(txtAtdncNo);
- lblSave = new JLabel("Save");
- lblSave.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
- lblSave.setIcon(new ImageIcon(Student.class.getResource("/img/Check-16.png")));
- lblSave.setForeground(new Color(0, 51, 102));
- lblSave.setFont(new Font("Tw Cen MT", Font.PLAIN, 16));
- lblSave.setBounds(206, 340, 72, 18);
- panelAtdnc.add(lblSave);
- cmbName = new JComboBox();
- cmbName.setEnabled(false);
- cmbName.setForeground(new Color(0, 51, 102));
- cmbName.setBorder(new MatteBorder(0, 0, 1, 0, (Color) Color.LIGHT_GRAY));
- cmbName.setFont(new Font("Tw Cen MT", Font.PLAIN, 13));
- cmbName.setBounds(10, 85, 150, 22);
- cmbName.setRenderer(new MyComboBoxRenderer(" Name of the Student"));
- cmbName.setSelectedIndex(-1);
- panelAtdnc.add(cmbName);
- JLabel lblCheck = new JLabel("Check");
- lblCheck.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent arg0) {
- name=new Vector();
- atdnc=new Vector();
- try{
- //Class.forName("com.oracle.jdbc.Driver");
- Connection con=DriverManager.getConnection("jdbc:oracle:thin:@//localhost:1521/XE","ADMIN","admin");
- Statement st=con.createStatement();
- ResultSet rslt1=st.executeQuery("select * from student where stream='"+cmbAtdncStrm.getSelectedItem()+"' and semester='"+cmbAtdncSem.getSelectedItem()+"'");
- //ResultSet rslt2=st.executeQuery("select distinct attendance from student where
- current_date='"+cmbDtDay.getSelectedItem()+"''"+cmbDtMnth.getSelectedItem()+"''"+cmbDtYr.getSelectedItem()+"'");
- while(rslt1.next()){
- name.add(rslt1.getString(2));
- System.out.println(name);
- cmbName.setEnabled(true);
- cmbName=new JComboBox<>(name);
- }
- }catch(Exception e){
- e.printStackTrace();
- JOptionPane.showMessageDialog(null,"No Student Found");
- }
- }
- });
- lblCheck.setForeground(new Color(0, 51, 102));
- lblCheck.setFont(new Font("Tw Cen MT", Font.PLAIN, 16));
- lblCheck.setBounds(258, 39, 46, 14);
- panelAtdnc.add(lblCheck);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement