Different JComboBox in different Cells in a JTable

Hi:
I would like to make a JTable whose content would be several JBox with different values each one. That is to say, a double-column table with the value name in the first column and a range of possible values in the second column,
Despite my efforts I was not able to do that. Every example that I found in the Web does not let different JComboBox per cell. They run with the same cell and values for each column.
Can anybody help me?
Thanks in advance.
Carlos

Here is an example that is based on camickr´s example:
import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.*;
import java.util.*;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.table.*;
import javax.swing.JTable;
import java.util.ArrayList;
import javax.swing.DefaultCellEditor;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
public class TableCell extends JFrame
     JComboBox comboBox1 = new JComboBox();
     JComboBox comboBox2 = new JComboBox();
     JTable table;
     ArrayList<DefaultCellEditor> editors = new ArrayList<DefaultCellEditor>();
     TableCell()
          comboBox1.addItem("Tennis");
          comboBox1.addItem("Fotboll");
          comboBox1.addItem("Baseball");
          comboBox1.addItem("Handboll");
          comboBox2.addItem("USA");
          comboBox2.addItem("Brazil");
          comboBox2.addItem("Australia");
          comboBox2.addItem("China");
          comboBox2.addItem("Egypt");
          DefaultCellEditor dce1 = new DefaultCellEditor(comboBox1);
          DefaultCellEditor dce2 = new DefaultCellEditor(comboBox2);
          editors.add(dce1);
          editors.add(dce2);
          final JTable table = new JTable()
          { // anonym innerklass
               private Class editingClass;
               public TableCellRenderer getCellRenderer(int row, int column)
                    editingClass = null;
                    int modelColumn = convertColumnIndexToModel(column);
                    int modelRow = convertRowIndexToModel(row);
                    if (modelColumn == 1)
                         Class rowClass = getModel().getValueAt(row, modelColumn).getClass();
                         return getDefaultRenderer( rowClass );
                    else
                         return super.getCellRenderer(row, column);
               public TableCellEditor getCellEditor(int row, int column)
                    editingClass = null;
                    int modelColumn = convertColumnIndexToModel(column);
                    int modelRow = convertRowIndexToModel(row);
                    if (modelColumn == 1)
                         if (modelRow == 5)     // cell number 5 in column 1 which is going to show the combobox
                              return (DefaultCellEditor) editors.get(0);
                         if (modelRow == 6)     // cell number 6 in column 1 which is going to show the combobox
                              return (DefaultCellEditor) editors.get(1);
                         else
                              editingClass = getModel().getValueAt(modelRow, modelColumn).getClass();
                              return getDefaultEditor( editingClass );
                    else
                         return super.getCellEditor(row, column);
          table.setModel(new javax.swing.table.DefaultTableModel
               new Object [][]
                      {"String", "I'm a string"},
                    {"Date", new Date()},
                    {"Integer", new Integer(123)},
                    {"Double", new Double(123.45)},
                    {"Boolean", Boolean.TRUE},
                    {"Combobox 1", "COMBOBOX 1"},
                    {"Combobox 2", "COMBOBOX 2"}
               new String [] { "Attribute", "Data" }
          table.setPreferredScrollableViewportSize(table.getPreferredSize());
          JScrollPane scrollPane = new JScrollPane( table );
          getContentPane().add( scrollPane );
     public static void main(String[] args)
          TableCell frame = new TableCell();
          frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
          frame.pack();
          frame.setLocationRelativeTo( null );
          frame.setVisible(true);
}

Similar Messages

  • JComboBox as a cell editor in JTable

    Hi,
    I've set one of my columns in my table to have a JComboBox as a cell editor. This is fine but my problem is that each row has different values in the JComboBox but when I update each row the column with the JComboBox they all end up with the same values.
    All help appreciated,
    Thanks,
    Lou
    // column with JComboBox
    TableColumn myCol = table.getColumnModel().getColumn(3);
    Vector comboValues = new Vector();
    JComboBox myCombo = null;
    for (int row = 0; row < tableModel.getRowCount(); row++)
    comboValues = new Vector();
    if (row == 0)
    // code here to add values to comboValues
    myCombo = (JComboBox) (((DefaultCellEditor) (table.getCellEditor(row, 3, .getComponent());
    myCombo = new JComboBox(comboValues);
    myCol.setCellEditor(new DefaultCellEditor(myCombo);
    tableModel.fireTableStructureChanged();
    tableModel.fireTableDataChanged();
    else
    // get differnent values for comboValues and update comboValues Vector
    myCombo = (JComboBox) (((DefaultCellEditor) (table.getCellEditor(row, 3, .getComponent());
    myCombo = new JComboBox(comboValues);
    myCol.setCellEditor(new DefaultCellEditor(myCombo);
    tableModel.fireTableStructureChanged();
    tableModel.fireTableDataChanged();

    Remember that you Table API specifies that each cell will use one instance of the specified editor...
    Think about that... the same editor is being used for each cell in that column... therefore, setting the
    data in the combobox et all will set it for that instance bveing used to edit the cell....
    Check out [url http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender]How to use Tables if in doubt...

  • How to set different renderers to different cells in same column of JTable?

    Hello Friends,
    I need your help again...
    Does any body knows, how to set different renderer's for different cells of same column in JTable..??
    For ex.
    Col1 Col2 Col3 Col4
    A       A       A      A
    A       A       A      B
    A       A       A      C
    A       A      A       D
    Where A B C D would be different Renderers.  I want set exactly same ,,, ie. one column with different renderer at different cell positions..
    Right now i m setting renderer using statement bellow :
    table.getColumnModel().getColumn(int).setCellRenderer(rederer_Instance);But with this, effect in the last renderer is applicable whole column....
    Can any body help me out ?????????
    please refer this thread for similar kind of discussion...
    http://forums.sun.com/thread.jspa?forumID=57&threadID=571445Thanks
    Suyog

    Please refer to the first reply of [this thread|http://forums.sun.com/thread.jspa?forumID=57&threadID=571445] for the answer. If you have a specific problem implementing it, post you code with a specific question.

  • Display of text of different rows with different color - JTable

    Hi all !
    I have struck in a problem. I have to display the different rows with different color in the JTable. I have created an arraylist in the model class, which stores color of all the rows. Now in renderer class, I am just picking up color from the arraylist, taking rowIndex as index for arraylist. I used to set foreground color for each row in the renderer class. The problem is that it is not showing all the rows properly, sometimes it show all the rows correctly, but as i resize the window/panel, it starts behaving abnormally, some text is painted properly, but other aren't.
    Does anybody have any solution regarding this problem.
    One thing i want to mention is that in getTableCellRendererComponent() method, i used to retrive the color everytime, and setting the foreground color of the text. Is this a right approach or some other technique have to be followed.
    here is code of renderer class ---
    import java.awt.*;
    import javax.swing.*;
    * Renderer to plot stage record table.
    public class ExStageCellRenderer extends javax.swing.table.DefaultTableCellRenderer
        Color curColor;
         * returns component to be painted, overridding this method from
         * DefaultCellRenderer
         * @param table
         *            table whose component has to be plotted
         * @param value
         *            value of that particular cell
         * @param isSelected
         *            is Cell selected
         * @param hasFocus
         *            has the cell got focus
         * @param row
         *            row of the cell
         * @param column
         *            column of the cell
         * @return painted component
        public Component getTableCellRendererComponent (JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
                int column)
            Component component = super.getTableCellRendererComponent (table, value, isSelected, hasFocus, row, column);
            ExStageDataModel model = (ExStageDataModel)table.getModel ();       
            if (curColor instanceof Color) {
                    curColor = model.getColor(row);
                } else {
                    // If color unknown, use table's foreground color
                    curColor = table.getForeground();
            String tooltip = "";
            StringBuffer stringBuffer = new StringBuffer ();
            for (int i = 0; i < table.getColumnCount (); i++)
                    Object Value = table.getValueAt (row, i);
                    if (Value == null) continue;
                    stringBuffer.append (Value.toString () + "    ");
            tooltip += stringBuffer.toString ();
            tooltip = tooltip.trim ();
            ((JComponent) component).setToolTipText (tooltip);
            if (column == 1)
                this.setHorizontalAlignment (SwingConstants.CENTER);
            else if (column == 0 || column == 4 || column == 5)
                this.setHorizontalAlignment (SwingConstants.LEFT);
            else
                this.setHorizontalAlignment (SwingConstants.RIGHT);
            // LOOK!! should turn tip off if there is none !!
            component.setForeground (this.curColor);
            //System.out.println("render : " + component.getBounds ());
            //component.validate ();
            component.update (component.getGraphics ());
            return component;
    Waiting for reply....
    Code snooker

    Hmm, why are you doing the curColor instanceof? What does this accomplish? I don't see any reason to ask what it was before; all you should be interested in here is what you want it to be now.
    All you should have to do is say:
    this.setForeground(model.getColor(row));I also don't see why you're doing the update() -- JTable is going to do that for you at the appropriate time, you have no idea if now is the right time to do it or not. In fact it probably isn't, you're probably updating the previously-drawn cell with your new color and alignment, which may be the strange behavior you're seeing.
    Also, I don't see why you're doing the super. All that's going to do is return "this", so why not just use "this"?
    Well, without knowing your larger code or exactly what you're trying to accomplish, maybe I'm just missing something.
    I've just recently been working on a program where I had some similar requirements -- different foreground and background colors and alignment -- and I found it much cleaner to create a class to hold all this data, and then create a default renderer for that class. Then I made some constructors for this "attribute" class that let me set whatever I need, like
    public CellAttrib(String s,Color c,int alignment,Border border)
      this.s=s;
      this.c=c;
      this.border=border;
    // with suitable defaults ...
    pubic CellAtrtrib(String s)
      this.s=s;
      this.c=Color.BLACK;
      this.border=null;
    }Then the renderer just queried the cell-attributes class, as in:
    setForeground(value.getColor());
    setHorizontalAlignment(value.getAlignment());
    setBorder(value.getBorder);

  • Different format in one cell by formula?

    Hi there,
    does someone know if it is possible to grab and connect text with the & operator and set different formats (bold, italic...) with a command in the formula?
    For example I have different lines in one cell done with the CHAR(10) and want to have the last line in bold format. Is this kind of manipulation possible?

    As far as I know, there is no such function.
    We may apply different styles in a cell by hand, not by a formula.
    I checked that the concatenation of the contents of cells with different styles result with a string in standard style.
    Yvan KOENIG (from FRANCE samedi 13 décembre 2008 19:44:03)

  • JComboBox Cell Editor in JTable

    I've scouered the forums for an answer to my question, and while
    finding other valuable advice, I have yet to find an answer to my
    question. But first, a little description:
    I have a JTable consisting of 5 columns:
    col1= standard Object cell editor
    col2= JComboBox cell editor
    col3= JComboBox cell editor, values dependent on col2
    col4= JComboBox cell editor, values dependent on col3
    col5= JComboBox cell editor, values dependent on col4
    Data structure looks like this:
    col1= company object, containing vector of values for col2
    col2= lease object, containing vector of values for col3
    col3= well object, containing vector of values for col4
    col4= pump object, containing vector of values for col5
    col5= simply displayed.
    I have a JButton that adds a new row to the table via dialog, then menu
    options to add entries to the comboboxes/vectors. The kicker here is
    that everything is fine up until I've added a pump, and click the cell
    to view the entry. In my cellEditor class, I have a 'getSelected()'
    method that returns 'combobox.getSelectedIndex()'. When 'edittingStopped()'
    is thrown for any cell in this column, I get a null pointer in my
    getSelectedIndex() method of the lease combobox - only in this pump
    column. Even the part column works correctly. Code snips:
    public class MyApplication ... {
      private TableColumn leaseColumn;
      private TableColumn wellColumn;
      private TableColumn pumpColumn;
      private TableColumn partColumn;
      private LeaseDropDown leaseDropDown;
      private WellDropDown wellDropDown;
      private PumpDropDown pumpDropDown;
      private PartDropDown partDropDown;
      private int currentLease = 0;
      private int currentWell = 0;
      private int currentPump = 0;
      public MyApplication() {
        leaseColumn = pumpshopTable.getColumnModel().getColumn(1);
        leaseDropDown = new LeaseDropDown(companies);
        leaseColumn.setCellEditor(leaseDropDown);
        DefaultTableCellRenderer leaseRenderer =
          new DefaultTableCellRenderer();
        leaseRenderer.setToolTipText("Click for leases");
        leaseColumn.setCellRenderer(leaseRenderer);
        //... same for lease, well, pump, part ...
        leaseDropDown.addCellEditorListener(new CellEditorListener() {
          public void editingCanceled(ChangeEvent e) {
          } // end editingCanceled method
          public void editingStopped(ChangeEvent e) {
            updateCells();
          } // end editingStopped method
        }); // end addCellEditorListener inner class
        //.... same inner class for well, pump, part ...
      } // end MyApplication constructor
      public void updateCells() {
        currentLease = leaseDropDown.getSelectedLease();
        //... get current well, pump, part ...
        leaseDropDown = new LeaseDropDown(companies); // companies=Vector,col1
        leaseColumn.setCellEditor(leaseDropDown);
        //... same for lease, well, pump and part columns ...
      } // end updateCells method
    } // end MyApplication class
    public class LeaseDropDown extends AbstractCellEditor
        implements TableCellEditor {
      private Vector companiesVector;
      private JComboBox leaseList;
      public LeaseDropDown(Vector cVector) {
        companiesVector = cVector;     
      } // end LeaseDropDown constructor
      public Component getTableCellEditorComponent(JTable table,
          Object value, boolean isSelected, int rowIndex, int vColIndex) {
        Company thisCompany = (Company) companiesVector.get(rowIndex);
        Vector leasesVector = (Vector) thisCompany.getLeases();
        leaseList = new JComboBox(leasesVector);
        return leaseList;
      } // end getTableCellEditorComponent method
      public Object getCellEditorValue() {
        return leaseList.getSelectedItem();
      } // end getCellEditorValue method
      public int getSelectedLease() {
        JOptionPane.showInputDialog("Selected lease is: " +
          leaseList.getSelectedIndex());
        return leaseList.getSelectedIndex();          
      } // end getSelectedLease method
    } // end LeaseDropDown class... LeaseDropDown can be extrapolated to well, pump, and part,
    handing well the selected lease, handing pump the selected
    lease and well, handing part the selected lease, well and pump.
    I guess my question is how do I get the selected comboboxitem (I'd
    settle for the entire combobox if there's no other way) to fill in the
    next column? Why does the way I have it now work for the first 2 combobox
    columns and not the third?

    I'll try to provide more details.
    I use a JComboBox implementation as a cell in a JTable. The CombBox is editable . This is what I get when I try to type in something.
    java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
    at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1507)
    at java.awt.Component.getLocationOnScreen(Component.java:1481)
    at javax.swing.JPopupMenu.show(JPopupMenu.java:921)
    at javax.swing.plaf.basic.BasicComboPopup.show(BasicComboPopup.java:177)
    at javax.swing.plaf.basic.BasicComboBoxUI.setPopupVisible(BasicComboBoxUI.java:927)
    at javax.swing.JComboBox.setPopupVisible(JComboBox.java:790)
    at javax.swing.JComboBox.showPopup(JComboBox.java:775)
    I read some related bugs on the sun site but I am not sure if this is a bug and if it is then has it been fixed or work-around provided.
    any insights ??

  • How to set two different UIE in one cell in ALV table

    Hi all,
    I have a hierachy ALV table. For some reason I want to have two UI elements in one column. For example, the text and a menu next to the text. Is it possiable to do that?
    best regards,
    Wenwen

    Hi,
    thank you for your answer. Yes, now I also find the class CL_SALV_WD_MULTI_CELL_EDITOR which could be used to set different UIE in one cell. But it is quite limited, just the following UIE could be used
    - LinkToAction 
    - LinkToURL    
    - FileDownload 
    - Button       
    - ToggleButton 
    best regards,
    Wenwen

  • How can i apply different color for each cell in jlist component?

    hi guys i need your help and sorry if my english is very bad..guys how can i apply different colors for each cell in jlist component? for example for the first cell i want to apply color blue, for the second cell i want red, etc... i need your answer guys tnx..
    Edited by: ryrene on Mar 21, 2010 12:13 AM

    ryrene wrote:
    hi guys i need your help and sorry if my english is very bad.
    ..guys how can i apply different colors for each cell in jlist component? for example for the first cell i want to apply color blue, for the second cell i want red, etc... i need your answer guys tnx..I'll see your tnx, and raise you dve bmbrs & nplm.

  • Different link for each cell on table item

    hello..,
    I have one table item on my WAD template.
    I created Characteristic Structure/Selection for rows and Key Figure Structure/Selection for columns.
    There is a requirement to jump to different report for each cell on that table.
    Is it possible?
    I try to created class "ZCL_MYCLASS" with superclass of "CL_RSR_WWW_MODIFY_TABLE".
    And put some code on HTML as below:
    <P><object>
             <param name="OWNER" value="SAP_BW"/>
             <param name="CMD" value="GET_ITEM"/>
             <param name="NAME" value="TABLE"/>
             <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_GRID"/>
             <param name="DATA_PROVIDER" value="DATAPROVIDER"/>
             <param name="MODIFY_CLASS" value="ZCL_MYCLASS"/>
             ITEM:            TABLE
    </object></P>
    For testing purpose, I put coding on CHARACTERISTIC_CELL method:
    if I_CHAVL = 'Revenue'. "This is selection description
    c_cell_content = 'R_e_v_e_n_u_e'.
    endif.
    But, it seems that it doesn't work.
    The question:
    1. How do I create simple MODIFY_CLASS, just for testing purpose that what I modify in class is already correct.
    2. How to debug class on WAD?
    Thanks in advance

    Not statically, but you can do this in code:
    That's a method on the left and a property on the right.
    I don't know if this will work as you expect (it should change the tip strip, but I don't know if it will appear like you want it to), so you can also implement this yourself by having a string indicator which you show and move around using its properties.
    Try to take over the world!

  • Problem of JComboBox as cell editor in JTable

    Hi,
    I use JComboBox as cell editor in JTable. If the drop-down menu of the JComboBox out of the JTable area (as the editable cell is near the bottom of the JTable), the item in JComboBox can not be selected with mouse, in this situation there is no MouseEvent to be received in JTable. But it works when I use the keyboard to choose an item in JComboBox.

    Works fine for me.
    If you need further help then you will need to provide [url http://www.physci.org/codes/sscce.jsp]Simple Demo Code that demonstrates the problem.

  • Help:JCombobox in table cell

    I have a column using combobox as cell editor in jtable, the combo box 's content is different based on the row user selects, for example, user selects the first row, the combo box will show selections" hi, hello", when user selected the second row, that row's combobox will show "where, what, why". How can I create individual comboxeditor or renderer for each cell in combo box column, so the contents of combo box will change based on the different rows. My old way is just to create a editor for the whole column, but based on the selection, remove all items in the combobox, and add new items in that combo box. The problem is when user first click the combo, all items disappear,the second click will show all newly added items,how can I show just all new items just by one click.
    Thanks a lot.

    I have a code that con solve your problem... It shows the contents of a cell as jcombobox...
    /*--- formatted by Jindent 2.1, (www.c-lab.de/~jindent) ---*/
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.table.*;
    * Class declaration
    * @author
    * @version %I%, %G%
    public class TableComboDemo extends JPanel {
         private JTable table;
         private int rows = 3;
         private int columns = 3;
         private int depth = 3;
         private String[][][] strings = new String[rows][columns][depth];
         private TableCellRenderer myRenderer = new MyComboRenderer();
         private TableCellEditor myEditor = new MyComboEditor();
         private TableModel myTableModel = new MyTableModel();
         * Constructor declaration
         * @see
         public TableComboDemo() {
              setupModel();
              table = new JTable() {
                   * Method declaration
                   * @param row
                   * @param column
                   * @return
                   * @see
                   public TableCellRenderer getCellRenderer(int row, int column) {
                        return myRenderer;
                   public TableCellEditor getCellEditor(int row, int column) {
                        return myEditor;
              table.setModel(myTableModel);
              this.add(new JScrollPane(table));
         * Method declaration
         * @see
         public void setupModel() {
              strings[0][0][0] = "a";
              strings[0][0][1] = "b";
              strings[0][0][2] = "c";
              strings[0][1][0] = "d";
              strings[0][1][1] = "e";
              strings[0][1][2] = "f";
              strings[0][2][0] = "g";
              strings[0][2][1] = "h";
              strings[0][2][2] = "i";
              strings[1][0][0] = "j";
              strings[1][0][1] = "k";
              strings[1][0][2] = "l";
              strings[1][1][0] = "m";
              strings[1][1][1] = "n";
              strings[1][1][2] = "o";
              strings[1][2][0] = "p";
              strings[1][2][1] = "q";
              strings[1][2][2] = "r";
              strings[2][0][0] = "j";
              strings[2][0][1] = "s";
              strings[2][0][2] = "t";
              strings[2][1][0] = "u";
              strings[2][1][1] = "v";
              strings[2][1][2] = "w";
              strings[2][2][0] = "x";
              strings[2][2][1] = "y";
              strings[2][2][2] = "z";
         * Method declaration
         * @param args
         * @see
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              frame.getContentPane().add(new TableComboDemo());
              frame.pack();
              frame.setVisible(true);
         * Class declaration
         * @author
         * @version %I%, %G%
         private class MyComboRenderer implements TableCellRenderer {
              private JComboBox combo;
              * Method declaration
              * @param table
              * @param value
              * @param isSelected
              * @param hasFocus
              * @param row
              * @param column
              * @return
              * @see
              public Component getTableCellRendererComponent(
                   JTable table,
                   Object value,
                   boolean isSelected,
                   boolean hasFocus,
                   int row,
                   int column) {
                   combo = new JComboBox((String[]) value);
                   return combo;
         * Class declaration
         * @author
         * @version %I%, %G%
         private class MyComboEditor extends DefaultCellEditor {
              private JComboBox combo;
              public MyComboEditor() {
                   super(new JComboBox());
              * Method declaration
              * @param table
              * @param value
              * @param isSelected
              * @param row
              * @param column
              * @return
              * @see
              public Component getTableCellEditorComponent(
                   JTable table,
                   Object value,
                   boolean isSelected,
                   int row,
                   int column) {
                   combo = new JComboBox((String[]) value);
                   return combo;
         * Class declaration
         * @author
         * @version %I%, %G%
         private class MyTableModel extends AbstractTableModel {
              * Method declaration
              * @return
              * @see
              public int getRowCount() {
                   return rows;
              * Method declaration
              * @return
              * @see
              public int getColumnCount() {
                   return columns;
              * Method declaration
              * @param row
              * @param column
              * @return
              * @see
              public Object getValueAt(int row, int column) {
                   return strings[row][column];
              * Method declaration
              * @param row
              * @param col
              * @return
              * @see
              public boolean isCellEditable(int row, int col) {
                   return true;
    }

  • Getting right end of text displayed in cells of a JTable column

    Hey All,
    Platform: WinXP, Java 5.0.
    I have a simple one-column table whose cells contain pathnames of user-selected files. The pathnames may be quite long, and when they're too long for the fixed width of the column (the containing JFrame is not resizable), I want the trailing (right) end of the pathnames to visible (so the filenames are visible) and for elipsis to be used on the left side (omitting root directory, etc., if need be). I can't figure out how to do this. I've tried many different approaches. Currently I use a class that extends TableCellRenderer, but no combination of alignment settings in this class seems to do the trick.
    I've noticed that in the case of JTextFields, this manner of display seems to be the default, no matter what alignment setting I choose. I can't seem to get the desired effect with the display of cells in my JTable though.
    Anyone have any suggestions?
    Thanks in advance.

    Great job camickr,
    That did just what I wanted; you get the points for sure! I will say that It's surprising to me that Swing leaves so much work in calculation to be done for this simple idea.
    Btw, I also want to mention here that there's another forum issue I raised and you responded to recently, and you never quite answered my question there:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=5160875
    That's got 10 pts riding on it too, if you care to revisit the issue...
    Thanks very much for the good work on the CellRenderer.

  • How can i add a MouseMotionlistener  to the cells in the JTable?

    hi !
    how can i add a MouseMotionlistener to the cells in the JTable?

    yes i have.but that is different from adding MouseMotionlistener to the cells for me .
    i just want get the values where the mouse moves to .

  • Jtable in the cell of parent jtable

    hi,
    i wans to make jtable whose all cell's contains jtable and all of these jtables should dynamically get different datas .suppose i needs to create a parent 10*3 jtable,now all the 30 cells again contains jtable of 1*2 and all these 1*2 jtables contains different datas at runtime how can i do that plz sujjest me.

    Implement the TableCellRenderer interface to return a JTable.
    How to use tables: http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    Also worth asking yourself whether you really are better off with tables within tables, or if it's more appropriate to simply use a 10x6 table. Might be one, might be the other.

  • How to enable JScrollPane in a cell of the JTable

    Hi,
    I am able to place the components into the cell of the JTable. But I am unable to interact with the components like JTable or JComboBox after inseting them into a cell of the JTable.
    This was the one of the Scenario:
    Step 1: I created One JTable named as "insertTable"and adding to JScrollPane
    Step 2: I'm able to inserted the newly created JTable ("insertTable") in to a cell of another JTable(like table inserting a table) using TableCellRenderer.
    here was the problem. I am able to insert the newly created table into the cell. the "insertTable" size is greater the Cell size. So, the "insertTable" is appering with Horizantal and Vertical Scrollbars because the "insertTable" is added to JScrollBar. but I am unable to move the scrollbars.
    please any one help me for this.

    you still didn't try to learn the difference between cellEditor vs cellRenderer - as you were advised to do more than once in recent posts.
    If you do, the answer will be obvious (to you :-). As long as you don't there's nothing to help
    Cheers
    Jeanette

Maybe you are looking for

  • Error while using jsp scriptlet or expression with JSPDynpage default jsp

    Hi everyone, I am getting the following error while trying to use any kind of jsp scriptlet or expression within the default jsp page that is created with JSPDynpage application: Portal Runtime Error An exception occurred while processing a request f

  • My time machine backup of address book and iphoto etc wont open

    So I'm about to do a bunch of stuff on my computer and want to make sure that my time machine backups are going to be able to be restored and that I can unpartition my bootcamp drive safely. I will be downloading SnowLeopard, Parrallels, and some oth

  • Best Practices in use of ABAP for SRM and/or CRM Configuration

    I was wondering if there is a document that defines best practices for the use of ABAP with the installation and customization of SRM and/or CRM. Such as amount of ABAP coding typically required, and best practices around the use of ABAP for customiz

  • Mouse no longer scrolls

    Relatively new wired mouse and keyboard. Mouse just suddenly no longer scrolls ???? any advice welcome. Steve

  • BI - Exam Questions & Tips

    Hai Friends   I am going to take BI Certification Exam next Week. If any one has got model exam questions or tips about the exam, please write to me at [email protected] Thanks in advance A.Bharath