|
||||||
| Java Tutorials Tutorials and Code for Java |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
|
This is the first of six tutorials that will show you how to create graphical user interfaces using java.
Prerequisites You should have JDK installed and an editing environment you are comfortable with. http://forum.codecall.net/java-tutorials/1703-java-tutorial-getting-started.html You should know how to create classes within your IDE http://forum.codecall.net/java-tutorials/1706-java-tutorial-hello-world.html Also for any questions please refer to my tutorial index: INDEX The Idea In order for your program to be attractive, the user must be able to easily navigate through your program. By creating a GUI the user is presented with all the features of the program in a clear and coherent manner. Solution The first thing we are going to do is create our class with a constructor and a main method to start our application. Code:
package cctuts;
public class InterfaceOne {
public InterfaceOne(){
}
public static void main(String[] args){
new InterfaceOne();
}
}
Code:
package cctuts;
import javax.swing.*;
public class InterfaceOne {
public InterfaceOne(){
}
public static void main(String[] args){
new InterfaceOne();
}
}
Code:
package cctuts;
import javax.swing.*;
public class InterfaceOne extends JFrame{
public InterfaceOne(){
}
public static void main(String[] args){
new InterfaceOne();
}
}
Code:
package cctuts;
import javax.swing.*;
public class InterfaceOne extends JFrame{
public InterfaceOne(){
setSize(400,400);
}
public static void main(String[] args){
new InterfaceOne();
}
}
Code:
package cctuts;
import javax.swing.*;
public class InterfaceOne extends JFrame{
public InterfaceOne(){
setSize(400,400);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String[] args){
new InterfaceOne();
}
}
Code:
package cctuts;
import javax.swing.*;
public class InterfaceOne extends JFrame{
public InterfaceOne(){
setSize(400,400);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
}
public static void main(String[] args){
new InterfaceOne();
}
}
![]() Last edited by John; 01-11-2007 at 03:07 PM. |
| Sponsored Links |
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java:Tutorial - Tic-Tac-Toe | John | Java Tutorials | 25 | 02-27-2008 06:41 PM |
| New window with custom content - JS | domestic | JavaScript and CSS | 10 | 06-04-2007 02:08 AM |
| ! Need urgent help ! Drawing program using cygwin | siren | C and C++ | 0 | 05-26-2007 10:51 PM |
| Java:Tutorial - Making multiple objects work differently | John | Java Tutorials | 0 | 01-11-2007 02:10 PM |
| Java:Tutorial - Adding more objects to your window | John | Java Tutorials | 0 | 01-11-2007 02:09 PM |
| Xav | ........ | 1333.07 |
| MeTh0Dz|Reb0rn | ........ | 1059.52 |
| John | ........ | 887.37 |
| morefood2001 | ........ | 879.43 |
| marwex89 | ........ | 869.98 |
| WingedPanther | ........ | 851.68 |
| Brandon W | ........ | 764.23 |
| chili5 | ........ | 312.39 |
| Steve.L | ........ | 254.16 |
| dcs | ........ | 223.87 |
Goal: 100,000 Posts
Complete: 82%