class MyFrame { JDialog d; JLabel label1=new JLabel("Enter Name"); JTextField text1 = new JTextField(10); JLabel label2=new JLabel("Enter Address"); JTextField text2 = new JTextField(10); JPanel panel=new JPanel(new GridLayout(3,2)); public MyFrame(JFrame parent) { JButton button = new JButton("OK"); d = new JDialog(parent); panel.add(label1); panel.add(text1); panel.add(label2); panel.add(text2); panel.add(button); d.getContentPane().add(panel,BorderLayout.CENTER); d.setTitle("JDialog"); d.setModal(true); d.pack(); d.setSize(300,100);
button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ d.dispose(); } }); d.setVisible(true);
}
public String getName(){ return text1.getText(); } public String getAddress(){ return text2.getText(); }
} class ModelFrame { JLabel label1 = new JLabel(); JLabel label2 = new JLabel(); JPanel panel=new JPanel(new GridLayout(3,2)); public void buildGUI() { JButton button = new JButton("Click here to enter name and address"); panel.add(label1); panel.add(label2); panel.add(button); final JFrame f = new JFrame(); f.getContentPane().add(panel,BorderLayout.CENTER); f.pack(); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ label1.setText("Name = "+new MyFrame(f).getName()); label2.setText("Address = "+new MyFrame(f).getAddress()); } }); } public static void main(String[] args) { new ModelFrame().buildGUI();
} }
Thanks
Related Pages:
Jdialog box with textfield - Java Beginners Jdialogbox with textfield i have to create a dialog box with 2...*;
import java.awt.*;
import java.awt.event.*;
class MyFrame
{
JDialog d...(JFrame parent)
{
JButton button = new JButton("OK");
d = new JDialog
JDialog
JDialog hi ... please help me in creatin a JDialogbox that contains two buttons of minimization and exit with simple code and comments
JDialog to create a customized dialog box for entering text data JDialog to create a customized dialog box for entering text data Hello sir
I wanted to know the code to generate a JDialog to create a customized dialog box for entering text data.
The dialog can be split into panes, left pane
TextField
;TextField("Type in the box");
add(tf); ...
TextField
 ... as the TextField.
In the example given below, shown a textfield in the applet by creating its
JDialog return value to JDialog ???? JDialog return value to JDialog ???? hello all....
legend.
JD1 = JDialog1
JD2 = JDialog2
JD1 open JD2......JD2 has any values, how I return this values to JD1 ???
// JD1 open JD2
JD2 jd2 = new JD2(null, true
JDialog return value to JDialog ???? JDialog return value to JDialog ???? hello all....
legend.
JD1 = JDialog1
JD2 = JDialog2
JD1 open JD2......JD2 has any values, how I return this values to JD1 ???
[code]
// JD1 open JD2
JD2 jd2 = new JD2(null
Simple Java applet that need usernam, password and textfield.
a textfieldbox.
Anything that been input to that textbox will be transfer to DB2...Simple Java applet that need usernam, password and textfield. Hi.
Anyone can help me on this matter:
I need to create a small application
TextField on the Image TextField on the Image how we set label or textfield etc. on the Image
TextField validations TextField validations I want to know How to check first letter capital or not in a text field and also check all are characters or not in same textfield?
and also want to know how to check all digits or not in a textfield?
ex
TextField validations TextField validations I want to know How to check first letter capital or not in a text field and also check all are characters or not in same textfield?
and also want to know how to check all digits or not in a textfield?
ex
Java textfield validaton
Java textfield validaton Sir... i'm new to java. In java JTextfield when we entered a negative value after pressing one button it have to display an error message dialog of textfield and also the textfield should accept
Java textfield validaton
Java textfield validaton Sir... i'm new to java. In java JTextfield when we entered a negative value after pressing one button it have to display an error message dialog of textfield and also the textfield should accept
s:textfield - Struts
s:textfield I am using the s:textfield tag in an appication and need... this? Hi friend,
Textfield Tag Example
Textfield Tag Example
IPhone-UIPicker Data to TextField
IPhone-UIPicker Data to TextField When I select the textfield, a picker view must come in form of action sheet and the data selected from that picker view must be populated in the text field. can anyone help me on this please
get textfield value in javascript
get textfield value in javascript How to get and the set value of text field in JavaScript?
Get the text field value in JavaScript
<html>
<head>
<script type="text/javascript">
<
how to set size of button,textfield.
how to set size of button,textfield. how we set size of button textfield etc and reduce problem when click maximize button the text or textfield get large how to set as a preferd size in the panel or frame .when we click
How to Type in japanese in java Textfield?
How to Type in japanese in java Textfield? Hello Sir/madam;
Am creating an application in java in which i want to get a japanese String input from... in textfield ..Please help me and tell me how to write in japanese
Need to push the combo box to flash movie - Java Beginners
Need to push the combo box to flash movie Hi,
I need to push the combo box values to the flash movie. I am succusfull in pushing the textfield... in pushing the combo box values to the flash movie
how to move pointer in Textfield to newline
how to move pointer in Textfield to newline consider my case...;
class Table1 extends Frame implements ActionListener{
TextField tf1,tf2,tf3...");
l2.setBounds(100,50,200,20);
tf1=new TextField();
tf1.setBounds(100,80,200,20
instead of text boxe i have to show check box as selected.
instead of text boxe i have to show check box as selected. i have... the database. when ever the valsue is there in textfield, instead of text boxe i have to show check box as selected.
Thanks In advance
R.Raveen.
How to pass value of a link to a textfield
How to pass value of a link to a textfield Dear Sir, in my project I'm initially making a value of the textfield as a link. Now, I want to pass the value of the link in the textfield after clicking the link and dont want to open
Getting content of alert message into textfield
Getting content of alert message into textfield how to get content of alert message into textfield using javascript
Getting content of alert message into text field
1)If you want the code in java, then here
Getting content of alert message into textfield
Getting content of alert message into textfield how to get content of alert message into textfield using javascript
Getting content of alert message into text field
1)If you want the code in java, then here
Textfield Tag (Form Tag) Example Textfield Tag (Form Tag) Example
In this section, we are going to describe the textfield
tag. The textfield tag is a UI tag that is used to render an HTML input field of
type text.
Add
autocompletion in textfield fetching from database in jsp
autocompletion in textfield fetching from database in jsp hi
i want to retrieve country name from mysql db to textfield..
maeans if anyone type... i caant able to select particular name to textfield...
it should be in jsp
Validate textfield in Java Swing
Validate Jtextfield in Java Swing
In this section,you will learn how to validate the textfield by allowing only numbers to enter. For this purpose, we have used the keyEvent class.Using the method getKeyChar() of keyEvent class, we have
how can u reduce the size of textfield?
how can u reduce the size of textfield? how can u reduce the size of textfield?
thanks in advance
import javax.swing.*;
public class ReduceTextField extends JFrame {
public static void main(String
textfield should not allow the user to fill the date in it. textfield should not allow the user to fill the date in it. I got a requirement like this,
I am dislaying a text field along with a calendar. Here user should not fill the date inside the text field manually. If he tries
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql can... data into database using an drop down box .....as i m using eclipse as jdbc...());
final TextField DOR = new TextField("RetireDate", new Model(), Date.class
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql can... data into database using an drop down box .....as i m using eclipse as jdbc...());
final TextField DOR = new TextField("RetireDate", new Model(), Date.class
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql can... data into database using an drop down box .....as i m using eclipse as jdbc...());
final TextField DOR = new TextField("RetireDate", new Model(), Date.class
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql can... data into database using an drop down box .....as i m using eclipse as jdbc...());
final TextField DOR = new TextField("RetireDate", new Model(), Date.class
iphone text field example
iphone textfield with example
In this iphone example you are going to see...how to add the value of two different textfield and printing it in another textfield. This is a quite easy! What all we have to do is to take three
HTML in the box
HTML in the box Can I use any HTML in the box
input box
input box give me the code of input box in core java
input box
input box give me the code of input box in core java
Not able to filter rows of jtable with textfield in netbeans
Not able to filter rows of jtable with textfield in netbeans DBOperations objDB;
ArrayList alstStock;
public TableRowSorter sorter;
public void... of implementing row filter to the 4th column of jtable with a textfield but its
Not able to filter rows of jtable with textfield in netbeans
Not able to filter rows of jtable with textfield in netbeans DBOperations objDB;
ArrayList alstStock;
public TableRowSorter sorter;
public void... of implementing row filter to the 4th column of jtable with a textfield but its
Designing of textfield arrays in Netbeans IDE - Swing AWT
Designing of textfield arrays in Netbeans IDE Respected sir,
Sir I want to create an array of Jtextfield in Jframe Form in Swing GUI in NetBeans IDE.... How can i do this.........????
I have a code which
select box and text box validations
select box and text box validations hi,
any one please tell me how to set validations for select box and text boxes using bean classes?
thank you
Please visit the following link:
http://www.roseindia.net/jsp/user
dropdown box
dropdown box i need to have country,state and city in drop down box using ajax and use db2 database
Have a look at the following link:
JSP dependent dropdown
Hollow Box
Hollow Box Write an application program that will draw a hollow box (a box with empty space in between). The program will ask the user to key... to exit. For example, if the user keys in 8, the hollow box (of length and width
dialog box
dialog box to ask to quit or continue hello.
write an application that displays a series of at least four interview questions and each question... of the interview, use a dialog box to ask whether the user wants to
- enter another set
dialog box
dialog box to show latest question hello.
write an application that displays a series of at least four interview questions and each question should... of the interview, use a dialog box to ask whether the user wants to
- enter another set