aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Need a GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Need a GUI " Watch "Need a GUI " New topic
Author

Need a GUI

Pracheth Gandrakota
Greenhorn

Joined: Feb 13, 2012
Posts: 3

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);
}
}
}
Pracheth Gandrakota
Greenhorn

Joined: Feb 13, 2012
Posts: 3
A drop down box thats says select language and submit and cancel buttons
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> I need a simple GUI for the following piece of code:

this is not a drive-through, try rent-a-coder
Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

i agree with michael dunn ...


http://plainoldjavaobject.blogspot.in
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Hi Pracheth,
Welcome to the Ranch!

Just saying that you need a GUI doesn't help. You need to show us what you have done in the form of an SSCCE.
And remember to use code tags when posting code.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Atul Darne
Ranch Hand

Joined: Jul 05, 2009
Posts: 118

Hi ,

You can go for a web project and make a simple JSP page that handles all with text boxes


Regards, Atul.
I came to this world on a Learner's License
Riaan Nel
Ranch Hand

Joined: Apr 23, 2009
Posts: 157

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);
}
}
}

So, what's the problem? I'm guessing that it relates to the fact that I see no GUI code in there.

Swing Tutorial


"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
Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

@Riaan Nel >> don't you think you should have started a new thread ???

So, what's the problem? I'm guessing that it relates to the fact that I see no GUI code in there.


yes it does relates to the fact that there's isn't any GUI code ...

try using swing or AWT to build up a small GUI or your app ... you can start with a button and a few textfields

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4529
    
    5

Atul Darne wrote:Hi ,

You can go for a web project and make a simple JSP page that handles all with text boxes

I wouldn't consider a JSP page a GUI. The question is about creating a GUI.


luck, db
There are no new questions, but there may be new answers.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4529
    
    5

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?

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

Not AWT, please, it's more than 10 years out of date and is inflexible and clunky. Swing is still the most popular GUI toolkit, and JavaFX 2 is on the way up and will have great advantages once Java SE 8 brings closures to the language.
Riaan Nel
Ranch Hand

Joined: Apr 23, 2009
Posts: 157

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?


Me too. Lalit, I was implying that the OP should write some GUI code and ask some questions about it, since this is NotACodeMill.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need a GUI