Home Answers Viewqa Swing-AWT I didn't gat an output for this code, plz send me a correct code

 
 


M.Ezilarasi
I didn't gat an output for this code, plz send me a correct code
0 Answer(s)      a year and 5 months ago
Posted in : Swing AWT

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 Pages:
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
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
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 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
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
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
output
output  Sir,I am experiencing some problems with the output... producing what it should.let me explain the output below is what happen when...?(yes/No) :yes Code: what should really happen is that if I say yes
plz help me today plz plz - Java Interview Questions
plz help me today plz plz  2.) Suppose list is an array of six elements of type int. What is stored in list after the following java code executes...]); } } } } Output of above code is: 2 6 10 Explanation-In the above code, firstly
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
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
plz help me find a program
plz help me find a program  plz help..i want a source code in jsp for order processing
Plz Plz reply Me - JSP-Servlet
Plz Plz reply Me  Respected Sir/madam, I am R.Ragavendran.. Actually I got your coding.. But This code is not enabling the user to click and change the image.. I request you to remember the code which you have provided for me
plz help me - Java Beginners
plz help me  Deepak I can write a sessioon code plz help me admin_home.jsp page is display but data is not disply plz help me what is wrong
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
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
How to get the correct value by calculating double values....
and values like 59,142 etc here i am getting wrong output for the same duration 59 i am getting wrong cost .. Sir plz help me in this code.Thank you Sir...How to get the correct value by calculating double values....  Hello
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 - Java Beginners
plz help me  Thanks deepak continue response..i face some problem i... is true...but i very confuse that how it is not displayed admin page plz any one give me reponse my persinal given id  Hi ragni, i am sending
How to get the correct value by calculating double values....
is integer type and values like 59,142 etc here i am getting wrong output for the same duration 59 i am getting wrong cost .. Sir plz help me in this code.Thank you Sir...How to get the correct value by calculating double values....  Hello
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
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...++) { formate[i].currencyFormat(locales[i]); } } } Output : 9Ã?â?? 843,21 Ã?¢ââ?¬Å
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
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
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
Help me quickly plz??
Help me quickly plz??  Can you help me to write code quickly this code is a java code take input as double and should use command line arguments and enhanced for statement then find the combine of the numbers plz help quickly
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
i need help plz .... Quickly
i need help plz .... Quickly   how can i count how many numbers enterd by the user so the output would be like this Total number of Scores = .... this is my code :- import java.util.Scanner; public class SCORES { public
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/O Program output error
I/O Program output error  Hello All, I am working on a program that requries me to read and analyze a .txt file and output the results to a .txt file, but I am getting incorrect output. I have been successfull with part
plz tell me
plz tell me  how to get no. of times the 'button' is pressed   Here is a java swing code that counts the number of times the button clicked... CountButtonClicks(); } JButton button1 = new JButton("Click Me!"); int clickCount
code
the correct code for a program.The output of the program is listed below...: {Block 5} ADDRESS-3: {San Juan} POST CODE:{6745} ENTER CODE (XX TO stop) CODE:{FF1} QUANTITY:{2} CODE:{TR4} QUANTITY:{1} CODE:XX INVOICE FOR YOUR ORDER Harry
jsp login code ... when username , drop down box and password is correct
jsp login code ... when username , drop down box and password is correct  i need a jsp code for login.... when username password and dropdown box value is correct.... the drop down box values should be retrieved from database
jsp login code when username , password and dropdown box value is correct...
jsp login code when username , password and dropdown box value is correct...  my project has login in whic i should select the company name...;please some one answer me soon.... i need it soon... pls   1)login.jsp
correct the sql error
correct the sql error  i am getting a SQL Error while retriving data... help me and studentId's datatye is number...... private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here
Plz Help Me
Plz Help Me  Write a program for traffic light tool to manage time giving between Main-Street and sub-Street. firstly, give green light for 40...? Program must be written in Micro C.   Here is a code that displays
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 help me with this Question - Java Beginners
Plz help me with this Question  this is java code ------------------------- Consider the following code: int [ ] a = [1, 2, 3]; Object o ="123... the effect of executing this code by means of a diagram similar to that in Figure
help me plz - Java Interview Questions
? plz answer my question   Hi Friend, Try the following code: 1...help me plz  1)write a java program that prompts the user to input...; System.out.println("Enter 5 decimal numbers:"); for (int i=0; i
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 Help me - Java Beginners
plz Help me  Hi, I want learn struts,I dont have any idea about this plz help how can i make a framework.If u have any information then plz send my personal id plz tell me that whose software installed.and give me brief
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
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
Download.jsp Urgent plz - JSP-Servlet
for it.. In this code, as an output, I am getting the open/Save dialog as desired.. But when I... inserted after every upload very successfully.. I am sending the code for your kind...){ e.printStackTrace(); } } %> Please modify the code as soon as possible and send
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
java, plz help me in doing this - Java Beginners
java, plz help me in doing this  # Write a small record management... operation.   Hi Friend, Try the following code: import java.io....=tf5.getText(); BufferedWriter output= new BufferedWriter(new FileWriter(f1

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.