View Full Version : GUI in JAVA


68HC11
21-04-04, 11:11 AM
Hi guys,
it is my first time here and I would like to start with a wonderful topic, which any programmer will find useful.

GUI using JAVA Swing package

1.0 Introduction

GUI,( Graphical User Interface), is what normal users see from a software and they like to interact with. These users like to deal with more dynamic interface other than command line and keyboard inputs. Moreover, a user friendly software is easier to use by less experienced users.

68HC11
21-04-04, 11:13 AM
1.0 Baby Swing
code:
//1
import javax.swing.*;
//2
public class MySwing extends JFrame
{
// 3
public class MySwing ()
{
setTitle(“My Swing”);
setSize(250,250);
setVisible(true);
}// end of constructor

// 4
public static void main ( String arg [])
{
MySwing ms = new MySwing();
}//
}// end of class MySwing
end of Cod:

68HC11
21-04-04, 11:18 AM
- note: each point indicates a block of the code.
1.1.1 Understanding the Code

1- the first line in the code : import javax.swing this line tells java to import the Swing package.

2-MySwing is our class and it extends the JFrame class from the Swing package, therefore all methods and attributes created in the JFrame are inherited my MySwing.

3-The constructor of our class, MySwing, sets the title and size of theframe.Then, it makes the frame visible. As you may have noticed, all methods here are called without being implemented in MySwing class. This is because they already exist in the “parent” class, JFrame.
4-The main method creates an Object of MySwing.

---- to be continued soon

Kamakazy
21-04-04, 04:55 PM
its all comming back to me...

Intro to Java

EviliO
21-04-04, 07:06 PM
Intersting.
BTW i did use the 68HC11(F1) in one of my projects ;)

Welcome aboard!

Shinoda LP
21-04-04, 10:40 PM
Hey I have projects and projects on GUI, on me. Let me know if you want this whole thing zipped and set to you ... lol

Btw, What in heaven's name is ... 68HCI or whatever? Am I sleeping?

EviliO
21-04-04, 10:56 PM
It's a microcontroller shinoda, check the Intelligent car project in this thread (http://www.englishsabla.com/forum/showthread.php?threadid=12865&highlight=intelligent)

Lets stay with the java in here..