I didn't gat an output for this code, plz send me a correct code

I didn't gat an output for this code, plz send me a correct code

Hi, Here is my code:

import java.awt.event.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.*; import java.sql.*; public class example2 extends javax.swing.JFrame {

public example2() {

    tmark1=new JTextField();
    tmark1.addKeyListener(new TetAdapter());
    tmark2=new JTextField();
    tmark2.addKeyListener(new TetAdapter());
    ttotal=new JTextField();

    initComponents();
}

class TetAdapter extends KeyAdapter{
  public void keyReleased(KeyEvent k){
      int value1 = 0, value2 = 0;
      try{
          value1 = Integer.parseInt(tmark1.getText());
      }catch(NumberFormatException ne){
          value1 = 0;
      }
      try{
          value2 = Integer.parseInt(tmark2.getText());
      }catch(NumberFormatException ne){
          value2 = 0;
      }
      ttotal.setText(value1+value2+"");
  }

} @SuppressWarnings("unchecked") // private void initComponents() {

    ttotal = new javax.swing.JTextField();
    ltotal = new javax.swing.JLabel();
    tmark1 = new javax.swing.JTextField();
    lmark2 = new javax.swing.JLabel();
    tmark2 = new javax.swing.JTextField();
    lmark1 = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    ttotal.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ttotalActionPerformed(evt);
        }
    });

    ltotal.setText("TOTAL");

    lmark2.setText("MARK2");

    lmark1.setText("MARK1");

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGap(0, 400, Short.MAX_VALUE)
        .addGroup(layout.createSequentialGroup()
            .addGap(19, 19, 19)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                .addComponent(ltotal, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lmark2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lmark1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGap(36, 36, 36)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                .addComponent(tmark1)
                .addComponent(tmark2, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)
                .addComponent(ttotal))
            .addGap(80, 80, 80))
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGap(0, 300, Short.MAX_VALUE)
        .addGroup(layout.createSequentialGroup()
            .addGap(87, 87, 87)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(tmark1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lmark1))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(tmark2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lmark2))
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(ltotal)
                .addComponent(ttotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addContainerGap(131, Short.MAX_VALUE))
    );

    pack();
}// </editor-fold>

private void ttotalActionPerformed(java.awt.event.ActionEvent evt) {

}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new example2().setVisible(true);
        }
    });
}

// Variables declaration - do not modify
private javax.swing.JLabel lmark1;
private javax.swing.JLabel lmark2;
private javax.swing.JLabel ltotal;
public javax.swing.JTextField tmark1;
public javax.swing.JTextField tmark2;
public javax.swing.JTextField ttotal;
// End of variables declaration

}

Thanks

View Answers









Related Tutorials/Questions & Answers:
I didn't gat an output for this code, plz send me a correct code
I didn't gat an output for this code, plz send me a correct code  Hi, Here is my code: import java.awt.event.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.*; import java.sql.*; public
PLZ HELP ME. i need php code.
PLZ HELP ME. i need php code.   I want php code for bellow OUTPUT. output is just example but it must be letters only. abc bcd efg jku rgt azs hje qqc wws adt
Advertisements
plz send code for this
plz send code for this  Program to calculate the sum of two big numbers (the numbers can contain more than 1000 digits). Don't use any library classes or methods (BigInteger etc
Plz give me code for this question
Plz give me code for this question  Program to find depth of the file in a directory and list all files those are having more number of parent directories
Plz Provide correct program code for all questions.
Plz Provide correct program code for all questions.   Write a program... rate expressed as a decimal, and the number of years. Mail me... the following code: 1) import java.util.*; class FindDifference { public static
sir plz send the project on quiz system code
sir plz send the project on quiz system code  sir plz send the client server based project in core java database in my sql
i want to create website,with manu with three level submenu on top side of page please send me code java
i want to create website,with manu with three level submenu on top side of page please send me code java   iam createing wibsite thats using eclipse andtomcat server,please help me to write menu with three level submenu
Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems
Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..
i want to find the byte code of a image file ... for my project..plz if anybody help me for java coding i will grateful..   i want to convert... project.. but i cant convert Image file to its byte code format.. if anybody can plz
send me javascript code - Java Beginners
send me javascript code  please send me code javascript validation code for this html page.pleaseeeeeeeee. a.first:link...          Hi friend, complete code
pls send me the code for login and register - Java Beginners
pls send me the code for login and register  pls immediately send me the jsp code for login and registration with validation with java bean in mysql database...  Hi friend, This login action code
how to send email please give me details with code in jsp,servlet
how to send email please give me details with code in jsp,servlet  how to send email please give me details with code in jsp,servlet
Plz send me answer quckly
Plz send me answer quckly  Respected Sir, myself is pavan shrivastava.i want ask a question that is ( we can't create object of interface then how would possible to create object
plz tell me the code & execution process - Java Beginners
plz tell me the code & execution process  Write a program to download a website from a given URL. It must download all the pages from that website. It should take the depth of retrieval from the user input. All the files/pages
plz tell me the code & execution process - Java Beginners
plz tell me the code & execution process  Write a program to download a website from a given URL. It must download all the pages from that website... must be stored in a folder.  Hi friend, Code to help in solving
conert java code to jsp... plz imm i wan...
conert java code to jsp... plz imm i wan...  how to convert this java code into jsp?? Java| Frameworks| Databases| Technology| Development| Build... currency according to the locale. In the code given below we are formatting Currency
very urgent : Iam unable to code this program plz help me - RMI
very urgent : Iam unable to code this program plz help me  Write a Multi-user chat server and client.  Hi friend, Chat server is a standlone application that is made up the combination of two-application, server
please send me javascript validation code - Java Beginners
please send me javascript validation code  hallo sir , please send me java script code for this html page.since i want to do validation.i am a new user in java ....please send me its urgent
plz Help me find the correct programs answers
plz Help me find the correct programs answers   Create a washing... INDICA" and "TATA NANO" respectively. Plz mail me your answers...; subtract Create a class called Student which has the following methods: i
This code send email two times but i want only once
This code send email two times but i want only once   public void dbbackup_notify(String email,String data,String subject...) { e.printStackTrace(); System.out.println("Don't Send Successfully
This code send email two times but i want only once
This code send email two times but i want only once   public void dbbackup_notify(String email,String data,String subject...) { e.printStackTrace(); System.out.println("Don't Send Successfully
Pls send code
Pls send code   I am Mohini Charankar suppose Name="Mohini" Edit Button Click on that I change my Name with "Mohini/" Save it and page refresh After... an error pls send code
i want java code for this xml file...please show me..
i want java code for this xml file...please show me..   xbrli:shares xbrli:pure iso4217:INR
java code to send an email
java code to send an email  i developed one java code that has to send a mail but i am getting an runtime exception calledjavax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465; nested
sir, how to convert excel file to csv file using java? please send me sample code.
sir, how to convert excel file to csv file using java? please send me sample code.  please send me sample code for converting excel file into csv file uisng java
pls send code
pls send code   pls send code for set database value into text box based on selected value in struts and jsp   use any database and get its code for getting values from google
plz explain me the output of program - Java Beginners
plz explain me the output of program  Hi friends, can u please explain me the output of below program with proper explanation of each and every line...;Hi Friend, Output of this program is: a=2 b=0 c=0 mul=27 volume=18
this is my javascript code and i am not understanding the mistake in this,please help me?
this is my javascript code and i am not understanding the mistake in this,please help me?  <html> <h2>Form Validation</h2> <script language = "Javascript"> function checkEmail
jsp code plz
jsp code plz  write jsp code which takes student roll number as input and prints the student group,study center, and his grade card   Please visit the following links: http://www.roseindia.net/jsp/user-search.shtml
how to write code for this output?
how to write code for this output?   1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
Show me the code for that
Show me the code for that  JVM on my machine? And how do I know whether its working
Is the logic correct to detect IE version..plz let me know
Is the logic correct to detect IE version..plz let me know  <html> <head> <script type="text/javascript"> function...;/head> <body> <form> <input type="button" value="Click me
code to send sms alerts using jsp online
code to send sms alerts using jsp online  I am new to mobile aplication development. pls send me the code for sms alerts after clicking the button
please send code - Java Beginners
please send code  hai friends plese provide code for fallowing program(CORE JAVA) i am taking string from commandprompt like 'AC2E4T45hj789' now... number it should be taken as single number) URGENTLY send the code
plz check my codings are correct or not...There is an error..i cant find it..
plz check my codings are correct or not...There is an error..i cant find it..  import java.util.Scanner; public class Student { private String indexNo; private String gender; private char initial; private int mark1
how to send sms on mobile and email using java code
how to send sms on mobile and email using java code  hi.... I am developing a project where I need to send a confirmation/updation msg on clients mobile and also an email on their particular email id....plz help me to find
I need help on my Java code.... please please help me out!?
I need help on my Java code.... please please help me out!?  Well my code is supposed to ask for an input file and then (ex: input.txt), read... the anagram on screen or the output file! Please show me whats wrong. Thanks i
verify the code and give me the code with out errors
verify the code and give me the code with out errors   import...(); } } when i run this program... it shows the given below errors.pls clear the errors and give me correct tutorial for my knowledge improving.pls anyone
php brute force code.. hlp plz .....
php brute force code.. hlp plz .....  hello friends, from somewhere i got a code that can generate all posible combination via recursive function..., ''); //////////////////////////////////// Ended PHP Code ////////////////////// now i
i want code for these programs
i want code for these programs   Advances in operating system Laboratory Work: (The following programs can be executed on any available and suitable platform) Design, develop and execute a program using any
provide me code - Java Beginners
provide me code  can any body provide code for SNAKE XENZIA game in NOKIA mobile? please urgently
Give me the source code for this problem
Give me the source code for this problem  Ram likes skiing a lot... the heights. R and C won't be bigger than 100. Output For each test case, print... 13 12 11 10 9 Sample Output Manali: 7 Narkanda: 25
Plz send - Java Beginners
Plz send  Hi, please send whole code i understood ur sending sql query Thanks  hai dear frnd........ look how can i write the code... without knowing ur table structure...from where should the search occur
Can i write JavaScript code in AjaxResponse Code ?
Can i write JavaScript code in AjaxResponse Code ?  Hai Every Dynamic's We can't write JavaScript code in Ajax Response Code.Why because it takes...'s not working.rather than that i try to created on innerHtml document. here
plz send immediately - Java Beginners
plz send immediately  Hi Deepak, How are you, Deepak I face some problem in my project,plz help me My Questin is user input... should be updated. plz write a code and immediate response its very urgent plz
diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output   diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output   diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output   diff between encapsulation and abstraction code with output
sir i,have a assignment for these question plz help me sir - JavaMail
sir i,have a assignment for these question plz help me sir  ...; } else { String str = " "; for (int i = 0; i <= top; i++) str = str + " " + arr[i]; System.out.println("Elements are " + str

Ads