LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   java gui (https://www.linuxquestions.org/questions/programming-9/java-gui-197589/)

linux_ub 06-25-2004 09:14 AM

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

linuxxed 06-25-2004 09:31 AM

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

linux_ub 06-25-2004 09:39 AM

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

Mega Man X 06-25-2004 09:43 AM

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!

Mega Man X 06-25-2004 09:45 AM

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...

linux_ub 06-25-2004 09:54 AM

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

coolman0stress 06-25-2004 03:20 PM

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).

jbstew32 06-26-2004 12:25 PM

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.

avarus 06-26-2004 03:00 PM

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

Looking_Lost 06-26-2004 08:22 PM

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.

linux_ub 06-30-2004 08:38 AM

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

coolman0stress 06-30-2004 11:26 AM

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

linux_ub 07-01-2004 10:58 AM

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

coolman0stress 07-01-2004 11:08 AM

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.

aaa 07-02-2004 06:38 AM

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.


All times are GMT -5. The time now is 05:42 PM.