Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-20-2008, 12:25 PM
Member
 
Join Date: Jan 2008
Posts: 2
kim85 is on a distinguished road
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?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Count Apple2 JavaServer Pages (JSP) and JSTL 1 04-29-2008 10:02 AM
How to get the count of all the lines in a file Java Tip java.io 0 04-06-2008 08:45 PM
Getting row count Java Tip Java Tips 0 02-11-2008 09:49 AM
making a count down timer using java saytri New To Java 3 12-29-2007 10:49 PM
Getting row count from executeQuery() Java Tip Java Tips 0 12-05-2007 03:31 PM


All times are GMT +3. The time now is 04:10 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org