Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 25th, 2003, 02:49 PM
Registered User
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using JDialog to get values from user

 I am new to JFC. When user press ok button it has to popup one JDialog, which is asking as follows...

Enter the product name ---------------
Enter the product code ---------------
Enter the accountno ---------------

Note: Here i wants to add 3label and 3 TextField in the same Dialog... I saw some example it shows to get one value using InputDialog....But i want to put all in same dialog...


Old October 9th, 2003, 02:30 AM
Registered User
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to secret_friend

hi pratheeba!
this is the code u wanted.
u can ask any doubt .
mail to me directly ,
dont use this form i may not be checking this regularly
contact me for any help .
my mail id: way_to_victory@kongu.ac.in


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

public class MainFrame extends JFrame

implements ActionListener


   public MainFrame()
       super("Dialog Based Application");
       //settings for JFrame

       //JButton Settings
       click=new JButton("Click me");

       //adding controls to JFrame



       public void actionPerformed(ActionEvent ae)

           JButton ok=new JButton("ok");
          ok.addActionListener(new ActionListener(){

             public void actionPerformed(ActionEvent e)

                          //add ur code here to manipulate text field values





          inputbox=new JDialog(MainFrame.this,true);

          inputbox.setTitle("Enter Inputs");

          lblname=new JLabel("Product Name");
          lblcode=new JLabel("Product Code");
          lblacc=new JLabel("Account Number");



          txtname=new JTextField("");
          txtcode=new JTextField("");
          txtacc=new JTextField("");





       public static void main(String[] args)

                  new MainFrame();

            public JButton click;
            public JDialog inputbox;
            public JLabel lblname;
            public JLabel lblcode;
            public JLabel lblacc;
            public JTextField txtname;
            public JTextField txtcode;
            public JTextField txtacc;

Similar Threads
Thread Thread Starter Forum Replies Last Post
JDialog hoop_12 Java GUI 0 April 20th, 2006 11:56 AM
Jdialog tabbed panes nady Java GUI 0 April 11th, 2006 12:52 PM
New User having trouble with Zero Values AngelaR Pro VB 6 1 January 8th, 2006 09:15 PM
No text in Jdialog poojak16 Java GUI 2 May 23rd, 2005 02:26 AM
Titlebar on JDialog/JFrame raven983 Java GUI 4 May 7th, 2005 07:08 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.