• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Problem in java code

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
String D1 = jTextField1.getText();
String D2 = jTextField2.getText();
String D3 = jTextField3.getText();
String D4 = jTextField4.getText();
StringTokenizer st1 = new StringTokenizer(D1, " ,");
StringTokenizer st2 = new StringTokenizer(D2, " ,");
StringTokenizer st3 = new StringTokenizer(D3, " ,");
StringTokenizer st4 = new StringTokenizer(D4, " ,");
String q = jTextField5.getText();
StringTokenizer qq = new StringTokenizer(q, "ANDORNOT");
while(qq.hasMoreTokens()) {

String queryToken = qq.nextToken();
while (st1.hasMoreTokens()) {
String token = st1.nextToken();
if (token.contains(queryToken)) {
jTextArea2.append(queryToken + " --- ");
jTextArea2.append("D1" + "\n");

}
}
while (st2.hasMoreTokens()) {
String token = st2.nextToken();
if (token.contains(queryToken)) {
jTextArea2.append(queryToken + " --- ");
jTextArea2.append("D2" + "\n");
}
}
while (st3.hasMoreTokens()) {
String token = st3.nextToken();
if (token.contains(queryToken)) {
jTextArea2.append(queryToken + " --- ");
jTextArea2.append("D3 "+ "\n");
}
}
while (st4.hasMoreTokens()) {
String token = st4.nextToken();
if (token.contains(queryToken)) {
jTextArea2.append(queryToken + " --- ");
jTextArea2.append("D4" + "\n");
}

}
}
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shaimaa: Welcome to CodeRanch.

Please explain exactly what the problem is with your Java code.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic