Urgent:Jtable: differnt row's size...

Hi everone,
I have a Jtable i want to give a diffent size for each row , how can I do that, any help i'll be gratefully
thanks

In JDK1.3 the JTable has a setRowHeight() method. Prior to 1.3, I can't help you.

Similar Messages

  • JTable Blank Rows When INSERT/DELETE in other panel with same ViewObject

    Hi,
    Jdev 10.1.2
    JClient
    2 panels based on same ViewObject in same AM
    One panel with Grid UI => JTable
    Other panel with Form UI
    When I insert or delete a record in the panel with Form UI and return to the panel with JTable blank rows are displayed.
    The problem remains even after commiting before returning to JTable panel.
    When I activate the execute button in the JTable panel, the display is OK but the currency is lost.
    I suppose calling the refresh method when returning to the JTable panel should solve the problem.
    Can you please suggest me a server-side/model workaround:
    refresh (which option to use ??)
    Thanks
    Frederic
    PS I tried the workaround of thread 10.1.2 JClient binding Error. but that doesn't help.

    Same problem with default wizard generated Master-Detail Form.
    When in the detail more then 10 rows exist, the scrollbar shows that not all rows are displayed.
    If I use the scrollbar to view the last rows they are blank, in order to display them I must activate the next button one time for each additional row.
    The workaround is to enter -1 in the range size of the iterator.
    But what if the range size is 10.
    Is the blank rows display a bug?
    OR
    Must the scrolling area (size of JScrollPane) be defined according to the range size of the iterator?
    If the latter is true:
    Can somebody give me some clues on which attributes of the JScrollPane must be set (PreferredSize, MinimumSize ??) and on how to calculate this area: total width & total height if the row height for the table is set to 20?
    Your help will be appreciated
    Frederic

  • How to find accurate number of Rows, and size of all the tables of a Schema

    HI,
    How to find the accurate number of Rows, and size of all the tables of a Schema ????
    Thanks.

    SELECT t.table_name AS "Table Name",
    t.num_rows AS "Rows",
    t.avg_row_len AS "Avg Row Len",
    Trunc((t.blocks * p.value)/1024) AS "Size KB",
    t.last_analyzed AS "Last Analyzed"
    FROM dba_tables t,
    v$parameter p
    WHERE t.owner = Decode(Upper('&1'), 'ALL', t.owner, Upper('&1'))
    AND p.name = 'db_block_size'
    ORDER by 4 desc nulls last;
    ## Gather schema stats
    begin
    dbms_stats.gather_schema_stats(ownname=>'SYSLOG');
    end;
    ## Gather a particular table stats of a schema
    begin
    DBMS_STATS.gather_table_stats(ownname=>'syslog',tabname=>'logs');
    end;
    http://www.oradev.com/create_statistics.jsp
    Hope this will work.
    Regards
    Asif Kabir
    -- Mark the answer as correct/helpful

  • Checkbox and Buttons in a JTable's row

    Hi,
    how do i put an Checkbox or a Button in a JTable row? When i try to insert any element to a JTable's row it automatically converts it to string. How can i solve this?
    Many thanks,
    Nuno Almeida

    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

  • How to set color of our specified JTable's row

    i need to set color of our specified JTable's row.so send the coddings of that part.

    i need to set color of our specified JTable's row.so
    send the coddings of that part.I think you misunderstand how this forum works...
    If you have a problem, you post your problem here with example code which demonstrates said problem...
    The people here then attempt to help you if they want to.
    You do not post demands for code examples

  • Listen double clicks on JTable's row

    hi,
    I want to know how to catch double clicks did on a specific JTable's row, or any cell on that.
    I know that's possible because JTable is a JComponent..so, I want to know how to catch the event when the user press Enter over a single selected row, too...
    If you may show me and example or specific links, I'll thank you so much..
    lucky..

    b) The Enter key is used to move the row selection to
    the next row so you need to override the default
    mappings of the table.
    This posting shows how you would do the above on a
    JList. The code should be similiar for a JTable.
    http://forum.java.sun.com/thread.jspa?forumID=57&threa
    dID=626866Thanks anyway...I fix that with a tricky and simplest solution.
    I only put a KeyEventListener on the table and catch the keyEvent, and if it's a EnterKey, then check wich row is selected on table.
    table.addkeyListener(new KeyListener(){
                public void keyPressed(KeyEvent e) {
                    if(e.getKeyCode()==KeyEvent.VK_ENTER){
                        int[] selected_rows = table.getSelectedRows();
                        if(selected_rows.length==1){
                            int row = selected_rows[0];
                            DefaultTableModel table_model = (DefaultTableModel)table.getModel();
                            Object element_at_row = directory_model.getValueAt(row, 1); //I wanna Only the element at column 1
                             //do more things...                      
    //....other interface's methods..
    );

  • Displaying jtable as rows instead of columns

    This may be really simple, but I can't figure it out. I want to display information in a JTable as rows instead of columns. Can anyone help me with this?
    Thanks in advance,
    m

    Check here:
    http://www2.gol.com/users/tame/swing/examples/SwingExam
    les.html
    They may well have what you want, if not they will
    probably have some ideas you can use.There's always the swing tutorial, also. I learned JTables from the tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/table.html and it gave me a lot of good ideas and points to start from.
    You could probably create your own cell renderer (or use the header renderer) and set the first column to use that to display their text.

  • JTable, select row on right mouse click

    Hi,
    If I right click on a jTable row in my application, the row I click on does not get selected.
    How can I modify the mouse listener attached to the jtable to deal with this?
    jtable.addMouseListener( { e->
    if (e.isPopupTrigger())
        swing.popupMenu(menuItems).show(e.getComponent(), e.getX(), e.getY());
    } as java.awt.event.MouseListener)Thanks!

    Problem solved!
    jtable.addMouseListener( { e->
    if (e.isPopupTrigger()){
        int row = jtable.rowAtPoint( e.getPoint() );
        jtable.changeSelection( row, 0, false, false );
        swing.popupMenu(menuItems).show(e.getComponent(), e.getX(), e.getY());
    } as java.awt.event.MouseListener)

  • Finding Avg Row Length size

    Hi All,
    How we can find Avg row length size of a table, without inserting data into a table. This is required to basically estimate table size (roughly). We might need to this for at least 100+ tables.
    regards,
    vara

    The average row length depends on the data you are inserting into the table.
    You can easily compute an approximation of the max row length from Oracle’s data dictionary:
    select
      table_name ,
      sum(data_length)
    from
      user_tab_columns
    group by
      table_nameLet’s say we have a table with a number(10) and a varchar2(1000) column. For a data set where the varchar2 column contains at least 900 characters we would get average row size of 900+. For the same table, but with another data set where the varchar2 column has fewer than 50 characters, we would get average row size of less than 100.
    Iordan Iotzov
    http://iiotzov.wordpress.com/

  • JTable - Resize rows the same way as the columns

    Hi!
    I have run into a very frustrating problem and have tried to solve this for many hours but can't come up with a good solution. If there is anyone that can help me on the right track I will be very grateful!
    When I'm using a JTable it provides good "graphical" functionality to handle resize of colums, but when it comes to resize rows it is not available.
    I have found a solution for the row height adjustment in the following post: [http://forums.sun.com/thread.jspa?forumID=257&threadID=453665]
    That solution only partially work in my case because of the following:
    The JTable exists inside a JInternalFrame and the JTable should not be able to get bigger then the actual size of the InternalFrame it is put in (so no scrollbar).
    The problem with the solution above is that the JTable total height will also expand when a row is resized (contrary to what happens when the columns are resized), ending up with a JTable that is bigger then the InternalFrame.
    So my question is:
    Is it possible to provide the same ("graphical") resize functionality for rows as for columns in a JTable? Or any row resize functionality that prevent the JTable from getting bigger then the container it is placed in?
    Thanks for your time!
    Best regards,
    Marcus

    Thanks for the fast answer!
    Yes, that would solve the height expanding problem. Thanks!
    It would be even better though if the row resize functionality would behave the same as the column resize (for consistency). For example: If a row is resized the other rows will get smaller so they all fit into the InternalFrame.
    It has to be some easy way to do this. I have started on a solution with component listeners etc. (to track resize) but it is quite hard to get it right and I keep getting the feeling I reinventing the wheel all over again:(
    Any ideas out there?

  • JTable with row header plus value extraction from headers

    Hi, I am trying to do the following:
    Short Version-
    1. Create a table that has both row and column headers
    2. Allow the user to mouse over any of these headers such that doing so will display an image I have produced on a panel. (I already know how to create the image and how to display it, I'm just not sure how to associate it with a particular row or column header)
    3. Make the row headers look as much as possible like the column headers.
    Slightly Longer Version-
    Column headers will be labled A-H (maximum) while row headers will be labled 1-12 (maximum). Either can be less, however, depending on user input. After the table has been realized, the user will move the mouse over say, header 'H' and when they do, a JPEG image will appear on another panel and a tooltip will appear above the cell showing a formula. This happens when either row or column headers are moused over.
    Currently, I am using the following code from the O'reilly Swing book as a baseline for experimentation but any help you can offer will be appreciated. I'm fairly new to the JTable world... :-(
    TableModel tm = new AbstractTableModel(){
                   String data[] = {"", "a", "b", "c", "d", "e"};
                   String headers [] = {"Row #", "Column1", "Column2", "Column3", "Column4", "Column5"};
                   public int getColumnCount(){ return data.length;}
                   public int getRowCount() { return 1000;}
                   public String getColumnName(int col){ return headers[col];}
                   public Object getValueAt(int row, int col){
                        return data[col] + row;
              //creates a column model for the main table. This model ignores the first
              //column added and sets a minimum width of 150 pixels for all others
              TableColumnModel cm = new DefaultTableColumnModel(){
                   boolean first = true;
                   public void addColumn(TableColumn tc){
                        if(first) {first = false; return;}
                        tc.setMinWidth(150);
                        super.addColumn(tc);
              //Creates a column model that will serve as the row header table. This model
              //picks a maxium width and stores only the first column
              TableColumnModel rowHeaderModel = new DefaultTableColumnModel(){
                   boolean first = true;
                   public void addColumn(TableColumn tc){
                        if(first) {
                             tc.setMaxWidth(tc.getPreferredWidth());
                             super.addColumn(tc);
                             first = false;
              JTable grid = new JTable(tm, cm);
              //set up the header column and hook it up to everything
              JTable headerColumn = new JTable(tm, rowHeaderModel);
              grid.createDefaultColumnsFromModel();
              headerColumn.createDefaultColumnsFromModel();
              //make sure the selection between the main table and the header stay in sync
              grid.setSelectionModel(headerColumn.getSelectionModel());
              headerColumn.setBorder(BorderFactory.createEtchedBorder());
              headerColumn.setBackground(Color.lightGray);
              headerColumn.setColumnSelectionAllowed(false);
              headerColumn.setCellSelectionEnabled(false);
              JViewport jv = new JViewport();
              jv.setView(headerColumn);
              jv.setPreferredSize(headerColumn.getMaximumSize());
              //to make the table scroll properly
              grid.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
              //have to manually attach row headers but after that, the scroll pane
              //keeps them in sync
              JScrollPane jsp = new JScrollPane(grid);
              jsp.setRowHeader(jv);
              jsp.setCorner(ScrollPaneConstants.UPPER_LEFT_CORNER, headerColumn.getTableHeader());
              gridPanel.add(jsp, BorderLayout.NORTH);

    There a number of nice examples on JTable: http://www.senun.com/Left/Programming/Java_old/Examples_swing/SwingExamples.html
    Hope you could find something suitable ...
    Regards,
    Anton.

  • JTable fixed Row and Column in the same window

    Hi
    Could anyone tip me how to make fixed row and column in the same table(s).
    I know how to make column fixed and row, tried to combine them but it didnt look pretty.
    Can anyone give me a tip?
    Thanks! :)

    Got it to work!
    heres the kod.. nothing beautiful, didnt clean it up.
    * NewClass.java
    * Created on den 29 november 2007, 12:51
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package tablevectortest;
    * @author Sockan
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    public class FixedRowCol extends JFrame {
      Object[][] data;
      Object[] column;
      JTable fixedTable,table,fixedColTable,fixedTopmodelTable;
      private int FIXED_NUM = 16;
      public FixedRowCol() {
        super( "Fixed Row Example" );
        data =  new Object[][]{
            {      "","A","A","A","",""},
            {      "a","b","","","",""},
            {      "a","","c","","",""},
            {      "","","","d","",""},
            {      "","","","","e",""},
            {      "","","","","","f"},
            {      "","b","","","",""},
            {      "","","c","","",""},
            {      "","","","d","",""},
            {      "","","","","e",""},
            {      "","b","","","",""},
            {      "","","c","","",""},
            {      "","","","d","",""},
            {      "","","","","e",""},
            {      "","","","","","f"},
            {      "I","","W","G","A",""}};
        column = new Object[]{"A","B","C","D","E","F"};
        AbstractTableModel fixedColModel = new AbstractTableModel() {
          public int getColumnCount() {
            return 1;
          public int getRowCount() {
            return data.length;
          public String getColumnName(int col) {
            return (String) column[col];
          public Object getValueAt(int row, int col) {
            return data[row][col];
          public boolean CellEditable(int row, int col) {
            return true;
        AbstractTableModel    model = new AbstractTableModel() {
          public int getColumnCount() { return column.length-2; }
          public int getRowCount() { return data.length - FIXED_NUM; }
          public String getColumnName(int col) {
           return (String)column[col+1];
          public Object getValueAt(int row, int col) {
            return data[row][col+1];
          public void setValueAt(Object obj, int row, int col) {
            data[row][col+1] = obj;
          public boolean CellEditable(int row, int col) {
            return true;
        AbstractTableModel fixedTopModel = new AbstractTableModel() {
          public int getColumnCount() { return 1; }
          public int getRowCount() { return data.length - FIXED_NUM; }
          public String getColumnName(int col) {
           return (String)column[col];
          public Object getValueAt(int row, int col) {
            return data[row][col];
          public void setValueAt(Object obj, int row, int col) {
            data[row][col] = obj;
          public boolean CellEditable(int row, int col) {
            return true;
        AbstractTableModel fixedModel = new AbstractTableModel() {     
          public int getColumnCount() { return column.length-2; }
          public int getRowCount() { return FIXED_NUM; }
          public Object getValueAt(int row, int col) {
            return data[row + (data.length - FIXED_NUM)][col+1];
        table = new JTable( model );
        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        fixedTable = new JTable( fixedModel );
        fixedTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        fixedTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        fixedColTable= new JTable(fixedColModel);
        fixedColTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        fixedColTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        fixedTopmodelTable = new JTable(fixedTopModel);
        fixedTopmodelTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        fixedTopmodelTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);   
        JScrollPane scroll      = new JScrollPane( table );
         scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
         scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        JScrollPane fixedScroll = new JScrollPane( fixedTable ) {
          public void setColumnHeaderView(Component view) {}
        fixedScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        fixedScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        JScrollBar bar = scroll.getVerticalScrollBar();
        JScrollBar dummyBar = new JScrollBar() {
          public void paint(Graphics g) {}
        dummyBar.setPreferredSize(bar.getPreferredSize());
        scroll.setVerticalScrollBar(dummyBar);
        final JScrollBar bar1 = scroll.getHorizontalScrollBar();
        JScrollBar bar2 = fixedScroll.getHorizontalScrollBar();
        bar2.addAdjustmentListener(new AdjustmentListener() {
          public void adjustmentValueChanged(AdjustmentEvent e) {
            bar1.setValue(e.getValue());
        JViewport viewport = new JViewport();
        viewport.setView(fixedColTable);
        viewport.setPreferredSize(fixedColTable.getPreferredSize());
        fixedScroll.setRowHeaderView(viewport);
        fixedScroll.setCorner(JScrollPane.UPPER_LEFT_CORNER, fixedColTable
            .getTableHeader());   
        JViewport viewport2 = new JViewport();
        viewport2.setView(fixedTopmodelTable);
        viewport2.setPreferredSize(fixedTopmodelTable.getPreferredSize());
        scroll.setRowHeaderView(viewport2);
        scroll.setCorner(JScrollPane.UPPER_LEFT_CORNER, fixedTopmodelTable
            .getTableHeader()); 
        scroll.setPreferredSize(new Dimension(600, 19));
        fixedScroll.setPreferredSize(new Dimension(600, 100)); 
        getContentPane().add(     scroll, BorderLayout.NORTH);
        getContentPane().add(fixedScroll, BorderLayout.CENTER);   
      public static void main(String[] args) {
        FixedRowCol frame = new FixedRowCol();
        frame.addWindowListener( new WindowAdapter() {
          public void windowClosing( WindowEvent e ) {
            System.exit(0);
        frame.pack();
        frame.setVisible(true);
    }

  • JTable in JScrollPane, preferred size

    When I put a JTable in a JScrollPane, the JScrollPane seems to want to be very big. How does the scroll pane determine its size? run this code for an example..
    import javax.swing.*;
    public class TestPanel extends JPanel
    public TestPanel()
         add(new JScrollPane(new JTable(1,1)));
    public static void main(String args[])
         JFrame f = new JFrame("big table test");
         f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         TestPanel thePanel = new TestPanel();
         f.setContentPane(thePanel);
         f.pack();
         f.show();

    public class TestPanel extends JPanel {
      public TestPanel() {
        JTable jt = new JTable(1,1);
        jt.setPreferredScrollableViewportSize(new Dimension(100,100));  // Do this
        JScrollPane jsp = new JScrollPane(jt);
        jsp.setPreferredSize(new Dimension(100,100));  //OR this
        add(new JScrollPane(new JTable(1,1)));
    }

  • How to make a Jtable's row selected thru program

    Hi , in my application few of the rows (not continous)
    need to get selected automatically when the jTable is intially shown.
    I did this using table.setRowSelectionInterval(0,2)
    This method works fine selecting all the rows from 0 th to 2 th row,
    but if i want only 0 th and 2 th ( excluding the 1 st row ) to be selected , i dont know how to do that???
    i tried the following also
    //indeces of rows to be selected in the table are stored
    //in array
    int[] array = new int [2];
    parray [0]= 0;
    parray [1]= 2;
    table.setRowSelectionInterval(parray[0], parray[0] );
    table.setRowSelectionInterval(parray[2], parray[2] );
    //for each iteration a single row will be selected
    //coz the starting and ending indeces are same ie
    (parray[0],parray[0])
    but when this code is run only the 2 nd row gets selected , what abt the 0'th row???
    please help.
    Thanx.

    sorry
    there is a small correction in the above code
    //indeces of rows to be selected in the table are stored
    //in parray
    int[] parray = new int [2];
    parray [0]= 0;
    parray [1]= 2;
    table.setRowSelectionInterval(parray[0], parray[0] );
    table.setRowSelectionInterval(parray[1], parray[1] );
    //for each iteration a single row will be selected
    //coz the starting and ending indeces are same ie
    (parray[0],parray[0])

  • JTable select row by double click, single click

    Hi all,
    I would like to double click on the row of the JTable and pop up a window for adding stuff, a single click for selecting the row and then in the menu bar I can choose to etither add, change or delete stuff. I try to use the ListSelectionModel but does not seems to distinguish between double or single click.
    Any idea, doc, samples?
    or I should not use ListselectionModel at all?
    thanks
    andrew

    Hi. I used an inner class. By using MouseAdapter u dont have to implement all methods in the interface..
    MouseListener mouseListener = new MouseAdapter()
    public void mouseClicked(MouseEvent e)
    if(SwingUtilities.isLeftMouseButton(e))// if left mouse button
    if (e.getClickCount() == 2) // if doubleclick
    //do something
    U also need to add mouselistener to the table:
    table.addMouseListener(mouseListener);
    As I said, this is how I did it.. There are probably alot of ways to solve this, as usual :). Hope it helps

Maybe you are looking for

  • Same Business Partner as both Vendor and Customer !!!!

    Hi, Our client has a customer, say XYZ, who is also a vendor to our client. XYZ sends them Raw Material and bills them for that. Our client sends him Finished goods and bills him for that. When he pays our client, the amount for multiple bills of Fin

  • Remote Time Machine backup over VPN, high data usage?

    I have a remote Mac mini Server running 10.10.1 in a hosted environment. I'm attempting to perform a Time Machine backup from a MacBook Pro, also running Yosemite, over VPN. While TM does see the AFP share over VPN and is backing up, it's been workin

  • Sql server 2008 R2

    Hello - I am having problems migrating my database from an old machine to the new machine. Both are using the same SQL Server 2008 R2, both are standalone. My new machine is 64-bit while the old one is a 32-bit. I have recently backed up my database

  • Help please: Edit Acrobat Vector Object in Illustrator

    I am using Adobe Acrobat 9 Pro (9.1.3) in Windows Vista (x32).  I have a non-secured pdf document which contains raster graphics. I am trying to copy them so I can edit them in Illustrator (to save them as .eps so I can import them into InDesign). I

  • Problems with 10.4.9 and USB memory stick??

    Since I've updated to 10.4.9 I'm having nothing but grief when using my Memorex USB 1GB memory stick. I use it for backing up crucial files (e.g address book, etc.) Now, when I attempt to copy files to the memory stick, the system goes into an infini