Hey guys can somebody show me a way good way of concatenating these strings with commas
Basically Im building a header criteria string showing which forms variables have been selected. I need to put commas in between the values and keep the break tags in place...can somebody see a better way to do it. I didnt want commas if there were just on value
This is what it looks like currently formatted:
protected final String getCriteriaHeader(MetricFilterCriteriaForm form)
{
String filterCriteria = "<br/>";
}
if (form.isSacNone() || form.isSac1() || form.isSac2() || form.isSac3())
{
filterCriteria = filterCriteria + "SAC:";
}
if (form.isSacNone())
{
filterCriteria = filterCriteria + " NONE";
}
if (form.isSac1())
{
filterCriteria = filterCriteria + " 1";
}
if (form.isSac2())
{
filterCriteria = filterCriteria + " 2";
}
if (form.isSac3())
{
filterCriteria = filterCriteria + " 3";
}
if (form.isSac1() || form.isSac2() || form.isSac3())
{
filterCriteria = filterCriteria + "<br/>";
}
if (form.isRegularScheduleType() || form.isLotScheduleType() || form.isBatchScheduleType())
{
filterCriteria = filterCriteria + "Schedule Type:";
}
if (form.isRegularScheduleType())
{
filterCriteria = filterCriteria + " Regular";
}
if (form.isLotScheduleType())
{
filterCriteria = filterCriteria + " Lot";
}
if (form.isBatchScheduleType())
{
filterCriteria = filterCriteria + " Batch";
}
return filterCriteria;
}
There are different ways to concatenate a set of values in a string with a separator.
With StringBuilder
Add the values with the comma, then remove the last comma manually.
StringBuilder sb = new StringBuilder();
if (/*condition1*/) {
sb.add("A,"); // value with comma
}
if (/*condition2*/) {
sb.add("B,");
}
sb.delete(sb.length()-1, sb.length()); // remove last character, which is the comma.
String result = sb.toString(); // get the result string.
With Guava's Joiner
Put it all in a List and use Joiner.
List<String> list = Lists.newArrayList();
if (/*condition1*/) {
list.add("A"); // no comma here
}
if (/*condition2*/) {
list.add("B");
}
String result = Joiner.on(",").join(list); // use Joiner to join elements of the list.
Alternatively to Guava, there is StringUtils.Join from Apache Common Lang. See #Iswanto San's answer.
You can use StringUtils.Join from Apache Common Lang
Example :
protected final String getCriteriaHeader(MetricFilterCriteriaForm form)
{
String filterCriteria = "<br/>";
List<String> sacs = new ArrayList<String>();
List<String> schedules = new ArrayList<String>();
if (form.isSacNone() || form.isSac1() || form.isSac2() || form.isSac3())
{
filterCriteria = filterCriteria + "SAC:";
}
if (form.isSacNone())
{
filterCriteria = filterCriteria + " NONE";
}
if (form.isSac1())
{
sacs.add(" 1");
}
if (form.isSac2())
{
sacs.add(" 2");
}
if (form.isSac3())
{
sacs.add(" 3");
}
filterCriteria += StringUtils.join(saces, ",");
if (form.isSac1() || form.isSac2() || form.isSac3())
{
filterCriteria = filterCriteria + "<br/>";
}
if (form.isRegularScheduleType() || form.isLotScheduleType() || form.isBatchScheduleType())
{
filterCriteria = filterCriteria + "Schedule Type:";
}
if (form.isRegularScheduleType())
{
schedules.add(" Regular");
}
if (form.isLotScheduleType())
{
schedules.add(" Lot");
}
if (form.isBatchScheduleType())
{
schedules.add(" Batch");
}
filterCriteria+=StringUtils.join(schedules, ",");
return filterCriteria;
}
At first avoid creating so much String instances by using StringBuilder. Then nest the conditions to speed things up a bit and to get more structure.
protected final String getCriteriaHeader(MetricFilterCriteriaForm form)
{
StringBuilder filterCriteria = new StringBuilder("<br/>");
if (form.isSacNone() || form.isSac1() || form.isSac2() || form.isSac3())
{
filterCriteria.append("SAC:");
if (form.isSacNone())
filterCriteria.append(" NONE");
if (form.isSac1() || form.isSac2() || form.isSac3())
{
if (form.isSac1())
filterCriteria.append(" 1,");
if (form.isSac2())
filterCriteria.append(" 2,");
if (form.isSac3())
filterCriteria.append(" 3,");
if(','==filterCriteria.charAt(filterCriteria.length-1) )
filterCriteria.deleteCharAt(filterCriteria.length-1)
filterCriteria.append("<br/>");
}
}
if (form.isRegularScheduleType() || form.isLotScheduleType() || form.isBatchScheduleType())
{
filterCriteria.append("Schedule Type:");
if (form.isRegularScheduleType())
filterCriteria.append(" Regular,");
if (form.isLotScheduleType())
filterCriteria.append(" Lot,");
if (form.isBatchScheduleType())
filterCriteria.append(" Batch,");
if(','==filterCriteria.charAt(filterCriteria.length-1) )
filterCriteria.deleteCharAt(filterCriteria.length-1)
}
return filterCriteria.toString();
}
If only one condition can be true,you can also use else if instead of cascades of if.
You could use a StringBuilder to build the string, it's better than simple string concatenation :
StringBuilder sb = new StringBuilder();
if(XX) {
sb.append("XX");
}
return sb.toString();
Hope this helps :)
PS: Note that StringBuilder is faster than StringBuffer, but the latter is Thread-safe.
EDIT
I re-read your question, and it seems I don't answer it well, although I provided useful advice (IMHO). I don't understand exactly what you need.
I would suggest whacking the thing into a List then using a StringBuilder:
protected final String getCriteriaHeader(MetricFilterCriteriaForm form) {
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("<br/>");
final List<String> sacList = new LinkedList<String>();
if (form.isSacNone() || form.isSac1() || form.isSac2() || form.isSac3()) {
stringBuilder.append("SAC: ");
}
if (form.isSacNone()) {
sacList.add("NONE");
}
if (form.isSac1()) {
sacList.add("1");
}
if (form.isSac2()) {
sacList.add("2");
}
if (form.isSac3()) {
sacList.add("3");
}
final Iterator<String> sacIter = sacList.iterator();
while (sacIter.hasNext()) {
stringBuilder.append(sacIter.next());
if (sacIter.hasNext()) {
stringBuilder.append(", ");
}
}
if (form.isSac1() || form.isSac2() || form.isSac3()) {
stringBuilder.append("<br/>");
}
final List<String> scheduleTypeList = new LinkedList<String>();
if (form.isRegularScheduleType() || form.isLotScheduleType() || form.isBatchScheduleType()) {
scheduleTypeList.add("Schedule Type: ");
}
if (form.isRegularScheduleType()) {
scheduleTypeList.add("Regular");
}
if (form.isLotScheduleType()) {
scheduleTypeList.add("Lot");
}
if (form.isBatchScheduleType()) {
scheduleTypeList.add("Batch");
}
final Iterator<String> scheduleTypeIter = scheduleTypeList.iterator();
while (scheduleTypeIter.hasNext()) {
stringBuilder.append(scheduleTypeIter.next());
if (scheduleTypeIter.hasNext()) {
stringBuilder.append(", ");
}
}
return stringBuilder.toString();
}
Related
I have the following code:
public void setSHAShortSha() {
if (parentTracked == null) {
String s = "";
for (Blob b : blobHashMap.values()) {
s += b.toString();
}
sha = Utils.sha1(logMessage + dateFormatted + s);
} else {
String s = "";
for (Blob b : blobHashMap.values()) {
s += b.toString();
}
for (Blob b : parentTracked.values()) {
s += b.toString();
}
sha = Utils.sha1(logMessage + dateFormatted + s);
}
shortSha = MyUtils.getShortSha(sha);
}
This looks a lot complex. Could there be a simpler way to write it in java?
boolean found = false;
for (Commit commit : commits.values()) {
if (commit.getLogMessage().compareTo(commitMessageToSearch) == 0) {
System.out.println(commit.getSha());
found = true;
}
}
if (!found) {
System.out.println("aksdhlkasj");
}
Adding one more code as that is on the same lines. I am little unfamiliar with different forms of for loop and streams need help converting them
You can join all of the values with streams:
s += blobHashMap.values().stream().map(Object::toString).collect(Collectors.joining());
You can at least avoid the repetition.
public void setSHAShortSha() {
String s = "";
for (Blob b : blobHashMap.values()) {
s += b.toString();
}
if (parentTracked != null) {
for (Blob b : parentTracked.values()) {
s += b.toString();
}
}
sha = Utils.sha1(logMessage + dateFormatted + s);
shortSha = MyUtils.getShortSha(sha);
}
you can use the forEach Method of the Map, like this:
StringBuilder stringBuilder = new StringBuilder();
blobHashMap.forEach((key, blob) -> {
stringBuilder.append(blob.toString());
});
if (parentTracked != null) {
parentTracked.forEach((key, blob) -> {
stringBuilder.append(blob.toString());
});
}
sha = Utils.sha1(logMessage + dateFormatted + stringBuilder.toString());
shortSha = MyUtils.getShortSha(sha);
}
I try to remove a space into a string which contains a int type value.
I read a .csv file with the scanner methode.
I use a Class to set/get the data.
I format data into the setter of the class.
Input data example:
String Pu_ht = "1 635,90";
Basic Example:
/**
* #param Pu_ht the Pu_ht to set
*/
public void setPu_ht(String Pu_ht) {
this.Pu_ht = Pu_ht.replace(",", ".").replace(".00", "");
}
Tried example:
/**
* #param Pu_ht the Pu_ht to set
*/
public void setPu_ht(String Pu_ht) {
this.Pu_ht = Pu_ht.replace(",", ".").replace(".00", "").replaceAll("\\s+", "");
}
Other example:
/**
* #param Pu_ht the Pu_ht to set
*/
public void setPu_ht(String Pu_ht) {
this.Pu_ht = Pu_ht.replace(",", ".").replace(".00", "").replaceAll(" ", "");
}
Output data example: 1 635.90
I tried a lots of things but nothing work for my case.
Best regards
EDIT:
My code:
public void requete_pommes() throws IOException, ClassNotFoundException, SQLException {
// open file input stream
BufferedReader reader = new BufferedReader(new FileReader(filename));
// read file line by line
String line = null;
Scanner scanner = null;
int index = 0;
List<Pommes> pomList = new ArrayList<>();
boolean firstLine = false;
while ((line = reader.readLine()) != null) {
if (!(line.equals(";;;;TOTAL HT"))) {
if (!(line.equals(";;;;"))) {
Pommes pom = new Pommes();
scanner = new Scanner(line);
scanner.useDelimiter(";");
while (scanner.hasNext()) {
String data = scanner.next();
pom.setNumero_compte("21826");
if ((index == 0)) {
pom.setReference(data);
} else if ((index == 1)) {
pom.setDesignation(data);
} else if ((index == 2)) {
pom.setQte(data);
} else if ((index == 3)) {
if(data.equals("1 635,90")){
data = data.replaceAll("\\s","");
System.err.println("data: " + data);
}
pom.setPu_ht(data);
} else if ((index == 4)) {
pom.setMontant_HT(data);
} else {
System.out.println("invalid data::" + data);
}
pom.setNumero_commande("1554");
index++;
}
index = 0;
pomList.add(pom);
requeteCorps = "(( SELECT codea FROM article WHERE tarif7 != 'O' AND tarif8 = 'O' AND pvente > 0 AND COALESCE(trim( reffou), '') != '' AND reffou = '" + pom.getReference() + "' ), " + pom.getQte() + " , " + pom.getPu_ht() + ", '" + kapiece + "', 'stomag','vendu', getnum('LCK')),";
ar.add(requeteCorps);
}
}
}
The value "1 635,90" probably stems from a locale specific format, and the "space" actually is a non-breaking space, \u00A0. This is done often to prevent in flexible width text representation a line break to happen inside a number.
s = s.replace("\u00A0", "");
String Pu_ht = "1 635,90";
System.out.println(Pu_ht.replace(",", ".").replace(".00", "").replaceAll("\\s+", ""));
just put the above codes in main method and execute. the output will be 1635.90,then examine your codes.
I want to print the all values in the array but it just prints the last value int the array, how can I get my desired result by improving this code:
public void applyAttendence(ArrayList<String> presents, ArrayList<String> absents) {
ArrayList<String> present = new ArrayList<String>();
HashMap params = new HashMap();
// [232, 232, 12, 223]
String[] stringArray = presents.toArray(new String[0]);
if (presents.size() == 0) {
params.put("present", "");
} else {
// for(String pre:presents) {
params.put("present", stringArray);
System.out.println(" present[]" + presents);
System.out.println("hellow present man: " + params.get("present"));
// }
System.out.println("hellow present man: " + params.get("present"));
}
if (absents.size() == 0) {
params.put("absent", "");
} else {
for (String abs : absents) {
params.put("absent[]", abs);
}
// params.put("present[]", presents + "");
//
params.put("absent[]", absents + "");
}
}
That is because you are overwriting same key with different value every time
for (String abs : absents) {
params.put("absent[]", abs);
}
So your hashmap will only have last value written against the key absent[]
This is may be you have defined array as:
String[] stringArray = presents.toArray(new String[0]);
try initializing as:
String[] stringArray = new String[presents.size()];
stringArray = presents.toArray(stringArray );
Try this simplified solution to show all of the attendance
public void applyAttendence(ArrayList<String> presents, ArrayList<String> absents) {
String sPresent = "";
for (String present : presents) {
sPresent += present + ", ";
}
if (!sPresent.equals(""))
sPresent = sPresent.substring(0, sPresent.length() - 2);
String sAbsent = "";
for (String absent : absents) {
sAbsent += absent + ", ";
}
if (!sAbsent.equals(""))
sAbsent = sAbsent.substring(0, sAbsent.length() - 2);
if (presents.size() > 0) {
System.out.println("present = " + sPresent);
} else {
System.out.println("present = no one");
}
if (absents.size() > 0) {
System.out.println("absent = " + sAbsent);
} else {
System.out.println("absent = no one");
}
}
I have some complex objects that I would like to print out including the attributes names, types and values. As long as I don't know in advance the amount and depth of all attributes/sub-attributes, I need a recursive call including a loop. I have done it for 2 levels
StringBuilder descr = new StringBuilder();
foreach (PropertyInfo propertyInfo in req.GetType().GetProperties())
{
if (propertyInfo.CanRead)
{
string attributValue = "";
string attributName = propertyInfo.Name;
Type attributType = propertyInfo.PropertyType;
var propertyInfoValue = propertyInfo.GetValue(req, null);
//if (attributType == typeof(XFkType))
if (attributType != typeof(System.String) &&
attributType != typeof(System.Boolean))
{
PropertyInfo[] nestedpropertyInfoArray = propertyInfo.PropertyType.GetProperties();
attributValue += "{";
foreach (PropertyInfo subProperty in nestedpropertyInfoArray)
{
// var instance = (EntityBase)Activator.CreateInstance(subClass);
attributValue += subProperty.Name + "=";
try
{
attributValue += propertyInfoValue == null ? "" : subProperty.GetValue(propertyInfoValue, null).ToString();
}
catch (Exception e)
{
attributValue += "null";
}
attributValue += ",";
}
attributValue = attributValue.Length > 1 ? attributValue.Substring(0, attributValue.Length - 1) : attributValue;
attributValue += "}";
}
else
attributValue = propertyInfo.GetValue(req, null) == null ? "" : propertyInfo.GetValue(req, null).ToString();
descr.Append("[" + propertyInfo.PropertyType + "]" + attributName + "=" + attributValue + " | ");
}
}
The result is something like:
[XPhone]class{Phone,protocol=SIP,protocolSide=User,callingSearchSpaceName=XFkType,devicePoolName=XFkType,commonDeviceConfigName=XFkType,commonPhoneConfigName=XFkType,networkLocation=Use System Default,locationName=XFkType,mediaResourceListName=null,wirelessLanProfileGroup=null,ctiid=null} | [System.UInt64]sequence={} | [System.Boolean]sequenceSpecified=False |
It's a bit difficult to understand your structures but I would expect the solution to be in the following form:
public String propertyDescription(PropertyInfo[] properties) {
StringBuilder description;
for (PropertyInfo property: properties) {
if (property.containsNestedProperties()) {
description.append(propertyDescription(property.getNestedProperties()));
} else {
description.append( ... );
}
}
return description.toString();
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
This part is supposed to add a train to the TRAININFO table in my database. I have to use mysql.
So there are some constraints I have to see before adding the train.
jTextField1.getText(); TrainNo. should not have more than 6 characters and it should be an integer.
jTextField2.getText(); TrainName. Should not have more than 30 characters.
jTextField10,jTextField12 have Depttime and araivaltime respectively.
It has 5 characters,"hr:mn" So I have to check if 'hr'<=24 and 'mn'<=59.
If the value of jTextField3.getText()==0 (number of ac1 coaches), then the trainfare for ac1 coaches (tfac1) should also be ==0.
Keeping this in mind I have tried to code it. but it doesn't work.
when ever i run this there is an error message .
Please do tell me where I am wrong.
stacktrace:[Ljava.lang.StackTraceElement;#e596c9
okay heres how it should work:
String m="-",t="-",w="-",th="--",f="-",st="--",s="-",runson;
if(jCheckBox1.isSelected()==true)
{
m="m";
}
if(jCheckBox2.isSelected()==true)
{
t="t";
}
if(jCheckBox3.isSelected()==true)
{
w="w";
}
if(jCheckBox4.isSelected()==true)
{
th="th";
}
if(jCheckBox5.isSelected()==true)
{
f="f";
}
if(jCheckBox6.isSelected()==true)
{
st="st";
}
if(jCheckBox7.isSelected()==true)
{
s="s";
}
runson=m+t+w+th+f+st+s;
int h1=Integer.valueOf(jTextField10.getText().substring(0,2));
int mins1=Integer.valueOf(jTextField10.getText().substring(3,5));
int h2=Integer.valueOf(jTextField12.getText().substring(0,2));
int mins2=Integer.valueOf(jTextField12.getText().substring(2,3));
String time1=jTextField10.getText().substring(0,2)+jTextField10.getText().substring
(2,3)+jTextField10.getText().substring(3,5);
String time2=jTextField12.getText().substring(0,2)+jTextField12.getText().substring
(2,3)+jTextField12.getText().substring(3,5);
String tfac1=jTextField13.getText();
String tfac2=jTextField14.getText();
String tfac3=jTextField15.getText();
String tfsl=jTextField16.getText();
if(Integer.valueOf(jTextField3.getText())==0)
{
tfac1="0";
}
if(Integer.valueOf(jTextField4.getText())==0)
{
tfac2="0";
}
if(Integer.valueOf(jTextField5.getText())==0)
{
tfac3="0";
}
if(Integer.valueOf(jTextField6.getText())==0)
{
tfsl="0";
}
try
{
Class.forName("java.sql.DriverManager");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/bvdb","root","enter");
Statement stm=con.createStatement();
int n=jTextField1.getText().trim().length();
int m=jTextField2.getText().trim().length();
if( n<=6 && m<=30 && h1<=24 && h2<=24 && mins1<=59 && mins2<=59 )
//This should check the constraints(1,2,3).if the condition is true the following statement will be executed ..else the catch block should be executed. But this doesn't seem to happen when i run the code. There is always an Exception raised.//
{
String q="INSERT INTO TRAININFO VALUE ("+jTextField1.getText()+",'"+jTextField2.getText()+"','"+jTextField9.getText()+"','"+time1+"','"+jTextField11.getText()+"','"+time2+"','"+runson+"',"+tfac1+","+tfac2+ ","+tfac3+","+tfsl+","+jTextField3.getText()+","+jTextField4.getText()+","+jTextField5.getText()+","+jTextField6.getText()+")";
stm.executeUpdate(q);
System.out.print("ADDED");
}
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this,"Enter valid details");
}
s will always be - if !jCheckBox7.isSelected(). Think about it, you have:
if(something) {
...
} else {
s = ...;
}
if(something2) {
...
} else {
s = ...;
}
...
if(somethingN) {
...
} else {
s = "-"; //This will always be executed if !somethingN
}
You might want to have if.. else if instead of if below if.
Also note that it's not a good practice to compare boolean by writing == true. This might lead to problems if you, for example, write = instead of ==. Just write if(isTrue()) instead of if(isTrue() == true).
Basically you need to split your code into many functions. That will make it more readable.
Below is an example of how to structure your code, not a complete working code.
public void InsertTrainInfo() {
String runson = GetRunSon();
Boolean validTime1 = IsTimeValid(jTextField10.getText());
Boolean validTime2 = IsTimeValid(jTextField12.getText());
String time1 = GetTheTime(jTextField10.getText());
String time2 = GetTheTime(jTextField12.getText());
String tfac1 = GetFact(jTextField13.getText());
String tfac2 = GetFact(jTextField14.getText());
String tfac3 = GetFact(jTextField15.getText());
String tfsl = GetFact(jTextField16.getText());
try {
Class.forName("java.sql.DriverManager");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/bvdb", "root", "enter");
Statement stm = con.createStatement();
if (jTextField1.getText().trim().length() <= 6 && jTextField2.getText().trim().length() <= 30 && validTime1 && validTime2) {
String q = "INSERT INTO TRAININFO VALUE (" + jTextField1.getText() + ",'" + jTextField2.getText() + "','" + jTextField9.getText() + "','" + time1 + "','" + jTextField11.getText() + "','" + time2 + "','" + runson + "'," + tfac1 + "," + tfac2 + "," + tfac3 + "," + tfsl + "," + jTextField3.getText() + "," + jTextField4.getText() + "," + jTextField5.getText() + "," + jTextField6.getText() + ")";
stm.executeUpdate(q);
ResetFOrm();
}
} catch (Exception e) {
GetValidDetails();
}
}
Boolean IsTimeValid(String timetext) {
Boolean isOK = false;
try {
int h1 = Integer.valueOf(timetext.substring(0, 2));
int mins1 = Integer.valueOf(timetext.substring(3, 5));
isOK = (h1 <= 24 && mins1 <= 59);
} catch (Exception e) {
isOK = false;
}
return isOK;
}
String GetTheTime(String timetext) {
// do some basic length checks
return timetext.substring(0, 2) + timetext.substring(2, 3) + timetext.substring(3, 5);
}
String GetFact(String facttext) {
String fact = facttext;
if (Integer.valueOf(fact) == 0) {
fact = "0";
}
return fact;
}
void ResetFOrm() {
jTextField1.setEditable(true);
jButton1.setEnabled(true);
jButton2.setEnabled(false);
jButton4.setEnabled(false);
jTextField2.setEditable(false);
jTextField9.setEditable(false);
jTextField10.setEditable(false);
jTextField11.setEditable(false);
jTextField12.setEditable(false);
jTextField13.setEditable(false);
jTextField14.setEditable(false);
jTextField15.setEditable(false);
jTextField16.setEditable(false);
jTextField3.setEditable(false);
jTextField4.setEditable(false);
jTextField5.setEditable(false);
jTextField6.setEditable(false);
jCheckBox1.setEnabled(false);
jCheckBox2.setEnabled(false);
jCheckBox3.setEnabled(false);
jCheckBox4.setEnabled(false);
jCheckBox5.setEnabled(false);
jCheckBox6.setEnabled(false);
jCheckBox7.setEnabled(false);
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
jTextField5.setText("");
jTextField6.setText("");
jTextField7.setText("");
jTextField8.setText("");
jTextField9.setText("");
jTextField10.setText("");
jTextField11.setText("");
jTextField12.setText("");
jTextField13.setText("");
jTextField14.setText("");
jTextField15.setText("");
jTextField16.setText("");
}
void GetValidDetails() {
JOptionPane.showMessageDialog(this, "Enter valid details");
jTextField9.setEditable(true);
jTextField10.setEditable(true);
jTextField11.setEditable(true);
jTextField12.setEditable(true);
jTextField13.setEditable(true);
jTextField14.setEditable(true);
jTextField15.setEditable(true);
jTextField16.setEditable(true);
jTextField2.setEditable(true);
jTextField3.setEditable(true);
jTextField4.setEditable(true);
jTextField5.setEditable(true);
jTextField6.setEditable(true);
jCheckBox1.setEnabled(true);
jCheckBox2.setEnabled(true);
jCheckBox3.setEnabled(true);
jCheckBox4.setEnabled(true);
jCheckBox5.setEnabled(true);
jCheckBox6.setEnabled(true);
jCheckBox7.setEnabled(true);
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
jTextField5.setText("");
jTextField6.setText("");
jTextField7.setText("");
jTextField8.setText("");
jTextField9.setText("");
jTextField10.setText("");
jTextField11.setText("");
jTextField12.setText("");
jTextField13.setText("");
jTextField14.setText("");
jTextField15.setText("");
jTextField16.setText("");
jCheckBox1.setSelected(false);
jCheckBox2.setSelected(false);
jCheckBox3.setSelected(false);
jCheckBox4.setSelected(false);
jCheckBox5.setSelected(false);
jCheckBox6.setSelected(false);
jCheckBox7.setSelected(false);
}
String GetRunSon() {
String m = "-", t = "-", w = "-", th = "--", f = "-", st = "--", s = "-", runson;
if (jCheckBox1.isSelected()) {
m = "m";
}
if (jCheckBox2.isSelected()) {
t = "t";
}
if (jCheckBox3.isSelected()) {
w = "w";
}
if (jCheckBox4.isSelected()) {
th = "th";
}
if (jCheckBox5.isSelected()) {
f = "f";
}
if (jCheckBox6.isSelected()) {
st = "st";
}
if (jCheckBox7.isSelected()) {
s = "s";
}
runson = m + t + w + th + f + st + s;
return runson;
}