Java/PHP Developer

Java/PHP Developer

help me with passing data from jframe to text file please.

View Answers

November 16, 2011 at 1:40 PM

import javax.swing.*;
import java.awt.*;
import java.io.*;
import java.awt.event.*;
import java.sql.*;
class Form extends JFrame
{
JButton ADD;
JPanel panel;
JLabel label1,label2,label3,label4,label5;
final JTextField text1,text2,text3,text4,text5;
Form(){
label1 = new JLabel();
label1.setText("UserID:");
text1 = new JTextField(20);

label2 = new JLabel();
label2.setText("First Name:");
text2 = new JTextField(20);

label3 = new JLabel();
label3.setText("Last Name:");
text3 = new JTextField(20);

label4 = new JLabel();
label4.setText("ADDRESS:");
text4 = new JTextField(20);

label5 = new JLabel();
label5.setText("Email:");
text5 = new JTextField(20);

ADD=new JButton("ADD");

panel=new JPanel(new GridLayout(6,2));
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
panel.add(label3);
panel.add(text3);
panel.add(label4);
panel.add(text4);
panel.add(label5);
panel.add(text5);
panel.add(ADD);
add(panel,BorderLayout.CENTER);
setTitle("FORM");
ADD.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
String value1=text1.getText();
String value2=text2.getText();
String value3=text3.getText();
String value4=text4.getText();
String value5=text5.getText();
try{
BufferedWriter bw=new BufferedWriter(new FileWriter("data.txt",true));
bw.write(value1+" "+value2+" "+value3+" "+value4+" "+value5);
bw.newLine();
bw.close();
JOptionPane.showMessageDialog(null,"Data is inserted into file.");
}
catch(Exception e){
System.out.println(e);
}
}
});

}
}
class FormDemo
{
public static void main(String arg[])
{
try
{
Form frame=new Form();
frame.setSize(300,300);
frame.setVisible(true);
}
catch(Exception e)
{}
}
}









Related Tutorials/Questions & Answers:
Java/PHP Developer
Java/PHP Developer  help me with passing data from jframe to text file please
Java/PHP Developer
Java/PHP Developer  please help me to bring cell values of jtable to a text file
Advertisements
Java/PHP Developer
Java/PHP Developer  how to remove and add a new contentpane on same frame do we have any methods
Java/PHP Developer
Java/PHP Developer  Hi, can u help me with, question from a text file and answers from another text file with check box
Java/PHP Developer
Java/PHP Developer  Hi, I need a cloak embedded in java swing frame or panel..And it should not change when system time is changed ..please
Java/PHP Developer
Java/PHP Developer  Hi, can u help me to embedd time on java frame and it should be independent of operating system time..if we change system time it should'nt be changed.. Thank you sir
Java/PHP Developer
Java/PHP Developer  how can we get words seperated by delimeters in text file can be imported in jframe like one word for one line
Java/PHP Developer
Java/PHP Developer  Hi, how to create radio buttons on one pannel and should change when pressed ok... can u help me htrough this sooner... THANK U
Java/PHP Developer
Java/PHP Developer  Hi, can u please help me with this, I have a text file with 3 sentences separated by delimiters and i want to get each sentence in different JFrames when press ok button on first frame it should close
Java/PHP Developer
Java/PHP Developer  Hi, can u help me with, question from a text file and answers from another text file with check box..... like a text file containing questions and another text file containing answer of 3 r 4 options,each one
Java/PHP Developer
Java/PHP Developer  Hi, can u help me with, question from a text file and answers from another text file with check box..... like a text file containing questions and another text file containing answer of 3 r 4 options,each one
Java/PHP Developer
Java/PHP Developer  Hi, I have a textfile(notepad1.txt) with 1 question and another textfile(notepad2.txt) with answers(4 options like multiple choice),question is imported from first text file to jframe and 4 options with check
Java/PHP Developer
Java/PHP Developer  Hello sir, Am working on playing audio file in jframe and im not able to import javax.media into the code.. the code.../java/javase/download-142937.html After downloading, put the jar file under the lib
Java/PHP Developer
Java/PHP Developer  HI, I want to know how can we place a link in one jframe to open a videopanel. import java.net.MalformedURLException; import... } // end MediaPanel constructor } // end class MediaPanel   Java create
plsql developer
plsql developer  how did plsql developer provided the information to the frent end people when ever they contact plsql developer and how plsql developer tck the data from the database
Java Developer
Java Developer  Hi, I am engineering student. I want to make career in as Java Developer. How to become a Java Developer? What programming languages... an expert Java Developer? Thanks
App Developer
App Developer  Hi, Who is App Developer? Thanks   Hi, App Developer is the term used for the programmers or companies developing mobile applications. Mobile application or simply app is the hot trend there days
ModuleNotFoundError: No module named 'developer'
ModuleNotFoundError: No module named 'developer'  Hi, My Python... 'developer' How to remove the ModuleNotFoundError: No module named 'developer' error? Thanks   Hi, In your python environment you
Developer Files - Development process
Developer Files  Hi, I dont have real time experience. can u tell as a j2ee developer should i edit struts properties files or not . like wise changes in any other properties file. Thanks Prakash
Developer discussion forums
Developer discussion forums  Hi, What is discussion forums? Is there any good forum for discussion programming technologies? Thanks... managed and spam protected. You can check LiveTechTalk.com - Developer discussion
Hire iPhone developer
Hire iPhone developer - Hire iPhone developers in India Apple?s iPhone... few efficient developer in this field. If you want to develop any outstanding... programmer or hire iPhone app developer who can develop an iPhone application
ai developer course
ai developer course  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: ai developer course... the topic "ai developer course". Also tell me which is the good training
iPhone apps developer
iPhone apps developer With the launch of Apple's innovative product iPhone that comprises three advanced products in it-a smart mobile, a faster internet connection and advanced multimedia devices with touch screen and virtual
Version of merlin-developer>merlin-developer-core dependency
List of Version of merlin-developer>merlin-developer-core dependency
Mozilla Developer Center
Mozilla Developer Center       Great site to get a first look at AJAX. Read full DescriptionADS_TO_REPLACE_1
Artifacts of merlin-developer
List of Artifacts of merlin-developer maven depenency
Artifacts of com.ns-developer
List of Artifacts of com.ns-developer maven depenency
Maven Repository/Dependency: merlin-developer | merlin-developer-core
Maven Repository/Dependency of Group ID merlin-developer and Artifact ID merlin-developer-core. Latest version of merlin-developer:merlin-developer-core dependencies. # Version Release Date
What skills are required to be a Hadoop developer?
What skills are required to be a Hadoop developer?  Hi, How to become a good Hadoop Developer? What skills are required to be a Hadoop developer? Thanks
What are job role of Hadoop Developer?
What are job role of Hadoop Developer?  Hi, I am planning to get the the job in Hadoop Development as Hadoop Developer. What are the roles of a Hadoop Developer? Thanks
ModuleNotFoundError: No module named 'developer-tools'
ModuleNotFoundError: No module named 'developer-tools'  Hi, My... named 'developer-tools' How to remove the ModuleNotFoundError: No module named 'developer-tools' error? Thanks   Hi, In your python
Looking to Hire Magento Website Developer?
Looking to Hire Magento Website Developer?  Are you searching for Magento ecommerce development solution? Then you have arrived on the right place... at reasonable prices. You can hire Magento ecommerce developer from us
google developer machine learning bootcamp
google developer machine learning bootcamp  Hi, I am beginner... to learn: google developer machine learning bootcamp Try to provide me good examples or tutorials links so that I can learn the topic "google developer
What is the salary of Python developer in India?
What is the salary of Python developer in India?  Hi, I am beginner... to learn: What is the salary of Python developer in India? Try to provide me... is the salary of Python developer in India?". Also tell me which is the good
Searching Mobile developer for image recognition
Searching Mobile developer for image recognition  Hi, I have an idea for an application that requires image recognition. I have decided to use... of calling web services. Developer should have at least 5 years of experience
software developer
software developer
Software Developer
Software Developer  what is the java code to turn off my pc
java developer
java developer  i didnt get the correct ANSWER PLZ EXECUTE THE FOOLWING SERVLET BY USING DATABASE USERLOGIN TABLE VALUES. //validate login.html <html> <body> <body bgcolor="wheat"> <center>
Java Developer
Java Developer  What is scenario where i use interface and where use interface
Java Developer
Java Developer  where we should use interface and where we should use abstract class
Version of com.ns-developer>tagcloudview dependency
How to become a PHP Developer?
PHP developer. This explains you all the technologies you have to learn to become a PHP Developer. You will definitely find this step-by-step tutorial very.... To become a PHP developer following the following steps:ADS_TO_REPLACE_1 How
PHP Application Developer in India
PHP Application Developer in India We offer PHP Application Developer in India... using PHP language. Roseindia, a leading PHP developer India has a strong... in Application development in PHP framework. PHP is a very powerful open source
PHP Application Developer in India
PHP Application Developer in India We offer PHP Application Developer in India... using PHP language. Roseindia, a leading PHP developer India has a strong... in Application development in PHP framework. PHP is a very powerful open source
PHP Application Developer in India
PHP Application Developer in India We offer PHP Application Developer in India... using PHP language. Roseindia, a leading PHP developer India has a strong... in Application development in PHP framework. PHP is a very powerful open source
PHP Application Developer in India
PHP Application Developer in India We offer PHP Application Developer in India... developer India has a strong network of PHP professionals that can develop... in Application development in PHP framework. PHP is a very powerful open source
Perl Developer
Perl Developer       Position Vacant: Perl Developer Job Description  We... Experience: 1- 6 Years  Keywords: Perl, Developer, Unix
ModuleNotFoundError: No module named 'example-pkg-Developer-EC'
ModuleNotFoundError: No module named 'example-pkg-Developer-EC'  Hi...: No module named 'example-pkg-Developer-EC' How to remove the ModuleNotFoundError: No module named 'example-pkg-Developer-EC' error? Thanks  
ModuleNotFoundError: No module named 'watson-developer-cloud'
ModuleNotFoundError: No module named 'watson-developer-cloud'  Hi...: No module named 'watson-developer-cloud' How to remove the ModuleNotFoundError: No module named 'watson-developer-cloud' error? Thanks   Hi

Ads