LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-25-2004, 09:14 AM   #1
linux_ub
Member
 
Registered: May 2004
Location: NY
Distribution: fedora core 1
Posts: 65

Rep: Reputation: 18
java gui


hi

i need to create a gui for an application using java ... am a newbie to java ... and have no idea abt gui. i have done a little bit of gui development in VC++ and tht tooo very very basic ... but i do understand the concept of listeners and event handlers ...

please could neone of u, direct me to a good place to learn gui development in java .... or are there ne IDE's tht could help me developing the gui

thanks a lot in advance
 
Old 06-25-2004, 09:31 AM   #2
linuxxed
Member
 
Registered: Feb 2004
Posts: 273

Rep: Reputation: 30
Re: java gui

Quote:
Originally posted by linux_ub
hi

i need to create a gui for an application using java ... am a newbie to java ... and have no idea abt gui. i have done a little bit of gui development in VC++ and tht tooo very very basic ... but i do understand the concept of listeners and event handlers ...

please could neone of u, direct me to a good place to learn gui development in java .... or are there ne IDE's tht could help me developing the gui

thanks a lot in advance
Forget java.
use Python, PyGTK and Glade . It rocks!


If you insist - try the java.sun.com
 
Old 06-25-2004, 09:39 AM   #3
linux_ub
Member
 
Registered: May 2004
Location: NY
Distribution: fedora core 1
Posts: 65

Original Poster
Rep: Reputation: 18
i am creating an application for someone...all of my other processing is being done in java .... so i would like to have my front end too in java .... or ... is it possible to use my java code with python. can i create executables with python as the front end and java as a back end .... ????

i was planning to use java for gui and then make the whole project as a .jar and distribute it
 
Old 06-25-2004, 09:43 AM   #4
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Re: java gui

Quote:
Originally posted by linux_ub


please could neone of u, direct me to a good place to learn gui development in java .... or are there ne IDE's tht could help me developing the gui

There're two major classes in Java to handle gui's: AWT and Swing. To learn about them, take a look at the complete API:

http://java.sun.com/j2se/1.4.2/docs/api/index.html

You can do the gui stuff by hand, but if you want something similar to VS/VB where you can "draw" the gui's and buttons, then put code on it, Java Netbeans is going to be your best shot:

http://java.sun.com/j2se/1.4.2/download.html#docs

It's quite heavy, but nonetheless, a great IDE

Good luck!
 
Old 06-25-2004, 09:45 AM   #5
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Re: Re: java gui

Quote:
Originally posted by linuxxed
Forget java.
use Python, PyGTK and Glade . It rocks!


If you insist - try the java.sun.com
it really, really depends of what his project is about . Java is great, I found it to be a bit slow, but very versatile...
 
Old 06-25-2004, 09:54 AM   #6
linux_ub
Member
 
Registered: May 2004
Location: NY
Distribution: fedora core 1
Posts: 65

Original Poster
Rep: Reputation: 18
Re: Re: Re: java gui

Quote:
Originally posted by Megaman X
it really, really depends of what his project is about . Java is great, I found it to be a bit slow, but very versatile...
my project is to develope an application with the following aim

input - microsoft word documents.
the documents have certain headings and data ... i need the information under certain headings only. i am using antiword to get the text inside the .doc files .... doing the processing and creating an xml file. now this xml file is to be searched and depending upon the search query some records qill be displayed.

i need a module tht will help add information to the xml file ... by specifying the path to the documents.

another module to actually query the xml file and display the results (and print them)

3rd module which would allow the user to enter the information right in the appliction .. so it directly gets stored as an xml ... and helps him to avoid using MICROSOFT OFFICE

how should i go abt creating the GUI

also i am looking at netbeans and really seems to be a great tool
 
Old 06-25-2004, 03:20 PM   #7
coolman0stress
Member
 
Registered: Jun 2003
Location: Toronto, Ontario, Canada
Posts: 288

Rep: Reputation: 30
Quote:
can i create executables with python as the front end and java as a back end .... ????
You can, through Jython. It's a pure Java implementation of Python. You code using Python syntax, yet have access to both libraries.

Though, unless you are willing to learn a new language, i'd continue with implementing the GUI in Java (Swing ain't the simplest of GUI libraries, but it's not that hard).
 
Old 06-26-2004, 12:25 PM   #8
jbstew32
Member
 
Registered: Feb 2003
Location: Atlanta, GA
Posts: 151

Rep: Reputation: 15
what's with all the python, he wnats java! heh

ok I have a fair amount of experience in java GUI programming. Swing is very useful. Basically in your constructor just create all the necessary objects (JButtons, the JFrame,the JPanel, etc...) and then in your main method (say your JFrame object is called frame) just calll:

frame.pack();
frame.show();

and that will display your window and all the objects on the screen. Also make use you do

panel.add(Button1)
panel .add(Button2)

or whatever objects you have that need to be displayed (assuming your JPanel object is called panel).

Sorry if this confuses more than it helps, but if you have to there are entire books devoted to swing and it's functionality. It's very very useful but as was stated earlier....you're application won't be very fast.

If you are just making a GUI Frontend for taking in strings for example, try looking at a simple JOptionPane....it's much simpler than what I described above, but it isn't nearly as powerful.
 
Old 06-26-2004, 03:00 PM   #9
avarus
Member
 
Registered: Apr 2004
Location: Oxford, UK
Distribution: Ubuntu, Debian, various
Posts: 230
Blog Entries: 5

Rep: Reputation: 33
Hi,

Swing is so last-century. SWT is the way forward! Seriously, if you are about to start Java GUI programming then read this:

http://www.developer.com/java/other/article.php/3330861

TIM
 
Old 06-26-2004, 08:22 PM   #10
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
If you have experience of event driven programming then java will be a breeze in gui programming. Only pain in the ass is everything on the screen is relative (unless you want to take control of everything). Take a look at Sun's java tutorial trails if you don't have any other literature on hand.
 
Old 06-30-2004, 08:38 AM   #11
linux_ub
Member
 
Registered: May 2004
Location: NY
Distribution: fedora core 1
Posts: 65

Original Poster
Rep: Reputation: 18
Hi guys

thanks for ur inputs ... was away so did not read ne messages for the past 3-4 days ...

i have started developing the gui in netbeans ... am slowly and steadily learning Swing. just wanted to pose anothe question
how slow will my application be ??? wht can i use to make it faster ... and how powerful is Jython .... am ready to learn a new language .... think thts wht internships are for

thanks
 
Old 06-30-2004, 11:26 AM   #12
coolman0stress
Member
 
Registered: Jun 2003
Location: Toronto, Ontario, Canada
Posts: 288

Rep: Reputation: 30
Speed is relative. It all depends on your needs. You hear people bash Java for it's lack of performance, but most of the time it's not that big of a deal. You gain by developing the application faster (compared to more native implementations).
It obviously also depends on how complicated the gui is and many other aspects..

Having said that, Java applications do tend to be slower than native applications, but if you take care during your design, you can elevate that. Speed is the price you pay for platform independences. Most of the time your app will run on any OS that has the jvm.

The problem really with Swing (and Java) is that it tries to be perfect. The way they [sun] designed it is amazing at times from a design perspective, but that obviously doesn't mean it's easy or handy to program with. Sometimes you need to go through a lot of dumb steps to do a little thing (think java's IO).

Anyway, do your app in plain Swing, chances are the performance will be just fine. If you want to explore, then check out SWT (what Eclipse is built on). It tends to be faster but not as platform independent (i believe).

As far as Jython is conserned. It's another layer over Java. So while it will make your development easier and faster (think of it as a scripting engine for Java, like BeanShell, etc), it will definatly NOT make your apps faster (it will make them slower unless you compile the Jython code straight to java's class files - jythonc).

Good luck

Last edited by coolman0stress; 06-30-2004 at 11:27 AM.
 
Old 07-01-2004, 10:58 AM   #13
linux_ub
Member
 
Registered: May 2004
Location: NY
Distribution: fedora core 1
Posts: 65

Original Poster
Rep: Reputation: 18
hi guys

need more help

i am not very clear whn should i add a JDesktopPane to my class and when should i add a JPanel. am really not able to understand the complete concept of developing the GUI

ne hwlp will be greatly appreciatted.

Thanks
 
Old 07-01-2004, 11:08 AM   #14
coolman0stress
Member
 
Registered: Jun 2003
Location: Toronto, Ontario, Canada
Posts: 288

Rep: Reputation: 30
You generally buildup Swing applications by nesting of components. Usually through JPanel, which is a generic container.

You start of with a top level JFrame, then you add to it JPanels with other components in them, etc.
 
Old 07-02-2004, 06:38 AM   #15
aaa
LQ Guru
 
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 47
Don't forget about layout managers. To use one, you would call setLayout() on a JFrame or JPanel. Different layout managers arrange your components in different ways. You can nest JPanels to make complex arrangements.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Like GUI Tool For Java? jamie_barrow Programming 11 12-17-2005 06:01 AM
java GUI in QT? true_atlantis Linux - Software 5 09-27-2004 05:59 PM
edonkey java gui not finding java Sephiroth Linux - Software 0 03-13-2004 08:14 PM
java and non-GUI RH8 Zeke Linux - Newbie 1 08-09-2003 10:32 PM
Java Gui Builders Paula01 Linux - General 1 03-16-2002 01:46 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration