Guest User

Untitled

a guest
Jan 14th, 2020
85
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import javax.swing.JTextField;
  3.  
  4. /*
  5. * To change this license header, choose License Headers in Project Properties.
  6. * To change this template file, choose Tools | Templates
  7. * and open the template in the editor.
  8. */
  9. /**
  10. *
  11. * @author BorisVassilev
  12. */
  13. public class JFrame2 extends javax.swing.JFrame {
  14.  
  15. /**
  16. * Creates new form JFrame_2
  17. */
  18. public JFrame2() {
  19. initComponents();
  20. }
  21.  
  22. /**
  23. * This method is called from within the constructor to initialize the form.
  24. * WARNING: Do NOT modify this code. The content of this method is always
  25. * regenerated by the Form Editor.
  26. */
  27. @SuppressWarnings("unchecked")
  28. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  29. private void initComponents() {
  30.  
  31. jPanel1 = new javax.swing.JPanel();
  32. jLabel1 = new javax.swing.JLabel();
  33. jLabel2 = new javax.swing.JLabel();
  34. jLabel3 = new javax.swing.JLabel();
  35. jTextField1 = new javax.swing.JTextField();
  36. jButton1 = new javax.swing.JButton();
  37.  
  38. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  39.  
  40. jPanel1.setBackground(new java.awt.Color(153, 204, 255));
  41.  
  42. jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 36)); // NOI18N
  43. jLabel1.setText("Total Marks?");
  44.  
  45. jLabel2.setText("Indicate the amount of marks the assessment was out of");
  46.  
  47. jLabel3.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
  48. jLabel3.setText("Answer:");
  49.  
  50. jTextField1.setText(" ");
  51. jTextField1.addActionListener(new java.awt.event.ActionListener() {
  52. public void actionPerformed(java.awt.event.ActionEvent evt) {
  53. jTextField1ActionPerformed(evt);
  54. }
  55. });
  56.  
  57. jButton1.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N
  58. jButton1.setText("Next");
  59. jButton1.addActionListener(new java.awt.event.ActionListener() {
  60. public void actionPerformed(java.awt.event.ActionEvent evt) {
  61. jButton1ActionPerformed(evt);
  62. }
  63. });
  64.  
  65. javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  66. jPanel1.setLayout(jPanel1Layout);
  67. jPanel1Layout.setHorizontalGroup(
  68. jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  69. .addGroup(jPanel1Layout.createSequentialGroup()
  70. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  71. .addGroup(jPanel1Layout.createSequentialGroup()
  72. .addGap(21, 21, 21)
  73. .addComponent(jLabel2))
  74. .addGroup(jPanel1Layout.createSequentialGroup()
  75. .addGap(83, 83, 83)
  76. .addComponent(jLabel1))
  77. .addGroup(jPanel1Layout.createSequentialGroup()
  78. .addGap(128, 128, 128)
  79. .addComponent(jLabel3)
  80. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  81. .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  82. .addGroup(jPanel1Layout.createSequentialGroup()
  83. .addGap(145, 145, 145)
  84. .addComponent(jButton1)))
  85. .addContainerGap(21, Short.MAX_VALUE))
  86. );
  87. jPanel1Layout.setVerticalGroup(
  88. jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  89. .addGroup(jPanel1Layout.createSequentialGroup()
  90. .addGap(74, 74, 74)
  91. .addComponent(jLabel1)
  92. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  93. .addComponent(jLabel2)
  94. .addGap(27, 27, 27)
  95. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  96. .addComponent(jLabel3)
  97. .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  98. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  99. .addComponent(jButton1)
  100. .addContainerGap(52, Short.MAX_VALUE))
  101. );
  102.  
  103. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  104. getContentPane().setLayout(layout);
  105. layout.setHorizontalGroup(
  106. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  107. .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  108. );
  109. layout.setVerticalGroup(
  110. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  111. .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  112. );
  113.  
  114. pack();
  115. }// </editor-fold>
  116.  
  117. /**
  118. *
  119. * @param evt
  120. */
  121. /**
  122. private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
  123. JTextField totalMarks = new JTextField();
  124. totalMarks.getText();
  125. String marksSTR = totalMarks.getText();
  126. int Marks = Integer.parseInt(marksSTR);
  127. // int totalMarks = Integer.partseInt()
  128. }
  129. */
  130. public static void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
  131. JTextField totalMarks = new JTextField();
  132. totalMarks.getText();
  133. String marksSTR = totalMarks.getText();
  134. int Marks = Integer.parseInt(marksSTR);
  135. }
  136.  
  137. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
  138. JFrame1 jFrame2 = new JFrame1();
  139. jFrame2.setVisible(false);
  140. JFrame3 jFrame3 = new JFrame3();
  141. jFrame3.setVisible(true);
  142. this.dispose();
  143. }
  144.  
  145. /**
  146. * @param args the command line arguments
  147. */
  148. public static void main(String args[]) {
  149. /* Set the Nimbus look and feel */
  150. //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  151. /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  152. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  153. */
  154. try {
  155. for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  156. if ("Nimbus".equals(info.getName())) {
  157. javax.swing.UIManager.setLookAndFeel(info.getClassName());
  158. break;
  159. }
  160. }
  161. } catch (ClassNotFoundException ex) {
  162. java.util.logging.Logger.getLogger(JFrame2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  163. } catch (InstantiationException ex) {
  164. java.util.logging.Logger.getLogger(JFrame2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  165. } catch (IllegalAccessException ex) {
  166. java.util.logging.Logger.getLogger(JFrame2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  167. } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  168. java.util.logging.Logger.getLogger(JFrame2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  169. }
  170. //</editor-fold>
  171. //</editor-fold>
  172.  
  173. /* Create and display the form */
  174. java.awt.EventQueue.invokeLater(new Runnable() {
  175. public void run() {
  176. new JFrame2().setVisible(true);
  177. }
  178. });
  179. }
  180.  
  181. // Variables declaration - do not modify
  182. private javax.swing.JButton jButton1;
  183. private javax.swing.JLabel jLabel1;
  184. private javax.swing.JLabel jLabel2;
  185. private javax.swing.JLabel jLabel3;
  186. private javax.swing.JPanel jPanel1;
  187. public javax.swing.JTextField jTextField1;
  188. // End of variables declaration
  189. }
RAW Paste Data