Setting a specific number of rows visiable in a JTable

Hi there,
I am implementing the Master-Detail pattern by using a using a JSplitPane to devide a JPanel into two.
In the upper split-pane I show a JTable as the Master View.
In the lower split-pane I show a JTable as the Detail View.
My problem is that I just want to show 2 (two) rows and the Header in the Detail-View.
The default behavier is that my SplitPane shows 1 and a half row and the tableHeader.
How can I tell the SplitPane that I (only) want two rows and the Header ?

table.setPreferredSize(...);Hi again,
thanks for input !
I tried your suggestion but it did not help me.
    int rowHeight = detailCompareTable.getRowHeight();       
    Dimension headerSize = detailCompareTable.getTableHeader().getPreferredSize();       
    d = new Dimension ((int) d.getWidth(), (int) (2 * rowHeight + headerSize.getHeight()));
    detailCompareTable.setPreferredSize(d);
   masterDetailSplitPane.resetToPreferredSizes();What am I gettig wrong ?

Similar Messages

  • Select  a specific  number of rows in query

    How can a specific number of rows be selected in a query? For example, a query retrieves 30,000 records and I want to retrieve the output by groups of 5,000. I want the query to retrieve the first 5,000 records, then the next 5,000 records etc. I tried rownum but that does not work.
    Thanks,
    PANY

    Not AGAIN. Please...........
    Do you know how to Google? Search forum?
    Why do you ask this boring FAQ AGAIN?
    Sybrand Bakker
    Senior Oracle DBA
    Experts: Those who know how to search.

  • Getting a specific number of rows

    Hi,
    I would like to know how to get a specific number of rows. For example, I want to page data in my web application, so I'd like to be able to retrieve just 25 rows in my SELECT statement. I searched and I couldn't see anything under the obvious keywords of LIMIT and TOP (as used by other database vendors) so I'm wondering if possible, what do I need to do - a pointer to the relevant documentation would be helpful also.

    You can achieve this with rownum
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/pseudocolumns009.htm#i1006297
    Best regards
    Maxim

  • Fitching a specific number of rows

    hi all
    i want to fitch a specific number of rows in my query
    not all matches (SQL2000 Server )
    what command in my sql query can be placed to do so
    thanks

    set rowcount n

  • Setting the maximum number of rows in a ResultSet

    Hi everybody,
    Anyone knows if it is possible to set the maximum number of rows to obtain in a ResultSet using JDBC 2.0, and if so, how to do it?
    Thanks in advance.

    Statement st = con.createStatement();
    st.setFetchSize(no_of_rows_here);
    ResultSet rs = st.executeQuery(query);Sudha

  • The number of rows displayed in a JTable

    Hi,
    Can anyone tell me how I choose the number of rows displayed in a JTable? My table displays 25 rows, and thats a bit too many.
    Thanks.

    You dont need to do much.. I think you just have to initialze the table with ..
    JTablt t = new JTable(rows,cols);
    and make sure to make the 'rows' parameter to whatever u want. :-)
    Cheers

  • Return specific number of rows depending on the data in a column in table

    Hi,
    I have a table named orders which has column orderid and noofbookstoorder in addition to other columns.
    I want to query the orders table and depending on the value of the 'noofbookstoorder' value return that number of rows.
    Eg
    Orderid noofbookstoorder
    1 1
    2 3
    3 2
    when I query the above data saying
    select * from orders where orderid=2;
    since it has noofbookstoorders value as 3 the query should return 3 rows and when I query
    select * from orders where orderid=3;
    it should return 2 rows and
    select * from orders where orderid=1;
    should return 1 row.
    Is it possible to achieve this. If yes, then how do I write my query.
    Thanks in advance.

    with t as (
               select 1 Orderid,1 noofbookstoorder from dual union all
               select 2,3 from dual union all
               select 3,2 from dual
    select  t.*
      from  t,
            table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.OdciNumberList))
      where Orderid = <order-id>
    /For example:
    SQL> with t as (
      2             select 1 Orderid,1 noofbookstoorder from dual union all
      3             select 2,3 from dual union all
      4             select 3,2 from dual
      5            )
      6  select  t.*
      7    from  t,
      8          table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.OdciNumberList))
      9    where Orderid = 2
    10  /
       ORDERID NOOFBOOKSTOORDER
             2                3
             2                3
             2                3
    SQL> with t as (
      2             select 1 Orderid,1 noofbookstoorder from dual union all
      3             select 2,3 from dual union all
      4             select 3,2 from dual
      5            )
      6  select  t.*
      7    from  t,
      8          table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.OdciNumberList))
      9    where Orderid = 3
    10  /
       ORDERID NOOFBOOKSTOORDER
             3                2
             3                2
    SQL> with t as (
      2             select 1 Orderid,1 noofbookstoorder from dual union all
      3             select 2,3 from dual union all
      4             select 3,2 from dual
      5            )
      6  select  t.*
      7    from  t,
      8          table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.Odc
    iNumberList))
      9    where Orderid = 1
    10  /
       ORDERID NOOFBOOKSTOORDER
             1                1
    SQL>  -- And if you want to select multiple orders
    SQL> with t as (
      2             select 1 Orderid,1 noofbookstoorder from dual union all
      3             select 2,3 from dual union all
      4             select 3,2 from dual
      5            )
      6  select  t.*
      7    from  t,
      8          table(cast(multiset(select 1 from dual connect by level <= noofbookstoorder) as sys.Odc
    iNumberList))
      9    where Orderid in (2,3)
    10  /
       ORDERID NOOFBOOKSTOORDER
             2                3
             2                3
             2                3
             3                2
             3                2
    SQL> SY.
    Edited by: Solomon Yakobson on Oct 26, 2009 7:36 AM

  • Select specific number of rows

    i'm listing all data entries in a database.
    for that i want to select the 1st ten entires, then the next ten and so on ordered
    by date_column.
    how can i do that? is it possible with rownum?
    in mysql/php i did it with limit
    $query = "select * from article where parent_id=0 order by date desc, time desc limit $select, 10";
    please email me.
    thanks for help
    chris

    but what about rownum if i want the
    records from 10-20?
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Chen Zhao ([email protected]):
    If you are using Oracle 8i, you can use ROWNUM to specify the specific number of records. You can see the ROWNUM by querying:
    SELECT *
    FROM (SELECT column_name FROM table_name ORDER BY column_name)
    WHERE ROWNUM<10
    CHEN<HR></BLOCKQUOTE>
    null

  • Specific number of rows within field(s)

    I'd like to get Top-N of Amt within Name&Loc as shown below.
    Is there a way to reset either COUNT or ROWNUM to get this result?
    Name---Loc--(ROWNUM)--Amt
    James--abc--------1--1000
    James--abc--------2---900
    James--abc--------3---750
    James--def--------1---500
    James--def--------2---300
    Jill---abc--------1---400
    Jill---abc--------2---150
    Jack---xyz--------1--2000
    Jack---xyz--------2--1800
    Thank you in advance for your help.

    try this,
    select rownum as rank,ename,sal from ( select ename,sal from emp order by sal desc) where rownum<6
    This query works on EMP table of SCOTT user.
    If you change "desc" to "asc" it will start from lower to higher values. You can also play with the condition ( rownum < 6 ) to fetch ur desired no. of rows.
    Hope this helps,
    Kalpen.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Danielle:
    Thanks for the reply, but that's not what I'm looking for.
    Is there a way to get the Top-N (top 10,top20...)records within a group of fields (e.g. Name & Loc )?<HR></BLOCKQUOTE>
    null

  • JTextArea - set specific amount of rows, or characters...

    I'm working on a Applet which handles text according to given parameters. One of these parameters sets a JTextArea to the horizontal size of, lets say: 5 rows. What i want is that once this TextArea is set to a specific number of rows no text beyond those rows can be inserted. 5 rows, or a specific amount of characters are allowed.
    My problem is that the TextArea wont stop allowing text vertically. The TextArea is visibly set to 5 rows, which doesnt change. But how can i stop text from being inserted beyond row 5?
    We have tried a number of different approaches, from trying to set TextArea's size with invisible scrollbars to overriding invalidate()...

    I never understand why people want to limit the number of rows in a JTextArea. Add the text area to a scroll pane and scroll bars will appear when the number of rows exceed the display area. The point of using a text area is to allow the user to enter data in a flexible format. If the format is not flexible then maybe you should be using another component or combination of combination of components.
    Setting a maximum character size is valid if you intend to store the data on a database with a fixed size field. It is easy to do this by using a custom Document with you JTextArea. Read this section from the Swing tutorial on "General Rules for Using Text Components" for example code on how to do this:
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html
    Note, if you really want to limit the text area to 5 lines then count the number of new line characters in the document and don't allow them to enter more than 4.

  • How to set total number of rows of table control

    Hi All,
    I want to set the total number of rows of table control. I don't want to display the blank rows in table.
    Regards,
    Shrinivas

    Need some fine tuning regarding the scrollbar height but it's a start
    Unless this isn't what you asked for
    Small number of rows
    Large number of rows
    Attachments:
    PlayingWithTable.vi ‏17 KB

  • Number of rows returned for a report

    I want to create reports on serveral tables, the number of rows in these tables varies a lot (5, 5000, and the other one can have 10000+ rows).
    In the Reports Attributes page, is there a way to set the max number of rows return to the number of rows of the table? For example, for a table that has 10000 rows now, may grow to 20000 rows in the near future. If I specify the "Max Row Count" to 20000, the number may be outgrown yet again soon. If I can specify "Max Row Count" to "Current number of rows in the table" then this problem will not happen. Can it be done?

    that "Max Row Count" attribute is used to limit the number of rows returned by a htmldb report region. in your case it sounds as if you want to show all available rows all the time. in that case you'd be fine to just put a very large number into that field like 4million. that way you'd always show all your rows.
    hope this helps,
    raj

  • Number of Rows on Master - Detail Form

    I want to dynamically display the number of detail rows.
    I can get the number of rows to be displayed by entering this PL/SQL code before displaying the page:
    declare
    cnt number;
    begin
    SELECT count(*) into cnt FROM table WHERE client = "Ford";
    end;
    How do I tell the 'Number of Detail Rows to Display' field on the 'Options for Detail Row' page to use this value?

    Let me answer my own question.
    Set the number of rows to 500 and it will dynamically set to the number of rows.

  • Java executed SQL statement to XML - large number of rows

    Hello,
    I have to write some code to generate XML as the result of a query. AFAIK I am using the latest versions of the relevant Java libraries etc.
    I have found that using a max_size function above 2000 results in 'Exception in thread "main" java.lang.OutOfMemoryError' errors
    I thought I could overcome this by reading the data in batches using the skip_rows functionality.
    I have included the code I am using below and would appreciate any help.
    Best Regards,
    Mark Robbins
    import java.sql.*;
    import java.math.*;
    import oracle.xml.sql.query.*;
    import oracle.xml.sql.docgen.*;
    import oracle.jdbc.*;
    import oracle.jdbc.driver.*;
    public class XMLRetr
    public static void main(String args[]) throws SQLException
    String tabName = "becc";
    String user = "test/test";
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    //initiate a JDBC connection
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:oci8:"+user+"@test");
    // initialize the OracleXMLQuery
    OracleXMLQuery qry = new OracleXMLQuery(conn,"select * from "+tabName+" where TRUNC(SAMPLED) < \'14-NOV-99\'" );
    // structure the generated XML document
    System.out.println("Before setting parameters");
    qry.setMaxRows(8000); // set the maximum number of rows to be returned
    qry.setRowsetTag("ROOTDOC"); // set the root document tag
    qry.setRowTag("DBROW"); // sets the row separator tag
    qry.setRaiseException(true);
    qry.keepCursorState(true);
    // create the document generation factory. Note: there are methods in OracleXMLQuery
    // which don't require that an OracleXMLDocGen object be passed in; but rather, they
    // create an OracleXMLDocGen object of their own.
    OracleXMLDocGen doc = (OracleXMLDocGen) new OracleXMLDocGenString();
    for (int rowCnt = 1; rowCnt < 8000; rowCnt = rowCnt + 1000)
    // get the xml
    System.out.println("Before skip rowCnt:"+rowCnt);
    qry.setSkipRows(rowCnt); // process next batch
    System.out.println("Before getXML");
    // this is where I get the exception on the second iteration of the loop
    qry.getXML(doc);
    System.out.println("Displaying document");
    // System.out.println(doc.getXMLDocumentString());
    System.out.println("Row number:"+rowCnt);
    System.out.flush();
    System.out.println("End of document");
    qry.close();
    null

    I used qry.getXMLString()
    But called it for every row, ie, set
    qry.maxRows(1) and qry.skipRows(rowcount-1).
    The down side is I had to postprocess the String to remove the processing instruction and doc level tags.

  • How to set the number of rows displayed in a classical report at runtime?

    Hi,
    Our customer has several standard client hardware configuration and would like to enable end users to choose their 'display profile' at login time. This 'display profile' would contain predefined values for these hardware configurations and supposed to set various paramters that should define the number of rows displayed in a classical report region.
    I tried to provide parameters on the report region but it refused to accept anything but numerical values. Is it possible to do this?
    Regards, Tamas

    The link is to the closest linkable point in the documentation to the description of the Number of Rows (Item) attribute.
    It sounds like you have been trying to enter&mdash;unsuccessfully&mdash;an item name or substitution string into the Number of Rows attribute. The Number of Rows (Item) attribute is the one that actually allows you to do this. Click on the flashlight icon beside it to get a list of items from the application.

Maybe you are looking for

  • Can´t configure Open Directory Master

    After a reinstall I can´t config Open Directory Master. I have this logs: Mar  4 12:22:28 servidor slapd[14293]: @(#) $OpenLDAP: slapd 2.4.23 (Oct 19 2011 00:16:13) $                     [email protected]:/private/var/tmp/OpenLDAP/OpenLDAP-186.2~3

  • Can't get Canon MP620 to work wirelessly with MacBook Pro or AirPort

    I bought a Canon MP620 printer at the Apple Store. I specifically asked if it would work wirelessly with my MacBook Pro or AirPort Express since I read comments to the contrary on here. I was assured it would work without a problem and I wouldn't nee

  • Spawned Process 441402

    Dear Gurus, I have been facing this problem after conducting a successful upgrade from 11.5.7 to 11.5.10.2. Most of my report log shows me Spawned Process xxxxx(number) Error. Below is the details of log file: Arguments P_BOOK='SBM_FA_200_CORP' P_PER

  • My BB Storm is deleting all of my old calendar entries in Outlook! HELP!

    I've seen this raised a few times with different handsets, and different email/calendar clients, however, I've yet to find a BB Storm messing around with Outlook 2009. However, am guessing that its a generic BB problem that messes up ALL email/calend

  • IMessage - message from 1 contact, 2 devices

    Hi have an iPhone 4 - my iMessage is set to recieve at both my mobile number and email address.  My girlfriend has an iPhone 4s and iPad 2. Her iMessage on the iphone is set to recieve at her mobile number and email. Her iPad is just set to recieve a