Modifying code so that JCheckBox can be used instead of JComboBox

Hello.
how can I modify the following code so that JCheckBox can be used instead of JComboBox?
Thanks.
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
public class Exercise32_6 extends JApplet {
  private JComboBox jcboTableName = new JComboBox();
  private JTextArea jtaResult = new JTextArea();
  private JButton jbtShowContents = new JButton("Show Contents");
  private Statement stmt;
  public void init() {
    initializeDB();
    jbtShowContents.addActionListener(new java.awt.event.ActionListener() {
       public void actionPerformed(ActionEvent e) {
          jbtShowContents_actionPerformed(e);
    JPanel jPanel1 = new JPanel();
    jPanel1.add(new JLabel("Table Name"));
    jPanel1.add(jcboTableName);
    jPanel1.add(jbtShowContents);
    this.getContentPane().add(jPanel1, BorderLayout.NORTH);
    this.getContentPane().add(new JScrollPane(jtaResult), BorderLayout.CENTER);
  private void initializeDB() {
    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      System.out.println("Driver loaded");
      Connection connection = DriverManager.getConnection("jdbc:odbc:VideoLibrary");
      System.out.println("Database connected");
      stmt = connection.createStatement();
      DatabaseMetaData dbMetaData = connection.getMetaData();
      ResultSet rsTables = dbMetaData.getTables(null, null, null, new String[] {"TABLE"});
      System.out.print("User tables: ");
      while (rsTables.next()) {
        jcboTableName.addItem(rsTables.getString("TABLE_NAME"));
    catch (Exception ex) {
      ex.printStackTrace();
  private void jbtShowContents_actionPerformed(ActionEvent e) {
    String tableName = (String)jcboTableName.getSelectedItem();
    try {
      String queryString = "select * from " + tableName;
      ResultSet resultSet = stmt.executeQuery(queryString);
      ResultSetMetaData rsMetaData = resultSet.getMetaData();
      for (int i = 1; i <= rsMetaData.getColumnCount(); i++) {
        jtaResult.append(rsMetaData.getColumnName(i) + "    ");
      jtaResult.append("\n");
      while (resultSet.next()) {
        for (int i = 1; i <= rsMetaData.getColumnCount(); i++) {
          jtaResult.append(resultSet.getObject(i) + "     ");
        jtaResult.append("\n");
    catch (SQLException ex) {
      ex.printStackTrace();
  public static void main(String[] args) {
    Exercise32_6 applet = new Exercise32_6();
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setTitle("Exercise32_6");
    frame.getContentPane().add(applet, BorderLayout.CENTER);
    applet.init();
    applet.start();
    frame.setSize(380, 180);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}

hello.
thanks for the reply. i want users of my video library system to be able to view CD/DVD/Game information by name, age category, type and year. Users should be able to click on a check box (e.g. view by name, age category, type or year) and press a button. What would happen then is that data from the Product table would appear in the text area.

Similar Messages

  • How can i update my old 2006 iMac Intel core 2 duo running 10.6.8 to OSX Lion so that I can sync using iCloud with my newer devices?  Mountain Lion is not an option for my older model and Lion is no longer available at App store.

    How can i update my old 2006 iMac Intel core 2 duo running 10.6.8 to OSX Lion so that I can sync using iCloud with my newer devices?  Mountain Lion is not an option for my older model and Lion is no longer available at App store. 

    Call Apple's online store's telesales agents: 1-800-MY-APPLE (1-800-692-7753) or Customer Service and Sales Support at 1-800-676-2775. For Lion you'll get a redemptions code via e-mail and need to DL from the Mac Apple Store (requires SL 10.6.6+).

  • [svn] 1263: Update language selection code so that you can actually select one of the new languages I recently added .

    Revision: 1263
    Author: [email protected]
    Date: 2008-04-16 12:25:02 -0700 (Wed, 16 Apr 2008)
    Log Message:
    Update language selection code so that you can actually select one of the new languages I recently added.
    Modified Paths:
    flex/sdk/trunk/modules/asc/src/java/macromedia/asc/util/Context.java
    flex/sdk/trunk/modules/asc/src/java/macromedia/asc/util/ContextStatics.java

    Revision: 1263
    Author: [email protected]
    Date: 2008-04-16 12:25:02 -0700 (Wed, 16 Apr 2008)
    Log Message:
    Update language selection code so that you can actually select one of the new languages I recently added.
    Modified Paths:
    flex/sdk/trunk/modules/asc/src/java/macromedia/asc/util/Context.java
    flex/sdk/trunk/modules/asc/src/java/macromedia/asc/util/ContextStatics.java

  • [svn] 2216: Changed InterfaceCompiler to public so that it can be used directly for mxml parsing by other tools .

    Revision: 2216
    Author: [email protected]
    Date: 2008-06-24 13:34:15 -0700 (Tue, 24 Jun 2008)
    Log Message:
    Changed InterfaceCompiler to public so that it can be used directly for mxml parsing by other tools. Also change parseMxml to public.
    Reviewed by: Paul
    Modified Paths:
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/InterfaceCompiler.java

    Before I read this helpful post, I changed my Google search key words from "change location Firefox profiles" to "change path Firefox Profiles" and found this link: http://kb.mozillazine.org/Thunderbird_:_FAQs_:_Changing_Profile_Folder_Location. This brought me to the article "Moving Your Firefox Profile" which answered my question. Your suggested link would have ultimately led me to the same solution.
    The problem was that I had copied my Firefox profile to the new location and then modified "profiles.ini" to point to the new location and saved it there as a replacement to the original "profiles.ini" that I had renamed "profiles.iniOld." Even though I had changed "IsRelative" from "=1" to "=0" I got error messages. I had used this procedure successfully before, but it would not work this time. When I used Profile Manager to move the Firefox Profiles everything worked fine the first time I tried it, and it took only a few minutes.
    Thank you, cor-el.

  • How to make a method global so that it can be used in another component.?

    Hi,
    Is it possible to make a method global so that it can be used in another component.?
    i.e I have one component C1 and methods declared in this component M1, M2, ...
    Now I have another component C2 and in this component i want to use method M1 of component C1.
    how to do so?
    Any inputs will be appreciated.
    Thanx.

    Hi,
    As Uday said, To make the method as global of component say C1, You have to make method as interface by clicking the check box.
    Now while using the method in other component say C2, you have to follow following steps:
    1. In used component of comp. C2, add component C1.
    2. Instantiate the component atleast once in any of the method of component using code wizard option:
    'Instantiate Used Componet'.
    3. Now you can call the method of component C1 using code wizard option 'Method call in used controller'

  • If we use DML statement in function then that function can be used inside s

    if we use DML statement in function then that function can be used inside select query or any DML query?

    select f from t2;I think you meant to query t1.
    It works if the function is an autonomous transaction:
    create or replace function f return number
    is
    PRAGMA AUTONOMOUS_TRANSACTION;
    begin
        update t1 set c=2;
        commit;
        return 1;
    end;
    select f from t1But as Billy said why would you want to do DML this way. And this is not the way autonomous procedures should be used either.
    An an answer to an interview question though nothing wrong with it.

  • How to store data in hashmap so that it can be used by different methods.

    Hello,
    I have an ADF/JSF application and the database is DRM. The program gets data from DRM into this hashmap. Program needs this data frequently. Getting this HashMap is very resource intensive due to a lot of data it has.
    I want to get the data in HashMap once ( I can do this - no problem).  But where/how do I keep it so that different methods can just use this and not make individual trips to DRM? It may be a very basic java question but I seem to be stuck :)
    I am not very concerned about the HashMap part, it can be any collection - the question is of storing it so that it can be used over and over.
    Thanks,

    User,
    If I understand you correctly, you have a JSF application that needs to store data in a HashMap such that it can be accessed over and over? You could put the hashmap into an appropriately-scoped managed bean and access it from there. I'm not sure what a "DRM" is (a digital rights management database, perhaps, in which case it's a "database"), so there is something special about a "DRM" that we need to know, please share.
    John

  • I can no longer download and save files. They are now saved with a ".part" suffix that I can not use or open. What happened, I used to do this all the time?

    Downloads seem to be happening normally at first but the file shows up with a file extension of ".part" that I can not use or open. If I refresh the folder where it was downloaded to, it disappears as though it wasn't there at all.
    I used to do this and it just yesterday started to give me problems. It doesn't seem to matter what file type I do this with as PDF, MP3 and EXE files have all shown this problem.
    Please help!

    It is possible that your anti-virus software is corrupting the downloaded files or otherwise interfering with downloading files by Firefox.<br />
    Try to disable the real-time (live) scanning of files in your anti-virus software temporarily to see if that makes downloading work.
    See also "Disable virus scanning in Firefox preferences - Windows"
    * http://kb.mozillazine.org/Unable_to_save_or_download_files

  • HT1918 I ve just bought a gift card from Belgium but I m living in Netherlands and I have an Iphone 4S subscription in Netherlands. What can I do to use the gift card? It is telling me that I can't use it because it's from Belgium.

    I ve just bought a gift card from Belgium but I m living in Netherlands and I have an Iphone 4S subscription in Netherlands. What can I do to use the gift card? It is telling me that I can't use it because it's from Belgium. i find it really stupid not to be able to use it?!
    please give me a hand over here
    plus i ve bought the gift card from a supermarket so its kind of hard to get my money back now :|

    Gift cards are country specific.  You cannot use them in another country.

  • II  downloaded the OS X version 10.9 and my iPhoto version 9.2.3 will n.ot open.  I get a message that I can't use this version of the application I photo with this version of OSX.  What do I do now and how do I get the photos out of the old version?

    I downloaded the OS X version 10.9 and my Iphoto version 9.2.3 will not open.  I get a message that I can't use this version of the application I photo with this version of OS X.  How do I upgrade to a i photo that will run on 10.9.  Do I purchase a new program or can I do just an download?

    Check the "Purchases" page in the Mac App Store and see if there is a more recent version there already waiting for you.

  • HT1338 I need to bulk upload to Auctiva (auction software) but Java was disabled on my computer. I have 10.5.8 so does this mean that I can't use Java? If not, then is there a workaround to be able to use the bulk uploader from Auctiva?

    I need to bulk upload images from iPhoto to Auctiva (auction software) that will then be posted to eBay; however Java was disabled on my computer some time ago due to "known issues."  I have 10.5.8 so does this mean that I can't use Java? If not, then is there a workaround to be able to use the bulk uploader from Auctiva? As it stands now, I have to upload photos individually which is super time consuming.

    You can re-enable it for special purposes, opposite of disabling it...
    Disable Java in your Browser settings, not JavaScript.
    http://support.apple.com/kb/HT5241?viewlocale=en_US
    http://support.google.com/chrome/bin/answer.py?hl=en-GB&answer=142064
    http://support.mozilla.org/en-US/kb/How%20to%20turn%20off%20Java%20applets

  • Illustrator keeps quitting-notice others have had similar issues, not resolved-so what it the reason for "sending a report" to Adobe if nothing can be done with it????? paying for a product that I can't use when I need to use it and no help-come on-someon

    Illustrator keeps quitting…notice others have had similar issues…so what it the reason for "sending a report" to Adobe if nothing can be done with it????? paying for a product that I can't use when I need to use it and no help…come on…someone has to have an answer…HELP Pleeeeease

    <moved from Adobe Creative Cloud to Illustrator>
    reset your preferences -
    acrobat:  http://help.adobe.com/en_US/acrobat/X/pro/using/WS58a04a822e3e50102bd615109794195ff-7feb.w .html
    adobe media encoder: https://forums.adobe.com/thread/1713540
    after effects:  http://helpx.adobe.com/after-effects/using/preferences.html
    dreamweaver:  https://helpx.adobe.com/dreamweaver/kb/restore-preferences-dreamweaver-cs6-cc.html
    flash:  http://helpx.adobe.com/flash/kb/re-create-preferences-flash-professional.html
    illustrator:  http://helpx.adobe.com/illustrator/using/setting-preferences.html
    indesign:  https://forums.adobe.com/thread/526990
    lightroom: https://helpx.adobe.com/lightroom/help/setting-preferences-lightroom.html
    muse (mac): https://forums.adobe.com/thread/1246022?tstart=0
    photoshop:  https://forums.adobe.com/thread/375776
    photoshop elements:  https://helpx.adobe.com/photoshop-elements/kb/preference-file-locations-photoshop-elements .html,  http://www.photokaboom.com/photography/learn/Photoshop_Elements/troubleshooting/1_delete_p references_file.htm
    premiere elements:  https://helpx.adobe.com/photoshop-elements/kb/preference-file-locations-photoshop-elements .html
    premiere pro: http://www.mediacollege.com/adobe/premiere/pro/troubleshooter/trash-preferences.html
    if that fails, uninstall, clean (http://www.adobe.com/support/contact/cscleanertool.html) and reinstall

  • Amount in Bar Code is incorrect;Amount in the line item can be used instead

    We have a problem in our Brazil company code.
    When we have a document with value higher than 5,000.00 BRL it is subject to Pis/cofins tax. In the Boleto (paper) document the amount is after tax deducted. But we see the full amount in the Vendor line item in SAP
    When the system reads the bar code and saves this code in the vendor line item during the document change we get a warning message no."8B797: Amount in Bar Code is incorrect;Amount in the line item can be used instead".
    And the amount in the Barcode line automatically adjusts itself to the line item amount which is the pre-tax amount (full amount).
    Example: Amount in the SAP Invoice doc is R$ 6,268.72   
                   Amount in Boleto (paper) R$ 5,977.22   (after deducting PIS/COFINS) - This amount appears in the bar code but once we press enter after the warning message it automatically adjusts to R$ 6,268.72 .
    We tried few notes like 784748 to apply but it says it is obsolete. We are on ECC 6.0 Release level 11.
    Regards.,
    Raj/

    answered through SAP note 784748

  • I am trying to convert a PDF into a document that can be edited - it's a client feedback form. I am using Adobe forms Central and it's saying that it can't use my document.

    I am trying to convert a PDF into a document that can be edited - it's a client feedback form. I am using Adobe forms Central and it's saying that it can't use my document.

    Hi Michelle ,
    We are extremely sorry that you have had a bad experience with Adobe .
    As far as your issue is concerned ,Acrobat generally prompts for internet connection as it is required to activate the product before you could use it comfortably .Once the product is activated or licensed you would be able to use the software offline .
    This could be the possible reason you are experiencing this .Please check if you have done so and still facing this .And if you have not ,you need to license/activate your product by typing in your credentials ,i.e Adobe ID and password .
    You could also refer the following link to get updated about the activation of your product .
    https://helpx.adobe.com/x-productkb/policy-pricing/activation-deactivation-products.html#a ctivate-how-to
    Regards
    Sukrit Dhingra

  • I just switch to 10.8 from 10.6, and found that I can't use WORD.  How do I recover and use my word documents?

    I just switch to 10.8 from 10.6, and found that I can't use WORD.  How do I recover and use my word documents?

    ds store wrote:
    LibreOffice is the new (and better) port of OpenOffice as Oracle isn't sure of OpenOffice's fate.
    https://www.libreoffice.org/
    Of course they aren't sure, Open Office is nothing to do with Oracle, it's an Apache product ..... update your notes.
    Open Office is available here: www.openoffice.org/

Maybe you are looking for