Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


kamoga
programing
1 Answer(s)      3 years and 3 months ago
Posted in : Java Beginners


Using Java, Design a simple interface that can capture information of your choice with the following controls; Labels, Text Fields, Checkbox, Radio buttons and command buttons. You may have to use the following files and others you may find important. Import java.awt.FlowLayout Import javax.swing.JFrame Import javax.swing. JOptionPane Import javax.swing.JButton etc

Hello if anyone can help I would like to know why I get this error when executing.. exception in thread "main" java.lang.NuSuchMethodError: main


Advertisement
View Answers

April 18, 2011 at 1:28 PM


import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class SwingFrame1
{
    SwingFrame1(){
    JFrame f=new JFrame();
    f.setLayout(null);
    JLabel label1=new JLabel("Enter Name: ");
    label1.setBounds(10,10,150,20);
    final JTextField text1=new JTextField(10);
    text1.setBounds(180,10,150,20);

    JLabel label2=new JLabel("Enter Address: ");
    label2.setBounds(10,40,150,20);
    JTextField text2=new JTextField(10);
    text2.setBounds(180,40,150,20);
    JLabel label3=new JLabel("Gender: ");
    label3.setBounds(10,70,150,20);
    JRadioButton b1=new JRadioButton("Male");
    b1.setBounds(180,70,80,20);
    JRadioButton b2=new JRadioButton("Female");
    b2.setBounds(270,70,80,20);

    ButtonGroup gp=new ButtonGroup();
    gp.add(b1);
    gp.add(b2);

    JLabel label4=new JLabel("Select Languages:");
    label4.setBounds(10,100,150,20);
    JCheckBox box1=new JCheckBox("Hindi");
    box1.setBounds(180,100,80,20);
    JCheckBox box2=new JCheckBox("English");
    box2.setBounds(270,100,80,20);
    JCheckBox box3=new JCheckBox("French");
    box3.setBounds(360,100,80,20);
    JCheckBox box4=new JCheckBox("German");
    box4.setBounds(450,100,80,20);

    JButton button=new JButton("Submit");
    button.setBounds(180,130,100,20);
    button.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
            String text=text1.getText();
            JOptionPane.showMessageDialog(null,"Hello "+text);
        }
    });
    f.add(label1);
    f.add(text1);
    f.add(label2);
    f.add(text2);
    f.add(label3);
    f.add(b1);
    f.add(b2);
    f.add(label4);
    f.add(box1);
    f.add(box2);
    f.add(box3);
    f.add(box4);
    f.add(button);
    f.setSize(600,200);
    f.setVisible(true);
    }
    public static void main(String[] args) 
    {
        new SwingFrame1();
    }
}


Related Tutorials/Questions & Answers:
Java programing
Java programing   need help wrting this Write a program that has an array of 5 Strings, and determines which ones are palindromes (letter-case does not matter). thanks
socket programing in servlet
socket programing in servlet  give me a example to write socket programing in servlet
Advertisements
programing question
programing question  how do i use loops(for,while) to add components in java   Hi Friend, The below code might help you. import java.awt.*; import javax.swing.*; class TextFieldArray extends JFrame{ JLabel l[]=new
Programing Help - Java Beginners
Programing Help  how to design a filebrowser in java "witout using Swing
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT  I WANT TO KNOW ABOUT THE JAVA SOCKET PROGRAMING FROM BASIC LEVEL AND HOW CAN I WORK ON IT I KNOW THE JAVA PROGRAMING.SO PLEASE HELP ME HOW CAN I DO SOCKET PROGRAMING
Java programing help
Java programing help  Can you help me create this program? Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign
javascript programing error - JSP-Servlet
javascript programing error  hi deepak i m using explorer to run javascript program in this there is no option to check error will u plz tell me the way to check error in explorer as we can check with mozila
java programing problem - Java Beginners
java programing problem  Create a class named Movie that can be used with your video rental business. The Movie class should track the Motion picture Association of America rating , ID Number, and movie title with appropriate
guys,, need help,, in java programing,, arrays
guys,, need help,, in java programing,, arrays  create a program where you will input 10 numbers and arrange it in ascending way using arrays
Threading in Java
Threading in Java         Overview of Thread Threading concept is very important in Java Programing language. A thread is a sequential path
containment
containment  what is containment??? and how write program using containment?? please explain with programing example
c programming
c programming  write a program to input five numbers by using while loop in c programing
Advertisements
 

 

 

DMCA.com