Hey Guys, I have a bit of a problem,
I need a simple GUI for the following piece of code:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
public class wordsearch {
void wordsearchfunc(String fname,String gword)
{
try
{
String cword="",identi="",sample="";
int count = 0;
File f = new File(fname);
Scanner input = new Scanner(f);
while (input.hasNextLine())
{
sample=input.nextLine();
count++;
}
String line = "";
int lineNo;
FileReader fr = new FileReader(fname);
BufferedReader br = new BufferedReader(fr);
for (lineNo = 1; lineNo < count; lineNo++)
{
line = br.readLine();
if(gword.length()<line.length())
{
cword=line.substring(0,gword.length());
identi=line.substring(gword.length(),gword.length()+2);
if (cword.equals(gword)&& identi.equals("||"))
{
System.out.println("Word: "+gword+ "\nNomenclature: "+line.substring(gword.length()+2,line.length()));
}
}
}
}
catch(IOException e)
{
System.out.println(e);
}
}
public static void main(String args[])
{
if(args.length!=2)
{
System.out.println("Enter valid arguments");
System.exit(0);
}
else
{
String fname=args[0];
String gword=args[1];
wordsearch ws= new wordsearch();
ws.wordsearchfunc(fname,gword);
}
}
}