You need to sign in to do that
Don't have an account?
Baba G
How to save radio buttons reference into Java Database (MS Access/SQl etc)
I just created a Java Swing page. I just want to save the actions/ references submitted by user into Database (MS Access/SQL/Text etc).
User will provide his/her review by giving answers.
Whenever user click on Submit button, i want that the references of Radio Buttons, Text Box, Combo Box save automatically to the Database.
Please help me to solve my problem related to Java database connectivity.
Here is the Front end code of My App.............................
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import javax.swing.JComboBox;
import javax.swing.JTextArea;
import javax.swing.JButton;
public class Customer {
private JFrame frame;
private final ButtonGroup buttonGroup = new ButtonGroup();
private final ButtonGroup buttonGroup_1 = new ButtonGroup();
private final ButtonGroup buttonGroup_2 = new ButtonGroup();
private final ButtonGroup buttonGroup_3 = new ButtonGroup();
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Customer window = new Customer();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Customer() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 779, 521);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JLabel l1 = new JLabel("Was the service performed on time?");
l1.setFont(new Font("Tahoma", Font.BOLD, 12));
l1.setBounds(71, 50, 356, 41);
frame.getContentPane().add(l1);
JLabel l2 = new JLabel("Was the location informed prior to the service?");
l2.setFont(new Font("Tahoma", Font.BOLD, 12));
l2.setBounds(71, 91, 356, 41);
frame.getContentPane().add(l2);
JLabel l3 = new JLabel("Was the location informed prior to the service?");
l3.setFont(new Font("Tahoma", Font.BOLD, 12));
l3.setBounds(71, 131, 356, 41);
frame.getContentPane().add(l3);
JLabel l4 = new JLabel("In a scale of 1-10 how would you rate quality of our service?");
l4.setFont(new Font("Tahoma", Font.BOLD, 12));
l4.setBounds(71, 168, 399, 41);
frame.getContentPane().add(l4);
JLabel l5 = new JLabel("how was your overall experience?");
l5.setFont(new Font("Tahoma", Font.BOLD, 12));
l5.setBounds(71, 217, 364, 41);
frame.getContentPane().add(l5);
JLabel l6 = new JLabel("If you have any issue, Please describe-");
l6.setFont(new Font("Tahoma", Font.BOLD, 12));
l6.setBounds(71, 278, 313, 34);
frame.getContentPane().add(l6);
JRadioButton b1 = new JRadioButton("Yes");
buttonGroup.add(b1);
b1.setFont(new Font("Tahoma", Font.BOLD, 12));
b1.setBounds(490, 54, 52, 34);
frame.getContentPane().add(b1);
JRadioButton b2 = new JRadioButton("No");
buttonGroup.add(b2);
b2.setFont(new Font("Tahoma", Font.BOLD, 12));
b2.setBounds(571, 54, 46, 34);
frame.getContentPane().add(b2);
JRadioButton b3 = new JRadioButton("Yes");
buttonGroup_1.add(b3);
b3.setFont(new Font("Tahoma", Font.BOLD, 12));
b3.setBounds(490, 96, 52, 31);
frame.getContentPane().add(b3);
JRadioButton b4 = new JRadioButton("No");
buttonGroup_1.add(b4);
b4.setFont(new Font("Tahoma", Font.BOLD, 12));
b4.setBounds(571, 93, 71, 36);
frame.getContentPane().add(b4);
JRadioButton b5 = new JRadioButton("Yes");
buttonGroup_2.add(b5);
b5.setFont(new Font("Tahoma", Font.BOLD, 12));
b5.setBounds(490, 141, 58, 23);
frame.getContentPane().add(b5);
JRadioButton b6 = new JRadioButton("No");
buttonGroup_2.add(b6);
b6.setFont(new Font("Tahoma", Font.BOLD, 12));
b6.setBounds(571, 141, 46, 23);
frame.getContentPane().add(b6);
JComboBox comboBox = new JComboBox();
comboBox.setBounds(496, 178, 46, 23);
frame.getContentPane().add(comboBox);
JRadioButton b7 = new JRadioButton("Bad");
buttonGroup_3.add(b7);
b7.setFont(new Font("Tahoma", Font.BOLD, 12));
b7.setBounds(490, 220, 52, 34);
frame.getContentPane().add(b7);
JRadioButton b8 = new JRadioButton("Fair");
buttonGroup_3.add(b8);
b8.setFont(new Font("Tahoma", Font.BOLD, 12));
b8.setBounds(571, 227, 52, 23);
frame.getContentPane().add(b8);
JRadioButton b9 = new JRadioButton("Good");
buttonGroup_3.add(b9);
b9.setFont(new Font("Tahoma", Font.BOLD, 12));
b9.setBounds(490, 257, 72, 30);
frame.getContentPane().add(b9);
JRadioButton b10 = new JRadioButton("Excellent");
buttonGroup_3.add(b10);
b10.setFont(new Font("Tahoma", Font.BOLD, 12));
b10.setBounds(571, 261, 89, 23);
frame.getContentPane().add(b10);
JTextArea textArea = new JTextArea();
textArea.setBounds(316, 294, 196, 103);
frame.getContentPane().add(textArea);
JButton btnSave = new JButton("Save");
btnSave.setFont(new Font("Tahoma", Font.BOLD, 14));
btnSave.setBounds(359, 423, 121, 34);
frame.getContentPane().add(btnSave);
}
}
User will provide his/her review by giving answers.
Whenever user click on Submit button, i want that the references of Radio Buttons, Text Box, Combo Box save automatically to the Database.
Please help me to solve my problem related to Java database connectivity.
Here is the Front end code of My App.............................
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import javax.swing.JComboBox;
import javax.swing.JTextArea;
import javax.swing.JButton;
public class Customer {
private JFrame frame;
private final ButtonGroup buttonGroup = new ButtonGroup();
private final ButtonGroup buttonGroup_1 = new ButtonGroup();
private final ButtonGroup buttonGroup_2 = new ButtonGroup();
private final ButtonGroup buttonGroup_3 = new ButtonGroup();
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Customer window = new Customer();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Customer() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 779, 521);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JLabel l1 = new JLabel("Was the service performed on time?");
l1.setFont(new Font("Tahoma", Font.BOLD, 12));
l1.setBounds(71, 50, 356, 41);
frame.getContentPane().add(l1);
JLabel l2 = new JLabel("Was the location informed prior to the service?");
l2.setFont(new Font("Tahoma", Font.BOLD, 12));
l2.setBounds(71, 91, 356, 41);
frame.getContentPane().add(l2);
JLabel l3 = new JLabel("Was the location informed prior to the service?");
l3.setFont(new Font("Tahoma", Font.BOLD, 12));
l3.setBounds(71, 131, 356, 41);
frame.getContentPane().add(l3);
JLabel l4 = new JLabel("In a scale of 1-10 how would you rate quality of our service?");
l4.setFont(new Font("Tahoma", Font.BOLD, 12));
l4.setBounds(71, 168, 399, 41);
frame.getContentPane().add(l4);
JLabel l5 = new JLabel("how was your overall experience?");
l5.setFont(new Font("Tahoma", Font.BOLD, 12));
l5.setBounds(71, 217, 364, 41);
frame.getContentPane().add(l5);
JLabel l6 = new JLabel("If you have any issue, Please describe-");
l6.setFont(new Font("Tahoma", Font.BOLD, 12));
l6.setBounds(71, 278, 313, 34);
frame.getContentPane().add(l6);
JRadioButton b1 = new JRadioButton("Yes");
buttonGroup.add(b1);
b1.setFont(new Font("Tahoma", Font.BOLD, 12));
b1.setBounds(490, 54, 52, 34);
frame.getContentPane().add(b1);
JRadioButton b2 = new JRadioButton("No");
buttonGroup.add(b2);
b2.setFont(new Font("Tahoma", Font.BOLD, 12));
b2.setBounds(571, 54, 46, 34);
frame.getContentPane().add(b2);
JRadioButton b3 = new JRadioButton("Yes");
buttonGroup_1.add(b3);
b3.setFont(new Font("Tahoma", Font.BOLD, 12));
b3.setBounds(490, 96, 52, 31);
frame.getContentPane().add(b3);
JRadioButton b4 = new JRadioButton("No");
buttonGroup_1.add(b4);
b4.setFont(new Font("Tahoma", Font.BOLD, 12));
b4.setBounds(571, 93, 71, 36);
frame.getContentPane().add(b4);
JRadioButton b5 = new JRadioButton("Yes");
buttonGroup_2.add(b5);
b5.setFont(new Font("Tahoma", Font.BOLD, 12));
b5.setBounds(490, 141, 58, 23);
frame.getContentPane().add(b5);
JRadioButton b6 = new JRadioButton("No");
buttonGroup_2.add(b6);
b6.setFont(new Font("Tahoma", Font.BOLD, 12));
b6.setBounds(571, 141, 46, 23);
frame.getContentPane().add(b6);
JComboBox comboBox = new JComboBox();
comboBox.setBounds(496, 178, 46, 23);
frame.getContentPane().add(comboBox);
JRadioButton b7 = new JRadioButton("Bad");
buttonGroup_3.add(b7);
b7.setFont(new Font("Tahoma", Font.BOLD, 12));
b7.setBounds(490, 220, 52, 34);
frame.getContentPane().add(b7);
JRadioButton b8 = new JRadioButton("Fair");
buttonGroup_3.add(b8);
b8.setFont(new Font("Tahoma", Font.BOLD, 12));
b8.setBounds(571, 227, 52, 23);
frame.getContentPane().add(b8);
JRadioButton b9 = new JRadioButton("Good");
buttonGroup_3.add(b9);
b9.setFont(new Font("Tahoma", Font.BOLD, 12));
b9.setBounds(490, 257, 72, 30);
frame.getContentPane().add(b9);
JRadioButton b10 = new JRadioButton("Excellent");
buttonGroup_3.add(b10);
b10.setFont(new Font("Tahoma", Font.BOLD, 12));
b10.setBounds(571, 261, 89, 23);
frame.getContentPane().add(b10);
JTextArea textArea = new JTextArea();
textArea.setBounds(316, 294, 196, 103);
frame.getContentPane().add(textArea);
JButton btnSave = new JButton("Save");
btnSave.setFont(new Font("Tahoma", Font.BOLD, 14));
btnSave.setBounds(359, 423, 121, 34);
frame.getContentPane().add(btnSave);
}
}
Sonam (Salesforce Developers)
Hi Shubham, I understand you wish to save this data in Salesforce. if yes, you will have to use the salesforce APIs to update this value in Salesforce:http://www.salesforce.com/developer/docs/api/Content/sforce_api_quickstart_intro.htm