How 2 create a Jtext box and Jcombobox with database connectivity

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class StockReport1 extends Frame implements ActionListener
JLabel l1,l2,l3;
JTextField t1,t2,t3;
JPanel p1,p2;
JButton b2,b4,b5;
static Connection cn;
static Statement st;
static ResultSet rs;
public StockReport1()
l1=new JLabel("Name");
l2=new JLabel("Age");
l3=new JLabel("Native");
t1=new JTextField(20);
t2=new JTextField(20);
t3=new JTextField(20);
p1=new JPanel();
p2=new JPanel();
p1.add(l1);
p1.add(t1);
p1.add(l2);
p1.add(t2);
p1.add(l3);
p1.add(t3);
b2=new JButton("Exit");
b4=new JButton("Next");
b5=new JButton("Previous");
b2.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
p2.add(b2);
p2.add(b4);
p2.add(b5);
p1.setLayout(new GridLayout(3,1));
p2.setLayout(new GridLayout(1,6));
add(p1);
add(p2);
setSize(500,500);
setVisible(true);
setLayout(new FlowLayout(FlowLayout.LEFT,30,40));
addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent e) {
                    System.exit(0);}});
public void actionPerformed(ActionEvent ae)
try
if(ae.getSource()==b2)
System.exit(0);
if(ae.getSource()==b4)
if(rs.isLast()==false)
rs.next();
display();
else
rs.last();
display();
if(ae.getSource()==b5)
if(rs.isFirst()==false)
rs.previous();
display();
else
rs.first();
display();
catch(SQLException se)
se.printStackTrace();
public static void main(String arg[])
new StockReport1();
public void display()
try
String s1=rs.getString(1);
String s2=rs.getString(2);
String s3=rs.getString(3);
t1.setText(s1);
t2.setText(s2);
t3.setText(s3);
catch(SQLException se)
se.printStackTrace();
}

don't mix up with awt and swing, use JFrame instead of Frame.
in display method just set the value of the result set to the textfields.
or put all the data into arraylist after each next button click just read the value and put into textfields

Similar Messages

  • How can I use SQL TOOLKIT concurrently with Database Connectivity ?

    I have installed LabVIEW 6.1 with the Database Connectivity Toolkit and the SQL Compatibility Toolkit (e.g. _SQL folder). I am trying to make the transition from the SQL Toolkit VIs to the Database Connectivity toolkits, but for compatability with existing systems I would like to be able to run the two sets of VIs concurrently (but not in the same app).
    When I read into 6.1 a connection VI that I wrote with LabVIEW 6.0 and the SQL toolkit the connection reference type gets changed from a number to type connection (see attachments) . Does compatbility mean that my SQL toolkit VIs are converted to a form compatible with the new ADO ?
    Can I use the SQL Toolkit VIs or the Database connectivit
    y VIs in the same installation of 6.1 ?
    Can I have the SQL Toolkit VIs appear on the functions pallette and function as they did when only the SQL toolkit was installed ?
    Attachments:
    CNNCT.vi ‏20 KB
    CNNCT.vi ‏22 KB

    In response to your #2 below:
    Actually it is possible to have the old SQL Toolkit and new Database
    connectivity in the same installation of LabVIEW. I have only tried it on
    6i, but don't see why it wouldn't work on 6.1. The trick is not to install
    the SQL toolkit compatabitily VI's. The old SQL toolkit uses the Intersolve
    dll through ODBC while the new Database connectivity uses ADO so it is
    possible to use both methods not only in the same LabVIEW install, but it
    the same running application. It has been a while since I originally did
    this, so I am posting only to mention that it is possible and not exactly
    how to do it. If anyone is interested in more details just respond.
    Brian
    "Jeff B" wrote in message
    news:[email protected]...
    > First, direct answers to your direct questions:
    >
    > 1. Does compatbility mean that my SQL toolkit VIs are converted to a
    > form compatible with the new ADO ?
    >
    > Yes
    >
    > 2. Can I use the SQL Toolkit VIs or the Database connectivity VIs in
    > the same installation of 6.1 ?
    >
    > No
    >
    > 3. Can I have the SQL Toolkit VIs appear on the functions pallette
    > and function as they did when only the SQL toolkit was installed ?
    >
    > No
    >
    >
    > Now an elaboration:
    >
    > Having the old SQL Toolkit and the new Database Connectivity Toolset
    > installed on the same version of LabVIEW on the same computer is not
    > supported.
    >
    > Once you install the Database Connectivity Toolset, any VIs written
    > with the SQL Toolkit will run, but with the ADO layer, as you
    > suspected.
    >
    > Internally, the only way we can have both the SQL Toolkit and the
    > Database Connectivity Toolset installed on the same computer for
    > troubleshooting customer issues is to have them installed on different
    > versions of LabVIEW. I, for example, have LabVIEW 5.1.2, 6.0.3, and
    > 6.1 all installed on my computer, and I have the SQL Toolkit install
    > on LabVIEW 5.1.2, and the Database Connectivity Toolset installed on
    > LabVIEW 6.0.3. In this configuration I can still run SQL Toolkit VIs
    > independent of the Database Connectivity Toolset if I open and run
    > them in LabVIEW 5.1.2.

  • How to create a Shuttle box in Apex with simple copy and move option..

    I want to create a shuttle box in Apex with simple copy option. the demo application I downloaded from oracle had a two level selection query option which I dont need and was not even compatible with my version. All I need is a way to shuttle single query values between two multiple select lists. I could not find any demo.
    My Apex version 2.1 with XE
    query : select distinct fieldid d, fieldid r from field order by 1
    What kind of buttons do I need.. ? submitting or url redirecting ?

    Hello,
    >>
    The demo is not working in my apex 2.1 as I mentioned in the post.
    >>
    Not working is not enough of a description to help you out. I assume that what you mean is it won't install into XE since the demo was built in 2.2 and uses some 2.2 specific technology for the install.
    The way to get around that issue like I said was to get a free workspace on apex.oracle.com install the demo application there and then using some cutting and pasting recreate the demo app in your XE instance.
    Carl

  • How to create schema for Header and Footer with pipe delimiter file BPEL11g

    Hi all,
    I have issule creating Schema for Header and Footer with body file .The file format is Pipe delimiter.The following format below like is...
    Softeware Components:File Adapter(Read) 11g,
    1|1211|000|577|5444
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|4544|000|yted
    I hope get the sollution for this from this Forum..Please help me out..Thankyou.

    You mean how many rows or columns..?
    If coloumns means 5 and rows only one(1).

  • How do I synchronise audio and video with an mpg file created in elements 11 ?

    How do I synchronise audio and video with an mpg file created in Premier Elements 11 ?
    The source files are VOB files, and there is no problem with those source files.  But after creating the mpg file, the audio can be out of sync by 1 second or even 10 seconds, and sometimes zero seconds (ie perfectly OK).  That varies.  The variation might be linked to some of the VOB files.  ie. some are OK, and some are not.
    Can I fix this automatically in Elements 11, or am I doing something wrong ?

    Hartwood,
    First, Premiere (both Pro and Elements) do not handle MPEG Audio perfectly - they like some files, but not all files with MPEG Audio. That makes a VOB a less-than-perfect source file. Still, with a bit of work, one should be able to edit it just fine. One of the factors is that there is a very slight block-size difference between the Encoded Video Stream and the Encode Audio Stream in a muxed MPEG-2 file. That often does not play into things, but can cause slight OOS (Out of Sync) issues. Also, both Premieres need to create all I-Frame files for the Video Stream, which is in GOP (Group of Pictures) structure, so what one sees on the Timeline is really a proxy of the MPEG-2 file's Video Stream. The Audio Stream must also be Conformed to PCM/WAV @ 48KHz 32-bit floating point, to be edited. That Conforming is perfect when one has PCM/WAV @ 48KHz 16-bit for the Audio Stream, but requires more work, when the Audio Stream is MPEG (one reason that some MP3's do not work well in Premiere). Several factors involved here, and a fair amount of work for the program. That is why DV-AVI Type II w/ 48KHz 16-bit PCM/WAV Audio works so perfectly.
    Now, fixing OOS might be easy, or might require a bit more work. This article goes into some workflows, that might be helpful: http://forums.adobe.com/thread/436751?tstart=0
    I can feel your pain, as I almost went crazy trying to fix OOS in a client's Project. They ONLY had the finished DVD, from which to work. The disc met the DVD-standards, so everything ripped/Imported fine, and when the simple edits were done (IIRC, there were four scenes, that had to be shortened, and then several Titles added), everything played fine in the Timeline. However, when I Transcoded that Timeline to be authored in Adobe Encore, two scenes went OOS. I went back to Premiere, and checked - all perfect there. I tried to judge the number of Frames that the Audio was out, in those scenes, and nudged them, tested, nudged, tested, and no matter what I did, I could never get the output files perfect, when Imported into Encore for authoring to DVD-Video. I tried DV-AVI, and letting Encore set the Transcoding automatically (usually a great way to work), I tried manually setting the Transcoding in Encore. I tried outputting to MPEG-2 from Premiere, and Importing that. No matter what I did, those two scenes were just OOS, and I could not even seem to improve them - it was like they were just locked OOS. I finally did some more editing, to break things up a bit, added a cut-away shot here, and there, and minimized the perceived OOS, but could never get it perfect. It was like trying to pick up quicksilver with a pair of tweezers!
    Good luck,
    Hunt

  • How to create the Check box and Text Area inside the Assignment block

    Dear all,
            I am new to web UI development. my requirement is to create the Check box and Text box in the Assignment block. Can anyone help me to do this requirement.
    Thanks & Regards,
    Ashok.

    Hi,
      Please place the below code in the GET_P methods of the fields.
      For Text Area 
    CASE iv_property.
        WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
          rv_value = cl_bsp_dlc_view_descriptor=>field_type_textarea.
      ENDCASE.
    For Check Box 
    CASE iv_property.
        WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
          rv_value = cl_bsp_dlc_view_descriptor=>field_type_checkbox.
      ENDCASE.
    Regards,
    Lakshmi.Y

  • How do I use Qt and OpenGL with Visual Studio

    Hi! I mainly want to program in C++ and I want to use Qt and OpenGL with Visual Studio.
    I am currently revising C++ and later on i am going to start reading Qt and OpenGL. I have a background of
    Embedded firmware design(C and Assembly).
    The Visual Studio Version I have is 2013 ultimate. How do I use Qt and OpenGL with Visual Studio?
    Thanks
    Alexandros

    Hi ClassicalGuitar,
    The forum supports VS setup and installation. And your issue is not about the forum. I will move the thread to off-topic forum. Thanks for your understanding.
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

  • How to link Icloud calendar and contacts with windows 8

    How to link Icloud Calendar and contacts with windows8

    Hi ATarakdjian,
    If you are having issues configuring iCloud Calendar on your Windows 8 machine, you may find the following article helpful:
    iCloud: Troubleshooting iCloud Calendar
    http://support.apple.com/kb/ts3999
    Cheers,
    - Brenden

  • How to use the eventing and databag with a WAS 6.20 ?

    How to use the eventing and databag with a WAS 6.20 ?
    Is what there is a good guide for these services?
    Thank's

    In the raise event you can pass the value
    like below.
    <SCRIPT>
    function raiseEvt(value1){
    if(window.document.domain == window.location.hostname){
    if ( document.domain.indexOf(".") > 0 ) document.domain = document.domain.substr(document.domain.indexOf(".")+1);
       EPCMPROXY.raiseEvent( "urn:com.sap:BWEvents","BWiViewevent", value1, null );
      // alert('tree domain'+document.domain);
    </SCRIPT>
    and in the
    subscribe event you can get the values like below.
    <script language="javascript">
    if(window.document.domain == window.location.hostname){
    document.domain = document.domain.substring(document.domain.indexOf('.')+1);
        EPCMPROXY.subscribeEvent("urn:com.sap:BWEvents","BWiViewevent", window, "myreceiveEvent");
    function myreceiveEvent( eventObj ) {
          document.forms[0].gp_hidden.value = eventObj.dataObject;
    </script>
    Also look at the following link for a complete documentation.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/Enterprise%20Portal%20Client.pdf
    Regards
    Raja

  • How to put Check Boxes and Radio button in Smartforms

    Hi all,
    How to put check Box and radio button in Smartforms ............ from web properties there is an option to use. But How to use.     
    regards,
    Mohsin

    u can declare the checkboxes or radiobuttons whatever in driver program and pass the same to ur form...

  • How migrate all mail (boxes and accounts) from 10.6.8 on Mavericks (without Migration Assistant)?

    How migrate all mail (boxes and accounts) from 10.6.8 on Mavericks (without Migration Assistant)? Install the system (10.9.1) on a blank disk, copied the program and set up manually. Mail accounts and folders does not work to install and configure. Migration Assistant does not want to use, as it copies everything, and you only need to e-mail. Read a lot, but nothing works.

    Try reindexing the mailbox. This can take awhile if you have a lot of mail.
    Reindex messages.
    If that doesn't work try deleting MessageUidsAlreadyDownloaded3.
    Quit the application.
    You need to look in your user Library. Either hold down the option key while using the Finder “Go To Folder” command and select your user Library in your home folder or use the Finder “Go To Folder” command and enter ~/Library/Mail/V2/Mail Data/MessageUidsAlreadyDownloaded3.  Move the file to your desktop.
    Open the application and test. If it works okay, delete the file from the desktop.
    If the application is the same, return thefile to where you got it from, overwriting the newer ones.
    If you prefer to make your User library permanently visible, use the Terminal command found below.
    Show User Library
    You might want to bookmark the command. I had to use it again after I installed 10.8.5. I have also been informed that if you drag the user library to Finder it will remain visible.

  • How to sync Address Book and iCal with Samsung GT-S5670 (Galaxy Fit) with Android 2.2 running?

    How to sync Address Book and iCal with Samsung GT-S5670 (Galaxy Fit) with Android 2.2 running?
    Couldn't find any iSync Plug-in nor software for Samsung phones fitting ...
    Thanx for any help!

    Hello,
    if you need to sync your media files as well, you might want to have a look at FoneSync for Android. It features an iTunes like interface and syncs contacts, calendars, music and photos.
    Kind regards
    Jan Fuellemann
    Disclaimer: I work for nova media, but get no benefit or compansation from posting here

  • How can I share applications and softwares with different users of the same computer?

    First question: How can I share applications and softwares with different users of the same computer?
    Second : Can I use 2 different I cloud accounts to synt 2 iphones with one computer?

    Applications installed on the admin account are available to all user accounts unless Parental Controls are enabled.
    Yes.   Separate user accounts, help here >   How to use multiple iPods, iPads, or iPhones with one computer

  • How i can associate my app user with database role

    In my application (oracle forms application developed in-house - We are using Oracle Forms 11gR2 with WebLogic 10.3.5 ), i want to use "application user" instead of database user.
    I have an application users table, actually, i have database users,and of course, menu application works with database roles (It was developed with oracle forms menu module), my question is, How i can associate my application user with database role, for reusing oracle forms menu funcionality?. It's possible?
    Thanks,
    Edward

    user8929172 wrote:
    In my application (oracle forms application developed in-house - We are using Oracle Forms 11gR2 with WebLogic 10.3.5 ), i want to use "application user" instead of database user.
    I have an application users table, actually, i have database users,and of course, menu application works with database roles (It was developed with oracle forms menu module), my question is, How i can associate my application user with database role, for reusing oracle forms menu funcionality?. It's possible?
    Hi Edward
    You can do this by assigning the role functionality to the application user. For example
    create the table to enter user name.
    create table to enter group name.
    create table to assign user to group.
    assign role to group.
    assign functionality for the user by coding.
    hope this helps

  • Problem with database connectivity

    Hi guys,
    I'm having a problem with database connectivity . I'm using the mySQL database & org.gjt.mm.mysql driver.
    I've kept the org folder under the directory where the Database.java program is residing .
    My program is as follows:
    import java.sql.*;
    public class Database
         Connection con;
         public void connect()
              System.out.println("In connect.");
         public Connection connectDB(String username,String password,String database)
              try
                   Class.forName("org.gjt.mm.mysql.jdbc.Driver");
                   String url="jdbc:mysql:"+database;
                   con=DriverManager.getConnection(url,username,password);
              catch(SQLException e)
                   System.out.println("SQL Exception caught:"+e);     
              catch(Exception e)
                   System.out.println("Exception e caught:"+e);     
              return con;
         public static void main(String args[])
              try
              Connection c;
              Database db=new Database();
              c=db.connectDB("root","","//192.168.0.2/squid");
              System.out.println("Connection created.");
              c.close();
              catch(Exception e)
                   System.out.println("Exception caught:"+e);     
    It gets compiled but gives the following error when run.
    Exception e caught:java.lang.ClassNotFoundException: org.gjt.mm.mysql.jdbc.Driver
    Connection created.
    Exception caught:java.lang.NullPointerException
    I don't know why the class is not found.Pl . help me rectify my mistake.Is there any other path to be set?
    Thanks.

    You need to run it with the JDBC driver in the classpath
    java -classpath .;[mySqlJdbcDriver.jar] Database

Maybe you are looking for