http://plainoldjavaobject.blogspot.in
Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Pracheth Gandrakota wrote:
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);
}
}
}
"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." - George Bernard Shaw
So, what's the problem? I'm guessing that it relates to the fact that I see no GUI code in there.
http://plainoldjavaobject.blogspot.in
Atul Darne wrote:Hi ,
You can go for a web project and make a simple JSP page that handles all with text boxes
luck, db
There are no new questions, but there may be new answers.
Lalit Mehra wrote:@Riaan Nel >> don't you think you should have started a new thread ???
Lalit Mehra wrote:try using swing or AWT to build up a small GUI or your app ... you can start with a button and a few textfields
luck, db
There are no new questions, but there may be new answers.
Darryl Burke wrote:
Lalit Mehra wrote:@Riaan Nel >> don't you think you should have started a new thread ???
I may be missing something, but what exactly prompted this remark?
"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." - George Bernard Shaw
Consider Paul's rocket mass heater. |