Write a program to design a page.use radio button?

Write a program to design a page.use radio button?

i would lik to know about well designed page

View Answers

July 3, 2012 at 5:26 PM

In the given code, we have used swing components to create a form on frame.

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

public class SwingFrame{
public static void main(String[] args) throws Exception{
SwingFrame sf=new SwingFrame();
}

public SwingFrame(){
JFrame f = new JFrame("Frame in Java Swing");
f.getContentPane().setLayout(null);
JLabel lbl1 = new JLabel("Name");
final JTextField jt1=new JTextField(15);
JLabel lbl2 = new JLabel("Address");
final JPasswordField jt2=new JPasswordField(15);
JLabel lbl3 = new JLabel("Contact No");
final JPasswordField jt3=new JPasswordField(15);
JLabel lbl4 = new JLabel("Gender");
final JRadioButton Male,Female;
ButtonGroup radioGroup=new ButtonGroup();
Male=new JRadioButton("Male");
radioGroup.add(Male);
Female=new JRadioButton("Female");
radioGroup.add(Female);
JButton button=new JButton("Submit");
lbl1.setBounds(50,50,70,20);
lbl2.setBounds(50,90,70,20);
lbl3.setBounds(50,130,70,20);
lbl4.setBounds(50,170,70,20);
button.setBounds(50,210,100,20);
jt1.setBounds(150,50,100,20);
jt2.setBounds(150,90,100,20);
jt3.setBounds(150,130,100,20);
Male.setBounds(150,170,100,20);
Female.setBounds(250,170,100,20);

f.add(lbl1);
f.add(lbl2);
f.add(lbl3);
f.add(lbl4);
f.add(jt1);
f.add(jt2);
f.add(jt3);
f.add(Male);
f.add(Female);
f.add(button);
f.setSize(500,500);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}









Related Tutorials/Questions & Answers:
Write a program to design a page.use radio button?
WRITE A CODE IN STRUTS ACTION CLASS FOR CHECK BOXES AND RADIO BUTTONS - Struts
Advertisements
radio buttons
write a program for creating html page with images and 2 buttons
3 RADIO BUTTONS
Radio Buttons - Java Beginners
Radio Buttons in Jsp - JSP-Servlet
write a program
Radio Buttons in DB Very Urgent - JSP-Servlet
Tab sequence problem with Radio buttons - JSP-Servlet
prog. using radio buttons for simple calculator
prog. using radio buttons for simple calculator
Java radio buttons and button groups two values
Java radio buttons and button groups two values
understanding buttons :JSP random no program
write a java program
Web design program - WebSevices
inserting data from radio buttons to database - JSP-Servlet
How to write Java Program
inserting data from radio buttons to database - JSP-Servlet
need help for writting code in struts action class for check boxes and radio buttons - Struts
WRITE A PROGRAM IN JAVA
Display Label and radio buttons runtime with respect to DB values
write the java program?
Write java program?
write the java program?
Write java program?
Web design program - WebSevices
Buttons
Web design program - WebSevices
write a program to print
Write a java application program........?
inserting data from radio buttons to database-ERROR - JSP-Servlet
Web design program - WebSevices
Write a program in java...
how to write this program
write a program - Java Beginners
Radio Buttons in HTML
WRITE A PROGRAM IN JAVA
write program - Java Beginners
Web design program - WebSevices
write a program in java.
Radio buttons in html
write following program
Web design program - WebSevices
Web design program - WebSevices
Write a program to print using for loop
How to write calculator in J2ME program?
how to write servlet program in eclipse?
Solve Program - Design concepts & design patterns

Ads