How to put jcheckbox in a jtable

The problem is as followed:
I've got An MSAcces2000 Database. From in my java prog I am getting data from this dbase. the data is loaded into a resultset. This resultset is loaded in a jtable.
Now i want two extra columns in the jtable. One with a jcheckbox and one with a counter. So How do i do that...
Anyone an idea

thanks, but with the counter I mean: a counter that can be set to a certain number. That number represents how many times the line in printed. the checkbox represent if the line is printed at all...
Somebody has an example of a cell renderer, because I don't get much of the tutorial. I can get checkboxes when i add a column in my dbase with boolean. But i don't wonna do it that way. My program has to fenerate an extra column iwth checkboxes and an counter....

Similar Messages

  • How to insert jcheckbox in jtable

    hello
    i am user of oracle9i jdeveloper using jclient/swing .
    question:
    how to insert jcheckbox at a particular cell in jtable.
    please reply to me if anyone amongst you know the solution.
    thank you

    Please continue the discussion here: how to insert checkbox at a particular  cell  in jtable
    Correct me if this is not about the same subject.

  • How do I add a JCheckBox to a JTable - URGENT HELP NEEDED

    Hello All,
    This is kicking my butt. I need to create a JTable that I can dynamically add and delete rows of data to and this table must contain a JCheckBox which I can read the value of. I've been able to find examples out there that provides the ability to have a JCheckBox in the JTable, but do not also provide the function to add / delete rows from the JTable. I need to have both funtions in my table. Can somebody out there please help me with this?
    Here's a simple example that I'm working with as a test to figure this out. This example has the functionality to add rows of data.
    Thanks in advance.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.JFrame;
    import javax.swing.JTable;
    import javax.swing.table.*;
    public class TableTest extends JFrame implements ActionListener
         JButton btnAdd;
         BorderLayout layout;
         DefaultTableModel model;
         public static void main(String[] args)
              TableTest app = new TableTest();
              app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public TableTest()
              super("Table Example");
              layout = new BorderLayout();
              Container container = getContentPane();
              container.setLayout(layout);
              btnAdd = new JButton("Add");
              btnAdd.addActionListener(this);
              model = new DefaultTableModel();
              JTable table = new JTable(model);
              // Create a couple of columns
              model.addColumn("Col1");
              model.addColumn("Col2");
              // Append a row
              model.addRow(new Object[] { "v1", "v2" });
              model.addRow(new Object[] { "v3", "v4" });
              JScrollPane scrollPane = new JScrollPane(table);
              container.add(btnAdd, BorderLayout.NORTH);
              container.add(scrollPane,BorderLayout.CENTER);
              setSize(300, 200);
              setVisible(true);
         public void actionPerformed(ActionEvent e)
              if (e.getSource() == btnAdd)
                   model.addRow(new Object[]{"Test", new Boolean(true)});
    }

    I got it, I added the public Class getColumnClass to new DefaultTableModel(). Here it is for your viewing pleasure.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.JFrame;
    import javax.swing.JTable;
    import javax.swing.table.*;
    public class TableTest extends JFrame implements ActionListener
         JButton btnAdd;
         BorderLayout layout;
         DefaultTableModel model;
         JTable table;
         public static void main(String[] args)
              TableTest app = new TableTest();
              app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public TableTest()
              super("Table Example");
              layout = new BorderLayout();
              Container container = getContentPane();
              container.setLayout(layout);
              btnAdd = new JButton("Add");
              btnAdd.addActionListener(this);
              model = new DefaultTableModel()
                   public Class getColumnClass(int col)
                        switch (col)
                             case 1 :
                                  return Boolean.class;
                             default :
                                  return Object.class;
              table = new JTable(model);
              // Create a couple of columns
              model.addColumn("Col1");
              model.addColumn("Col2");
              // Append a row
              model.addRow(new Object[] { "v1", new Boolean(false)});
              model.addRow(new Object[] { "v3", new Boolean(false)});
              JScrollPane scrollPane = new JScrollPane(table);
              container.add(btnAdd, BorderLayout.NORTH);
              container.add(scrollPane, BorderLayout.CENTER);
              setSize(300, 200);
              setVisible(true);
         public void actionPerformed(ActionEvent e)
              if (e.getSource() == btnAdd)
                   model.addRow(new Object[] { "Karl", new Boolean(true)});

  • How to put web app to Oracle 8i Jserver ?

    I've developed a web app with JDev3.1 , Oracle8i 8.1.6 on NTServer4.0.
    and want to put it on Oracle Jserver 8.1.6:
    The app works well within JDev3.1.
    I depolyed my Business Components project and test well.
    I would like to know how to put web app to Jserver. Is it possible?

    when you say "web app" i am assuming you mean an applet, servlet or java server page(jsp) ??
    if you mean this, then you need to move to the rdbms 8.1.7 environment for this support.
    rdbms 8.1.7 supports servlets and jsp's in two different ways :
    externally -- on the rdbms 8.1.7 platform
    they can be run in an external apache front end included with the 8.1.7 rdbms.
    internally -- inside the rdbms 8.1.7
    they can be deployed internally to 8.1.7 in the "oracle servlet engine" (ose)
    applets and html static pages still need to be deployed to a web server on the mid-tier OR the external apache front end included with the 8.1.7 rdbms to optimize performance.
    i hope this helps ...
    p.s. if i've misunderstood your question , please restate it.
    null

  • How to put a few pages together as a panel group in the same screen ?

    Dear Friends,
    Hello. I am developing the accounting application of Journal Entry module. I have developed 5 pages for a journal entry: Journal header, Journal Line, Journal total, Journal Error and Journal Approval. I want to put 5 pages together as a panel group in the same screen so that users are convenient to use them. The format is as follows:
    Header | Lines | Total | Error | Approval
    When a user click on Header or Lines or Total or Error or Approval, its related page is displayed below it on the screen. But I don't understand how to put "Header", "Lines", "Total", "Error" and "Approval" together as above format and link them to its related page. Can anybody tell me how to do that ? Thanks.
    Lucy

    Mike,
    It's correct to make 5 pages as a seperate component.
    I am developing an accounting system using PeopleTools by myself.
    Because you understand PeopleSoft financial application, please tell me the 2 questions as follows:
    First, In Journal Line page, when select "edit Journal" and click button "process", the system check the Journal against Budget, if it's Ok, the System assign Journal ID for the Journal and put "valid" into the field of "Budget Status" and "Journal Status" in Total page. If it's not OK, the system send error message into Error page. Do you know how developer do that ?
    Second, In Journal Line Page, when select "Submit Journal" and click button "process", the system send the Journal to Approval page for approval. Do you know how developer do that ?
    Lucy

  • How to put text line just for a moment ?

    Hi,
    Do you know how to put a text line  just  for one photo? I mean I have more photos  in one portfolio but i need the text line to be seen just for one photo for the others no.
    Thank you in advance.

    You can use composition for this , where you can insert text frame for that specific photo where you want to add some description and for rest dont use text frame.
    Thanks,
    Sanjit

  • How to put separator lines in menu items in a gui status ?

    Hi,
    I have created gui status for my z transaction
    I need the separator lines in the menu items like it is seen in std transactions
    For example, in any screen , in the Help menu, we can see the following.
    Application Help
    SAP Library
    Glossary
    (line)
    Release notes
    (line)
    SAP Service Marketplace
    could you please help me how to put the lines ?
    thanks

    Hi,
    Goto Your GUI status.click on your  MENU bar.
    under the menu bar you will have your own menu items.
    where ever you want separator line  do the following way.
    you will have 2 columns under menu bar
    1) code
    2) text.
    under code dont put anything.
    but under text column you put dashes and enter or select right click there and choose separator line.
    you will get separator line.
    activate and run the ztcode.you will get .
    code                                            text
    Application Help                         
    SAP Library
    Glossary
    Release notes
    SAP Service Marketplace
    Thanks
    Parvathi

  • I have an ipod touch and i put cds on itunes on my pc , but i cant figure out how to put the music from the cds on my ipod .. can u help me ?

    i have an ipod touch and i put cds on itunes onmy computer , but i cant figure out how to put the music from the cds on my ipod touch can anyone help me?

    ok i select th e music from my music libary and go to file and click sync to my ipod and when it gets to step 3.. it says waiting for changes to be made.. yes the songs play on the itunes ..  and no it wasnt the same computer i used last time

  • Can't figure out how to PUT

    First off, I'm a Newbie to Dreamweaver. So. I'm in a real
    learning phase.
    I can't figure out how to "Put" my development file to my web
    Server. I have an ftp connection. At least I think I do since I
    have file list that seems to be pointing to the files I have on
    webserver. I manually copied my files from my development folder to
    my web server. Now I want to use Dreamweaver to put my files and
    then I want to have Dreamweaver manage my file so that next time I
    one have to upload my "Changed" files. I searched Dreamweaver Help
    and didn't understand what I read. Sorry..
    Appreciate any help you can give me, or point me to somewhere
    on the web that my a step by step procedure.
    Thanks....

    Please tell me this - when you look at the name of the site
    in the drop-down
    list of defined sites on the left top of the Files panel, do
    you see a
    folder icon, or a little computer icon?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "bruceaj" <[email protected]> wrote in
    message
    news:epr3mt$4mu$[email protected]..
    > First off, I'm a Newbie to Dreamweaver. So. I'm in a
    real learning phase.
    >
    > I can't figure out how to "Put" my development file to
    my web Server. I
    > have
    > an ftp connection. At least I think I do since I have
    file list that seems
    > to
    > be pointing to the files I have on webserver. I manually
    copied my files
    > from
    > my development folder to my web server. Now I want to
    use Dreamweaver to
    > put my
    > files and then I want to have Dreamweaver manage my file
    so that next
    > time I
    > one have to upload my "Changed" files. I searched
    Dreamweaver Help and
    > didn't
    > understand what I read. Sorry..
    >
    > Appreciate any help you can give me, or point me to
    somewhere on the web
    > that
    > my a step by step procedure.
    >
    > Thanks....
    >

  • How to put Video/DVD/games/eBook to Nokia

    Nokia phone still the NO.1 of all the phones, As a fan to Nokia phone, I want to share with you some tips to play Nokia. Only some experience of play Nokia phone, just enjoy it.
    This guide will show you how to put videos to Nokia, DVD to Nokia, games to Nokia and eBook to Nokia.
    1 How to convert DVD/Video to Nokia
    2 How to free download games to Nokia
    3 How to put eBook to Nokia
    1 How to convert Video/DVD to Nokia
    After you download [url=http://www.daniusoft.com/dvd-to-nokia-suite.html]Daniusoft DVD to Nokia Suite[/url], you may find there are two options for you to choose for DVD to Nokia or Video to Nokia.
    1 Run “DVD to Nokia Converter” to load Daniusoft DVD to Nokia Converter.
    Insert your DVD disc into your DVD-Rom. Click “Load DVD” button to add the DVD file. You can also click “Load File” to add DVD/IFO from your hard disk.
    [img]http://www.daniusoft.com/article-image/nokia/dvd-nokia.jpg[/img]
    A regular DVD movie has several titles, by default, this software will merge all the DVD chapters into one video clips, you can check the click box before the title list to select any DVD clips you want to rip. Then just check the box “Merge into one file” to join file.
    2 Open the drop download list to choose the Audio and Subtitle you like, you can also change the output files location.
    3 Click on “Start” button to start the conversion.
    Video to Nokia
    Click “Video to Nokia Converter” to load the Daniusoft Video to Nokia Converter.
    The convert video to Nokia is similar with the operation of convert DVD to Nokia
    “Add” button to load video -> Choose output “format” -> “Start” Convert
    This software supports batch conversion, so you can add several video clips at one time.
    Tips:
    Cut off the black edge of DVD- Click on “Effect” button. Move your mouse cursor to a box on the frame around the video to cut off black edge.
    Control file size- You also click on the “Settings” button to customize the resolution, such as: video bit rate, encoder, frame rate, audio bit rate, channel, etc. This program also lets you create a profile and save it, then you can use different settings for each video clips.
    With the “trim” function, you can trim any segment of videos to convert as you want:
    Edit video effect – Click on “Effect” button. You can Adjust Brightness, Contract, Saturation of the video and the adjust the volume of music.
    2 How to download games to Nokia (Free Nokia Java Games Installation guide)
    Step 1 Download one of the Free Nokia Java Game files to your computer, and unzip the contents to a folder called 'Games' on your desktop.
    Step 2. Download and install Nokia PC Suite
    Step 3. Connect your Nokia to your computer with a cable or Bluetooth Dongle or infra-red cable
    Step 4. Launch the Application Installer and continue. (Tutorial is based on the Nokia 7210)
    Click the Install Application Icon Pictured
    Here is a webpage which contains the games and themes list for Nokia, you may find many useful information here:
    http://www.daniusoft.com//nokia-resource-list.html
    How to transfer between Nokia and computer
    Bluetooth - To send a game to your mobile via Bluetooth. You simply right click the desired theme on your desktop, select Send To/Bluetooth/Nokia 6600
    A new message will arrive on your phone, open it and you will be able to install the new game. Once installed, delete the message and press the menu button and your game will have been added.
    infra red connection cable - Firstly you will need an infra red connection cable. Download the SIS file to your computer. Enable infrared port in your phone. Select your sis file on PC, press right mouse button and select "Send to -> Infrared". The file will arrive as new message. Open Messaging application, then open the message. Installer will be started automatically.
    [img]http://www.daniusoft.com/article-image/nokia/game-nokia.jpg[/img]
    Then go to the folder where your files have been downloaded and unzipped into, and select a game folder. For this tutorial we are going to install Blackjack, because we have a gambling problem Double click the Blackjack folder.
    Now you will see the all important Blackjack.jad file double click it to download it to your Nokia 7210
    Wait until the installation process has finished (indicated below). Blackjack is now installed and you can gamble to your hearts content
    3 How to read eBook on Nokia
    1 Download and install the Ebook for Nokia to use as your eBook reader.
    2 Download the Doc or TCR version of an eBook (perhaps Frankenstein).
    3 Transfer the downloaded file to your phone in the standard way.
    Recommended eBooks:
    1 eReader http://www.ereader.com/product/detail/18841?refid=45377
    Formats: eReader, Doc.
    2 MicroReader http://home.c2i.net/thvoslef/midlets/mrinfo.html
    For java-enabled Siemens mobile phones.
    Formats: Doc, TCR, text. Freeware.
    3 ReadM http://my-symbian.com/7650/applications/applications.php?faq=18&fldAuto=347
    Formats: Doc, TCR, and gzipped text files. Freeware.
    4 eBook for Nokia http://www.geocities.com/ebooknokia/
    Formats: Doc, TCR, text, and HTML. Freeware.
    5 iSilo http://www.isilo.com/
    iSilo reads Doc eBooks in addition to its own iSilo format, and it's very easy to convert text, HTML, or DOC files into an iSilo document using free desktop tools.
    Formats: Doc and iSilo.

    Re: Ebooks
    Your explanation for adding ebooks to the phone:
    "3 How to read eBook on Nokia
    1 Download and install the Ebook for Nokia to use as your eBook reader.
    2 Download the Doc or TCR version of an eBook (perhaps Frankenstein).
    3 Transfer the downloaded file to your phone in the standard way."
    Well the only way I know how to put ANYTHING on there is ZOON and ZOON DOES NOT HAVE AN OPTION IN IT FOR EBOOKS THAT I CAN SEE.  
    How is "IN THE STANDARD WAY" supposed to be of any use or help to me whatsoever when STANDARD WAY FOR EBOOKS IS NOT EVIDENT TO ME???

  • How to put two ipods on one computer

    how to put two ipods on one computer

    Set up the second exactly the same way as you set up the first. If iTunes is already installed, it doesn't need to be installed again.
    (64746)

  • How do you transfer the content from an iPhone to a PC? I have to use a PC for a while and don't know how to put my stuff on to there from my phone

    How do you transfer the content from an iPhone to a PC? I have to use a PC for a while and don't know how to put my stuff on to there from my phone

    If you're talking about music and movies an i-device was not designed for unique storage of media. It is not a backup device and media transfer was planned with you maintaining a master copy of your media on a computer which is itself properly backed up against loss. Syncing music and movies is one way, computer to device, updating the device content to the content on the computer, not updating or restoring content on a computer. The exception is iTunes Store purchases which can be transferred from a device to a computer.
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer - http://support.apple.com/kb/HT1848 - only purchases from iTunes Store
    For transferring other items from an i-device to a computer you will have to use third party commercial software.  See this document by turingtest2: Recovering your iTunes library from your iPod or iOS device - https://discussions.apple.com/docs/DOC-3991

  • How Can I set up a JTable columns?

    Dear All,
    How can I set up my JTable columns to have the amount the user specifies?
    for example when the user types in 50 in JTextField 1 I want the JTables columns to then set to 50.
    How can this be done?
    Thanks
    lol
    import javax.swing.*;
    import javax.swing.table.TableModel;
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    public class si1 extends javax.swing.JFrame implements ActionListener {
        JTextField name = new JTextField(15);
        JTextField name1 = new JTextField(15);
        public si1() {
            super("DataBase Loader");
            setSize(1025,740);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JPanel pane = new JPanel();
            JPanel pane1 = new JPanel();
            JPanel pane2 = new JPanel();
            JPanel pane3 = new JPanel();
            JPanel pane4 = new JPanel();
            pane.setLayout(new GridLayout(20,1));
            pane1.setLayout(new BorderLayout());
            int j=10;
            String[][] data = new String[j][2];
            for (int k=0; k<j; k++){
               String[] row = {"",""};
               data[k] = row;
            String[] columnNames = {"First Name", "Last Name"};
            JTable perstab = new JTable(data, columnNames);
            perstab.setGridColor(Color.yellow);
            perstab.setPreferredScrollableViewportSize(new Dimension(500,500));
            JScrollPane scrollPane = new JScrollPane(perstab);
            pane1.add(new JPanel(), BorderLayout.EAST);
            JButton btn = new JButton("What are the names?");
            btn.addActionListener(this);
            btn.putClientProperty("DATABASE", perstab);
            pane1.add(new JPanel().add(btn), BorderLayout.SOUTH);
            pane2.add(name);
            pane3.add(name1);
            pane.add(pane2);
            pane.add(pane3);
            pane1.add(pane, BorderLayout.WEST);
            pane4.add(scrollPane);
            pane1.add(pane4, BorderLayout.CENTER);
            setContentPane(pane1);
            show();
        public static void main(String[] args) {
            si1 frame = new si1();
            frame.setVisible(true);
        public void actionPerformed(ActionEvent e) {
            JTable table = (JTable)((JButton)e.getSource()).getClientProperty("DATABASE");
            TableModel model = table.getModel();
            int count = model.getRowCount();
            String[] firstnames = new String[count];
            String[] lastnames = new String[count];
            for (int i=0; i < count; i++) {
               firstnames[i] = (String)model.getValueAt(i, 0);
                System.out.println("first name at row " + i + ": " + firstnames);
    lastnames[i] = (String)model.getValueAt(i, 1);
    System.out.println("lastname name at row " + i + ": " + lastnames[i]);

    As you can see I have tried this, but no success.
    If I am doing something wrong please accept my apology, and address me in the right direction.
    Thanks
    Lol
    import javax.swing.*;
    import javax.swing.table.TableModel;
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    public class si1 extends javax.swing.JFrame implements ActionListener {
        JTextField name = new JTextField(15);
        JTextField name1 = new JTextField(15);
        public si1() {
            super("DataBase Loader");
            setSize(1025,740);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JPanel pane = new JPanel();
            JPanel pane1 = new JPanel();
            JPanel pane2 = new JPanel();
            JPanel pane3 = new JPanel();
            JPanel pane4 = new JPanel();
            pane.setLayout(new GridLayout(20,1));
            pane1.setLayout(new BorderLayout());
            int j=10;
            String[][] data = new String[j][2];
            for (int k=0; k<j; k++){
               String[] row = {"",""};
               data[k] = row;
            String[] columnNames = {"First Name", "Last Name"};
            JTable perstab = new JTable(data, columnNames);
         ((DefaultTableModel)perstab.getModel()).setColumnCount(Integer.parseInt(name.getText()));
            perstab.setGridColor(Color.yellow);
            perstab.setPreferredScrollableViewportSize(new Dimension(500,500));
            JScrollPane scrollPane = new JScrollPane(perstab);
            pane1.add(new JPanel(), BorderLayout.EAST);
            JButton btn = new JButton("What are the names?");
            btn.addActionListener(this);
            btn.putClientProperty("DATABASE", perstab);
            pane1.add(new JPanel().add(btn), BorderLayout.SOUTH);
            pane2.add(name);
            pane3.add(name1);
            pane.add(pane2);
            pane.add(pane3);
            pane1.add(pane, BorderLayout.WEST);
            pane4.add(scrollPane);
            pane1.add(pane4, BorderLayout.CENTER);
            setContentPane(pane1);
            show();
        public static void main(String[] args) {
            si1 frame = new si1();
            frame.setVisible(true);
        public void actionPerformed(ActionEvent e) {
            JTable table = (JTable)((JButton)e.getSource()).getClientProperty("DATABASE");
            TableModel model = table.getModel();
            int count = model.getRowCount();
            String[] firstnames = new String[count];
            String[] lastnames = new String[count];
            for (int i=0; i < count; i++) {
               firstnames[i] = (String)model.getValueAt(i, 0);
                System.out.println("first name at row " + i + ": " + firstnames);
    lastnames[i] = (String)model.getValueAt(i, 1);
    System.out.println("lastname name at row " + i + ": " + lastnames[i]);

  • How to put scrol bar in table viw control in module pool programming

    how to put scrool bar in table-view control in module pool programming

    Hi Rani,
       You need not insert Scrollbar in the table control, it appears automcatically once the amount of data vertical or horizontal limit of table control.
    Regards,
    Sathish
    Note : Reward useful Answers

  • I forgot my password for my apple ID. Any ideas on how to put in a new one without knowing the old one?

    I forgot my password for my Apple ID. Anyone have a solution on how to put in a new one without knowing the old one?
    Thanks

    Welcome to Apple Support Communities
    You have to reset your password. You can do this in this site > http://iforgot.apple.com

Maybe you are looking for

  • How to remove control chars from clob, prior to creating xmltype

    Hi, I am struggling with what should be really straightforward ... I have a simple program that takes an xml file stored in a clob column and attempts to convert it into an xml type. The program is declare      v_xml xmltype;      v_jobs_clob clob :=

  • How to change the initial value of the list.

    Hi, I have to change the initial value of the list.In the 'When-new-block instance' trigger, i wrote the following: set_item_property(list_id,initial_value, '2000'); But when I run the form, it says this property is not recognised. I need to change t

  • New fix for Podcasts app

    Hello, After a long period of bad problems with Podcasts app, I finally got it right. This is a fix so simple to do that most people will do it wright first time. There is no need to call your Mac Geek friend to help you. This fix solves all problems

  • Need help with .cr2 RAW-files

    Hi, I've installed Aperture 2.1.2, and the newest RAW compability update (2.5). However, when I try to work with RAW files from my Canon EOS 1000D camera (nothing big, I know), all I see is "Unsupported image format". I really need help with this qui

  • Email issues with Pantech Breakout

    I wonder if anyone else has had this problem.  I got my Pantech Breakout about 3 months ago or so.  After having it for a bit, I set up my email on it.  About 3 weeks ago it was time to change my password for my SBC Global/Yahoo email account and I d