Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package researchbehaviour; /** * * @author ARUNI PC */ import java.awt.BorderLayout; import java.awt.Color; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.renderer.category.BarRenderer; import org.jfree.data.category.DefaultCategoryDataset; public class MainOutput extends javax.swing.JFrame { /** * Creates new form MainOutput */ public MainOutput() { initComponents(); LodNextNumber(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel(); jLabel18 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); panelChart = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jLabel19 = new javax.swing.JLabel(); jLabel20 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(255, 204, 204)); jPanel1.setMaximumSize(new java.awt.Dimension(2147483647, 2147483647)); jPanel1.setMinimumSize(new java.awt.Dimension(0, 0)); jPanel1.setName(""); // NOI18N jPanel1.setPreferredSize(new java.awt.Dimension(1366, 768)); jPanel1.setLayout(null); jLabel2.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N jLabel2.setForeground(new java.awt.Color(0, 0, 102)); jLabel2.setText("APPLICANT STATUES"); jPanel1.add(jLabel2); jLabel2.setBounds(30, 20, 280, 34); jPanel3.setBackground(new java.awt.Color(255, 204, 204)); jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 0, 51), 2)); jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jLabel3.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N jLabel3.setText("Extraversion (E)"); jLabel4.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N jLabel4.setText("Agreeableness (A)"); jLabel5.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N jLabel5.setText("Conscientiousness (C)"); jLabel6.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N jLabel6.setText("Emotional Stability (N)"); jLabel7.setFont(new java.awt.Font("Comic Sans MS", 0, 12)); // NOI18N jLabel7.setText("personality trait of seeking fulfillment from sources outside "); jLabel8.setFont(new java.awt.Font("Comic Sans MS", 0, 12)); // NOI18N jLabel8.setText("the self or in community. High scorers tend to be very social"); jLabel9.setFont(new java.awt.Font("Comic Sans MS", 0, 12)); // NOI18N jLabel9.setText("while low scorers prefer to work on their projects alone."); jLabel10.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N jLabel10.setText("Openness to Experience (O)"); jLabel11.setFont(new java.awt.Font("Comic Sans MS", 0, 12)); // NOI18N jLabel11.setText("reflects much individuals adjust their behavior to suit others."); jLabel12.setFont(new java.awt.Font("Comic Sans MS", 0, 12)); // NOI18N jLabel12.setText("High scorers are typically polite and like people."); jLabel13.setFont(new java.awt.Font("Comic Sans MS", 0, 12)); // NOI18N jLabel13.setText("personality trait of being honest and hardworking. High "); jLabel14.setFont(new java.awt.Font("Comic Sans MS", 0, 12)); // NOI18N jLabel14.setText("scorers tend to follow rules and prefer clean homes."); jLabel15.setFont(new java.awt.Font("Comic Sans MS", 0, 12)); // NOI18N jLabel15.setText("personality trait of being emotional."); jLabel16.setFont(new java.awt.Font("Comic Sans MS", 0, 12)); // NOI18N jLabel16.setText("personality trait of seeking new experience and intellectual "); jLabel17.setFont(new java.awt.Font("Comic Sans MS", 0, 12)); // NOI18N jLabel17.setText("pursuits."); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel16, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup( jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 366, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, Short.MAX_VALUE))))); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(26, 26, 26).addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(25, Short.MAX_VALUE))); jPanel3.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, 380, 420)); jPanel1.add(jPanel3); jPanel3.setBounds(920, 130, 420, 460); jLabel18.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/cvelite.png"))); // NOI18N jPanel1.add(jLabel18); jLabel18.setBounds(930, 10, 390, 130); jTextArea1.setBackground(new java.awt.Color(255, 255, 204)); jTextArea1.setColumns(20); jTextArea1.setFont(new java.awt.Font("Comic Sans MS", 0, 14)); // NOI18N jTextArea1.setRows(5); jScrollPane1.setViewportView(jTextArea1); jPanel1.add(jScrollPane1); jScrollPane1.setBounds(30, 130, 840, 210); panelChart.setBackground(new java.awt.Color(204, 204, 204)); panelChart.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 0, 51), 2)); panelChart.setName("panelChart"); // NOI18N panelChart.setLayout(new java.awt.BorderLayout()); jPanel1.add(panelChart); panelChart.setBounds(30, 350, 840, 330); jButton1.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N jButton1.setText("VIEW DETAILS"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jPanel1.add(jButton1); jButton1.setBounds(30, 80, 190, 30); jLabel19.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N jLabel19.setForeground(new java.awt.Color(0, 0, 102)); jLabel19.setText("Applicant Name : "); jPanel1.add(jLabel19); jLabel19.setBounds(280, 80, 160, 26); jLabel20.setFont(new java.awt.Font("Comic Sans MS", 1, 18)); // NOI18N jPanel1.add(jLabel20); jLabel20.setBounds(450, 80, 410, 30); jButton2.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N jButton2.setText("VIEW MORE ABOUT APPLICANT"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jPanel1.add(jButton2); jButton2.setBounds(1000, 600, 270, 30); jButton3.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N jButton3.setText("ANALYZE NEW APPLICANT"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jPanel1.add(jButton3); jButton3.setBounds(1000, 650, 270, 30); jLabel1.setIcon( new javax.swing.ImageIcon(getClass().getResource("/Images/green-wallpaper-background-6.jpg"))); // NOI18N jPanel1.add(jLabel1); jLabel1.setBounds(0, 0, 1370, 740); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 740, Short.MAX_VALUE)); pack(); }// </editor-fold>//GEN-END:initComponents //ApplicantRank ar = new ApplicantRank(); // BehaviourA be = new BehaviourA(); PersonalityValues pv = new PersonalityValues(); public void LodNextNumber() { // int pNo = ar.personNo(); // String pNoS = "" + pNo; // jLabel21.setText(pNoS); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { FileReader reader = new FileReader("xml.txt"); BufferedReader br = new BufferedReader(reader); String line; line = br.readLine(); String[] strArray = line.split(" "); String[] FName = strArray[0].split(">"); String applicantName = FName[1] + " " + strArray[1]; jLabel20.setText(applicantName); double agr = 0; double con = 0; double ext = 0; double emo = 0; double ope = 0; double edu = 0; try { // agr = be.agreeablenessPersentage(); // con = be.conscientiousPersentage(); // ext = be.extraversionPersentage(); // emo = be.emotional_stabilityPersentage(); // ope = be.opennessPersentage(); // edu = be.educationPersentage(); // agr = pv.agrvalue(); con = pv.convalue(); ext = pv.extvalue(); emo = pv.emovalue(); ope = pv.opevalue(); edu = pv.eduvalue(); } catch (IOException ex) { Logger.getLogger(MainOutput.class.getName()).log(Level.SEVERE, null, ex); } DefaultCategoryDataset barChartData = new DefaultCategoryDataset(); barChartData.setValue(agr, "Personality Factor", "A"); barChartData.setValue(con, "Personality Factor", "C"); barChartData.setValue(ext, "Personality Factor", "E"); barChartData.setValue(emo, "Personality Factor", "N"); barChartData.setValue(ope, "Personality Factor", "O"); barChartData.setValue(edu - 20, "Personality Factor", "Education"); // barChartData.setValue(81.12, "Personality Factor", "A"); // barChartData.setValue(70.01, "Personality Factor", "C"); // barChartData.setValue(34.34, "Personality Factor", "E"); // barChartData.setValue(44.67,"Personality Factor", "N"); // barChartData.setValue(55.87, "Personality Factor", "O"); // barChartData.setValue(77.34, "Personality Factor", "Education"); JFreeChart barChart = ChartFactory.createBarChart("Applicant Statues", "Personality Factor", "Persentage", barChartData, PlotOrientation.VERTICAL, false, true, false); CategoryPlot barchart = barChart.getCategoryPlot(); barchart.setRangeGridlinePaint(Color.BLUE); // Plot plot = bar.getPlot(); BarRenderer barRenderer = (BarRenderer) barchart.getRenderer(); barRenderer.setSeriesPaint(0, Color.white); ChartPanel barPanel = new ChartPanel(barChart); panelChart.removeAll(); panelChart.add(barPanel, BorderLayout.CENTER); panelChart.validate(); // panelChart.repaint(); ChangeValues cvv = new ChangeValues(); ArrayList<Double> updateVal2 = new ArrayList<Double>(); updateVal2 = cvv.changedCutOff(); if (agr > updateVal2.get(0)) { jTextArea1.append( " The person has good Agreeableness,altruistic, sympathetic to others and eager to help them, and in return believes that others will be " + "\n" + " equally helpful." + "\n"); } else jTextArea1.append( " Low agreeableness, egocentric, sceptical of other's intentions, and competitive rather than co-operative." + "\n"); if (ope > updateVal2.get(2)) { jTextArea1.append( " Have active imagination, aesthetic sensitivity, attentiveness to inner feelings, a preference for variety, intellectual curiosity " + "\n" + " and independence of judgement " + "\n"); } else jTextArea1.append(" Not having enough openness to experience value." + "\n"); if (emo > updateVal2.get(3)) { jTextArea1.append( " Calm,even-tempered, relaxed and able to face stressful situations without becoming upset." + "\n"); } else { jTextArea1.append( " Not having good emotional stability.not calm,hot tempered ,not able to face stressfull situations sucessfully." + "\n"); } if (ext > updateVal2.get(1)) { jTextArea1.append( " Have good extraversion.social,active , talkative,energetic and optimistic person. " + "\n"); } else { jTextArea1.append( " Not having good extraversion.reserved rather than unfriendly, independent rather than followers, even-paced " + "\n" + "rather than sluggish." + "\n"); } if (con > updateVal2.get(4)) { jTextArea1.append(" Conscientious person,purposeful, strong-willed and determined." + "\n"); } else { jTextArea1.append(" Not having enough Conscientious." + "\n"); } } catch (IOException ex) { Logger.getLogger(MainOutput.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed try { this.setVisible(false); new MoreAboutApplicant().setVisible(true); } catch (IOException ex) { Logger.getLogger(MainOutput.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jButton2ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed this.setVisible(false); new Behavour().setVisible(true); }//GEN-LAST:event_jButton3ActionPerformed // dividSentence dc = new dividSentence(); // JFrame Admin_panel = new JFrame(); /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(MainOutput.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MainOutput.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MainOutput.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MainOutput.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MainOutput().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea jTextArea1; private javax.swing.JPanel panelChart; // End of variables declaration//GEN-END:variables }