Frame

Frame

Michael wants to create a Java application with the following requirements: 1.Two labels representing name and age. 2.Two textboxes accepting name and age. The textbox accepting age should accept maximum 2 values. 3.A listbox representing values male and female.

Write a code which will accomplish the above mentioned task.

View Answers

February 11, 2011 at 5:08 PM

Java create swing frame

import java.awt.*;
import javax.swing.*;
class FrameExample 
{
    public static void main(String[] args) 
    {
        JFrame f=new JFrame();
        f.setLayout(null);

        JLabel lab1=new JLabel("Name");
        JLabel lab2=new JLabel("Age");
        JLabel lab3=new JLabel("Select");

        JTextField text1=new JTextField(20);
        JTextField text2=new JTextField(20);
        JComboBox combo=new JComboBox();
        combo.addItem("Select");
        combo.addItem("Male");
        combo.addItem("Female");

        lab1.setBounds(10,10,100,20);
        text1.setBounds(120,10,100,20);

        lab2.setBounds(10,40,100,20);
        text2.setBounds(120,40,100,20);

        lab3.setBounds(10,70,100,20);
        combo.setBounds(120,70,100,20);

        f.add(lab1);
        f.add(text1);
        f.add(lab2);
        f.add(text2);
        f.add(lab3);
        f.add(combo);

        f.setVisible(true);
        f.setSize(300,150);

    }
}









Related Tutorials/Questions & Answers:
FRAME
FRAME  WHILE I'M RUNNINGFILE OF A GUI PROGRAMME(JDBC CONNECTION) INSTEAD OF OUTPUT FRAME ONLY TWO BLANK FRAMES ARE GETTING DISPLAYD... CAN ANYONE HELP ME TO SOLVE DS PROBLEM
FRAME
FRAME  WHILE I'M RUNNINGFILE OF A GUI PROGRAMME(JDBC CONNECTION) INSTEAD OF OUTPUT FRAME ONLY TWO BLANK FRAMES ARE GETTING DISPLAYD... CAN ANYONE HELP ME TO SOLVE DS PROBLEM
Advertisements
frame
frame  how to creat a frame in java   Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public static void
frame update another frame.
frame update another frame.   How do I make a link or form in one frame update another frame
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
panel and frame
panel and frame  What is the difference between panel and frame
Java Frame
Java Frame  What is the difference between a Window and a Frame
billing frame
billing frame  how to generate billing frame using swing which contain sr. no, name of product, quantity, price & total
Image on frame
Image on frame   Hi, This is my code. In this I am unable to load... java.awt.event.*; public class AwtImg extends Frame { Image img; public...(); } AwtImg() { super("Image Frame"); MediaTracker mt=new
Frame query
Frame query  Hi, I am working on Images in java. I have two JFrame displaying same image. We shall call it outerFrame and innerFrame.In innerFrame i am rotating the image.After all the rotations i need to display this image
frame generation
frame generation  Hi I wnat to genarate one frame with two tabs working ,production..and I want two radiobuttons sector ,others in the frames..based on the tab selection I want to clikc the radio button..when i ckick the radio
Frame
frame
how to create frame in swings
how to create frame in swings  how to create frame in swings
collection frame work
collection frame work  explain all the concept in collection frame work
link to other frame - Applet
link to other frame  how a button to open to another frame? and the frame can keyin the data and it can show at the previous frame
collection frame work
collection frame work  explain the hierarchy of one dimensional collection frame work classes
collection frame work
collection frame work  could you please tell me detail the concept of collection frame work
ModuleNotFoundError: No module named 'frame'
ModuleNotFoundError: No module named 'frame'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'frame' How to remove the ModuleNotFoundError: No module named 'frame'
Creating a Frame
; Setting the Icon for a Frame    Showing a Dialog Box  ... an Icon to a JButton Component    Making a Frame Non-Resizable    Removing the Title Bar of a Frame   
single frame coding in java
single frame coding in java  sir, i am a beginner in java.i want to do a desktop application in java in which a single frame satisfies all needs.but i want changes in that frame only.how can i solve this?i think multiple frames
Cross frame menus - Ajax
Cross frame menus  Respected Sir/Madam, I am Ragavendran.R.. I need to implement DHTML Cross frame menus..i.e There must be a page with 2 frames(top and bottom).. The main menus must be in the top frame and when I
spring MVC frame work - Spring
spring MVC frame work  Example of spring MVC frame work
another frame by using awt or swings
another frame by using awt or swings  how to connect one frame to another frame by using awt or swings
Frame with JDBC - JDBC
Frame with JDBC  What is the Frame in JDBC?  Hello,What is the structure of table and in which format you wan't to display the data.Last time also you posted the same question.Answer me the above question and I
Dialog Frame focus - Framework
Dialog Frame focus  Is it possible somehow to focus/activate/select... visit the parent frame also. But on some event(like a button), I want my dialog frame to be focussed/active.(Here i dont want to reopen it. As it is already opened
jumping frame jFrame to jInternalframe
jumping frame jFrame to jInternalframe  Afternoon sir, I want to ask something code like jumping frame. example this i have form Login , Menu...) , and in employee(jinternal Frame) have nik(jTexkfield1), name(jtextfield2
swing frame problem
swing frame problem  Hi All, I m creating a swing/awt based window... a frame which have few buttons and Text Box to get some data from user at this time when I will click on submit button then next frame should be open with in same
hibernat frame work
hibernat frame work  what is the deployment structure for 'hibernete.cfg.xml','contact.hbm.xml','Contact.java','FirstExample.java' programs into eclipse ide   Have a look at the following link: Hibernate Tutorial
Frame with JDBC - JDBC
Frame with JDBC   i am using frame having two textfield so how i retrieve the data from the ms-access there is two columns name and salary   Hi,Do you want to display the data on JSP Page?If yes then following tutorial
Frame works - Framework
Frame works  I need tutorials on JAVA Plugin Frameworks and hibernate and springs ? I new to these Technologies so i need with Examples to understand Using above technologies i need to do project. so ASAP pls
zend2 frame work
zend2 frame work  Hi can you please detail about Zend framework 2 latest folder structure and related things in details . I already seen zend website am confused with two old and new folder structures which one has to use
How to make frame of the picture, make frame of the picture, frame of the picture
How to make frame of the picture       This is about a frame example that has been made by some steps, I have mention here all the steps to make this effect. Take picture: First
call frame - Java Beginners
call frame   dear java, I want to ask something about call frame to another frame and back to first frame. I have FrameA and FrameB. In frameA... String PAINT_ICON = "paint_icon"; //true if the next frame created should
Creating a Frame
Creating a Frame : Swing Tutorials       This program shows you how to create a frame in Java Swing Application. The frame in java works like the main window where your components
ModuleNotFoundError: No module named 'ascii_frame'
ModuleNotFoundError: No module named 'ascii_frame'  Hi, My Python... 'ascii_frame' How to remove the ModuleNotFoundError: No module named 'ascii_frame' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'frame_logging'
ModuleNotFoundError: No module named 'frame_logging'  Hi, My... 'frame_logging' How to remove the ModuleNotFoundError: No module named 'frame_logging' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'static-frame'
ModuleNotFoundError: No module named 'static-frame'  Hi, My Python... 'static-frame' How to remove the ModuleNotFoundError: No module named 'static-frame' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ascii_frame'
ModuleNotFoundError: No module named 'ascii_frame'  Hi, My Python... 'ascii_frame' How to remove the ModuleNotFoundError: No module named 'ascii_frame' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'click-frame'
ModuleNotFoundError: No module named 'click-frame'  Hi, My Python... 'click-frame' How to remove the ModuleNotFoundError: No module named 'click-frame' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'dl-frame'
ModuleNotFoundError: No module named 'dl-frame'  Hi, My Python...-frame' How to remove the ModuleNotFoundError: No module named 'dl-frame... to install padas library. You can install dl-frame python with following
ModuleNotFoundError: No module named 'frame-ilens'
ModuleNotFoundError: No module named 'frame-ilens'  Hi, My Python... 'frame-ilens' How to remove the ModuleNotFoundError: No module named 'frame-ilens' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'frame_logging'
ModuleNotFoundError: No module named 'frame_logging'  Hi, My... 'frame_logging' How to remove the ModuleNotFoundError: No module named 'frame_logging' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'gameai-frame'
ModuleNotFoundError: No module named 'gameai-frame'  Hi, My Python... 'gameai-frame' How to remove the ModuleNotFoundError: No module named 'gameai-frame' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'howfo-frame'
ModuleNotFoundError: No module named 'howfo-frame'  Hi, My Python... 'howfo-frame' How to remove the ModuleNotFoundError: No module named 'howfo-frame' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'ilens-frame'
ModuleNotFoundError: No module named 'ilens-frame'  Hi, My Python... 'ilens-frame' How to remove the ModuleNotFoundError: No module named 'ilens-frame' error? Thanks   Hi, In your python environment
Helps with combo box and frame
on add button another frame pop up with text field(name ,address etc..) ,confirm button and cancel button at bottom of the frame. When i put something...() { return TelephoneNumber; } public AddressList(){ JFrame frame
Collection frame work - Java Beginners
Collection frame work  How to a sort a list of objects ordered by an attribute of the object
Frame related query - Java Beginners
Frame related query  hi..... i m having a query dat...can i open a frame inside another frame like dis.. m a new biginner of java n m finding... java.awt.event.*; public class TestFrame extends Frame implements ActionListener
Frame refresh problem - Swing AWT
Frame refresh problem  Whenever I close a child frame and reload it using the button on parent frame controls on the child frame load twice...[] args){ JFrame frame=new JFrame(); JButton b=new JButton("Submit"); frame.add(b

Ads