Showing posts with label java beginners. Show all posts
Showing posts with label java beginners. Show all posts
Thursday, 16 May 2013
Monday, 13 May 2013
Creating ASP.NET website Part 2
basic asp.net|Free dot net video tutorials for beginners
Saturday, 11 May 2013
ASP.NET MVC - Internet Application examples
ASP.NET MVC - Internet Application
http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/intro-to-aspnet-mvc-3
Friday, 10 May 2013
ASP MVC video basic |webmatrix |visual web developer 2010
http://pluralsight.com/training/players/PSODPlayer?author=scott-allen&name=mvc3-building-intro&mode=live&clip=0&course=aspdotnet-mvc3-intro
http://localhost:49547/
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-web-developer-express/thank-you?key=CBC25520-5055-4921-80FF-DF39665DFB13&lang=en
WebMatrix is a free, lightweight, cloud-connected web development tool
http://www.microsoft.com/web/webmatrix/
http://www.microsoft.com/web/category/all
http://localhost:49547/
VISUAL WEB DEVELOPER 2010
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-web-developer-express/thank-you?key=CBC25520-5055-4921-80FF-DF39665DFB13&lang=en
WebMatrix is a free, lightweight, cloud-connected web development tool
http://www.microsoft.com/web/webmatrix/
http://www.microsoft.com/web/category/all
Thursday, 9 May 2013
java data base with jform connection
java data base with jform connection :
links : http://www.homeandlearn.co.uk/java/databases_and_java_forms.html
http://www.homeandlearn.co.uk/java/databases_and_java_forms.html
http://www.java-forums.org/new-java/63794-gui-nullpointerexception.html
http://ideone.com/RzLiJT
http://henry416.wordpress.com/2012/01/10/how-to-bind-data-from-database-with-java-swing-ui/
http://henry416.wordpress.com/2012/01/12/query-database-using-swing-ui/
http://stackoverflow.com/questions/13766262/database-scrolling-buttons-using-java-forms-error-when-calling-next-method-to
code :
---------
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Employees;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
/**
*
* @author backup
*/
public class Workers extends javax.swing.JFrame {
/**
* Creates new form Workers
*/
//VARIBALE DECLARATION
Connection con;
Statement stmt;
ResultSet rs;
//WORKERS CONSTRUCTOR
public Workers() {
initComponents();
DoConnect();
}
public void DoConnect(){
try{
//CONNECT TO THE DATABASE
String host = "jdbc:derby://localhost:1527/Employees ";
String uName = "riyo";
String uPassword = "iw123456";
con = DriverManager.getConnection(host,uName,uPassword);
//EXECUTE SOME SQL AND LOAD THE RECORDS
stmt = con.createStatement();
String sql = "SELECT*FROM WORKERS";
rs = stmt.executeQuery(sql);
//CALL FIRST RECORD DATA AND GET DATA
rs.next() ;
int id_col = rs.getInt("ID");
String id = Integer.toString(id_col);
String First = rs.getString("First_Name");
String Last = rs.getString("Last_Name");
String Job = rs.getString("Job_Title");
//DISPLAY THE FIRST RECORD IN TEH TEXT FIELDS
textID.setText(id);
textFirstName.setText(First);
textLastName.setText(Last);
textJobTitle.setText(Job);
}
catch( SQLException err ){
JOptionPane.showMessageDialog(Workers.this, err.getMessage());
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
textID = new javax.swing.JTextField();
textFirstName = new javax.swing.JTextField();
textLastName = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
textJobTitle = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
textID.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textIDActionPerformed(evt);
}
});
textFirstName.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textFirstNameActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setText("JobTitle:");
textJobTitle.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textJobTitleActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textID, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(47, 47, 47)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(textFirstName, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(80, 80, 80)
.addComponent(textLastName, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(textJobTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(234, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(textID, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textFirstName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textLastName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(58, 58, 58)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textJobTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(204, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void textIDActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void textFirstNameActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void textJobTitleActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Workers().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
private javax.swing.JTextField textFirstName;
private javax.swing.JTextField textID;
private javax.swing.JTextField textJobTitle;
private javax.swing.JTextField textLastName;
// End of variables declaration
}
links : http://www.homeandlearn.co.uk/java/databases_and_java_forms.html
http://www.homeandlearn.co.uk/java/databases_and_java_forms.html
http://www.java-forums.org/new-java/63794-gui-nullpointerexception.html
http://ideone.com/RzLiJT
http://henry416.wordpress.com/2012/01/10/how-to-bind-data-from-database-with-java-swing-ui/
http://henry416.wordpress.com/2012/01/12/query-database-using-swing-ui/
http://stackoverflow.com/questions/13766262/database-scrolling-buttons-using-java-forms-error-when-calling-next-method-to
code :
---------
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Employees;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
/**
*
* @author backup
*/
public class Workers extends javax.swing.JFrame {
/**
* Creates new form Workers
*/
//VARIBALE DECLARATION
Connection con;
Statement stmt;
ResultSet rs;
//WORKERS CONSTRUCTOR
public Workers() {
initComponents();
DoConnect();
}
public void DoConnect(){
try{
//CONNECT TO THE DATABASE
String host = "jdbc:derby://localhost:1527/Employees ";
String uName = "riyo";
String uPassword = "iw123456";
con = DriverManager.getConnection(host,uName,uPassword);
//EXECUTE SOME SQL AND LOAD THE RECORDS
stmt = con.createStatement();
String sql = "SELECT*FROM WORKERS";
rs = stmt.executeQuery(sql);
//CALL FIRST RECORD DATA AND GET DATA
rs.next() ;
int id_col = rs.getInt("ID");
String id = Integer.toString(id_col);
String First = rs.getString("First_Name");
String Last = rs.getString("Last_Name");
String Job = rs.getString("Job_Title");
//DISPLAY THE FIRST RECORD IN TEH TEXT FIELDS
textID.setText(id);
textFirstName.setText(First);
textLastName.setText(Last);
textJobTitle.setText(Job);
}
catch( SQLException err ){
JOptionPane.showMessageDialog(Workers.this, err.getMessage());
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
textID = new javax.swing.JTextField();
textFirstName = new javax.swing.JTextField();
textLastName = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
textJobTitle = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
textID.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textIDActionPerformed(evt);
}
});
textFirstName.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textFirstNameActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setText("JobTitle:");
textJobTitle.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textJobTitleActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(textID, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(47, 47, 47)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(textFirstName, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(80, 80, 80)
.addComponent(textLastName, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(textJobTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(234, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(textID, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textFirstName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textLastName, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(58, 58, 58)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textJobTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(204, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void textIDActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void textFirstNameActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void textJobTitleActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Workers().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
private javax.swing.JTextField textFirstName;
private javax.swing.JTextField textID;
private javax.swing.JTextField textJobTitle;
private javax.swing.JTextField textLastName;
// End of variables declaration
}
java database easy application
java database easy application
http://www.javaguicodexample.com/javadesktopguimysql1.html
code example :
http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/components/BorderDemoProject/src/components/BorderDemo.java
swing:
http://docs.oracle.com/javase/tutorial/uiswing/components/jcomponent.html
swing 2
http://docs.oracle.com/javase/tutorial/uiswing/components/toplevel.html
swing calc:
http://www.homeandlearn.co.uk/java/java_events.html
java DB:
http://www.homeandlearn.co.uk/java/databases_and_java_forms.html
netbeans google
http://bits.netbeans.org/dev/javadoc/
https://sites.google.com/a/geotoolkit.net/intviewer/using-netbeans-swing-components-walkthroughs
Monday, 6 May 2013
Friday, 3 May 2013
java database with code
http://www.homeandlearn.co.uk/java/connecting_to_a_database_table.html
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package smallDatabase_console;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author backup
*/
public class JavaDB {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try{
String host = "jdbc:derby://localhost:1527/ForexSignalsNew ";
String uName="riyo";
String uPass="iw123456";
Connection con=DriverManager.getConnection(host,uName,uPass);
}
catch(SQLException err )
{
System.out.println(err.getMessage());
}
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package smallDatabase_console;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author backup
*/
public class JavaDB {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try{
String host = "jdbc:derby://localhost:1527/ForexSignalsNew ";
String uName="riyo";
String uPass="iw123456";
Connection con=DriverManager.getConnection(host,uName,uPass);
}
catch(SQLException err )
{
System.out.println(err.getMessage());
}
}
}
Thursday, 2 May 2013
netbeans swing tutorial basics
Wednesday, 17 April 2013
Java For beginners |JFrame Form |Addition Example using netbeans
Java For beginners |JFrame Form |Addition Example
I done today my first and best application using by java :)
I got so much of happy by this small application .Because its only give a good path for my programming route .
i done by this using this good website link way :
You just follow this side details then easily you also make a small application
https://netbeans.org/kb/docs/java/gui-functionality.html
I done today my first and best application using by java :)
I got so much of happy by this small application .Because its only give a good path for my programming route .
i done by this using this good website link way :
You just follow this side details then easily you also make a small application
https://netbeans.org/kb/docs/java/gui-functionality.html
Exercise 1: Creating a Project
The first step is to create an IDE project for the application that we are going to develop. We will name our project NumberAddition.
- Choose File > New Project. Alternatively, you can click the New Project icon in the IDE toolbar.
- In the Categories pane, select the Java node. In the Projects pane, choose Java Application. Click Next.
- Type
NumberAdditionin the Project Name field and specify a path, for example, in your home directory, as the project location. - (Optional) Select the Use Dedicated Folder for Storing Libraries checkbox and specify the location for the libraries folder. See Sharing Project Libraries for more information on this option.
- Deselect the Create Main Class checkbox if it is selected.
- Click Finish.
Exercise 2: Building the Front End
To proceed with building our interface, we need to create a Java container within which we will place the other required GUI components. In this step we'll create a container using the
JFrame component. We will place the container in a new package, which will appear within the Source Packages node.Create a JFrame container
- In the Projects window, right-click the NumberAddition node and choose New > Other.
- In the New File dialog box, choose the Swing GUI Forms category and the JFrame Form file type. Click Next.
- Enter NumberAdditionUI as the class name.
- Enter
my.numberadditionas the package. - Click Finish.
The IDE creates the
NumberAdditionUI form and the NumberAdditionUI class within the NumberAddition application, and opens the NumberAdditionUI form in the GUI Builder. Themy.NumberAddition package replaces the default package.Adding Components: Making the Front End
Next we will use the Palette to populate our application's front end with a JPanel. Then we will add three JLabels, three JTextFields, and three JButtons. If you have not used the GUI Builder before, you might find information in the Designing a Swing GUI in NetBeans IDE tutorial on positioning components useful.
Once you are done dragging and positioning the aforementioned components, the JFrame should look something like the following screenshot.

If you do not see the Palette window in the upper right corner of the IDE, choose Window > Palette.
- Start by selecting a Panel from the Swing Containers category on Palette and drop it onto the JFrame.
- While the JPanel is highlighted, go to the Properties window and click the ellipsis (...) button next to Border to choose a border style.
- In the Border dialog, select TitledBorder from the list, and type in
Number Additionin the Title field. Click OK to save the changes and exit the dialog. - You should now see an empty titled JFrame that says Number Addition like in the screenshot. Look at the screenshot and add three JLabels, three JTextFields and three JButtons as you see above.
Renaming the Components
In this step we are going to rename the display text of the components that were just added to the JFrame.
- Double-click
jLabel1and change the text property toFirst Number - Double-click
jLabel2and change the text toSecond Number - Double-click
jLabel3and change the text toResult - Delete the sample text from
jTextField1. You can make the display text editable by right-clicking the text field and choosing Edit Text from the popup menu. You may have to resize thejTextField1to its original size. Repeat this step forjTextField2andjTextField3. - Rename the display text of
jButton1toClear. (You can edit a button's text by right-clicking the button and choosing Edit Text. Or you can click the button, pause, and then click again.) - Rename the display text of
jButton2toAdd. - Rename the display text of
jButton3toExit.
Your Finished GUI should now look like the following screenshot:

Exercise 3: Adding Functionality
In this exercise we are going to give functionality to the Add, Clear, and Exit buttons. The
jTextField1 and jTextField2 boxes will be used for user input and jTextField3 for program output - what we are creating is a very simple calculator. Let's begin.Making the Exit Button Work
In order to give function to the buttons, we have to assign an event handler to each to respond to events. In our case we want to know when the button is pressed, either by mouse click or via keyboard. So we will use ActionListener responding to ActionEvent.
- Right click the Exit button. From the pop-up menu choose Events > Action > actionPerformed. Note that the menu contains many more events you can respond to! When you select the actionPerformedevent, the IDE will automatically add an ActionListener to the Exit button and generate a handler method for handling the listener's actionPerformed method.
- The IDE will open up the Source Code window and scroll to where you implement the action you want the button to do when the button is pressed (either by mouse click or via keyboard). Your Source Code window should contain the following lines:
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { //TODO add your handling code here: } - We are now going to add code for what we want the Exit Button to do. Replace the TODO line with
System.exit(0);. Your finished Exit button code should look like this:private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); }
Making the Clear Button Work
- Click the Design tab at the top of your work area to go back to the Form Design.
- Right click the Clear button (
jButton1). From the pop-up menu select Events > Action > actionPerformed. - We are going to have the Clear button erase all text from the jTextFields. To do this, you will add some code like above. Your finished source code should look like this:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt){ jTextField1.setText(""); jTextField2.setText(""); jTextField3.setText(""); }
The above code changes the text in all three of our JTextFields to nothing, in essence it is overwriting the existing Text with a blank.
Making the Add Button Work
The Add button will perform three actions.
- It is going to accept user input from
jTextField1andjTextField2and convert the input from a type String to a float. - It will then perform addition of the two numbers.
- And finally, it will convert the sum to a type String and place it in
jTextField3.
- Click the Design tab at the top of your work area to go back to the Form Design.
- Right-click the Add button (
jButton2). From the pop-up menu, select Events > Action > actionPerformed. - We are going to add some code to have our Add button work. The finished source code shall look like this:
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt){ // First we define float variables. float num1, num2, result; // We have to parse the text to a type float. num1 = Float.parseFloat(jTextField1.getText()); num2 = Float.parseFloat(jTextField2.getText()); // Now we can perform the addition. result = num1+num2; // We will now pass the value of result to jTextField3. // At the same time, we are going to // change the value of result from a float to a string. jTextField3.setText(String.valueOf(result)); }
Our program is now complete we can now build and run it to see it in action.
Exercise 4: Running the Program
To run the program in the IDE:
Choose Run > Run Main Project (alternatively, press F6).
So this is the good path for to start a better java life :)
Tuesday, 16 April 2013
Using method of java : Text Field API
http://docs.oracle.com/javase/tutorial/uiswing/components/textfield.html
This is the best guide way to understand about Java
This is the best guide way to understand about Java
Text Field API
Saturday, 13 April 2013
struggle in learn java
struggle in learn java :
I got more struggle in my java class.I dont know how ?where ?which ?
Way first start its .
So i got one good info and guide from my friend(google) .He given a good link to learn about java.
http://www.homeandlearn.co.uk/java/java_and_databases.html
http://www.homeandlearn.co.uk/java/changing_button_properties.html
A Java Calculator Project
A Java Calculator Project:
This is the my first and best training class.
so i plan to start its from monday .
Before start i wan to clear all software problem in my pc .
ok lets start that now :)
I got more struggle in my java class.I dont know how ?where ?which ?
Way first start its .
So i got one good info and guide from my friend(google) .He given a good link to learn about java.
http://www.homeandlearn.co.uk/java/java_and_databases.html
http://www.homeandlearn.co.uk/java/changing_button_properties.html
A Java Calculator Project
A Java Calculator Project:
This is the my first and best training class.
so i plan to start its from monday .
Before start i wan to clear all software problem in my pc .
ok lets start that now :)
Tuesday, 9 April 2013
Java 21 day class for beginners | Day 1
Just come with empty mind here .I will insert into your brain side about all Java basic within 21 days .
So our first day .........
Is start now :)
Day 1 :
Today we learn about the basic introduction of Java and what Java is, why it’s cool, and how to get the
software. You’ll also create your first Java applications and applets.
Simply
What is Java ?
Java is an object-oriented programming language developed by Sun Micro systems.
Need to learn about Hot Java ?
Yes we need to learn about hotjava to .Because its using at HTML webpage making time more .
Hot Java is the first World Wide Web Browser to be able to play Java applets .
HotJava was the first World Wide Web browser
What is applets ?
Applets can be used to create animations,
figures, or areas that can respond to input from the reader, games, or other interactive effects on
the same Web pages among the text and graphics.
Platform-independence is a program’s capability of moving easily from one computer
system to another.
Bytecodes are a set of instructions that looks a lot like some machine codes, but that is not
specific to any one processor.
Process :
Java Development Process have two steps mainly :
1 -Java compiler
2-Java interpreter
Need to collect info from this sites :https://www.google.co.in/search?hl=en&output=search&sclient=psy-ab&q=teach+yourself+java+in+21+days+&oq=teach+yourself+java+in+21+days+&gs_l=hp.3...4898.4898.0.5586.1.1.0.0.0.0.0.0..0.0...0.0...1c.1.8.psy-ab.XrbGWvVkZA8&pbx=1&bav=on.2,or.r_cp.r_qf.&bvm=bv.44990110,d.bmk&biw=1600&bih=775&ech=1&psi=1QJlUc2KEoqsrAef-IDIBw.1365574357835.3&emsg=NCSR&noj=1&ei=1QJlUc2KEoqsrAef-IDIBw
Day 1 is the basic introduction: what Java is, why it’s cool, and how to get the
software. You’ll also create your first Java applications and applets.
xxiii
Sams.net
Learning
Center
abcd
n On Day 2, you’ll explore basic object-oriented programming concepts as they apply to
Java.
n On Day 3, you start getting down to details with the basic Java building blocks: data
types, variables, and expressions such as arithmetic and comparisons.
n Day 4 goes into detail about how to deal with objects in Java: how to create them,
how to access their variables and call their methods, and how to compare and copy
them. You’ll also get your first glance at the Java class libraries.
n On Day 5, you’ll learn more about Java with arrays, conditional statements. and
loops.
n Day 6 is the best one yet. You’ll learn how to create classes, the basic building blocks
of any Java program, as well as how to put together a Java application (an application
being a Java program that can run on its own without a Web browser).
n Day 7 builds on what you learned on Day 6. On Day 7, you’ll learn more about how
to create and use methods, including overriding and overloading methods and
creating constructors.
Subscribe to:
Posts (Atom)