JScroller on JTable and table size

Hi everyone...
I have a small problem...i added JScrollPane to my JTable...but if i do the following...
JScrollPane contentScroller= new JScrollPane(myJTable,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
myJTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);In this case scroller works great....accept if i have a smaller data set to show...for example only one column...
Basically what i would like is to be able to set like minimum size of my JTable...is that possible...

Oh ya...
sorry i apologize...
Well basically what i did is the following...
In the constructor of my sub-class that extends JTable i set the following property:
this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
/*...........................................................................*/ And then i also added the following code...(i created some additional methods...i dont really know if this is the right way but i didnt find anything more suitable for my problem)
/*i set JScrollPane onto witch i added my JTable class instance, to a private JscrollPane variable*/
public void setParentJPanel(JScrollPane parentJScrollPane){
        this.parentJScrollPane = parentJScrollPane;
/*I only added these 3 methods cos i wanted to get the size of JScrollPane onto witch i added my JTable class instance*/
    public JScrollPane getParentJPanel(){
        return this.parentJScrollPane;
/*this methods sort of sets all the columns to equal size witch i guess i wanted it to do...*/
    public void setAllColumnsWidth(){
        int parentWidth = this.getParentJPanel().getWidth();
        int columnNumber = this.getColumnNumber();/*method that i wrote to work with another class that works with database*/
        int columnWidth = parentWidth/columnNumber;
        for(int i=0;i < columnNumber;i++)
            this.getColumnModel().getColumn(i).setPreferredWidth(columnWidth);     
    }Hmmm sorry again for not posting my solution...its not really that much impressive thats why i didnt post it the first time...
Well i hope it helps....(what i needed is basically how to set columns to as equal size as possible...)

Similar Messages

  • DB Size and TAble size Estimation

    Hi all
    Please tell mehelp link or spredsheet to estimation DB Size and TAble size Estimate
    Regards

    Please tell mehelp link or spredsheet to estimation
    DB Size and TAble size EstimateWhat size are you looking for?
    1) Estimate of physical disk space used by an existing database schema?
    2) Estimate of how much physical disk space will be required for some arbitrary data in order to create a new database?
    Something else?
    You need to be clear with your requirements

  • Index size and table size

    Hi,
    I have 3 user tables spaces that the os is reporting as 33 GB, 7 GB, and 5 GB.
    Just from a gut feeling I know we don't have that much data in our tables but I can't seem to find out where the space is allocated. I checked the internet and found various queries.
    The first one (found at ask Uncle Tom), breaks the space for table by table:
    select table_name,blocks, empty_blocks,
    avg_space as avg_space_free_K, num_freelist_blocks, blocks + empty_blocks + num_freelist_blocks as
    total_blocks_allocated,
    ((blocks + empty_blocks + num_freelist_blocks) * 8192) /1048576
    from dba_tables
    order by ((blocks + empty_blocks + num_freelist_blocks) * 8192) /1048576 desc
    This gives a total of just over 8096 MB for all tables on all table spaces.
    I then found a query on this forum.
    SELECT
    SUM(BYTES) / 1048576 as mb_allocated
    FROM
    dba_SEGMENTS
    WHERE
    SEGMENT_TYPE = 'TABLE'
    This gives me around 38,372 MB.
    What is the difference between query 1 and 2?. Can I modifiy query 2 to break down the space allocated by table?
    Thanks in advance.
    Regards,
    Ned

    Tom's query is using information gathered for the cost-based optimizer (CBO). If you have not gathered sttaistics on the tables recently, those values may be way off.
    If you want to see a breakdown of the space used by different objects, you could use something like
    select owner, segment_name, sum(bytes)/1024/1024 MB
      from dba_segments
    where owner NOT IN ('SYS', 'SYSTEM')
    group by owner, segment_nameFrom the operating system, however, you would be looking at the size of the data files allocated to the tablespace. If you allocate 10 GB to the tablespace but only have 1 GB of space from that tablespace allocated to actual objects, you still have 10 GB allocated to Oracle at the operating system level.
    select tablespace_name, sum(bytes)/1024/1024 "MB"
      from dba_data_files
    group by tablespace_nameshould match the values reported at the operating system level.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Tab order direction and table size

    Hello.
    I have a form with a table that should be filled by the user. The default tab order is Left to Right, and I need it to be Right to Left. I tried to set the tab order from the Tab Order tab, and it worked on the first row, but when adding rows their tab order is left to right again. How can I change the default tab order?
    And one more thing - How can I get the size of the table (number of rows) with JavaScript?
    Regards,
    Arik

    Hi Arick,
    This is a standard functionality provided by Adobe form. You can see 'Tab order' under options, and using the shift key, decide the order in which you want the tab to move.
    for the number of row, use the following ( i dont know if theres any standard function, but since its repeated nodes of a subform, you can calculate  it in the following way)
    I am assuming that the table is called 'Table1' defined under the root node, and has only headerRow defined. No FooterRow is defined
    var count = 0;
    var nNumRows = form.Table1.nodes.length;
    for (var nNodeCount = 0; nNodeCount < nNumRows; nNodeCount ++){
    if (Table1.nodes.item(nNodeCount).className == "subform") {
    if (Table1.nodes.item(nNodeCount).name != "HeaderRow"){
    count++;
    the value of count is the no. of rows in the table

  • Indexes, Clusters, Views and Table Size

    Hi
    Anyone can kindly tell me how to check the size of tables,
    indexs, cluster and views? what are the commands to check the
    size? Thank you so much!
    Xiong

    I believe you just need to query
    user_segments,dba_segments,all_segments, Whichever you have
    access to.
    SELECT segment_name,segment_type,bytes/1024 "KB",extents
    FROM
    user_segments
    where segment_type in ('TABLE','INDEX','CLUSTER');
    I don't think views take up any storage aside from their
    definition in the Data Dictionary. Views are Logical.

  • Image and table size help

    Hey all:
    I'm obviously new to Dreamweaver MX, and I've been having
    quite a problem with my banner at the top of my site. Using
    photoshop, I made a banner and tried to put it at the top of my
    site. However, when I inserted the image, the image doesn't fit and
    leaves a white space around the image...it doesn't fit into the
    table. So what I had to do is make the background color in that
    specific cell black so it looks like the entire banner fit into the
    table. But I want to change the banner so it's a better designed
    image, but I know that no matter what I do, the image will not fit
    the cell perfectly. How can I do this?
    The site is: www.tudortastic.com
    Thanks!
    -H

    A table cell will expand to exactly contain an inserted image
    assuming
    the table's cellpadding and cellspacing are both set to zero
    and you
    have not specified an oversized height or width.
    "HappyHelen" <[email protected]> wrote in
    message
    news:eksu5e$4n6$[email protected]..
    > Hey all:
    >
    > I'm obviously new to Dreamweaver MX, and I've been
    having quite a problem
    > with
    > my banner at the top of my site. Using photoshop, I made
    a banner and
    > tried
    > to put it at the top of my site. However, when I
    inserted the image, the
    > image
    > doesn't fit and leaves a white space around the
    image...it doesn't fit
    > into the
    > table. So what I had to do is make the background color
    in that specific
    > cell
    > black so it looks like the entire banner fit into the
    table. But I want
    > to
    > change the banner so it's a better designed image, but I
    know that no
    > matter
    > what I do, the image will not fit the cell perfectly.
    How can I do this?
    >
    > Thanks!
    > -H
    >

  • Why Index size is bigger than table size?

    Dear All,
    I found in my database my tables sizes is coming around 30TB (All Tables in Database). and my index size for the same is 60TB. This is data ware housing environment.
    How the index size and table size are differing?
    Why they are differing? why index size is bigger than table size?
    How to manage the size?
    Please give me clear explanation and required information on the above.
    Regards
    Suresh

    There are many reasons why the total space allocated indexes could be larger than the total space allocated to tables. Sometimes it's a mark of good design, sometimes it indicates a problem. In your position your first move is to spend as little time as possible in deciding whether your high-level summary is indicative of a problem, so you need to look at a little more detail.
    As someone else pointed out - are you looking at the sizes because you are running out of space, or because you have a perceived performance problem. If not, then your question is one of curiosity.
    If it's about performance then you should be looking for code (either through statspack/AWR or sql_trace) that is performing badly and use the analysis of that code to help you identify suspect indexes.
    If it's about space, then you need to do some simple investigations aimed at finding a few indexes that can be "shrunk" or dropped. Pointers for this are:
    select
            table_owner, table_name, count(*)
    from
            dba_indexes
    group by
            table_owner, table_name
    having
            count(*) > 2   -- adjust to keep the output short
    order by
            count(*) desc;This tells you which tables have the most indexes - check the sizes of the tables and indexes and then check the index definitions for the larger tables with lots of indexes.
    Second quick check - join dba_tables to dba_indexes by table_name, and report the table blocks and index leaf blocks in desending order of leaf block count. Look for indexes which are very big, and also bigger than their underlying tables. There are special cases (and bugs) that can cause indexes to be much bigger than they need to be ... this report may identify a couple of anomalies that could benefit from an emergency fix followed (possibly) by a strategic fix.
    Regards
    Jonathan Lewis

  • Report to find all table and index sizes

    Hi all,
    Good day..
    Is there any report.sql or so to find out the sizes of all the tables and indexes in a database.
    thanks,
    baskar.l

    1.To get table size
    What will be the table size if?
    <or>
    break on report
    set line 200
    COMPUTE SUM LABEL "Total Reclaimable Space" OF "KB Free Space" ON REPORT
    column "Table Size" Format a20
    column "Actual Data Size" Format a20
    column "KB Free Space" Format "9,99,999.99"
    select table_name,
    round((blocks*8),2)||'kb' "Table size",
    round((num_rows*avg_row_len/1024),2)||'kb' "Actual Data size",
    pct_free,
    round((blocks*8),2) - (round((blocks*8),2)*pct_free/100) - (round((num_rows*avg_row_len/1024),2)) "KB Free Space"
    from user_tables
    where round((blocks*8),2) - (round((blocks*8),2)*pct_free/100) - (round((num_rows*avg_row_len/1024),2)) > 0
    order by round((blocks*8),2) - (round((blocks*8),2)*pct_free/100) - (round((num_rows*avg_row_len/1024),2)) desc
    2.To get index size
    How to size the Index
    Hth
    Girish Sharma

  • Change table size and headers in type def cluster

    Is is possible to change a table size and headers that is inside a type def cluster?
    I have a vi that loads test parameters from a csv file. The original program used an AC load so there was a column for power factor. I now have to convert this same program to be used with a DC load, so there is no power factor column.
    I have modified to vi to adjust the "test table" dynamically based on the input file. But the "test table" in the cluster does not update it's size or column headers.
    The "test table" in the cluster is used through out the main program to set the values for each test step and display the current step by highlighting the row.
    Attachments:
    Load Test Parms.JPG ‏199 KB
    Table Cluster.JPG ‏122 KB

    Nevermind, I figured it out...
    I was doing it wrong from the start, in an effort to save time writing the original program I simply copied the "test table" to by type def cluster.  This worked but was not really as universal as I thought it would be, as the table was now engraved in stone since the cluster is a type def.
    I should not have done that, but rather used an array in the cluster and only used the table in the top level VI where it's displayed on the screen.

  • How to know  columns and table name  whose column size are modified

    Hi guys
    I want to know which all columns in the tables are modify
    i.e. list of columns and table name whose column size are modified
    Step1 :
    CREATE TABLE employees
    ( employee_number number(5) ,
    employee_name varchar2(50) ,
    department_id number(10)
    CREATE TABLE Supplier
    ( Supplier_number number(5) ,
    Supplier_name varchar2(50) ,
    CREATE TABLE customers
    ( customer_id number(10) not null,
    customer_name varchar2(50),
    address varchar2(50),
    city varchar2(50),
    state varchar2(25),
    zip_code varchar2(10),
    Step2 :
    Alter table employees
    MODIFY employee_number number(10)
    ALTER TABLE supplier
    MODIFY supplier_name varchar2(100)
    step3
    query to dispaly
    columnname table name
    employee_number employees
    supplier_name supplier
    How to know columns and table name whose column size are modified
    could you please provide query
    Thanks in Advance

    09:35:50 SQL> desc dba_objects
    Name                            Null?    Type
    OWNER                                  VARCHAR2(30)
    OBJECT_NAME                             VARCHAR2(128)
    SUBOBJECT_NAME                         VARCHAR2(30)
    OBJECT_ID                             NUMBER
    DATA_OBJECT_ID                         NUMBER
    OBJECT_TYPE                             VARCHAR2(19)
    CREATED                             DATE
    LAST_DDL_TIME                             DATE
    TIMESTAMP                             VARCHAR2(19)
    STATUS                              VARCHAR2(7)
    TEMPORARY                             VARCHAR2(1)
    GENERATED                             VARCHAR2(1)
    SECONDARY                             VARCHAR2(1)
    NAMESPACE                             NUMBER
    EDITION_NAME                             VARCHAR2(30)LAST_DDL_TIME can be utilized

  • Funtion module to  'Determine table and index size online' for DB400

    hi ,
      i am using the a custom program for getting the table details,
      in this i am using the function module  'DB_TABLE_DATA_READ'.
      This is working fine if the DataBase is ORACLE,
      But not working for the database DB400,
      Please Provide with the alternative function module or any other way
    Regards,
    Kumar

    Kumar,
    in what "table details" are you interested? Maybe function module DB4_FILE_INFO could provide you with the information that you need. If you are primarily looking at table sizes, you can also try to query the tables DB4TABLE_STAT and DB4INDEX_STAT directly (in older SAP releases: DBSTATTDB4 and DBSTATIDB4). Please note that the function module and the table structures are no official interfaces, so they may change in future releases.
    Kind regards,
    Christian Bartels.

  • Table spaces and extent sizes

    hi all,
    how can we set the table spaces and extent sizes

    Hi
    All the things you can do when you are trying to create a table.
    You create a table using SE11.
    After that you have assign the fields to the table and later you need to give the technical settings to a table.
    Here you need to specify the table size which you call it as Extents.
    Table spaces are also defined to a table there itself.
    Reward if useful

  • DB Query to get table sizes and classification in OIM Schema

    My customer's OIM Production DB size has gone upto 300 gb. They want to know why. Like they want to know "what kind of data" is the reason for such a large size of DB. Is there a way to find out, from OIM schema, what are sizes for each table (like ACT, USR etc) and classify them into User Data, Config Data, Audit Data, Recon Data, etc?
    Any help is very much appreciated in this regard.
    Regards
    Vinay

    You can categorize tables using information from below link:
    http://rajnishbhatia19.blogspot.in/2008/08/oim-tables-descriptions-9011.html
    You can count number of rows for tables using:
    select count(*) from tablename;
    Find major tables whose size is to be calculated and find avg length of a row (by adding attribute lengths defined).
    Finally, calculate the table size using below query:
    select TABLE_NAME, ROUND((AVG_ROW_LEN * NUM_ROWS / 1024), 2) SIZE_KB from USER_TABLES order by TABLE_NAME;
    regards,
    GP

  • JTable and the ****** TableModel

    Ok, I know I'm messing with all of these threads about table and table model but there is no way for me to understand:
    I do
    MyTable table = new MyTable( rowData, column );
    public class MyTable extends JTabel {
    MyTableModel myMod = null;
    public MyTable( Vector vec1, Vector vec2 ) {
    super();
    myMod = new MyModel( vec1, vec2 );
    setModel( myMod);
    public class MyModel extends DefaultTableModel {
    public MyModel( Vector vec1, Vector vec2 ) { super(vec1,vec2); }
    but my tables are empty (1)
    and I can't add rows (2)
    Why? I'm messing with this for a lot.. could some one very kind post a bit of code that make me understand what is right and what is not right?
    thanks in advance

    Try this out, and you will probably figure out what you're doing wrong.
    * TableRenderDemo.java is a 1.4 application that requires no other files.
    import javax.swing.DefaultCellEditor;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    * TableRenderDemo is just like TableDemo, except that it
    * explicitly initializes column sizes and it uses a combo box
    * as an editor for the Sport column.
    public class TableRenderDemo extends JPanel {
        private boolean DEBUG = false;
        public TableRenderDemo() {
            super(new GridLayout(1,0));
            JTable table = new JTable(new MyTableModel());
            table.setPreferredScrollableViewportSize(new Dimension(500, 70));
            //Create the scroll pane and add the table to it.
            JScrollPane scrollPane = new JScrollPane(table);
            //Set up column sizes.
            initColumnSizes(table);
            //Fiddle with the Sport column's cell editors/renderers.
            setUpSportColumn(table, table.getColumnModel().getColumn(2));
            //Add the scroll pane to this panel.
            add(scrollPane);
         * This method picks good column sizes.
         * If all column heads are wider than the column's cells'
         * contents, then you can just use column.sizeWidthToFit().
        private void initColumnSizes(JTable table) {
            MyTableModel model = (MyTableModel)table.getModel();
            TableColumn column = null;
            Component comp = null;
            int headerWidth = 0;
            int cellWidth = 0;
            Object[] longValues = model.longValues;
            TableCellRenderer headerRenderer =
                table.getTableHeader().getDefaultRenderer();
            for (int i = 0; i < 5; i++) {
                column = table.getColumnModel().getColumn(i);
                comp = headerRenderer.getTableCellRendererComponent(
                                     null, column.getHeaderValue(),
                                     false, false, 0, 0);
                headerWidth = comp.getPreferredSize().width;
                comp = table.getDefaultRenderer(model.getColumnClass(i)).
                                 getTableCellRendererComponent(
                                     table, longValues,
    false, false, 0, i);
    cellWidth = comp.getPreferredSize().width;
    if (DEBUG) {
    System.out.println("Initializing width of column "
    + i + ". "
    + "headerWidth = " + headerWidth
    + "; cellWidth = " + cellWidth);
    //XXX: Before Swing 1.1 Beta 2, use setMinWidth instead.
    column.setPreferredWidth(Math.max(headerWidth, cellWidth));
    public void setUpSportColumn(JTable table,
    TableColumn sportColumn) {
    //Set up the editor for the sport cells.
    JComboBox comboBox = new JComboBox();
    comboBox.addItem("Snowboarding");
    comboBox.addItem("Rowing");
    comboBox.addItem("Knitting");
    comboBox.addItem("Speed reading");
    comboBox.addItem("Pool");
    comboBox.addItem("None of the above");
    sportColumn.setCellEditor(new DefaultCellEditor(comboBox));
    //Set up tool tips for the sport cells.
    DefaultTableCellRenderer renderer =
    new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for combo box");
    sportColumn.setCellRenderer(renderer);
    class MyTableModel extends AbstractTableModel {
    private String[] columnNames = {"First Name",
    "Last Name",
    "Sport",
    "# of Years",
    "Vegetarian"};
    private Object[][] data = {
    {"Mary", "Campione",
    "Snowboarding", new Integer(5), new Boolean(false)},
    {"Alison", "Huml",
    "Rowing", new Integer(3), new Boolean(true)},
    {"Kathy", "Walrath",
    "Knitting", new Integer(2), new Boolean(false)},
    {"Sharon", "Zakhour",
    "Speed reading", new Integer(20), new Boolean(true)},
    {"Philip", "Milne",
    "Pool", new Integer(10), new Boolean(false)}
    public final Object[] longValues = {"Sharon", "Campione",
    "None of the above",
    new Integer(20), Boolean.TRUE};
    public int getColumnCount() {
    return columnNames.length;
    public int getRowCount() {
    return data.length;
    public String getColumnName(int col) {
    return columnNames[col];
    public Object getValueAt(int row, int col) {
    return data[row][col];
    * JTable uses this method to determine the default renderer/
    * editor for each cell. If we didn't implement this method,
    * then the last column would contain text ("true"/"false"),
    * rather than a check box.
    public Class getColumnClass(int c) {
    return getValueAt(0, c).getClass();
    * Don't need to implement this method unless your table's
    * editable.
    public boolean isCellEditable(int row, int col) {
    //Note that the data/cell address is constant,
    //no matter where the cell appears onscreen.
    if (col < 2) {
    return false;
    } else {
    return true;
    * Don't need to implement this method unless your table's
    * data can change.
    public void setValueAt(Object value, int row, int col) {
    if (DEBUG) {
    System.out.println("Setting value at " + row + "," + col
    + " to " + value
    + " (an instance of "
    + value.getClass() + ")");
    data[row][col] = value;
    fireTableCellUpdated(row, col);
    if (DEBUG) {
    System.out.println("New value of data:");
    printDebugData();
    private void printDebugData() {
    int numRows = getRowCount();
    int numCols = getColumnCount();
    for (int i=0; i < numRows; i++) {
    System.out.print(" row " + i + ":");
    for (int j=0; j < numCols; j++) {
    System.out.print(" " + data[i][j]);
    System.out.println();
    System.out.println("--------------------------");
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("TableRenderDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    TableRenderDemo newContentPane = new TableRenderDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    Good luck!!

  • Not show horizontal srollbar when decrease table size

    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    public class SimpleTableDemo extends JPanel {
         final Object[][] data = {
                   { "Mary", "Campione", "ooooooooooooooooooooooooooo", "5" },
                   { "Alison", "Huml", "Rowing", "3" },
                   { "Kathy", "Walrath", "Chasing toddlers", "2" },
                   { "Mark", "Andrews", "Speed reading", "20" },
                   { "Angela", "Lih", "Teaching high school", "4" } };
         final Object[] columnNames = { "First Name", "Last Name", "Sport",
                   "Est. Years Experience" };
         public SimpleTableDemo() {
              JTable table = new JTable(data, columnNames);
              // Create the scroll pane and add the table to it.
              JScrollPane scrollPane = new JScrollPane(table);
              scrollPane.setPreferredSize(new Dimension(400, 100));
              // Add the scroll pane to this panel.
              setLayout(new GridLayout(1, 0));
              add(scrollPane);
         public static void main(String[] args) {
              JFrame frame = new JFrame("SimpleTableDemo");
              frame.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              frame.getContentPane().add("Center", new SimpleTableDemo());
              // frame.setSize(400, 125);
              frame.pack();
              frame.setVisible(true);
    }When I decrease table size the vertical scrollbar show, but horizontal srollbar NOT show. Why?

    When I decrease table size the vertical scrollbar show, but horizontal srollbar NOT show. Why? Because the table automatically resizes the width of each column.
    If you don't want this behaviour then set the setAutoResizeMode(...) method to off.

Maybe you are looking for