eading through your original post, i can conclude that your solution will be quite easy :
private static String cmdLine = "";
private static final String scriptFile = "MYSCRIPT.sh"
public GUI() {
setTitle("FAMILY");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JCheckBox chckbxMyFatherIs = new JCheckBox("My Father is Joe");
chckbxMyFatherIs.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if(!cmdLine.contains("JOE"))
cmdLine += " JOE ";
}
});
chckbxMyFatherIs.setBounds(45, 48, 137, 23);
contentPane.add(chckbxMyFatherIs);
JCheckBox chckbxNewCheckBox = new JCheckBox("My Mother is Audrey");
chckbxNewCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(!cmdLine.contains("AUDREY"))
cmdLine += " AUDREY ";
}
});
chckbxNewCheckBox.setBounds(196, 48, 198, 23);
contentPane.add(chckbxNewCheckBox);
JCheckBox chckbxNewCheckBox_1 = new JCheckBox("My Bother is Jerry");
chckbxNewCheckBox_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(!cmdLine.contains("JERRY"))
cmdLine += " JERRY ";
}
});
chckbxNewCheckBox_1.setBounds(45, 97, 137, 23);
contentPane.add(chckbxNewCheckBox_1);
JCheckBox chckbxNewCheckBox_2 = new JCheckBox("My eldest Sister is June ");
chckbxNewCheckBox_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(!cmdLine.contains("JUNE"))
cmdLine += " JUNE ";
}
});
chckbxNewCheckBox_2.setBounds(196, 97, 198, 23);
contentPane.add(chckbxNewCheckBox_2);
JCheckBox chckbxNewCheckBox_3 = new JCheckBox("My youngest sister is Awy");
chckbxNewCheckBox_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(!cmdLine.contains("AWY"))
cmdLine += " AWY ";
}
});
chckbxNewCheckBox_3.setBounds(196, 149, 198, 23);
contentPane.add(chckbxNewCheckBox_3);
JCheckBox chckbxAll = new JCheckBox("All");
chckbxAll.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
cmdLine = "JOE AUDREY JERRY JUNE AWY";
}
});
chckbxAll.setBounds(45, 149, 97, 23);
contentPane.add(chckbxAll);
}
You will also need an event-listener for your OK-button, in which you can call:
Runtime.getRuntime().exec(scriptFile + cmdLine);
Mind you : this will only ADD parameters to your list, removal (via un-ticking the boxes) also needs to be handled ... i think you now know how.
Consider using a list instead of one single string ... thats less messy and allows for dynamic lookup/removal/addition of parameters.