import java.sql.*;
/**
*
* @author Amol
*/
public class rFrame extends javax.swing.JFrame {
/** Creates new form rFrame */
public rFrame() {
//resultLabel.setText("submit");
initComponents();
}
private void resultLabelInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
// TODO add your handling code here:
resultLabel.setText("submit");
}
private void submitActionPerformed(java.awt.event.ActionEvent evt) {
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/sampledb1","root","root");
String radius= radiusTextField.getText();
String xaxis= xTextField.getText();
String yaxis = yTextField.getText();
PreparedStatement ps=con.prepareStatement("insert into radius values(?,?,?)");
ps.setString(1,radius);
ps.setString(2,xaxis);
ps.setString(3,yaxis);
ps.execute();
ps.close();
con.close();
new NewTable().setVisible(true);
}
catch(Exception e){
System.out.println("e = " + e);
}
}
private void radiusTextFieldActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void resultLabelMouseClicked(java.awt.event.MouseEvent evt) {
try{
int radius = Integer.parseInt(radiusTextField.getText());
int xAxis = Integer.parseInt(xTextField.getText());
int yAxis = Integer.parseInt(yTextField.getText());
if(xAxis<=radius && yAxis<=radius){
resultLabel.setText("Point lies in the circle");
}
else
resultLabel.setText("Point Lies out of the circle");
}
catch(Exception e){
System.out.println("e = " + e);
}
}
private void resultLabelKeyTyped(java.awt.event.KeyEvent evt) {
resultLabel.setText("submit");
// TODO add your handling code here:
}
private void formMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new rFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel radiusLabel;
private javax.swing.JTextField radiusTextField;
private javax.swing.JLabel resultLabel;
private javax.swing.JButton submit;
private javax.swing.JLabel xAxis;
private javax.swing.JTextField xTextField;
private javax.swing.JLabel yAxisLabel;
private javax.swing.JTextField yTextField;
// End of variables declaration
}
No comments:
Post a Comment