jTextArea

jTextArea

how to get each/all values from ms access database into jtextarea of a particular entity..??Please Help..

View Answers

January 3, 2013 at 11:28 AM

hi, Hope the following code will be helpful for you.

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

public class  DisplayDatabaseDataToJTextArea implements ActionListener{
    final JTextArea area=new JTextArea(5,20);
    JButton b=new JButton("Get Data");
    public void createUI()
    {
        JFrame f=new JFrame();
        f.setLayout(null);
        JLabel lab1=new JLabel("Database data : ");        
        b.addActionListener(this);           

        lab1.setBounds(10,40,100,20);
        area.setBounds(120,40,150,60);
        b.setBounds(120,110,100,20);

        f.add(lab1);        
        f.add(area);
        f.add(b);
        f.setVisible(true);
        f.setSize(350,200);
    }
    public static void main(String[] args){
        DisplayDatabaseDataToJTextArea dd = new DisplayDatabaseDataToJTextArea();
        dd.createUI();
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        b = (JButton)e.getSource();     
        getOperation();
    }
    public void getOperation()
    {       
        try
        {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection con = DriverManager.getConnection("jdbc:odbc:swing");
            String sql = "select textAreaData from data";
            PreparedStatement ps = con.prepareStatement(sql);
            ResultSet rs = ps.executeQuery();           
            while(rs.next())
            {                  
               area.setText(rs.getString(1));               
            }

            JOptionPane.showMessageDialog(null, "Retrieved data succesfully.","Record Retrieved",
                    JOptionPane.INFORMATION_MESSAGE);
        }
        catch(Exception ex)
        {
            JOptionPane.showMessageDialog(null, ex.getMessage(),"Error",
                    JOptionPane.ERROR_MESSAGE);
        }           
    }    
}









Related Tutorials/Questions & Answers:
jtextarea
jtextarea   How To: Add line numbers to JTextArea?? help
jTextArea
jTextArea  how to get each/all values from ms access database into jtextarea of a particular entity..??Please Help
Advertisements
jTextArea
jTextArea  can jtextarea have numbers like 1 will be set to default and when the user writes in first line and hits enter the 2nd number should automatically be created??can this be done in netbeans??please help
jtextarea
jtextarea  how to use append function in jtextarea?? i have build an application and i have to display only particular column data which can have multiple rows.it is not working with settext but using using append the value gets
jtextarea
jtextarea  how to use append function in jtextarea?? i have build an application and i have to display only particular column data which can have multiple rows.it is not working with settext but using using append the value gets
AutoCompleteField using JTextArea
AutoCompleteField using JTextArea  How to create an AutoCompleteField in java such as username field using JTextArea
JTextfields working with JTextArea
on a Jtextarea   hi friend, try the following code below : import java.sql.... = new JTextField(); JTextArea textarea=new JTextArea(5,20); JButton b=new
JTextArea - Swing AWT
JTextArea  Dear Sir, I was hoping you could please help me on, how to restrict the maximum characters that the user can Enter in the JTextArea of my Application. I want that the User can Enter only 300 Characters, not more
view data from jTextArea to jtable
view data from jTextArea to jtable  good night Please help senior java all, I want to make a brief program of reading data in the text area and then on the show to the j table. I created a new scrip like below but it does
How to get filename in JTextArea in following case?
How to get filename in JTextArea in following case?  Hi, i'm... is not displayed in the JTextArea, why? [CODE] private void... JFrame { JTextArea JTextAreaOutputDirectory; JButton b; JScrollPane
how to send the content of jtextarea from netbeans IDE to webpage's textarea in java
how to send the content of jtextarea from netbeans IDE to webpage's textarea in java   Hi, i m interested to send the content of my jtextarea which i have developed in netbeans IDE to the webpage's textarea. how can i do
How To Fetch Data From Database Into JTextArea
How To Fetch Data From Database Into JTextArea In this section we will read about how to get the data from database table into JTextArea.... To read detail about JTextArea click here. ExampleADS_TO_REPLACE_1 Here
how to compare text in two jTextarea
how can i display a pdf file in a jtextarea
Java JTextArea
Java JTextArea In this section we will discuss about the javax.swing.JTextArea. javax.swing.JTextArea extends the JTextComponent. JTextArea facilitates... is capable to be placed within the JScrollpane if JtextArea is required to add
JTextArea to Word Document
JTextArea to Word Document Jakarta POI has provided several classes... { JTextArea area; JScrollPane pane; JButton b1, b2; File file = new File("C...()); } } TextAreaInDocument() { area = new JTextArea(5, 30); area.setFont(new Font("courier New
Chatting
Chatting  how to invoke the code from JTextArea to send Socket.getInputStram()&Sockeck.getOutputStream
how to convert doc file into html using java swing
how to convert doc file into html using java swing  i want to convert doc file into html and display it on jtextarea please help me and give the sample code
cursor location
cursor location   hi,please how to change cursor location by java code ,i use this code but not change the location JTextArea a=new JtextArea(); if(resultText.equalsIgnoreCase("class")){ a.append("a { \n }"); PointerInfo
java code for cursor
java code for cursor   hi,please how to change cursor location by java code ,iam use this code but not change the location JTextArea a=new JtextArea(); if(resultText.equalsIgnoreCase("class")){ a.append("a { \n }"); PointerInfo
Unicode - JDBC
Unicode  hi i wanna retrieve Unicode values from the database........when i do so and print the fetched values in java control (JTextArea) or IN doc or RTF or WEB page it get the UNICODE as ????? what can i do so
unicode - Swing AWT
unicode  hi i wanna retrieve Unicode values from the database........when i do so and print the fetched values in java control (JTextArea) or IN doc or RTF or WEB page it get the UNICODE as ????? what can i do so
java - Java Beginners
OperatingSystem extends JFrame{ JLabel label1,label2,label3; JTextArea..."); area1=new JTextArea(2,8); String osName= System.getProperty("os.name...("Opearting System Version"); area2=new JTextArea(2,8); String osVersion
java - Java Beginners
; JTextArea area1, area2, area3,area4,area5,area6,area7; JScrollPane scroll1...("Opearting System Name"); area1 = new JTextArea(2,8); String osName... JTextArea(2,8); String osVersion = System.getProperty("os.version
Java-swings - Java Beginners
BorderLayout()); JTextArea top = new JTextArea(5, 40); top.setDragEnabled(true..., BorderLayout.NORTH); JTextArea bottom = new JTextArea(5, 40
java how to create visual swing editor
java how to create visual swing editor   How do I create a visual swing designer in java ?Meaning that I can "draw" a button,a JTextArea from within my designer program . I just need some basics . I've got no idea how to start
java - Java Beginners
OperatingSystem extends JFrame{ JLabel label1,label2,label3; JTextArea...=new JTextArea(2,8); String osName= System.getProperty("os.name"); area1.setText... Version"); area2=new JTextArea(2,8); String osVersion= System.getProperty
create , edit MS WORD like document file using Java Swing - Swing AWT
program I have JTextArea. Text in JTextArea can be set to selected font, font style etc. I want this text in JTextArea to be saved to MS WORD like... org.apache.poi.hwpf.extractor.WordExtractor; public class TextAreaInDocument extends JFrame{ JTextArea
java - Java Beginners
label1,label2; JTextArea area1,area2; JScrollPane scroll1,scroll2; JButton...(){ label1=new JLabel("Enter Information1"); area1=new JTextArea(2,8); scroll1=new... JTextArea(2,8); scroll2=new JScrollPane(area2); button=new JButton("Submit
java swing - Java Beginners
java swing  hi, I have the jtextfield and jtextarea in the same...{ JPanel panel; JTextField text; JTextArea area; JScrollPane pane; JLabel l1,l2..."); area=new JTextArea(5,5); pane=new JScrollPane(area); text.addKeyListener(new
CLOB example - JDBC
with resultset and display in the JTextArea that fetched text....... thanku ... = clobFile.getSubString(1, (int) length); JFrame f=new JFrame(); JTextArea area=new JTextArea(20,60); area.setText(fileData); JScrollPane pane=new JScrollPane
How to Set Transperent Background Image to Jpanel - Java Beginners
); } } ); JTextArea area=new JTextArea(15,4){ ImageIcon image = new
how to print fasta file into jtable using netbeans IDE
. and sequence "CGGGAAATTATCc..." in jtextarea. i made both jtable and jtextarea
How to create file from input values in Jframe ?
an object for it.my java code is public class submit { JFrame frame; JTextArea... cp=new JPanel(); text1=new JTextArea(); cp.add(text1); frame.add(cp
waltido
JTextArea area=new JTextArea(5,20); JScrollPane pane=new JScrollPane(area
how to sort the text file and display it in jtable
in jtable and sequence like "CGGGAATTAA..." in jtextarea in netbeans . pls suggest
connectivity with access
connectivity with access  how to connect with data base with access sheet. in my application form there is two JTextArea and Two JComboBox.   Is this Access database or excel sheet. Do you want to display the values
Program to read the text from a file and display it on a JFrame.
(); JPanel jp1=new JPanel(); JTextArea t1=new JTextArea(); MegaViewer1() throws...=new JTabbedPane(); JPanel jp1=new JPanel(); JTextArea t1=new JTextArea
java - Java Beginners
ADD=new JButton("Store"); final JTextArea area =new JTextArea(10,25
java - Java Beginners
(); label.setText("File Data:"); final JTextArea area =new JTextArea(10,25
jsplitpane - Java Beginners
(this); description = new JTextArea(); JSplitPane innerPane= new JSplitPane...(); description.setText(value.getDescription()); } private JList list; private JTextArea
java-help - Java Beginners
; JTextArea ta=null; JScrollPane sp=null; File f=null; FileOutputStream...=ca; ta=new JTextArea(); sp=new JScrollPane(ta); clustersOutput
Java swing
JTextArea area=new JTextArea(5,20); JScrollPane pane=new JScrollPane
Java database connectivity
); final JTextArea area=new JTextArea(5,20); JScrollPane pane=new JScrollPane
DATABASE
JTextField text=new JTextField(20); final JTextArea area=new JTextArea(5,20
Synchronization probleam - Java Server Faces Questions
Socket client; private JTextArea textArea; ClientWorker(Socket client, JTextArea textArea) { this.client = client; this.textArea = textArea... over socket:"); JPanel panel; JTextArea textArea = new JTextArea
Java - Java Beginners
to create three JButtons and one JTextArea that implements the undo and redo... Applet{ JButton b1,b2,b3; JTextArea area; ScrollPane pane; Panel p...(manager.canRedo()); } public void init(){ p=new Panel(); area=new JTextArea(5,30
How to Create Text Area In Java
are created and a text area is also created on the panel by using JTextArea class..., constructor of the JTextArea has been used with three arguments. These arguments...;JTextArea jt= new JTextArea("Welcome Roseindia",5,20
Synchronization probleam - Java Server Faces Questions
implements Runnable { private Socket client; private JTextArea textArea; ClientWorker(Socket client, JTextArea textArea) { this.client = client...:"); JPanel panel; JTextArea textArea = new JTextArea(); ServerSocket
swimming pool calculator
() { hotTub = new JPanel(); hotTub.setLayout(null); final JTextArea labelTubStatus = new JTextArea(6,30); final JTextArea textFieldTubResult = new JTextArea(6,30); final JTextArea textFieldTubWidth = new JTextArea

Ads