JTable:  resizing all columns as 1 column resizes

I have a JTable with 480 columns inside of a JScrollPane (AUTO_RESIZE_ALL_COLUMNS needs to be off for the JTABLE to display correctly in the JScrollPane). When the user resizes one column I would like the rest of the columns to resize too, so that the column widths of each column are equal.
Thank you in advance,
Brent

[...] I
I have the JScrollPane listening to a histogram of the
balances so the user can click on a month in the
histogram and the JScrollPane (actually JViewport)
will move to display the appropriate column in the
JTable. If the column sizes are not uniform then I
cannot be sure that I'm moving the JViewport to
display the correct JTable column(s).
I thing the GUI is a great design for what must be
done. And thank you for your help and comments.That still sounds pretty klunky. I don't see any user navigating around a 480 column table. They click in your histogram to go to a column, they click somewhere or do keyboard navigation and the display scrolls them a few columns/rows away... they are now lost in a sea of cells and have to go back to the histogram again to try and get back, etc. Having delt with similar situations, there are better ways. Read the last two days dilbert cartoons carefully. :-)
But anyway...
You don't have to have all the columns the same width to make a column visible in the viewport. You can just get the appropriate column's rect by either of these methods:Rectangle r = myTable.getTableHeader().getHeaderRect( col );
Rectangle r = myTable.getCellRect( row, col, true );And then tell the viewport to make sure that rect is visible:myViewport.scrollRectToVisible( r );Much easier than hacking around with custom column resizing logic.

Similar Messages

  • Moving column separator causes cell resize

    Hello, y'all,
    I've run into a strange issue, in which the cells of a table control will resize when I move a column separator.  I can't always reproduce it and I have no idea what's triggering it.  Is this a known issue?
    Thanks, 
    Slowpoke
    Slowpoke
    CLAD (believe it or not!), using LabVIEW 8.5
    They don't call me "Slowpoke" for nothin'!

    Hello, Mr. Altenbach!  Right, I should've been clearer.  The problem is that the cells to the *right* spontaneously resize themselves during a Mouse Move event--and to the same width, as far as I can tell.  I don't know what triggers it.  I'm running LabVIEW 8.5.
    Slowpoke
    CLAD (believe it or not!), using LabVIEW 8.5
    They don't call me "Slowpoke" for nothin'!
    Attachments:
    Untitled 1.vi ‏20 KB

  • Why can't I double click column seperaters to auto resize in OSX Lion?

    Why can't I double click column seperaters to auto resize in OSX Lion?

    No idea, why you are so aggressive.  We are only all trying to help each other.
    You didn't mention anything about Cover Flow in your orignal posts, did you?  I am neither content or not content using Column view.  This has nothing to do with me!  I was simply trying to help you by suggesting that Column view works.
    By the way, I am not wrong.  Column view resizes perfectly well when the vertical separator line is double clicked.

  • Cannot resize the message 'read/unread' column in leopard mail.

    I cannot seem to resize the message 'read/unread' column in leopard mail. All other columns (from, subject, date received, size etc) can be resized as normal, however the read/unread "blue dots" are taking up an inordinate amount of space and will not for the life of me resize!
    it is driving me crazy...is this a leopard bug or am I just doing something wrong? thank you very much.

    I cannot seem to resize the message 'read/unread' column in leopard mail. All other columns (from, subject, date received, size etc) can be resized as normal, however the read/unread "blue dots" are taking up an inordinate amount of space and will not for the life of me resize!
    it is driving me crazy...is this a leopard bug or am I just doing something wrong? thank you very much.

  • Auto-resizing all components

    Is there a method that auto resizes all components on a JFrame when it is maximised for example. I have got a JTable (in a scrollpane) and some other components on a panel. I have sized the frame to be approx 80% of the screen size. When the frame is maximised, the table and the other components retain their original size (understandably so!). Is there a method available that can resize the panel and its components to resize accordingly when the frame is maximised?...I know I can add the componentListener and implement a method in the componentResized() method...but I dont want to duplicate stuff that's already available. Thanx for your help.

    I don't know the specific needs.
    BorderLayout: simple Layout; Components are oriented NORTH, EAST, SOUTH, WEST
    FlowLayout: all components are added after the other
    GridLayout: components are oriented in a grid
    GridBagLayout: complex once
    See the Java Tutorial for more information.

  • Check all checkboxes in a column of a tabular form

    Hi,
    I think this can be useful for some people.. I have a tabular form with several columns containing checkboxes. I wanted to be able to check or uncheck a whole column. The problem is that I didn't find a function to do this. So I modified (and renamed) the $f_CheckFirstColumn(pNd) function.
    In "edit page > JavaScript Function and Global Variable Declaration", add this :
    function $f_CheckNthColumn(c,n){
         var e=$x_UpTill(c,"TABLE");
         for(var d=0,a=e.rows.length;d<a;d++){
              var b=$x_FormItems(e.rows[d],"CHECKBOX")[n];
              if(b){
                   if(b.checked != c.checked) {
                        b.click();
         return;
    }EDIT : The status of the checkboxes checked with the function below is not passed when submitting the form (it is passed when clicking on every checkbox). This is why I had to use the click() function (so that onClick is triggered).
    --function $f_CheckNthColumn(c,n){
         var e=$x_UpTill(c,"TABLE");
         var f=[];
         for(var d=0,a=e.rows.length;d<a;d++){
              var b=$x_FormItems(e.rows[d],"CHECKBOX")[n];
              if(b){
                   f[f.length]=b;
         $f_CheckAll(false,c.checked,f);
         return f;
    And in the report column header :
    <input type="checkbox" onClick="$f_CheckNthColumn(this, NUMBER);" />NUMBER being the column number (1st column containing checkboxes = 0, 2nd column containing checkboxes = 1, etc.)
    I'm using APEX 4.1.1.00.23, so I can not guarantee It'll work on other versions.
    Hope this can help !
    Edited by: ben0123 on Jul 13, 2012 12:12 AM
    Edited by: ben0123 on Jul 13, 2012 1:17 AM

    Glad it helped :)
    If you have only one checkbox that is conditional, you could change the $f_CheckNthColumn function by adding this kind of condition :
    if ($x_FormItems(e.rows[d],"CHECKBOX").length == max_number_of_checkboxes || n < position_of_conditional_checkbox) toggle checkbox(n); // all the checkboxes are displayed, or the nth checkbox is before the conditional checkbox
    else // one (or more?) checkbox is missing
      if (n == position_of_conditional_checkbox) do nothing;
      else toggle checkbox(n-1);

  • Script to resize all tables in a document

    I'm using Framemaker 11, and have tons of tables that need to be resized so that they fit within the text frame. Does anyone know of a script or a fast way to resize all the tables in a document at once?

    TableCleaner does a bunch more than just resizing, and is one of the best values I've seen for a plugin.
    Looks like he's switching his content to a Wordpress site, so here's Rick's direct info:
    rick at frameexpert dot com
    [use link: http://www.frameexpert.com/old/]

  • Date and Days for all year come in column

    Dear all
    I have 2 Column 1 is Date and 2nd is Day
    And i have one Button i need when i enter button then its show all year date in date column and day in day column for example
    Date---------Day+
    *1-jan-2009-Thursday*
    *2-jan-2009-Friday*
    *3-jan-2009-Saturday*
    And As on
    I hope you guys understand
    Regards
    Shahzaib ismail

    Hai,
    That means, You need to fill the multi record block which has 2 columns ( 1 is date, and the other is day.).
    For that Try this in the WHEN-BUTTON-PRESSED Trigger of the Button.
    DECLARE
         Dt_Date DATE;
    BEGIN
         GO_BLOCK ('<block_name>');
         CLEAR_BLOCK(NO_VALIDATE);
         FIRST_RECORD;
         Dt_Date := TO_DATE('01-JAN-2009');
         LOOP
              :<block_name>.TI_DATE := TO_CHAR(Dt_Date, 'DD-MON-YYYY');
              :<block_name>.TI_DAY  := TO_CHAR(Dt_Date, 'DAY');
              EXIT WHEN TO_CHAR(Dt_Date, 'YYYY') <> TO_CHAR(Dt_Date + 1, 'YYYY');   -- If next year reaches, exit from the loop.
              Dt_Date := Dt_Date + 1;
              NEXT_RECORD;
         END LOOP;
    END;          Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • Conversion puts all data in one column

    conversion puts all data in one column on excel

    ok i created my own function
    CREATE OR REPLACE TYPE t_varchar2_tab AS TABLE OF VARCHAR2(4000);
    CREATE OR REPLACE FUNCTION tab_to_string (p_varchar2_tab IN t_varchar2_tab,
    p_delimiter IN VARCHAR2 DEFAULT ',') RETURN VARCHAR2 IS
    l_string VARCHAR2(32767);
    BEGIN
    FOR i IN p_varchar2_tab.FIRST .. p_varchar2_tab.LAST LOOP
    IF i != p_varchar2_tab.FIRST THEN
    l_string := l_string || p_delimiter;
    END IF;
    l_string := l_string || p_varchar2_tab(i);
    END LOOP;
    RETURN l_string;
    END tab_to_string;

  • Multiple columns in a column in a JTable

    Hi,
    I'm trying to have a JTable with 7 columns (for the days of the week) and in these columns I would like to have 6 columns in each column - which in the end will be drop down boxes.
    Does anybody know if this is possible (I hope I've explained it ok!), or know of any examples that would be useful??
    Please help, thanks in advance!!

    Hi, thanks for the site - but I have tried to run the code which will do what I require - however it will not compile as it states that the import jp.gr.java_conf.tame.swing.table.*; does not exist.
    Does anyone know where I can get this from or how I change the code so I don't have to use this import?? I have tried removing it and it compiles, but it falls over on run time.
    Thanks in advance.

  • Can I batch resize all to 300px x 300px with some kind of white background for non square photos?

    I want to resize all to 300 x 300 but I don't want to ruin the photo integrity but I want them to be exactly 300 x 300 for example if I have an image that is 500 x 400 I don't want it to be resized to 300 x 200 I would like it resized to 300 x 300 with a white bar frame

    The answer is yes but doing that type of resize will distort your images and it can be done with a simple action.  Image size Resample checked constrain unchecked width and height set to 300.  With a script you could resize your images so that its shortest side is 300px then center crop the result to 300px by 300px you will loose some image pixels off the sides or the top and bottom. You can also resize the image and add canvas with an Action or script. The action would use menu File>Automate>Fit image (wihch is a script plugin) and set width and height to hight to 300.  This may resize the image to something like 300x200 so you follow the fit image step with Canvas size set width and height to 300px

  • List all of the existing column and there column format and data format?

    Hello Gurus,
    I am new to OBIEE and i have a requirement to verify the column format and data format for all of the existing column while generating a analysis report. Is there any way i can list down all of the columns which are exposed and list there column format and data format?
    For checking the individual column properties i know there is an option called 'Column Properties' but want to know all in once go.
    Kindly help me and thanks in advance.
    Thanks

    I don't think you have anything in answers to get that, Go to Repository and Utilities -> Generate Metadata Dictionary that will give columns and datatype.
    Award points if it helps
    ~Srix

  • Theres an opportunity to RESIZE all linked images to 100% of the frame?

    Theres some third party plugins, but i dont find one which works well and support layered psd for example. i think its a basic function and it should have an native way to do that.
    thanks a lot.

    That's a very old school way of achieving things - namely Quark.
    In the past it was necessary to resize all images to 100% @ the desired resolution.
    InDesign gives 2 resolution views in the Window>Info panel for each image.
    Actuall PPI and Effective PPI
    Actual shows the actual amount of PPI - and Effective PPI shows the PPI of the image after scaling .
    When you export the file to PDF you can choose the Compression of the image to any DPI you would like.
    This means the same file can be used for
    Newspapers
    Brochures
    Magazines
    High-End print finishing
    Each of the above have a unique LPI - which determines the optimum resoultion.
    This way you don't end up with 4 different files for the same job.
    Or worse - 16 incarations of the same image at different sizes for different outputs.

  • TS1538 When I open itunes, "Devices" does not appear at all in the left column on the screen, therefore I can not sync my ipod touch.

    When I open itunes, "Devices" does not appear t all in the left column on the screen. I can not sync my ipod with my itunes library. Suggestions?

    If you  have iTunes 11 turn on the Sidebar. Go to iTunes>View and click on Show Sidebar. You can also do a Crtl+S to show the sidebar. The sidebar is where Devices appears. and Control+B to show the Menu bar

  • Inserting values for all records except 1 or 2 column ,without specify column names.,?

    Hi,
    for example, in student table i am having 1000 columns,  column names like(id ,name,class, dept,etc,.).
    i want to insert 998 fields to department table from student tables except(id,class).
    i don't want to mention all column names in the insert command,
    is there any possibilities to filter the column names in insert command like (EXCEPT, NOT IN).
    Thanks in advance..

    duplicate of
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b31fa034-5b8f-42e4-b4e1-592a632ca6a5/inserting-values-for-all-records-except-1-or-2-column-without-specify-column-names?forum=sqlce
    please dont cross post
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

Maybe you are looking for

  • Help with percentages

    I have a form where I need to add the dollar amounts for projected small business spend and large business spend. (which is entered by the user) Then, actual cumulative smal and large spend is also entered by the user. I need to know how to write the

  • [Solved] Wireless connection help

    #Important Data about the driver I need. [14e4:4311] BCM4311 #I need B34-firmware #The Error that occured. user@linuxbox ~]$ lspci -vnn -d 14e4: 02:00.0 Network controller [0280]: Broadcom Corporation BCM4311 802.11b/g WLAN [14e4:4311] (rev 01) Subsy

  • ESB Exception Handling Best Practices

    I've update the "ESB Transactions, Error Handling and Resubmit" Lesson PDF to include a best practices section. Go to http://otn.oracle.com/goto/esb and click on the link in the Learning more section. Feedback welcome.

  • IBook don't go into sleep after 10.4.7 update.

    Hello, today i've installed the 10.4.7 update. After the installation my iBook doesn't go into sleep. When I close the Notebook the white indicator blinking once and the iBook wake up. If I try to activate the sleep mode from apple menu it is the sam

  • Is there any way to paste formatted text into muse, and have it stay formatted?

    Greetings, I have a client who sends material to me with intricate formatting (italics and bold only) for posting on the website. Is there any way to avoid losing that formatting when I paste it into Muse? If not, I have several hours of work to form