How to count 2 inserts together?

hello people,
i've just started programming with Java in NetBeans
and now i'm trying to make a countmachine
but i don't know how to get further
the script must count 2 inserts
1 + 1 = 2
and show the result in another textfield, what has to be lock (no insert over here)
i make the code like this:
public class ED5_1 extends javax.swing.JFrame
public ED5_1()
initComponents();
private void initComponents()
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
id_invoerGetal1 = new javax.swing.JTextField();
id_invoerGetal2 = new javax.swing.JTextField();
id_Optellen = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
id_resultaat = new javax.swing.JTextField();
id_Modulus = new javax.swing.JButton();
id_Vermenigvuldigen = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
jLabel1.setForeground(new java.awt.Color(0, 0, 255));
jLabel1.setText("Getal 1");
jLabel2.setForeground(new java.awt.Color(0, 0, 255));
jLabel2.setText("Getal 2");
id_invoerGetal1.addActionListener(new java.awt.event.ActionListener()
public void actionPerformed(java.awt.event.ActionEvent evt)
id_invoerGetal1ActionPerformed(evt);
id_Optellen.setToolTipText("Getallen met elkaar optellen");
id_Optellen.setLabel("Optellen");
jLabel3.setFont(new java.awt.Font("MS Sans Serif", 1, 11));
jLabel3.setForeground(new java.awt.Color(0, 0, 255));
jLabel3.setText("Antwoord");
id_Modulus.setText("Modulus");
id_Modulus.setToolTipText("De rest na deling");
id_Vermenigvuldigen.setText("Vermenigvuldigen");
id_Vermenigvuldigen.setToolTipText("Getallen met elkaar vermenigvuldigen");
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.Gro upLayout.LEADING)
.add(layout.createSequentialGroup()
.add(27, 27, 27)
.add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.LEADING, false)
.add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
.add(jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
.add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.R ELATED)
.add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.LEADING, false)
.add(id_invoerGetal1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
.add(id_invoerGetal2)
.add(id_resultaat))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.R ELATED, 38, Short.MAX_VALUE)
.add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.LEADING, false)
.add(id_Vermenigvuldigen, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(id_Modulus, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(id_Optellen, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(org.jdesktop.layout.GroupLayout.D EFAULT_SIZE, Short.MAX_VALUE))
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.Gro upLayout.LEADING)
.add(layout.createSequentialGroup()
.add(44, 44, 44)
.add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.TRAILING)
.add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.BASELINE)
.add(id_invoerGetal1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(id_Optellen))
.add(jLabel1))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.R ELATED)
.add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.BASELINE)
.add(jLabel2)
.add(id_invoerGetal2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(id_Modulus))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.R ELATED)
.add(id_Vermenigvuldigen)
.add(6, 6, 6)
.add(layout.createParallelGroup(org.jdesktop.layou t.GroupLayout.BASELINE)
.add(jLabel3)
.add(id_resultaat, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addContainerGap(49, Short.MAX_VALUE))
pack();
}// </editor-fold>
private void id_invoerGetal1ActionPerformed(java.awt.event.Acti onEvent evt)
// TODO add your handling code here:
public static void main(String args[])
java.awt.EventQueue.invokeLater(new Runnable()
public void run()
new ED5_1().setVisible(true);
//String Optellen;
//Optellen = id_invoerGetal1.getText();
//id_resultaat.setText(Optellen);
private javax.swing.JButton id_Modulus;
private javax.swing.JButton id_Optellen;
private javax.swing.JButton id_Vermenigvuldigen;
private javax.swing.JTextField id_invoerGetal1;
private javax.swing.JTextField id_invoerGetal2;
private javax.swing.JTextField id_resultaat;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
Can someone please help me?

JavaBeginner wrote:
you are right I know.
i need more practiseYes, lots.
but can you please tell me where i need to put the code to make this workNope, not worth my time.
between what?
and maybe a little start if it is not too muck to ask :$I think it is too much to ask. I'm only a volunteer, as is everyone else in this forum.
Sure you're not a student trying to sucker somebody into doing your homework for them?
Are you offering money?
Honestly, based on the previous post that I've answered I don't think you have enough basic Java knowledge. You will be a time sink for anyone foolish enough to bother answering all the questions that you'll be posting here. I'm not interested.
%

Similar Messages

  • How to Count number of rows

    Hi All
    If I have 2 tables with records in it, with primary Table A and Foreign key Table B structure.Then how to count the no of occurances of each records of table A in table B and print the values.
    Thanx

    Hi,
    If I understood you can a query like this:
    SGMS@ORACLE10> create table a (cod number);
    Table created.
    SGMS@ORACLE10> create table b (cod number,id number);
    Table created.
    SGMS@ORACLE10> alter table a add constraint pk_a primary key (cod);
    Table altered.
    SGMS@ORACLE10> alter table b add constraint fk_b_a foreign key (cod) references a;
    Table altered.
    SGMS@ORACLE10> insert into a values (1);
    1 row created.
    SGMS@ORACLE10> insert into a values (2);
    1 row created.
    SGMS@ORACLE10> insert into a values (3);
    1 row created.
    SGMS@ORACLE10> insert into b values (1,1);
    1 row created.
    SGMS@ORACLE10> insert into b values (1,2);
    1 row created.
    SGMS@ORACLE10> insert into b values (1,3);
    1 row created.
    SGMS@ORACLE10> insert into b values (2,1);
    1 row created.
    SGMS@ORACLE10> insert into b values (3,1);
    1 row created.
    SGMS@ORACLE10> insert into b values (3,2);
    1 row created.
    SGMS@ORACLE10> commit;
    SGMS@ORACLE10> select b.cod,count(*) from b,a where a.cod = b.cod group by b.cod;
           COD   COUNT(*)
             1          3
             2          1
             3          2
    SGMS@ORACLE10>Cheers

  • How to count the number or rows in file

    Hi Experts,
    I am file as source and Oracle as target. My file containing the some data which is going to load to the target.
    My requirement is that I want to count the number of rows which my file contains. Please help me how to count the total number of rows in file.
    Thx,
    Sahadeva.

    Hi,
    You won't give a name DEST_USER_NAME:ODI will get these information.
    it is important  Command on source and Command on Source side .
    -Pls write jython code on Command on Source side
    -And Command On Target side Choose technology as Oracle and set logical schema to HR_logical
    Sorry my mistake.İt is related jython syntax.Here is code:
    import java.lang as lang
    import java.sql as sql
    import java.lang.String
    import os
    lang.Class.forName("<%=snpRef.getInfo("DEST_JAVA_DRIVER")%>")
    cons=sql.DriverManager.getConnection("<%=snpRef.getInfo("DEST_JAVA_URL")%>", "<%=snpRef.getInfo("DEST_USER_NAME")%>", "<%=snpRef.getInfo("DEST_PASS")%>")
    dblinks= cons.createStatement()
    file1=open('EMP.txt','r')
    count=0
    line=file1.readline()
    while line !='':
         count+=1
         line=file1.readline()
    file1.close()
    sqlQuery = "insert into HR.ETL_FILE_LOG (FILE_COUNT) values (count)"
    rqQuery= dblinks.execute(sqlDBLink)
    cons.close()
    Regards

  • How can I group books together in iTunes?

    How can I group books together in iTunes? Some .pdf books will group but others won't even though they have the same Author, Album Name and are part of a Compilation. I have inserted a picture below to illustrate my point; as you can see, some issues of X-men have grouped together but others still show separately.

    I have tried to attach the image again to show what I mean.
    All the .pdf files I imported are tagged as Books and display properly in the books section. It is only the grouping that is not working. As can be seen in the picture, I don't want to actually merge the .pdfs to a single book, just group them into one 'Album' I suppose as turingtest2 says. However, I have set the Artist, Album Name and Grouping fields to be the same for all files, all are marked as part of a compilation but still only the first 3 X-men issues are grouping together. Any more ideas?

  • When importing songs of a same album but different artist iTunes will separate the artists. How can I bring all together in the same album?

    When importing songs of a same album but different artist iTunes will separate the artists. How can I bring all together in the same album?

    Generally setting a common Album Artist will fix things. For deeper problems see Grouping tracks into albums.
    tt2

  • How to count number of sales orders generated in a month in SAP SD

    Hi SD Gurus,
    I have a very strange query from client. I have to count the number of sales order created in a month for a z report. For example 30 in Jan, 25 in Feb etc. Could anyone suggest me How to count number of sales orders generated in a month in SAP SD.
    Regards
    Vinod Kumar

    Hi,
    Goto the T.Code "SE16" or "SE16n" or "SE11".
    Enter the table name as VBAK
    Enter the created on date as the starting date of the period and to date as the end date.
    Enter.
    Click on "Number of Entries".It will tell you the number of entries created in a particular period.
    If you want a report,goto the T.Code "VA05n".
    Regards,
    Krishna.

  • How to Count Number of completed line items in past 6 months / 12 months ?

    How to Count Number of completed line items in past 6 months / 12 months ?
    Hi,
    I am trying to count "Number of Completed Line Items in Purchase Order Document" for my Key Figure ZPO_CNT.
    Purchase Order document = ZEBELN
    Line Item = ZEBELP.
    I need to find and count if the Line Item has been received in the past 6 months from today and similarly in the past 12 months.
    I have "Delivery Completed" field, ELIKZ.
    So, based on this would I be able to calculate it in Query Designer?
    If so, Please let me know how

    Hello Deva
    If youe want to calculate the completed line item for last 6 or 12 month then i think u will be displaying the query data for these montrhs...create a customer exit to give you date range and restric it in filter area....
    Now Choose any of the below option
    1. I would suggest to implement an additional key figure "counter" in cube and fill values with one for which delivery is completed.
    Now use calculated key figure in Query Designer based on logic
    IF counter = 1 THEN counter ELSE 0
    OR
    2. create a formula variable based on ELIKZ and use replacement path variable, it will display you no. of docs for which delivery is completed....
    Award points if it solves your problem
    Revert back in case of further assistance...
    Thanks
    Tripple k

  • How to count number of related radibuttons in the doccument?

    The field "radiobutton" can have several related radiobuttons.
    How to count quantity of radibuttons with the same name in the doccument?

    With
    this.getField("radiobutton.0");
    this.getField("radiobutton.1");
    and so on you can access the different instances.

  • How to count number of repeated characters in a String

    I have a String.... 10022002202222.
    I need to know how many 2's are there in the string... here the string contains eight 2's..
    Thanks in advance..

    it is workingYes, but... attention to surprises...
    SQL> var v1 varchar2(1000);
    SQL> exec :v1 := 'How to count the number of occurences of a characters in a string';
    PL/SQL procedure successfully completed.
    SQL> select length(:v1) - length(replace(:v1,'c')) from dual;
    LENGTH(:V1)-LENGTH(REPLACE(:V1,'C'))
                                       6
    SQL> exec :v1 := 'cccccc';
    PL/SQL procedure successfully completed.
    SQL> select length(:v1) - length(replace(:v1,'c')) from dual;
    LENGTH(:V1)-LENGTH(REPLACE(:V1,'C'))
    SQL> select length(:v1) - nvl(length(replace(:v1,'c')),0) from dual;
    LENGTH(:V1)-NVL(LENGTH(REPLACE(:V1,'C')),0)
                                              6
    SQL>

  • How to count Number of  completed instances

    Hi all,
    I have one issue regarding *"How to Count Completed instances"* in SOA...
    How can i count the number of completed instances for a interface...Any idea or suggestion plzzzzzz....
    Thanks,
    Raj

    Hi Dariel Pérez ,
    By executing the Querey I'm able to get the State and num_cube instances but when I call this Query in BPEL by using DB adapter I get the following error
    BINDING.JCA-12563 Exception occured when binding was invoked. Exception occured during invocation of JCA binding: “JCA Binding execute of Reference operation ‘CountReq’ failed due to: Pure SQL Exception. Pure SQL Execute of SELECT (CASE WHEN STATE=1 THEN ‘OPEN AND RUNNING’ WHEN STATE=2 THEN ‘OPEN AND SUSPENDED’ WHEN STATE=3 THEN ‘OPEN AND FAULTED’ WHEN STATE=4 THEN ‘CLOSED AND PENDING’ WHEN STATE=5 THEN ‘CLOSED AND COMPLETED’ WHEN STATE=6 THEN ‘CLOSED AND FAUTED’ WHEN STATE=7 THEN ‘CLOSED AND CANCELLED’ WHEN STATE=8 THEN ‘CLOSED AND ABORTED’ WHEN STATE=9 THEN ‘CLOSED AND STALE’ WHEN STATE=10 THEN ‘NON-RECOVERABLE’ ELSE STATE || ” END) AS STATE, COUNT(*) AS NUM_OF_CUBE_INST FROM CUBE_INSTANCE GROUP BY STATE; failed. Caused by java.sql.SQLSyntaxErrorException: ORA-00911: invalid character . The Pure SQL option is for border use cases only and provides simple yet minimal functionality. Possibly try the “Perform an operation on a table” option instead. This exception is considered not retriable, likely due to a modelling mistake. To classify it as retriable instead add property nonRetriableErrorCodes with value “-911″ to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers. “. The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
    Any Suggetions.
    Thanks
    Mani

  • How to count number of autoextents that had took place between a period.

    urgent question
    Hi all
    how to provide me a report for getting the result of the Disk Drive Space usage (drive letter) that shows how quickly the space is being used up by the database(dbf files).
    Or how to count the number of autoextents that had took place between a certain period of time.
    either by cmd promt or OEM would be fine
    Oracle database 10g(single instance)
    OS:Windows 2003 server
    thanks
    Anto

    hi justin and Pavan
    First Thanks for your immediate responce,
    Secoundly client has asked for the growth report at the OS level and not at the database level. but the growth is with respect to the autoextent feature that oracle has over the datafiles.
    I was thinking that i could get a view or some history log to get this data retrieved from the past may be of a months data.I normally manually check the data base growth with the following script
    SELECT total_space,free_space,
    (NVL(total_space,2)-NVL(free_space,2) ) used_space
    FROM (select round(SUM(Bytes/1024/1024/1024),2) Total_space
    from DBA_data_files
    (select round(SUM(Bytes/1024/1024/1024),2) free_space
    from DBA_free_space
    but this is Oracle DB level.
    Any ideas for the report.like a query or somewhere in OEM
    Thanks
    Anto

  • How to count number of lines in a file?

    I am using a BufferedReader to read my file, but I like to know how to count the number of lines in a file is there a way to do that in Buffered Reader or do I have to use FileInputLineStream?

    Well, if you know how to read one line with a Buffered reader, and you know how to keep reading lines until you run out, then all you have to to is initialize a counter to zero before you start reading, add 1 to it each time you read a line, and then examine its value when you're done.
    Try that, and post again if you get stuck.
    Just be careful how you construct your loop. "Off by one" errors are a common way to get bitten. It could happen if you count what you think is the last line, but you've actually already counted all the lines and you end up counting one extra for "there are no more lines".

  • How to count the number of rows in a resultser object?

    hi there
    how to count the number of rows in a resultser object which may contains millions of rows? besides using a while loop? thanks

    You don't, you execute a query whose result is the record count of those records that match the search and then you execute the actual query to create your record set. Typically you do
    select count(id) from YourTable where [filter]
    from the resulting ResultSet do
    int res.getInt(1);
    which gives you the count and then
    select id from YourTable where [filter]
    to produce the actual result set.
    in the second query the id part can be substituted with the actual fields you want.

  • How to count number of ones in table

    Hello,
     i created one table 16x32 each cell is updating 1 byte of data,how to count number of one in all cell,and is it right way to calculate check sum??
    thank you

    The simplest way is to call GetTableCellRangeValues with VAL_ENTIRE_TABLE as the range, next summing array elements.
    But I don't understand your comment on checksum, so this may not be the more correct method for your actual needs: can you explain what do you mean?
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to count number of items present in a data block

    hi all,
    how to count how many items present in a particular data block in oracle forms 10g.
    whether it is a text_item or display_item or list_item etc is there any method to do this.
    please reply....

    hi all,
    i have written this when-button pressed but the problem is how to get the next item name in the block
    DECLARE
         V_COUNT NUMBER:=0;
         V_FIRSTITEM VARCHAR2(100):='';
    BEGIN
         GO_BLOCK('BLOCK_ITEMCOUNT');
         V_FIRSTITEM := GET_BLOCK_PROPERTY('BLOCK_ITEMCOUNT', FIRST_ITEM);
         LOOP
              V_COUNT := V_COUNT + 1;
              EXIT WHEN GET_ITEM_PROPERTY(V_FIRSTITEM, NEXTITEM) IS NULL;
              --V_FIRSTITEM := GET_BLOCK_PROPERTY('BLOCK_ITEMCOUNT', NEXTITEM);
              --V_COUNT := V_COUNT + 1;
         END LOOP;
    END;

Maybe you are looking for

  • Can't add distribution channel in org. model.

    Dear all. I had define distribution channel in SPRO->cust->CRM->Master Data -> Organizational managment-> Organizational Data for sales scenario->Define distribution channels After that i'm trying to add it in field Dist. channel in attribute tab of

  • Firefox Problems Watching Streaming Video (Netflix, Hulu, etc.)

    I have Netflix, hulu, VH1, etc. accounts that I use currently to watch movies, t.v. shows, videos, etc. online (desktop) as my only means to any entertainment. I continually have problems with unexpected pauses, starts/stops, "getting stuck" & having

  • Alphabetical playlists when I dont want them, any ideas?

    Ive got a new ipod Nano, and despite having the tracks in my playlists in the order I want on itunes my Nano keeps making them alphabetical when I add them to it, which I dont want. Any ideas? Many thanks in advance if you can help. Philip

  • Powershell Loop

    Guys, I would like to create a script which does the following. Search a file in d:\folder\test\ If it finds it, send-email and finish. If it doesn't find the file, retry again every 10 minutes for an hour or retry for a fixed number of times before

  • Nokia 208 Internet Problem

    Hi I just got my new Nokia 208. And  there is always a [H] Or [E] icon on my phone, which seems to indicate it's online.   Is my phone online the whole time ? And the FACEBOOK APPLICATION is tooooo SLOOOOW And why the internet connection is always ON