graphical user interface

graphical user interface

write a java program to display Employee details with a border heading,name,phone number, street,city,then on the other side Right text area for address, under it sex with a border title then radio button for male and female, hobbies line border,football check box,netball check box,chess check box, lower panel buttons, btn add, btn update, btn First, btn <<, btn >>, btn Last.
View Answers

August 5, 2010 at 4:25 PM

Hi Friend,

Try the following code:

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;

class EmployeeDetails extends JFrame{
JLabel l1,l2,l3,l4,l5,l6,l7;
JTextField text1,text2,text3,text4;
JTextArea area;
JScrollPane pane;
JCheckBox chk1,chk2,chk3;
JButton b1,b2,b3,b4,b5,b6;
JRadioButton r1,r2;
JPanel p1,p2,p3,p4,p;
ButtonGroup bg;

EmployeeDetails(){
l1=new JLabel("Name");
l2=new JLabel("Phone Number");
l3=new JLabel("Street");
l4=new JLabel("City");
l5=new JLabel("Address");
l6=new JLabel("Gender");
l7=new JLabel("Hobbies");

text1=new JTextField(20);
text2=new JTextField(20);
text3=new JTextField(20);
text4=new JTextField(20);

area=new JTextArea();
pane=new JScrollPane(area);

chk1=new JCheckBox("Football");
chk2=new JCheckBox("Netball");
chk3=new JCheckBox("Chess");

b1=new JButton("Add");
b2=new JButton("Update");
b3=new JButton("First");
b4=new JButton("Last");
b5=new JButton("Next");
b6=new JButton("Previous");

r1=new JRadioButton("Male",false);
r2=new JRadioButton("Female",false);
bg=new ButtonGroup();
bg.add(r1);
bg.add(r2);
p=new JPanel();
p1=new JPanel(new GridLayout(5,2));
p2=new JPanel();
p3=new JPanel();
p4=new JPanel();
Border border1 = BorderFactory.createTitledBorder("Employee Details");
p1.setBorder(border1);
p1.add(l1);
p1.add(text1);
p1.add(l2);
p1.add(text2);
p1.add(l3);
p1.add(text3);
p1.add(l4);
p1.add(text4);
p1.add(l5);
p1.add(pane);

Border border2 = BorderFactory.createTitledBorder("Gender");
p2.setBorder(border2);
p2.add(l6);
p2.add(r1);
p2.add(r2);

Border border3 = BorderFactory.createLineBorder(Color.RED);
p3.setBorder(border3);
p3.add(l7);
p3.add(chk1);
p3.add(chk2);
p3.add(chk3);

p4.add(b1);
p4.add(b2);
p4.add(b3);
p4.add(b4);
p4.add(b5);
p4.add(b6);

p.add(p1,BorderLayout.NORTH);
p.add(p2,BorderLayout.EAST);
p.add(p3,BorderLayout.WEST);
p.add(p4,BorderLayout.SOUTH);
add(p);
setVisible(true);
setSize(500,300);
}
public static void main(String[] args) {
new EmployeeDetails();
}
}

Thanks









Related Tutorials/Questions & Answers:
Java Graphical user interface
Java Graphical user interface  Hi, guys. I'm christina, need help with my home work Task 1: GUI Design and Implementation The user requirements... of the screen when it starts. It provides an interface to register the student name
graphical user interface - Java Beginners
graphical user interface  how do i write a code for a jmenu bar, File with items like open, save , save as. that lead to another interface?  Hi Friend, Please visit the following link: http://www.roseindia.net
Advertisements
graphical user interface - Java Beginners
graphical user interface  Hi, could u please tell me whats wrong with the code below. tried compiling but it gives me 2 errors. class or interface expected.thx import javax.swing.*; import java.awt.event.*; import
graphical user interface - Design concepts & design patterns
graphical user interface  Hi sir, could you help me in the designing and implementation of an election system graphical user interface please .any examples or suggestions will be highly appreciated .thank you
graphical user interface - Java Beginners
graphical user interface  write a java program to display Employee details with a border heading,name,phone number, street,city,then on the other side Right text area for address, under it sex with a border title then radio
graphical user interface - Java Beginners
graphical user interface  Help me write a code for this please Thank you. tried adjusting the previous one and got errors. Employee Details as Title Name (Text Field) Address (Text Area) Phone
Graphical User Interfaces
; for graphical user interface design. The implementation of the user interface... to create a Graphical User Interface (GUI). Moreover containers can be nested... Graphical User Interfaces      
User Interface Toolkits
User Interface Toolkits User Interface Toolkits / Libraries are given below..., dialog boxes etc and also dealing user input via those components. Swing... weight. These elements can be incorporate in user interfaces. Click here to go
Ajax user interface - Ajax
Ajax user interface  hello could anyone help my requirement is to design the database interaction using AJAX my requirement is a table will be displayed with checkbox as its first column when we select the checkbox
How to save user interface in flex for design tool
How to save user interface in flex for design tool  Hi I want to create a flex application "sticker design tool" in which i want to save all... user want to re-customize it later on then he can able to re-customize it. please
Linux as a Command Line Interface (CLI) Vs. Graphics User Interface (GUI).
a command line interface (CLI) to the operating system, while graphical shells provide a graphical user interface (GUI). A graphical user interface (GUI) is a human...Linux as a Command Line Interface (CLI) Vs. Graphics User Interface (GUI
MySQL User Interface
MySQL User Interface      ...;: You can add function with the help of UDF (user defined function) interface... defined function Interface   MySQL user-defined function  interface
interface
interface   what is the use of marking interface
interface.
interface.  Write short note on interface.   Please visit the following link: Java Interface
interface
interface  will the interface implements a interface   Hi Friend, No. Interface can extends another interface but cannot implements it, because interface will not contain the implementation. Thanks
INTERFACE
INTERFACE  how interface support multiple inheritance in java
interface
interface   Hi I have interface in that interface 3 methods are there , after some days client said that,i want to add one more method in that interface ,so how can add 4 method so that the implemented class did not affect
interface
interface  can we extend interface?   Hi Friend, Yes an interface can be extended by other interface like using extends keyword interface A{ } interface B extends A{ } For Example: interface IntefaceA { void
interface
interface  what the use of interface?   An interface is one... variables.Any class can implement(inherit)the interface and make use... is achieved by using the interface (by implementing more than one interface at a time
interface
interface  What is marker interface ?? what is its use in java programming?? is this us in programming ??Explain is implementation with code
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
Interface
for Interface in java? and want to know why they used interface instead of multiple inheritance? Thanks in advance   An interface is one which has abstract... implement(inherit)the interface and make use of the methods(functions
interface
interface  why do we need interface in java..if it`s usefull for to obtain multiple inheritance in the sense how it gonna be achieved...and i can...)...the y we need interface...THis is question often i heard from my developer
Interface
Interface  I need to implement the interface without overriding its method and also don't use abstract class for this. How to do
interface
interface  What is the exact use of interface in real time scenario? some people says that interface provides multiple inheritance. Is it true...; Through interface, we can achieve the multiple inheritance. Java does
Interface
Interface  1.Create an interface names ShapeInterface that has two... class a.Rectangle that uses the interface b.Circle that uses the interface and abstract class   interface ShapeInterface{ int l=0,b=0; public
Interface
Interface  1.Create an interface names ShapeInterface that has two... class a.Rectangle that uses the interface b.Circle that uses the interface and abstract class   interface ShapeInterface{ int l=0,b=0; public
Interface
Interface  Declare an Interface called property containting a method compute price to compute &return the price.The inerface is to be implemented by follwaing two class (1)Bungalow&(2)Flat both the lasses have following
Web-CAT CxxTest Plug-in
Web-CAT CxxTest Plug-in       The CxxTest plug-in for Eclipse provides Eclipse users who are developing C++ code with a graphical user interface for CxxTest
Pizza Order Application
Pizza Order Application Here we have created an application using graphical user interface that will allow the user to order the Pizza. For the pizza...). The user should be able to pay the total cost of the ordered pizza
show the database values graphical represantation
show the database values graphical represantation   show the database values graphical represantation and auto refresh for every 30 secand displaying in webpage
JList box java
JList box java We are going to describe JList box java. First of all we have created JList component of Swing. List is a component of GUI() Graphical User Interface. It allows the multiple items in a list and In this class extend
Show Calendar Icon
Show Calendar Icon       This section illustrates you how to draw the calendar icon. An icon is a pictorial image used in a graphical user interface to represent a program
Java Swing
Java programs with a graphical user interface (GUI). There are many components... the basic user interface such as customizable painting, event handling, drag and drop
Java Swing
for weak and inflexible AWT controls for providing more sophisticated graphical user interface (GUI) components for Java programs. Swings are lightweight and 100
Create ToolTip Text in SWT
Create ToolTip Text in SWT       In this section, you will learn how to create ToolTip. The ToolTip is the element of graphical user interface used in the conjunction
program on k-map with graphical circuit in c
program on k-map with graphical circuit in c  write a program in c to solve k-map with digital circuit
Netwiser
a graphical user interface, a network simulator, and a portable C++ framework... configuring your components as easy as point-and-click with its graphical
TUM
TUM Tikal Update Manager is a YUM-like graphical user interface, which wraps Eclipse and Callisto-format update sites, adding intuitive discover... with Eclipse's native update site support, mainly due to its interface
What is an interface?
What is an interface?  What is an interface
Can an Interface implement another Interface?
Can an Interface implement another Interface?   Hi, Can an Interface implement another Interface? Thanks
Can an Interface extend another Interface?
Can an Interface extend another Interface?   Hi, Can an Interface extend another Interface? thanks
ServletRequest interface
ServletRequest interface   What is new in ServletRequest interface
Graphical calculator using AWT - Java Beginners
Graphical calculator using AWT  hi Sir, I need a source code for the following prgm...pls help me.. Implement a simple graphical calculator using AWT.The calculator shd perform simple operation like addition, subtraction
Graphical calculator using AWT - Java Beginners
Graphical calculator using AWT  Hi Sir, Thanks for the reply... But i got some errors while compiling some of them i made clear but still one error.....and is it the same code we need implement on Graphical Calc using Swing? Here is the prg code
Map interface
Map interface  What is the Map interface
Java interface
Java interface  What is the List interface
List interface
List interface  What is the List interface
Interface implimentation
Interface implimentation  How to impliment an interface For Achieveing MVC & loosCupling in Any Project

Ads