Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  agyat : (23 May 2013 - 01:23 AM) Wow! Mr. Sb Back Home.
@  OpaQue : (23 May 2013 - 12:44 AM) Ting
@  OpaQue : (24 April 2013 - 02:44 PM) I guess, Time to run Mycent script.
@  OpaQue : (24 April 2013 - 02:43 PM) wow.. not much spam. except habatt posting lot of links.. :P
@  yordan : (23 April 2013 - 01:04 PM) You're welcome, agyat. Nice to have been helpful. Second lesson: try full words, "you" instead of "EW".
@  agyat : (23 April 2013 - 05:03 AM) @YORDAN: tHANK EW FOR YOUR FIRST LESSON.   :D
@  yordan : (22 April 2013 - 09:43 PM) @agyat : "why don't you help me", or "please help me", or "please teach us"
@  yordan : (22 April 2013 - 09:42 PM) welcome back, velma
@  velma : (22 April 2013 - 07:51 AM) **yawns** Good to be back, wonder what is going on here :)
@  agyat : (22 April 2013 - 03:50 AM) Oh! so, why don't help me learn english..
@  yordan : (21 April 2013 - 08:38 PM) The goal mentioned by shiu : "learning english, learning computer"
@  agyat : (21 April 2013 - 06:31 PM) WHAT GOAL?
@  yordan : (20 April 2013 - 10:39 AM) yes, that's our goal. simultaneouly learning English and teaching/learning computer using.
@  shiyu : (20 April 2013 - 07:30 AM) learning english,learning computer
@  yordan : (19 April 2013 - 01:11 PM) Oh, I see, it's just a trick in order to force people looking at your texte. Somehow smart, maybe.
@  agyat : (19 April 2013 - 02:54 AM) And of course I know it is not SEO friendly.
@  agyat : (19 April 2013 - 02:52 AM) There may be two possible answers for that ....


1) Shout was posted using mobile keypad.

2) To force people read content carefully and/or with more concentration.
@  agyat : (19 April 2013 - 02:49 AM) There may be two possible answers for that ....
@  yordan : (18 April 2013 - 09:35 PM) however, why this mixing of capital letters in the middle of your text?
@  agyat : (18 April 2013 - 11:10 AM) false feelings.

Photo
- - - - -

Graphcal User Interfaces In Java


8 replies to this topic

#1 .:Brian:.

.:Brian:.

    Premium Member

  • Members
  • 219 posts

Posted 26 September 2007 - 03:30 PM

Ok, right now I am currently using eclipse, however I can change to whatever if there is something else that would be better for this. But I have made a number of java applications, but they all simply use the command line for doing their user input and output. However, I have been interested in learning how to program graphical user interfaces in java, and was wondering if somebody could point me in the right direction, with some easy to understand and follow tutorials.

Also, once I have done that, what about making a java program that can be easily executed? (I know that this would probably make it OS dependant, by making files such as .exe, and such), but is there an easy way to do this? Do I simply make a program in some other language that acts as some sort of a wrapper around the java application somehow? I am just curious as to how to do this in order to make an application that is easily distributable and runnable over a number of platforms (I don't want people to have to worry about people going to the command line and running a ton of stuff in order to get it to work)

Thanks for the help,
Brian

#2 polarysekt

polarysekt

    Advanced Member

  • Members
  • 128 posts
  • Location:St. Louis, MO
  • Interests:computers, music

Posted 05 December 2007 - 04:58 AM

i would definately check out AWT and SWING for GUI dev...

as far as compiling JAVA to be machine-dependent... it's a little abstract as it defies the purpose of JAVA ("Compile once, run everywhere")

maybe check out:
http://www.thisiscoo...m/gcc_mingw.htm

look into the gcj varieties... good luck if you're still looking :rolleyes:

#3 Andres Martinez Andrade

Andres Martinez Andrade

    Newbie [ Level 2 ]

  • Members
  • 19 posts
  • Gender:Male
  • Location:Mexico
  • Interests:Artificial Intelligence, Programming Contests like ACM, Programming & Algorithms, Favorite languages Java, C++, PHP, Perl, Prolog, Scheme. Web Apps, Software Development, and more Geek's stuff...jaja

Posted 16 December 2007 - 08:05 AM

Ok, right now I am currently using eclipse, however I can change to whatever if there is something else that would be better for this.


Eclipse is a good java IDE if you just want to code Java without creating an interface because you will need to code it all (yes i know it takes a lot of time and sometimes a little bit boring).

Well there is another IDE that will be your perfect solution. It is Neatbeans! It has became one of the post famous and more used programming environment not only for Java, also for C/C++ applications and for creating UML diagrams and generating code from it (since version 6.0).

Netbeans allows you to easy create GUI by just dragging to the screen components such as textfields, labels, buttons, radio buttons, text areas, panels, and many other cool components. It support both the java.awt interface or the javax.swing. I heard that Netbeans won a prize because their GUI's building tool not only allows you to put components, it also have auto-align and auto-size functions that makes very easy to create professional user interfaces in minutes. It also has a preview button to easily view your interface without compiling you whole application.

Well this are only a few advantages of netbeans, I only mention these few because you ask about building interfaces; but it has many other features as managing classes in packages, to create test clases, deploy the application by creating the JAR file automatically, debugging, templates, and more!

The netbeans site is:
www.netbeans.org The only IDE you need for developing any application!

#4 java-area

java-area

    Member [ Level 1 ]

  • [HOSTED]
  • 47 posts

Posted 04 February 2008 - 03:16 AM

There are 2 main types of java-based GUI:

1. AWT/Swing elements are used in standalone Java applications and Java applets.
Many commercial IDE (like JBuilder) provide a very good builders for AWT/Swing user interfaces. You can simply create a form and put on it all necessary AWT/Swing elements (buttons, textboxes etc.) using drag and drop method, which provides an opportunity for immediate visual control of your form.
However, you can create such forms using java.awt and javax.swing packages in you Java code.

2. HTML forms are used in WEB applications.
HTML page can be created simply using any text editor (Notepad/Wordpad). I often do this for javascript-s debugging or for some testing purposes.
I think, today the most advanced technology for java-based Web applications is Java Server Faces (JSF). It is open-source. I use JSF tags directly in Eclipse text editor: unfortunally, no immediate visual control (I need every time to redeploy the application for visualising any changes).
But I do not know any good FREE tools for creating Java-based Web interfaces.

Edited by java-area, 04 February 2008 - 04:06 AM.


#5 Moo64c

Moo64c

    Newbie [ Level 1 ]

  • Members
  • 8 posts

Posted 30 May 2008 - 02:35 PM

As others said: AWT/Swing. But for a begginer, I'd suggests you download Netbeans. It has a really nice drag-and-drop feature to make basic 2D forms (and later can be used in 2D and even 3D Graphics). Make a few of these in Netbeans and look at the code. Should be under 'generated code'. just open it up and look at it. It's quite nice to have a direct example...

#6 Guest_(G)Kamalakar _*

Guest_(G)Kamalakar _*
  • Guests

Posted 07 February 2010 - 01:27 AM

How to create a Standalone Java Application using NetBeans and MySqlGraphcal User Interfaces In Java

How to create an Standalone Application which runs on 3 pcs concurrently and connects to database and retrieves data from it. I.E. Using Net Beans6.1, which has GlassFish Application Server & MySql server 5.1 installed with it.

Please help me!

Please...Please send me a link for any example application.

-question by Kamalakar

 



#7 vistz

vistz

    Member [ Level 2 ]

  • Members
  • 66 posts
  • Gender:Male
  • myCENTs:58.24

Posted 30 September 2010 - 04:06 PM

I agree that Netbeans has a user interface that is ideal for beginners. However, I hard coded all of my GUI's in Eclipse when I first started out and that helped me understand them better. Of course, Netbeans is a good tool as well.

#8 Dirk Wolfgang Glomp

Dirk Wolfgang Glomp

    Newbie [ Level 2 ]

  • Members
  • 23 posts
  • Gender:Male
  • Location:Germany; 22111 Hamburg Horn; Vierbergen 10 b
  • Interests:Assembler Programming for DOS

Posted 22 December 2010 - 05:16 AM

Ok, right now I am currently using eclipse, however I can change to whatever if there is something else that would be better for this. But I have made a number of java applications, but they all simply use the command line for doing their user input and output. However, I have been interested in learning how to program graphical user interfaces in java, and was wondering if somebody could point me in the right direction, with some easy to understand and follow tutorials.

Also, once I have done that, what about making a java program that can be easily executed? (I know that this would probably make it OS dependant, by making files such as .exe, and such), but is there an easy way to do this? Do I simply make a program in some other language that acts as some sort of a wrapper around the java application somehow? I am just curious as to how to do this in order to make an application that is easily distributable and runnable over a number of platforms (I don't want people to have to worry about people going to the command line and running a ton of stuff in order to get it to work)

Thanks for the help,
Brian

I have played a little with JBuilder, but i have not really a know what i am doing.
// $Header: z:/javafrak.java 2.1
import java.awt.*;
import java.lang.*;

public class javafrak extends java.applet.Applet
implements Runnable
{
 Thread thread=null;
 int Max_X,Max_Y,Iter,X,Y,Col,ColR,ColG,ColB;
 double A,B,C,D,G,F,H,I,J,K,L,M,Zoom,verti,hori;
 double A1,B1,C1,D1,Step;
 String message1,message2,textfont;
 int textsize,textX,textY,textH,textW;
 Graphics offGraphics;
 Image offImage;

 public void init()
 {
  Max_X=size().width;
  Max_Y=size().height;
  offImage=createImage(Max_X,Max_Y);
  offGraphics=offImage.getGraphics();
  offGraphics.fillRect(0,0,Max_X+1,Max_Y+1);

  Iter  = 1250;
  hori  = .000036;			 // nach rechts
  verti = .000035;			 // höher
  Zoom  = .002500;			 // tiefer
  Step  = Zoom/80;
  A	 = -.765216+Zoom+hori;
  B	 = -.765325-Zoom+hori;
  C	 = .099886-Zoom+verti;
  D	 = .099996+Zoom+verti;

  message1  = "Bitte etwas Geduld";
  message2  = "Fraktal wird berechnet";
  textfont  = "TimesRoman";
  textsize  = 36;
  Font myFont=new Font(textfont, Font.BOLD, textsize);
  FontMetrics myMetrix=getFontMetrics(myFont);
  textH=myMetrix.getHeight();
  textW=myMetrix.stringWidth(message1);
  textX=(int)((Max_X-textW)/2);
  textY=(int)((Max_Y-textH)/2)-myMetrix.getDescent();
  setFont(myFont);
 }

 public void start()
 {
  if(thread == null)
  {
   thread = new Thread(this);
   thread.start();
  }
 }

 public void stop()
 {
  thread = null;
  offImage = null;
  offGraphics = null;
 }

 public void run()
 {
  while (thread != null)
  {
   try {Thread.sleep(0);}
   catch (InterruptedException e) {}
   repaint();
  }
 }

 public void paint(Graphics g)
 {
  setBackground(Color.black);
  g.setColor(Color.green);
  g.drawString(message1,textX,textY);
  g.drawString(message2,textX-textsize,textY+textH);
  update(g);
 }

 public void update(Graphics g)
 {
  A1 = A;
  B1 = B;
  C1 = C;
  D1 = D;

  A -= Step;
  B += Step;
  C += Step;
  D -= Step;

  G=(D1-C1)/Max_Y;
  F=(B1-A1)/Max_X;
//----------------------------------------------
  for (Y = 0; Y < Max_Y; Y++)
  {
   for (X = 0; X < Max_X; X++)
   {
	Col=0;
	K=G*Y+C1;
	J=K;
	I=F*X+A1;
	H=I;
	L=J*J;
	M=H*H;
//----------------------------------------------
	frak: {
		   while (Col<Iter)
		   {
			J=2*H*J+K;
			H=M-L+I;
			L=J*J;
			M=H*H;
			Col++;

			if ((M+L)>4)
			{
			 break frak;
			}
		   }
		  }
// --------------  Pixel-Setzer ----------------
	Col=(Col & 0x0000FF); // and

	ColR=(Col & 0xE0);

	ColG=(Col & 0x18);
	ColG=(ColG << 3);	// shl

	ColB=(Col & 0x07);
	ColB=(ColB << 5);

	offGraphics.setColor(new Color(ColR,ColG,ColB));
	offGraphics.drawLine(X,Y,X,Y);
//----------------------------------------------
   }   // next X
  }	// next Y
//----------------------------------------------
  g.drawImage(offImage,0,0,this);
 }
}
Dirk

Edited by Dirk Wolfgang Glomp, 22 December 2010 - 05:18 AM.


#9 Guest_(G)Mish_*

Guest_(G)Mish_*
  • Guests

Posted 28 February 2011 - 02:26 AM

GUI in JavaGraphcal User Interfaces In Java

Am a beginner in Java.I have been asking myself the same question you posted in this post.In fact Its so educative because I have been able to learn on what best programs to use for Java GUI and in this case Netbeans.Also I have tried your code above in Eclipse and its working!

Can somebody please mention on how to code executable programs such as login systems that can connect to a database,update it,edit,do some few queries and return some results on a screen? Example: Enter names,password,create an account,enter some value in it,pay,show balance,confirm,exit etc. In Graphical User Interface.

Please help with examples,links or any code relevant to the question.

Thank you all and keep posting.

 

-reply by Mish

 





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users