Home Answers Viewqa Swing-AWT jcheckbox in jtable does nothing when clicking on it

 
 


tejas
jcheckbox in jtable does nothing when clicking on it
0 Answer(s)      8 months ago
Posted in : Swing AWT

my table model is as follows

public class MyTableModel implements TableModel {

ArrayList<PersonDTO> list=new ArrayList<PersonDTO>();

String headerName[]={"checkbox","student_id","name"};

    public MyTableModel(ArrayList<PersonDTO> list) {
        this.list=list;  
    }


    @Override
    public int getRowCount() {
        //throw new UnsupportedOperationException("Not supported yet.");
        System.out.println(list.size());
         return list.size();

    }

    @Override
    public int getColumnCount() {
        //throw new UnsupportedOperationException("Not supported yet.");
       // System.out.println(headerName.length);
        return headerName.length;
    }

    @Override
    public String getColumnName(int columnIndex) {
        //throw new UnsupportedOperationException("Not supported yet.");
       // System.out.println(headerName);
        return headerName[columnIndex];


    }

    @Override
    public Class<?> getColumnClass(int columnIndex) {
        //throw new UnsupportedOperationException("Not supported yet.");
        switch(columnIndex)
        {
            case 0:
                return JCheckBox.class;
                //return JCheckBox.class;
            case 1:
                return Integer.class;
            case 2:
                return String.class;


        }
        return null;
    }

    @Override
    public boolean isCellEditable(int rowIndex, int columnIndex) {
       // throw new UnsupportedOperationException("Not supported yet.");
         return  true;

    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        //throw new UnsupportedOperationException("Not supported yet.");
        PersonDTO personDTO=list.get(rowIndex);
         switch(columnIndex)
        {
            case 0:
               //System.out.println(personDTO.isCheckbox());
              return personDTO.getCheckBox();
                //return new JCheckBox();

            case 1:
                //System.out.println(personDTO.getName());
                return personDTO.getUserId();
            case 2:
                return personDTO.getName();


        }
        return null;
    }

    @Override
    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
        //throw new UnsupportedOperationException("Not supported yet."); 

    }

    @Override
    public void addTableModelListener(TableModelListener l) {
       // throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void removeTableModelListener(TableModelListener l) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

}
View Answers









Related Pages:
jcheckbox in jtable does nothing when clicking on it
jcheckbox in jtable does nothing when clicking on it  my table model is as follows public class MyTableModel implements TableModel...(); //return new JCheckBox(); case 1: //System.out.println
TristateCheckBox based on the Swing JCheckBox - Java Tutorials
to grab focus when the next state is entered, * otherwise clicking...TristateCheckBox based on the Swing JCheckBox   2003-12-02 The Java Specialists' Newsletter [Issue 082] - TristateCheckBox based on the Swing JCheckBox
JCheckBox
to the above, but gets the state of the checkbox when the value is needed. JCheckBox... Java: JCheckBox Description A JCheckBox shows a small box that is either marked or unmarked. When you click on it, it changes from
jcheckbox
jcheckbox  How to insert value into database from jcheckbox using java swing
JTable
JTable  Values to be displayed in JTextfield when Clicked on JTable Cells
JTABLE Issue
JTABLE Issue  Hi Eveyone, I am developing a small application on Swing-AWT. I have used JTABLE to show data. There is "input field" and "search button " on a frame , by clicking this search button data will be retrived from DB
jtable
jtable  how to get the values from database into jtable and also add a checkbox into it and then when selected the checkbox it should again insert into database the selected chewckbox.plzz help
jtable
jtable  hi Sir i am working netbeans IDE,I have a jtable when i insert values in jtable then i am unable to print all inserted values,For eg if i insert 1,2,3,4,5,6,7,8 values then , i am getting output
JTable
JTable  Hi I have problems in setting values to a cell in Jtable which is in a jFrame which implements TableModelListener which has a abstract method tableChanged(TableModelEvent e) . I'll be loading values from data base when
How to show multiple identicle rows from database on clicking search button to jtable
How to show multiple identicle rows from database on clicking search button... .when i enter search value in the search field only one row is displayed in the jtable .Suppose i enter name in search field which has two rows in the database
How to show multiple identicle rows from database on clicking search button to jtable
How to show multiple identicle rows from database on clicking search button... .when i enter search value in the search field only one row is displayed in the jtable .Suppose i enter name in search field which has two rows in the database
How to show multiple identicle rows from database on clicking search button to jtable
How to show multiple identicle rows from database on clicking search button... .when i enter search value in the search field only one row is displayed in the jtable .Suppose i enter name in search field which has two rows in the database
How to Display an alert message when nothing is selected in jspinner in java?
How to Display an alert message when nothing is selected in jspinner in java... a message when nothing is selected. My initial value is 0 min value = 0 max value = 200 so when the application is running it displays the jspinner
How to read and retrieve jtable row values into jtextfield on clicking at particular row ...
How to read and retrieve jtable row values into jtextfield on clicking... application in which i have to display database records in jtable .now I want... that in textfield below the jtable. plz sir give me the code.... Thank you Sir
JTable Cell Validation? - Swing AWT
JTable Cell Validation?  hi there please i want a simple example of JTable with 3 columns Name,Number,Price and the first columns is string... or leave the cell empty nothing happens(the value still as it was) thank you all 
Multi-line cells in the JTable - Java Tutorials
the JTextArea, as in cell (0, 2). However, the JTable does not increase the row...Multi-line cells in the JTable 2002-04-11 The Java Specialists' Newsletter [Issue 045] - Multi-line cells in the JTable Author: Dr. Heinz M. Kabutz
Creating a JTable Component
Creating a JTable Component       Now you can easily create a JTable component. Here, the procedure for creating a JTable component is given with the brief description
This JDK Tutorial shows you how to wrap text inside cells of a JTable
JDK Tutorial - Multi-line cells in JTable in JDK 1.4+ This JDK Tutorial shows you  how to wrap text inside cells of a JTable. 2005-04-14 The Java Specialists' Newsletter [Issue 106] - Multi-line cells in JTable in JDK 1.4
SplitButton of dropdownbutton invisible when mouse clicking - Swing AWT
SplitButton of dropdownbutton invisible when mouse clicking  click the SplitButton of dropdownbutton, when dropdownmenu willbe displayed. but this is not disabled when mouevent performed on the jpanel how to disabled or hide
Setting Tool Tips on Cells in a JTable
Setting Tool Tips on Cells in a JTable   ... the tool tips in the cells in a JTable component. So, you will be able to know... message or given references in string format taken by the pointer, when the mouse
regarding JTable - JDBC
regarding JTable  how to populate a JTable with mysql data after clicking JButton please explain with the example
First Program - Do Nothing
// Description: This is the smallest program. It does NOTHING. // File: doNothing... Prev: none | Next: Dialog Box Output Java NotesFirst Program - Do Nothing Here is just about the smallest legal program you can write. It starts up, does
problem with JTable - Swing AWT
to swings.i was having an assignment like i need to create a JTable... an action event such that if i check the checkbox outside the JTable,all the checkboxes inside the JTable should be checked. details: for creating JTable
import package.subpackage.* does not work
import package.subpackage.* does not work  I have 3 class files...(); } } When i am compiling the above 3 class, i am getting an error message like...: cannot access A bad class file: .\A.java file does not contain class A Please remove
JTable - Java Beginners
JTable search example  I've problem about JTable, i wan to search records when i types words in JTable cell,can u give the source code.I'm Beginner and i start begins learning java programming.Please send the example into my
jtable query compare with date
jtable query compare with date  how to transfer daytable data to monthtable when complete a month
Java: Adding Row in JTable
Java: Adding Row in JTable   how about if we already have the JTAble created earlier. And i just found nothing to get its DefaultTableModel, thus, I can't call insertRow() method. Is there any work around for this? I found
How to insert rows in jTable?
How to insert rows in jTable?  Hi, I need to take input from user using JTable. I want an empty row to appear after clicking a insert button. The values will be entered in this empty row. I have searched on this but could
Hide text by clicking button
Hide text by clicking button In this tutorial, we will discuss about hide/show text by clicking on button. In the below example, there are two buttons... button " is used to show text. These actions are fired when "
JTable with Date Picker
JTable with Date Picker  Hi, I'd like to implement the following but I have no idea where to start: I have a JTable with 1 column containing Date... that i'd like to pop up when this cell is clicked and allowing the user to select
jtable query compare with date
jtable query compare with date  how to transfer daytable data to monthtable when complete a month Hello Sir, I am developing a desktop application in which i have to display database records in jtable .now I want to transfer
jtable query compare with date
jtable query compare with date  how to transfer daytable data to monthtable when complete a month Hello Sir, I am developing a desktop application in which i have to display database records in jtable .now I want to transfer
jtable query compare with date
jtable query compare with date  how to transfer daytable data to monthtable when complete a month Hello Sir, I am developing a desktop application in which i have to display database records in jtable .now I want to transfer
JTable populate with resultset.
JTable populate with resultset.  How to diplay data of resultset using JTable?   JTable is component of java swing toolkit. JTable class is helpful in displaying data in tabular format. You can also edit data. JTable
Compose mail by clicking on send mail button
Compose mail by clicking on send mail button  How i get microsof out look page opend for composing mail by just clicking on send mail button and when outlook page open then in to:my email id is written on my jsp page
JTable - Java Beginners
JTable Search Filter  Hi,i wanted to add a search filter in my JTable application.Thanks in Advance!!  i'means using database access,when enter button on the keyboard i press the cell focus and when i type name's james
jtable-adding a row dynamically
jtable-adding a row dynamically  hi..i am doing a project for pharmacy .. *pblm:* when i want to enter the details in jtable while running the application there are 3 rows and 4 columns which is default bt when we we have
JTable
JTable  i want to delete record from JTable using a MenuItem DELETE. and values of JTable are fetched from database....please reply soon
JTable
JTable   how to select a definite cell which containing a similar text containg to the one which the user entering from a jtable at runtime in java
JTable values are not gettiing properly
JTable values are not gettiing properly  Sir, I created one JTable... but not 9.i.e a[0][0]=8 a[0][1]= (nothing printed) Please go through my code... details JTable table=null; JScrollPane js=null; Container cp=null; JPanel p=null
Should not logout after clicking the back/forward button
Should not logout after clicking the back/forward button  Hi all I have wrote a code for login now. User is able to login but after logging in when he clicks on the back button user automatically gets logged out. very next
Object does not support proprty or method
Object does not support proprty or method  Hi I have been given some HTML code which works on a stand alone machine but when I open the page on a network machine it returns a error which say's Object does'nt support this property
Hide boxes by clicking on it using jQuery
Hide boxes by clicking on it using jQuery In this tutorial , we will discuss about how to hide boxes by clicking on it using jQuery. In the given below example , 30 boxes inside web page are displayed. When we click on any box (among
jtable combo - Java Beginners
jtable combo  i am using jtable (using defaulttablemodel) ,when i am click on a particular cell of jtable i want to display the combo box...); JTable table = new JTable(model); TableColumnModel tcm = table.getColumnModel
update a JTable - Java Beginners
update a JTable   i have tried your advice as how to update a JTable... main(String args[]) { JTable table; Connection con = null..."); ResultSetTableModel model = new ResultSetTableModel(rs); table = new JTable(model
JTable - Java Beginners
. my problem is with Jtable, sometimes it is visible and sometimes it is not. when i hit show all button it is not visible to me, but when i hit maximize buttton...JTable  Hi, I have some problem with JTable. On show All button hit
JTable
JTable  need to add values to a JTable having 4 coloumns ,2 of them are comboboxes
search filter and JTable
my question is: how can i make search data in JTable of java? i wan to search records in table or textfield but the data display in JTable. Note: i dont...","Contact No","Email"}; JTable table=new JTable(data,labels
JTable
JTable  Hello, i cannot display data from my table in the database to the cells of my JTable. please help me
JTable - Java Beginners
JTable  Hi sir, i have used the code line you have given me in my project code: col.setPreferredWidth(1); but sir it does not increase the width...(); stat3.close(); JTable table = new JTable(data, columnNames