Boolean checkboxes in cells...

Hi,
I wonder if it is possible to insert boolean checkboxes into excel cells containing text and have a button concenate text from checked cells together afterwards.  Example:
Cell a1='This is cell A1,'
Cell b1= Checkbox unchecked & 'here is Cell B1'
Cell c1 = Checkbox checked & 'here is Cell C1'
When clicking the button, cell A20 should display: This is cell A1, here is Cell C1' (because ell C1 is checked and B1 is unchecked.
How would I do this in excel?
regards Tor

Insert three checkboxes from the control toolbar, place them over or near the cells, and name them
CheckBoxA1, CheckBoxB1, and CheckBoxC1
Then use code like this:
Sub TestMacro()
Dim strVal As String
strVal = ""
If ActiveSheet.CheckBoxA1.Value Then strVal = strVal & " " & Range("A1").Value
If ActiveSheet.CheckBoxB1.Value Then strVal = strVal & " " & Range("B1").Value
If ActiveSheet.CheckBoxC1.Value Then strVal = strVal & " " & Range("C1").Value
MsgBox Application.Trim(strVal)
End Sub
You can also replace ActiveSheet with a named sheet or sheet's codename

Similar Messages

  • To display a VARCHAR field in database as select boolean checkbox

    Hi,
    i have a table in database having a VARCHAR2(1) field named IsActive with value 'Y' or 'N' , I need to display this field as select boolean check box in the JSF page
    using ADF Entity Object and ViewObject. We have followed the following method for displaying this field as select boolean check box.
    1. Changed the datatype of the IsActive field in the Entity Object as Boolean and the database column type as Varchar2(10)
    2. we have edited the query using case when IsActive='Y' then 1 else 0 end .
    3.and converted the IsActive inputtext to select boolean checkbox.
    Thus we where able to display this field as select boolean check box but the problem is that we where not able to insert the data as 'Y' or 'N' using this method.
    Please help us whether the method we are following is correct or is there any other method to insert and display the similar fields like IsActive as select boolean check box in ADF
    Thanks in Advance
    Anitha

    Anitha,
    Create a transient boolean attribute on your EO. Write the getter to return true/false if the real attribute is Y/N. Write the setter to do the converse. Bind the transient attribute to the checkbox.
    John

  • Trapping the selected row in the table using boolean checkbox

    Hi,
    I am using Jdev 11.1.1.2.0 with ADF 11g.
    I have a screen that has a table with an additional column of 'Select boolean checkbox'. I have assigned a valuechangelistener method that helps me know which row has been selected. But the issue is it gets fired for all the rows in the table once I select/de-select a checkbox of 1 single row.
    How can I handle this? Yes I can iterate through the table rows and check the values of the checkbox. But that is not I want, I also want to trap the de-select event.
    What is the way to achieve this?

    Timo Hahn wrote:
    I don't see a bug in this behavior. This is because each row gets stamped when they render.
    The way to do this is to use an attribute (which can be transient) to hold the status of the check box. Exactly this does the link I gave.
    TimoHi,
    Why I am saying it as a bug is because it is not firing the event for the record where the event has occurred. instead the event is fired for each row which should definitely not what is expected. And because of this we have to add an additional variable.
    Now it becomes more complex if I have to handle de-selection as well, b'coz if the valuchangelistener is going to fire for all the records then I need to know which row was previously selected and now de-selected as now the de-selected record will also return a false.
    So any better solution, anyone?

  • How can only one Checkbox can be Selected in Table with Boolean CheckBoxes?

    I have an editable ADF table where one of the attributes is a Boolean Checkbox... and stores the value with Y or N.
    Is there any way where only one checkbox should be selected at the time of commit ?
    For example, in case its an Answers Table to a Single Choice Question of a Questionnaire application, while adding new answers to the table..., the user inserts 3 rows (answers)... then the boolean checkbox for only one of those 3 rows can be checked.
    Thanks
    DJ

    Thanks... I tried it by writing some code ... But it doesn't seem to work. Can you please have a look... and make the changes.
    public class checkBean {
    public void validateCheck(LaunchEvent launchEvent){
    BindingContext bctx1 = BindingContext.getCurrent();
    DCDataControl dc1 = bctx1.findDataControl("QuestionnaireAMDataControl");
    ApplicationModule service1 = (ApplicationModule)dc1.getDataProvider();
    ApplicationModule am1 = service1.findApplicationModule("QuestionnaireAM");
    ViewObject vo1 = am1.findViewObject("QuestionVO");
    String newValue = (String)vo1.getCurrentRow().getAttribute("QuestionTypeId");
    if(newValue.equals("10881")){
    System.out.println("Inside single");
    BindingContext bctx = BindingContext.getCurrent();
    DCDataControl dc = bctx.findDataControl("QuestionnaireAMDataControl");
    ApplicationModule service = (ApplicationModule)dc.getDataProvider();
    ApplicationModule am = service.findApplicationModule("QuestionnaireAM");
    ViewObject vo = am.findViewObject("QuestionResponseVO");
    int numRows;
    int j=0;
    numRows = vo.getRowCount();
    String rowValue = "a";
    int k = vo.getCurrentRowIndex();
    for (int i=0; i<numRows; i++){                   
    rowValue = (String)vo.getCurrentRow().getAttribute("CorrectResponseFlag");
    if(rowValue.equals("Y")){                           
    j++;
    if(j>1)
    System.out.println("same rows exist");
    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "Two correct respones!");
    FacesContext.getCurrentInstance().addMessage(null, msg);
    k++;
    vo.next();
    Thanks
    DJ

  • How to use a checkbox table cell in FXML

    I've figured out how to make a column in a TableView render as a checkbox rather then just text when the UI is written in Java. Now I'm trying to figure out how to do the same thing with FXML. I've tried a couple experiments which have all failed, usually with an exception complaining that it can't coerce a table cell class type (or extension) to an interface (i.e. Callback).
    Right now I'm just trying to make one of the columns be a checkbox. I'm not trying to use any custom type. In other words, in Java I would have done the following:
    TableColumn<MyModel, Boolean> col1 = new TableColumn<MyModel, Boolean>();
    col1.setCellValueFactory(new PropertyValueFactory<MyModel, Boolean>("col1Field"));
    col1.setCellFactory(CheckBoxTableCell.forTableColumn(col1));This works when I build the UI using Java API calls. Does anyone know how to do this in FXML?

    Thank you both.
    I used Luca's suggestion as a first step.
    You'll find attached my v.i. that enables me to do what I wanted. It finally works as I expected. It would have been much simpler if my DAQ was able to measure directly a resistance!
    Loris
    Attachments:
    banc_de_test_température.vi ‏205 KB

  • Boolean Checkboxes in Advanced Search

    Hi all,
    I'm trying to use a checkbox in the "Advanced Search Area", but appearantly, you can't use a Java type 'Boolean' in the "Advanced Search Area". What's the reason for that? And is there a workaround?
    If you make the checkbox any other type than 'Boolean', you need to specifiy a domain. But I don't want a domain, I just want it to pass on 'true' or 'false'. How can you pass a JSPX checkbox value (in the "Advanced Search Area") to a VO binding variable?
    Thanks in advance,
    Stijn.

    Stijn, this is intentional, see section 6.9 of the JHeadstart Developers Guide.
    Steven Davelaar,
    JHeadstart Team.

  • ADF 11g + Select Boolean CheckBox becomes readonly

    Hi All,
    I have a view object, in which I added a transient attribute called as "InActive". And I added this VO as an ADF:Table on to the JSPX page.
    1) My requirement is that if the other column called "EndDate" got any value ( any date value) then the "InActive" checkbox need to be autoselected.
    And the users have the option of the de-selecting it.
    2) The requirement is such a way that based on this "EndDate" column we are assuming that the current row/records is active or inactive in database.
    So using this checkbox attribute, if the checkBox is selected for the row, then we are setting the "EndDate" column with "sysdate" and if they are unselecting any exisiting
    checkbox, the same row will get updated with "EndDate" to null. Every thing is working fine for me with the code I have.
    3) The road block I'm facing here is that I'm setting the attribute 'selected="#{row.EndDt != null ? true : false}" '. This is properly setting the checkbox "Inactive" values based on the "EndDate" column from the
    database. But the entire check box column becomes read only, which does not allow me to edit.
    4) If I set the value expression for the "Inactive" transient boolen attribute at the VO level, with the following as the value expression: 'EndDt != null ? true : false', if also sets the checkbox values properly, and moreover
    the check box also editable, which is what we are expecting, but on submission of the page, the checkbox attribute is still pointing to the old/default value even though we change the value of the checkbox.
    For example if the checkbox was got selected on load of the page, and if I unselects, and submits, it still shows that checkbox value as true.
    So it would be greatly help ful to me if some one can provide me any hint on this.
    Below is the code snippet I'm using for this in backing bean to process the logic.
    int totalRows = this.t1.getRows();
    ArrayList InactivatedrowIndexes = new ArrayList();
    ArrayList ActivatedrowIndexes = new ArrayList();
    for (int i = 0; i < totalRows; i++) {
    JUCtrlHierNodeBinding rowData =
    (JUCtrlHierNodeBinding)this.t1.getRowData(i);
    Boolean check = (Boolean)rowData.getRow().getAttribute("Inactive"); // Inactive is the transient boolean attribute in VO - which has the value expression as EndDt != null ? true : false
    if (check == true) {                         
    InactivatedrowIndexes.add(i);
    if (check == false) {                         
    ActivatedrowIndexes.add(i);
    System.out.println("******The row indexes to inactivate are: " +InactivatedrowIndexes);
    System.out.println("******The row indexes to activate are: " +ActivatedrowIndexes);
    Thanks & Regards,
    Dharmathej M

    Hi All,
    I have a view object, in which I added a transient attribute called as "InActive". And I added this VO as an ADF:Table on to the JSPX page.
    1) My requirement is that if the other column called "EndDate" got any value ( any date value) then the "InActive" checkbox need to be autoselected.
    And the users have the option of the de-selecting it.
    2) The requirement is such a way that based on this "EndDate" column we are assuming that the current row/records is active or inactive in database.
    So using this checkbox attribute, if the checkBox is selected for the row, then we are setting the "EndDate" column with "sysdate" and if they are unselecting any exisiting
    checkbox, the same row will get updated with "EndDate" to null. Every thing is working fine for me with the code I have.
    3) The road block I'm facing here is that I'm setting the attribute 'selected="#{row.EndDt != null ? true : false}" '. This is properly setting the checkbox "Inactive" values based on the "EndDate" column from the
    database. But the entire check box column becomes read only, which does not allow me to edit.
    4) If I set the value expression for the "Inactive" transient boolen attribute at the VO level, with the following as the value expression: 'EndDt != null ? true : false', if also sets the checkbox values properly, and moreover
    the check box also editable, which is what we are expecting, but on submission of the page, the checkbox attribute is still pointing to the old/default value even though we change the value of the checkbox.
    For example if the checkbox was got selected on load of the page, and if I unselects, and submits, it still shows that checkbox value as true.
    So it would be greatly help ful to me if some one can provide me any hint on this.
    Below is the code snippet I'm using for this in backing bean to process the logic.
    int totalRows = this.t1.getRows();
    ArrayList InactivatedrowIndexes = new ArrayList();
    ArrayList ActivatedrowIndexes = new ArrayList();
    for (int i = 0; i < totalRows; i++) {
    JUCtrlHierNodeBinding rowData =
    (JUCtrlHierNodeBinding)this.t1.getRowData(i);
    Boolean check = (Boolean)rowData.getRow().getAttribute("Inactive"); // Inactive is the transient boolean attribute in VO - which has the value expression as EndDt != null ? true : false
    if (check == true) {                         
    InactivatedrowIndexes.add(i);
    if (check == false) {                         
    ActivatedrowIndexes.add(i);
    System.out.println("******The row indexes to inactivate are: " +InactivatedrowIndexes);
    System.out.println("******The row indexes to activate are: " +ActivatedrowIndexes);
    Thanks & Regards,
    Dharmathej M

  • Boolean checkbox.

    hi..
    am using jdev11.1.2.2 ver
    my jsp page contains one table...inside that table i have one boolean column...so i want to create checkbox for that column...if it is 'Y' it should select...if it is'N' it should be select please tell me how to create this...

    Suganya,
    Check this out.
    http://andrejusb.blogspot.in/2011/12/adf-tree-how-to-add-checkbox.html
    -Arun

  • Using a checkbox to display a value in another cell

    I want to use a checkbox in cell A1 to display in cell B1 either 0 or a value that's in cell C1. I've tried the IF function, but I keep getting a syntax error. Any ideas?

    How could you do the same thing but using only two cells?
    where the check box returns a specific value in the second.
    in this instance its for a staff registration sheet where a checkbox in (A) would return a set value in (B)
    i know this might sound simple to you guys in the know but i cant figure it out! I have been messing around trying things with the if function but still only shows me the red triangle (syntax error).
    A simple solution would be much appreciated.

  • How can i make a cell set a timestamp when I click a checkbox in numbers for iPad?

    I am trying to make it so that when I click a checkbox, the cell next to it creates a timestamp.  I have very put of practice making spreadsheets, and this new format is giving me a hard time.
    Thanks for your help!

    Under the previous version of Numbers for iOS at least, you could use the loophole/bug in the IF statement that would execute on TRUE, but do nothing if FALSE, if you didn't explicitly set it. This would allow the spreadsheet to have a sense of before and after that would allow for all sorts of time stamping possibilities. In fact, I wrote an entire complex spreadsheet based on this loophole. It worked great!  But I was also aware that Apple would likely close this loophole to make the IF statement conform to their documentation, and sure enough, they did, and now my spreadsheet is utterly useless.
    Maybe I'm just stupid, but with this latest update, I don't see any way to hold a static time stamp. I thought it would be doable by some contorted means, but after several hours, I still haven't come up with anything. Pity, too, because it was quite useful.
    Would someone please tell me how stupid I am.

  • Table component - how to find out which cell is clicked

    Hello!
    I have a couple of questions regarding table component
    1. Is there any way to find out which table cell is clicked on?
    2. And is it possible to paint clicked cell programmatically?
    Possible solution might be a Select Boolean Checkbox inside a cell, but anyway, i'd have to determine which cell contains this checkbox (some kind of cell coordinates, etc...)
    Thank you

    1. Is there any way to find out which table cell is clicked on? It would be easy to suggest the way, if you can share us the requirement
    2. And is it possible to paint clicked cell programmatically?You can do it through javascript by setting contentStyle property.
    Sample Code:
    <af:table ...>
      <af:column>
         <af:inputText ...>
                  <af:clientListener method="paintCurrentCell" type="click"/>
         </af:inputText>
      </af:column>
    </af:table>
    <!-- javascript method -->
    function paintCurrentCell(event){
        event.getSource().setContentStyle("background-color:red");
      }Sireesha
    Edited by: Sireesha Pinninti on Nov 10, 2009 7:01 PM

  • GridControl Cell rendered as either button or combobox depending on data

    I have worked out the following code. If the data has more than one row it will return the words <MORE> in the query. If there is only one row it will return text and if there are no rows the cell is blank.
    The following renders and takes care of the editor. So when you click on either a blank cell or a text cell it will display a comboboxcontrol. If you click on the cell that is a button it will return a joptionpane.
    I thought maybe somebody else would need this.
    Initial code taken from http://www2.gol.com/users/tame/swing/examples/JTableExamples2.html and tweeked for the button.
    package Samples;
    import javax.swing.table.*;
    import javax.swing.*;
    import java.awt.*;
    * A Class class.
    * <P>
    * @author Linda B. Rawson
    public class SampleNameRenderer extends DefaultTableCellRenderer {
    JCheckBox checkBox = new JCheckBox();
    JButton button = new JButton();
    * Constructor
    public SampleNameRenderer() {
    public Component getTableCellRendererComponent(
    JTable table, Object value,
    boolean isSelected, boolean hasFocus,
    int row, int column) {
    if (value instanceof Boolean) { // Boolean
    checkBox.setSelected(((Boolean)value).booleanValue());
    checkBox.setHorizontalAlignment(JLabel.CENTER);
    return checkBox;
    String str = (value == null) ? "" : value.toString();
    if (str.equals("<MORE>") ) {
    button.setText("< MORE >");
    return button;
    return super.getTableCellRendererComponent(
    table,str,isSelected,hasFocus,row,column);
    package Samples;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import oracle.dacf.control.swing.*;
    import javax.swing.event.*;
    import java.util.EventObject;
    import javax.infobus.*;
    * A Class SampleNameEditor class.
    * <P>
    * @author Linda B. Rawson
    public class SampleNameEditor implements TableCellEditor {
    private final static int COMBO = 0;
    private final static int BOOLEAN = 1;
    private final static int STRING = 2;
    private final static int NUM_EDITOR = 3;
    ComboBoxControl comboBox = new ComboBoxControl();
    JTextField textField = new JTextField();
    JCheckBox checkBox = new JCheckBox();
    JButton button = new JButton();
    private boolean isPushed;
    public String str = "";
    DefaultCellEditor[] cellEditors;
    int flg; // Default to String
    * Constructor
    public SampleNameEditor() {
    cellEditors = new DefaultCellEditor[NUM_EDITOR];
    // combo box editor
    comboBox = new ComboBoxControl();
    cellEditors[COMBO] = new DefaultCellEditor(comboBox);
    // Will not take button as an argument. Will only take checkbox.
    checkBox = new JCheckBox();
    checkBox.setOpaque( true );
    checkBox.setHorizontalAlignment(JLabel.CENTER);
    cellEditors[BOOLEAN] = new DefaultCellEditor(checkBox);
    cellEditors[STRING] = new DefaultCellEditor(textField);
    button = new JButton();
    isPushed = true;
    public Component getTableCellEditorComponent(JTable table, Object value,
    boolean isSelected, int row, int column) {
    if (value.toString().equals("<MORE>") ) {
    flg = BOOLEAN;
    if (isSelected) {
    button.setForeground(table.getSelectionForeground());
    button.setBackground(table.getSelectionBackground());
    } else{
    button.setForeground(table.getForeground());
    button.setBackground(table.getBackground());
    str = (value ==null) ? "" : value.toString();
    button.setText( str );
    button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    if (isPushed) {
    JOptionPane.showMessageDialog(button ,": Ouch! I am going to show you multiple samples");
    isPushed = false;
    cancelCellEditing();
    isPushed = true;
    return button;
    } else if (value instanceof String) { // ComboString
    flg = COMBO;
    comboBox. setFont(new Font("Dialog", 0, 12));
    comboBox.setListKeyDataItemName("infobus:/oracle/session1/rowSetSamples/SampleName");
    comboBox.setListValueDataItemName("infobus:/oracle/session1/rowSetSamples/SampleName");
    comboBox.setDataItemUsageMode(oracle.dacf.control.DualBindingControl.FOR_NAVIGATION);
    return comboBox;
    /* Use this if you ever desire a text field as well as a combo and button.
    } else if (value instanceof String) { // String
    flg = STRING;
    return cellEditors[STRING].getTableCellEditorComponent(
    table, value, isSelected, row, column);
    return null;
    public Object getCellEditorValue() {
    switch (flg) {
    case COMBO:
    str = ((ImmediateAccess)comboBox.getDataItem()).getValueAsString();
    return str;
    case BOOLEAN:
    case STRING:
    return cellEditors[flg].getCellEditorValue();
    default:
    return null;
    public Component getComponent() {
    return cellEditors[flg].getComponent();
    public boolean stopCellEditing() {
    return cellEditors[flg].stopCellEditing();
    public void cancelCellEditing() {
    cellEditors[flg].cancelCellEditing();
    public boolean isCellEditable(EventObject anEvent) {
    return cellEditors[flg].isCellEditable(anEvent);
    public boolean shouldSelectCell(EventObject anEvent) {
    return cellEditors[flg].shouldSelectCell(anEvent);
    public void addCellEditorListener(CellEditorListener l) {
    cellEditors[flg].addCellEditorListener(l);
    public void removeCellEditorListener(CellEditorListener l) {
    cellEditors[flg].removeCellEditorListener(l);
    public void setClickCountToStart(int n) {
    cellEditors[flg].setClickCountToStart(n);
    public int getClickCountToStart() {
    return cellEditors[flg].getClickCountToStart();
    Enjoy.
    Linda
    null

    Ok FYI Ive implemented a different solution which works fine.
    I have one class that contains a JPopupMenu and listens for a MouseEvent and displays the popup with the correct actions disabled/enabled as before. But I also register as a for PopupMenuListener on the Popup, and when it receives a PopupMenuIsBecomingInvisibleEvent , I enable all the actions in the associated table actionMap, this ensures that the action is always triggered from the keyboard shortcut
    When the action is triggered it checks the source of the ActionEvent, if it has come from the PopUp the action runs because we know it couldnt be triggered from the popup unless it was an enabled action. But if the source is a table we then perform the validation checks to see if it should run based on the cell contents, if it shouldnt it just returns without doing anything, if the validation is ok then it actaully does the action.

  • Dynamically re-render cells with event in another cell

    Dear all,
    I have a JTable that uses the default cellrenderer, it has two checkboxes, one of which disables the entire row, except for itself, so the row can be re-enabled.
    However, I want to be able to color in the row Color.GRAY or some other suitable color. I started to create my own cell renderers for the different object types in my rows, when I realised that I had no idea how to re-render any cell in a row, once ive checked the 'disable row' cell...
    there should be a way to fire this right? Also, in creating my own cell renderers, im having difficulty making them do the same thing as the normal cell renderers, apart from change color, is there any source code for the Boolean and Number cell renderers that comes with the java?
    Thanks
    Sam

    I have a JTable that uses the default cellrenderer, it
    has two checkboxes, one of which disables the entire
    row, except for itself, so the row can be re-enabled.
    However, I want to be able to color in the row
    Color.GRAY or some other suitable color. I started to
    create my own cell renderers for the different object
    types in my rows, when I realised that I had no idea
    how to re-render any cell in a row, once ive checked
    the 'disable row' cell...you probably need to change the color first and then disable the row, from the callback of the checkbox. For example, you first call:
    yourTableModel.fireTabelCellUpdated(row, other_column)
    // the renderer of other_column changes color now
    then disable the row.
    there should be a way to fire this right? Also, in
    creating my own cell renderers, im having difficulty
    making them do the same thing as the normal cell
    renderers, apart from change color, is there any
    source code for the Boolean and Number cell renderers
    that comes with the java?The complete source code comes with your JDK installation, e.g:
    UNIX: /usr/j2se/src.jar
    Windows: c:\Program Files\jdk1.3\src.jar
    jar -xvf src.jar, and look at the code.

  • Help with dispatching JTable event to underlying components in a cell.

    Hello..
    I have a JTable in which i show a panel with clickable labels.. I found that jTable by default doesnt dispatch or allow mouseevents to be caught by underlying elements..
    i need help with dispatching an event from jTable to a label on a panel in a jTable cell.. below is the code i have come up with after finding help with some websites. but i couldnt not get it right.. my dispatched event seems to go back to the jtable itself ..
    any help or suggestion is appreciated..
    Thanks
    'Harish.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.table.*;
    * @author  harish
    public class tableDemo extends javax.swing.JFrame {
        JTable jTable1;
        testpane dummyPane;
        /** Creates new form tableDemo */
        public tableDemo() {
            initComponents();
            //table settings
            String[] columnNames = {"Task", "Action"," "};
            Object[][] data = { };
            DefaultTableModel model = new DefaultTableModel(data, columnNames) {
              // This method returns the Class object of the first
              // cell in specified column in the table model.
            public Class getColumnClass(int mColIndex) {
                int rowIndex = 0;
                Object o = getValueAt(rowIndex, mColIndex);
                if (o == null)
                    return Object.class;
                } else
                    return o.getClass();
            jTable1 = new javax.swing.JTable(model);
            jTable1.addMouseListener(new MouseAdapter(){
              public void mouseClicked(MouseEvent e){
                  System.out.println("Clicked");
                  handleTableMouseEvents(e);
                 //invokeExternalApp("http://www.pixagogo.com");
              public void mouseEntered(MouseEvent e){
                  System.out.println("Entered");
                  //handleTableMouseEvents(e);
              public void mouseExited(MouseEvent e){
                  System.out.println("Exited");
                  //handleTableMouseEvents(e);
            jTable1.setRowHeight(100);
            jTable1.getTableHeader().setReorderingAllowed(false);
            jTable1.setBackground(new java.awt.Color(255, 255, 255));
            jTable1.setGridColor(new Color(250,250,250));
            jTable1.setShowGrid(true);
            jTable1.setShowVerticalLines(true);
            jTable1.setShowHorizontalLines(false);
            jTable1.setFont(new Font("Arial",0,11));
            jTable1.setMaximumSize(new java.awt.Dimension(32767, 32767));
            jTable1.setMinimumSize(new java.awt.Dimension(630, 255));
            jTable1.setPreferredSize(null);
            jTable1.setBackground(new Color(255,255,255));
            int vColIndex=0;
            TableColumn col = jTable1.getColumnModel().getColumn(vColIndex);
            int width = 100;
            col.setPreferredWidth(width);
            //add item to 2nd cell       
            Vector vec = new Vector();
            vec.addElement(null);
            dummyPane = new testpane();
            vec.addElement(dummyPane);
            ((DefaultTableModel)jTable1.getModel()).addRow(vec);
            jTable1.repaint();
            this.getContentPane().add(jTable1);
            jTable1.getColumn("Action").setCellRenderer(
              new MultiRenderer());
        protected void handleTableMouseEvents(MouseEvent e){
            TableColumnModel columnModel = jTable1.getColumnModel();
            int column = columnModel.getColumnIndexAtX(e.getX());
            int row    = e.getY() / jTable1.getRowHeight();
            testpane contentPane = (testpane)(jTable1.getModel().getValueAt(row, column));
            // get the mouse click point relative to the content pane
            Point containerPoint = SwingUtilities.convertPoint(jTable1, e.getPoint(),contentPane);
            if (column==1 && row==0)
            // so the user clicked on the cell that we are bothered about.         
            MouseEvent ev1 = (MouseEvent)SwingUtilities.convertMouseEvent(jTable1, e, contentPane);
            //once clicked on the cell.. we dispatch event to the object in that cell
         jTable1.dispatchEvent(ev1);
        private void initComponents() {
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-528)/2, (screenSize.height-423)/2, 528, 423);
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            new tableDemo().show();
        // Variables declaration - do not modify
        // End of variables declaration
        class testpane extends JPanel{
            public testpane(){
            GridBagConstraints gridBagConstraints;
            JPanel testpane = new JPanel(new GridBagLayout());
            testpane.setBackground(Color.CYAN);
            JLabel lblTest = new JLabel("test");
            lblTest.addMouseListener(new MouseAdapter(){
              public void mouseClicked(MouseEvent e){
                  System.out.println("panelClicked");
              public void mouseEntered(MouseEvent e){
                  System.out.println("panelEntered");
              public void mouseExited(MouseEvent e){
                  System.out.println("panelExited");
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 0;
            gridBagConstraints.gridy = 0;
            gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
            testpane.add(lblTest,gridBagConstraints);
            this.add(testpane);
    class MultiRenderer extends DefaultTableCellRenderer {
      JCheckBox checkBox = new JCheckBox();
      public Component getTableCellRendererComponent(
                         JTable table, Object value,
                         boolean isSelected, boolean hasFocus,
                         int row, int column) {
        if (value instanceof Boolean) {                    // Boolean
          checkBox.setSelected(((Boolean)value).booleanValue());
          checkBox.setHorizontalAlignment(JLabel.CENTER);
          return checkBox;
        String str = (value == null) ? "" : value.toString();
        return super.getTableCellRendererComponent(
             table,str,isSelected,hasFocus,row,column);
        return (testpane)value;
    class MultiEditor implements TableCellEditor {
      public MultiEditor() {
      public boolean isCellEditable(EventObject anEvent) {return false;}
      public boolean stopCellEditing() {return true;}
      public Object getCellEditorValue() {return null;} 
      public void cancelCellEditing() {}
      public boolean shouldSelectCell(EventObject anEvent) {return false;}
      public Component getTableCellEditorComponent(JTable table, Object value,
                  boolean isSelected, int row, int column) {
        if (value instanceof testpane) {                       // ComboString
          System.out.println("yes instance");
        return null;
      public void addCellEditorListener(javax.swing.event.CellEditorListener l) {
      public void removeCellEditorListener(javax.swing.event.CellEditorListener l) {
    }

    any help on this.. anybody. ?

  • How to update a cell's visibility in a af:table?

    The use case is:
    A table has 2 columns, 2 rows.
    Column 1 is a checkbox.
    Column 2 is a choices.
    Jdev is 11.1.2.4 & 11.1.1.7
    The goal is to update the choices' visibility according to the checkbox selection.
    However, when the last line of the JS is executed, choices in both rows are visible (or invisible).
    Expected behavior is: only the selected row is updated.
    Tried do this at server side but it's not working either.
    From IE's debugger, values (like clientId) of all variables are correct as expected.
    My code:
      <af:panelStretchLayout id="psl1">
        <f:facet name="bottom">
          <af:resource type="javascript">
          function onSelect(e){
              var checkbox = e.getSource();
              var table = checkbox.getParent();         
              var index = checkbox.getProperty("index");
              var choices = table.findComponent("smc1", index);
              choices.setVisible(checkbox.getValue());         
          </af:resource>
        </f:facet>
        <f:facet name="center">
          <af:table var="row" rowBandingInterval="0" id="t1" value="#{viewScope.bean.rows}" varStatus="vs"
                    horizontalGridVisible="false" verticalGridVisible="false">
            <af:column sortable="false" id="c1">
              <af:selectBooleanCheckbox text="" label="" id="sbc1" value="#{row.selected}" clientComponent="true">
                <af:clientAttribute name="index" value="#{vs.index}"/>
                <af:clientListener method="onSelect" type="valueChange"/>
              </af:selectBooleanCheckbox>
            </af:column>
            <af:column sortable="false" id="c2">
              <af:selectManyChoice label="Label 1" id="smc1" clientComponent="true">
              </af:selectManyChoice>
            </af:column>
          </af:table>
        </f:facet>
      </af:panelStretchLayout>

    Hi,
    Any specific reason why you would want to achieve this using JS? You could very well achieve this by setting autoSubmit to true for the select boolean checkbox and partialTriggers for the select many choice.
    Ex :
            <af:column sortable="false" id="c1">
              <af:selectBooleanCheckbox text="" label="" id="sbc1" value="#{row.selected}" autoSubmit="true">
              </af:selectBooleanCheckbox>
            </af:column>
            <af:column sortable="false" id="c2">
              <af:selectManyChoice label="Label 1" id="smc1" partialTriggers="::sbc1" visible="#{row.selected}">
              </af:selectManyChoice>
            </af:column>
    -Arun

Maybe you are looking for

  • 1099 Misc by SSN not by Vendor ID

    Dear Experts: We use tcode:  s_p00_07000134 / program RFIDYYWT to generate our 1099 MISC forms and file.  We are on ECC 604 and have Extended Withholding Tax activated. The forms and file are generated by Vendor ID but unfortunately we have some vend

  • Console Log Errors

    I'm getting some errors and warnings in my console system log that I don't quite understand - they have me a little concerned since things have been running a little bit strange on my system over the past few days: Mar 19 12:23:59 localhost Directory

  • Disable QuickTime plug-in...

    How can i disable quicktime's plug-in in Firefox? Thanks.

  • GRC CUP to disable mitigate option

    Hi, How can i disable mitigate option,when approver do risk analysis,we don't want approver to assign/create mitigate control .I know if i wouldn't put mitigation URL in mitigation can work.But, in SP14 if i remove mitigation URL. approver gets 500 s

  • Sharing calendar with others via icloud

    I just can't seem to get my calendar to get into my icloud account let alone share it with other members of my family, any suggestions?