Home Answers Viewqa Java-Beginners how to create frame in swings

 
 


raveen
how to create frame in swings
1 Answer(s)      a year and 9 months ago
Posted in : Java Beginners

how to create frame in swings

View Answers

August 23, 2011 at 5:09 PM


Simple Example

import javax.swing.*;

public class FrameExample{
  public static void main(String[] args){
  JFrame frame = new JFrame("Frame in Java Swing");
  frame.setSize(400, 400);
  frame.setVisible(true);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
}

Another Example

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");

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

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

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

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

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

For more information, visit the following link:

Swing Tutorials









Related Pages:
how to create frame in swings
how to create frame in swings  how to create frame in swings
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
How to create XML from Swings
How to create XML from Swings  How to create XML using Swings. I have a Swing GUI and capturing all data from it.When i click on submit, an xml...[]){ CreateXML frame=new CreateXML(); frame.setSize(300,300); frame.setVisible(true
swings
swings  i have 20 labels in mappanel ,if i click on the one label ,how to know which one is selected in this...  Hi Friend, Try...(String[]args){ ActionOnLabel frame=new ActionOnLabel(); } } Thanks
how to go from one frame to another frame in swings - Java Beginners
how to go from one frame to another frame in swings  Hi, My task is to go from one frame to another.......... let us think that iam having two buttons on a frame........button names are ok and next........ when iam clicking
How to create form in Swings
How to create form in Swings  How to create registration, login and question form in Java Swing?   Creating different forms in Java Swing - Examples how to create registration form in swing swing login form example
how can i close particular frame in swings - Java Beginners
how can i close particular frame in swings  Hi, I want to know, how can we close a particular frame when mulitple frames are appearing as output... on second frame close button, it should only get close....iam trying this in swings
How to Create Button on Frame
How to Create Button on Frame       In this section, you will learn how to create Button on  frame the topic of Java AWT package. In the section, from the generated output
Create a Frame in Java
Create a Frame in Java       Introduction This program shows you how to create a frame in java AWT package. The frame in java works like the main window where your
How to create CheckBox On frame
How to create CheckBox On frame     ... will learn how to create CheckBox on the frame. In the Java AWT, top-level windows... can learn in very efficient manner. In this section, you will see how to create
frame
frame  how to creat a frame in java   Hi Friend, Try the following code: import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public static void main(String[] args
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
To Create a Frame with Preferences
To Create a Frame with Preferences       In this section you will learn how to use the preferences in frame... with frame window. the required package to use the preferences with frame window
Creating a Frame
Creating a Frame : Swing Tutorials       This program shows you how to create a frame in Java Swing...;javax.swing.*; public class Swing_Create_Frame{   public 
java swings - Java Beginners
java swings  When we click on the button , than open a frame, How to create a link on button to frame , example : Suppose I... tell me how to create a link?  Hi Friend, Try the following code: 1
Swings - Java Beginners
also stored in database.after login how to go to another page  Hi Friend... can create an account.On clicking the 'Create Account', they will get...=new JButton("Login"); ADD=new JButton("Create Account"); panel=new JPanel
swings
swings  how to disable the labels.i am using the setenable(false) method to disable the label, but still mouse events(mouse clicked) are working on that label, how can i deactivate the mouse events also on the label
swings
swings  My program contains more one JComboBoxes how can i selectitems in my program. Please answer me my id raja.chaya@gmail.com
swings
swings  Thank you deepak it is fine.... I think you have gone through mine sent code in that i am not able add that Textfield dynamically. Can youhelp me how can i add textfields dynamically in my code lookin forward to hear
java swings
java swings  Hi, I need the sample code for how to set the background image using jframe and also set the jtext field and jlable boxes under...(){ return panel; } public static void main(String[] args) { JFrame frame = new
Java Swing Create XML file
Java Swing Create XML file In this tutorial, you will learn how to create XML file using swings. Here is a code that accepts the data from the user through... on frame to accept the data from the user. A button is there to perform an action
frame update another frame.
frame update another frame.   How do I make a link or form in one frame update another frame
JList in java swings - Java Beginners
() { //Create and set up the window. JFrame frame = new JFrame("JList...JList in java swings  HI I am trying to create a JList of buttons. i want the display of buttons in horizontal direction. How can i do it ....its
how display jsp frame - Java Beginners
how display jsp frame  Hi all, I am creating two jsp in frame... Create User Manage User... in another frame,you have to use target attribute of tag in your footer.jsp.
Set Frame Inside HTML
Frame Inside HTML. In this Tutorial, the code create a Inline frame inside a HTML... Frame inside it. For this we create a html page name iframe.htm. The code begin... define  <iframe src> : The <iframe src>  create a frame within
swings - Java Beginners
swings  how to add an image to combobox? i searched for this in google, but i got very difficult programs. i am beginner in java swings . i want... { public static void main(String args[]){ JFrame frame = new JFrame
Create multiple pie chart in single frame using JFreeChart
you how to create a multiple pie charts in a single frame in jsp page using... Create multiple pie chart in single frame using JFreeChart.... In the code given below we have extended class ApplicationFrame to create a frame
swings - Java Beginners
swings  i created one jframe, in that i added ok button. i want to add some images with name in that frame .By selecting the image and press ok button it will display on the jpannel, how can i do
JSP & Swings
JSP & Swings  How to integrate jsp and swings
Navigation Frame in HTML
Frame in HTML. In this Tutorial we help you to understand how to make Navigation Frame in HTML. First we create a html file name Navigation Frame .htm, The code create a list of hyper links of respective htm saved code, with second frame
swings - Java Beginners
swings  how to upload images using swings   Hi Friend, Try the following code: import java.awt.*; import java.io.*; import...; public static void main(String[] args) { JFrame frame = new JFrame(); JPanel
how to connect swings with jdbc... - Java Beginners
how to connect swings with jdbc...  Hi friends, Is it possible, to connect swings with data base like oracle....i want to store data into database... by using servlets and jsp but is it possible by using swings........ for data base
swings - Java Beginners
swings   how t upload images in swings. thanks   ... extends JFrame { public static JFrame frame; public JList list; public...; } public static void main(String [] args) { frame = new Uploader
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
swings question
swings question  how to change the background color with the help of color values by using swings
SWINGS - Swing AWT
SWINGS  Hi! How to receive value from showInputDialog in another...{ public static void main(String[] args){ JFrame frame = new JFrame("Input Dialog Box Frame"); JButton button = new JButton("Show Input Dialog Box
java swings - Java Beginners
java swings   Hi, This is my code. How can i set the jtextfield...:\\logo.gif"); // Create a label with text and an icon; the icon appears..., JLabel.CENTER); // Create a label with only an icon label = new
Swings - Java Beginners
Swings  Hi Friend... I have doubt on Swing concept.. How...{ Thread th; ImageIcon images; JFrame frame; JLabel lbl; int i = 0... = new SwingAnimation(); } public SwingAnimation(){ frame = new JFrame
how to display a table and buttons in swings - Java Beginners
how to display a table and buttons in swings  Hi frends, Actually... different buttons below this displayed table using swings.....please can any... static void main(String arg[]) { try { Form frame=new Form
XML and swings - Java Beginners
XML and swings  I have an xml file where all the contents that should be present in the tabbed pane are there. i would like to know how to parse the xml such that, whenever it reads the component type as label, it should create
swings for webnms
swings for webnms  if i am expanding node of jtree then i want to collapse previous expanding node of jtree in swings how is it possible
swings - Java Beginners
swings  I know how to add an image in a Panel with Netbeans but I want to add a background pattern with Netbeans in a Panel - you just have... main(String[] args) { JFrame frame = new JFrame("BackgroundImage
java-swings - Swing AWT
java-swings  How to move JLabel using Mouse? Here the problem is i have a set of labels in a panel. I want to arrange them in a customized order... frame = new JFrame("mouse motion event program
Java-swings - Java Beginners
Java-swings  How to move JLabels in a Frame  Hi friend, plz specify in detail. I am sending you a text drag code one textarea...(String args[]) { JFrame frame = new JFrame("Drag text one place to another
swings - Java Beginners
data will appear in the second combo box. how can i acheive this. thank you ... frame; private JPanel panel; private JComboBox cBox1; private JComboBox cBox2; public TestCombo() { frame = new JFrame("Combo
billing frame
billing frame  how to generate billing frame using swing which contain sr. no, name of product, quantity, price & total
swings - Java Beginners
on the jpannel. how can i do this........  Hi Friend, Try the following code... frame; public JList list; public DefaultListModel model; public File...++; } } return count; } public static void main(String [] args) { frame = new
Swings - Java Beginners
Swings  iam created one login form.iam using mysql database.values also stored in database.after login how to go to another page  Hi Friend..."); } public static void main(String arg[]) { LoginDemo frame=new LoginDemo
javaa swings - IDE Questions
javaa swings  I'm developing a java desktop database application using NetBeans 6.5 and using mysql as database,When I create the table and link... of that front end,if yes how? Jtable look n feel should be changed please
java swings - IDE Questions
java swings  I'm developing a java desktop database application using NetBeans 6.5 and using mysql as database,When I create the table and link... of that front end,if yes how? please answer me  Hi Friend, Please

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.