How do you hide columns and rows in a JTable component?

hi
i have jTable
basically it should contain 5 columns
but initially i would like to show 2 and on some action performed i would like to add the other 3
any suggestions

Hi,
See the TableColumnModel API for the answers you require.
addColumn/removeColumn/moveColumn methods.
Hope this helps for now.
A Swing FAQ containing more comprehensive explainations of common questions - coming soon!
Regards,
Matt.
Java Developer Technical Support
Sun Microsystems
http://www.sun.com/developers/support/

Similar Messages

  • HT202879 how do I make columns and rows?

    I have to take the minutes for meetings.  I normally have now problem creating a document with 4 columns and 5-6 rows.  Now since I updated I can no longer figure out how to do it.

    Hal,
    If you click the table icon in the toolbar, a Table will be added to your document at the current cursor position, and that table will have 4 columns and 5 rows. That seems to be what you are asking for, and it's easy to do, so there must be more to your question that I'm not getting. Could you elaborate?
    Jerry

  • How do I lock columns and rows in numbers?

    I have a large spreadsheet and I want to scroll up, down, left and right without the need to go up and down to find the name of the column or row where the information goes into.
    In Excel you lock a column or row just as easy but in numbers I have looked everywhere and don´t find an answer to this (otherwise) simple procedure.
    Thanks tho anyone who can help me.

    Hi Laura,
    The commands you are looking for are "Freeze Header Rows" and "Freeze Header Columns", both found in the Table menu.
    To use them, you must first convert the rows and columns you want to keep visible as Header Rows and Header Columns. You can define up to five of each. Rows must be at the top of the table and columns at the left, and multiple header rows/columns must be contiguous.
    Be aware that the conversion is not (easily) reversable, and that multiple headers (and footer rows) tend to slow large tables significantly.
    To convert an eligible row, hover the mouse over the row reference tab, then click the triangle when it appears. If the row is eligible for conversion (ie. if it is the top non-header row on the table, and is in the top five rows), you will see the option to "Convert to Header Row, seen below for row 2:.
    Regards,
    Barry

  • WPF: How to make the Column and Row separator more wide and different color in datagrid?

    Our application uses WPF.
    One of request is make the DataGrid column separator and row separator more wide and use different color and remove original black separator of rows and columns.
    Which template we need to modify to make it? Thx!
    JaneC

    Hi Magnus,
    Thanks for replying our question and provide your suggestions!
    Now we know modify both HorizontalGridLinesBrush and VerticalGridLinesBrush we can change the DataGrid cell separator color.
    Following your suggested, we modify the DataGridCell as following:
    <Style x:Key="Body_Content_DataGrid_Centering"
    TargetType="{x:Type DataGridCell}">
    <Setter Property="Padding" Value="2,0" />
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type DataGridCell}">
    <Border BorderThickness="2" BorderBrush="{StaticResource PageBorderBackground}" Margin="-1">
    <Grid Background="{TemplateBinding Background}" VerticalAlignment="Center" Height="42">
    <ContentPresenter VerticalAlignment="Center"/>
    </Grid>
    </Border>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>
    <Style x:Key="DataGridStyle1" TargetType="{x:Type DataGrid}">
    <Setter Property="HorizontalGridLinesBrush" Value="{x:Null}"/>
    <Setter Property="VerticalGridLinesBrush" Value="{x:Null}"/>
    </Style
    JaneC

  • I just updated to IOS 10.10.3 and the new photos app.  How do you hide photos so they don't show anywhere?

    I just updated to IOS 10.10.3 and the new photos app.  How do you hide photos and videos so they only show in the hidden album.  Thanks

    When publishing from Lightroom to Facebook, you are always sending them to an album. Lightroom doesn't generate you posts though. Generally Facebook is smart enough to create just one post for all of your images published to a single album. If you are getting individual posts per photo there isn't anything you can do from Lightroom's side to change that. Try refreshing you page your newsfeed or timeline to verify whether individual posts are being created or if it's just a timing issue.
    Also, uploading images to Facebook will always result in your file having a different file name on the server and in the page code. No avoiding this, no matter your method of upload.

  • Numbers-freezing columns and rows

    Can you freeze columns and rows in numbers although they are not designated as headers?

    FYI   I was looking for information in these old posts on the Freeze function in Numbers.  
    After looking through numerous posts and finally talking with an Apple Tech, we found that the freeze function was not in Number 08, but added in Number 09.   We were both surprised that this basic spreadsheet function was missing from 08
    With this function you can lock/freeze the top row and/or column so as you scroll through the spreadsheet, you can see you first rows or columns while looking at the data in the middle of the  spreadsheet.  
    I am not an Apple representative, but the only way to fix this and other flaws in Number 08 is to upgrade to 09 for $19.99.   Hope this helps.

  • How to enter a data into the specified column and row in a created table

    Hi,
    I want to enter some data to specified column and row in a already created table. Please let me know how to do this.
    Regards
    Shivakumar Singh

    A table is just a 2D array of strings. Keep it in a shift register and use "replace array element" to modify the desired entry programmatically.
    If you want to modify it manually and directly from the front panel, make it into a control and type directly into the desired element. (In this case your program would need to write to it using a local variable).
    Atttached is a simple example in LabVIEW 7.0 that shows both possibilities.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ChangeTableEntries.vi ‏41 KB

  • I use "element 12" and want  like in the old PS version due Automating and Contact  II upload multiple filesand print them with any columns and rows on the same page . How does it work?

    I use "element 12" and want  like in the old PS version due Automating and Contact  II upload multiple filesand print them with any columns and rows on the same page . How does it work?

    Can you supply a link?

  • Can we hide the lines between the columns and rows of an alv in wd abap

    HI all ,
      I know that we can colour cell/column/row in an alv in wd abap.
       but, can we hide the lines between the columns and rows of an alv in wd abap.
         i have checked this link [hiding lines b/n rows and columns of an  alv|http://help.sap.com/saphelp_nw04/helpdata/en/91/e7eb40c4f8712ae10000000a155106/content.htm]
         but didn't  understand, can please anybody provide some example or any material..? it will be very helpful.
                                                                         THANK  YOU.
    Edited by: arfat111 on Feb 15, 2010 7:05 AM

    Code some like this in the WDDOINIT method of your view which defines the ALV component as used component.
    instansiate the ALV component
    data lo_cmp_usage type ref to if_wd_component_usage.
    lo_cmp_usage = wd_this->wd_cpuse_usage_alv().
    if lo_cmp_usage->has_active_component() is initial.
       lo_cmp_usage->create_component().
    endif.
    data lo_interfacecontroller type ref to iwci_salv_wd_table.
    lo_interfacecontroller = wd_this->wd_cpifc_usage_alv().
    data lo_value type ref to cl_salv_wd_config_table.
    lo_value = lo_interfacecontroller->get_model().
    hide the grid lines
    lo_value->if_salv_wd_table_settings~SET_GRID_MODE( value = '01' ).
    Thanks,
    Abhishek

  • How to fix skewed table columns and rows after re-import XML

    My question is regarding XML Import in InDesign CS3.
    I have a XML that has a table of 5 columns and 5 rows, when I import it into InDesign, the table shows up fine with 5 columns and 5 rows. However when I revise my table to have an additional column, and re-import the XML file, the table gets updated, but instead of with an additional column, it gets 'appended' with an additional row instead (InDesign seems to blindly replace each cell from left to right, top to bottom, and ends up with 6 rows instead). The XML file specifies the number of columns and rows (5 and 5 before, 5 and 6 after), why doesn't InDesign recognize it and automatically add a new column when I re-import the file?  Is this problem fixed in CS5.5? Is there a script to fix this?
    Here is an example of my old XML vs new XML:
    Old:
    <frame5>
    <Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" aid:table="table" aid:trows="5" aid:tcols="5">
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1"></Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2006</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2005</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2004</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2003</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores at beginning of period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">678</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores opened during the period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">36</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">50</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">59</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">79</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores closed during the period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">13</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">9</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">7</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">4</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Total stores at end of period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">869</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>
    </Table>
    </frame5>
    New:
    <frame5>
    <Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"
    xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="5" aid:tcols="6">
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1"></Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2007</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2006</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2005</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2004</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2003</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores at beginning of period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">123</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">678</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores opened during the period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">456</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">36</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">50</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">59</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">79</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores closed during the period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">789</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">13</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">9</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">7</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">4</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Total stores at end of period</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">1368</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">869</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>
    <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>
    </Table>
    </frame5>

    What I mean is, right now there is a "workaround" which requires a user to manually add an extra column before re-importing the XML (with an extra column), otherwise the results get skewed. If by providing a script we can simply ask the user to "run" it, it would be a more "acceptable" solution.  
    Right. So, one solution would be to use Convert Text to Tables. If you find that works for you, then you can script it.
    That's why I asked you...
    Of course if nothing is required from the user other than simply re-importing, then that would be the best solution.
    Well, one could imagine a script that was attached to the re-import command, or to the link update notification, but probably the first step is to get something that works reasonably well without automating it completely. Especially because triggers to run scripts silently can introduce hard-to-debug problems.
    Sure we can switch to use "CALS table and see if this works. The question is, why should we need to? In the 2nd XML there is clearly a different "aid:tcols" value, and yet InDesign seems to ignore it and assume the same # of columns? This sounds like an Indesign bug, can someone confirm? Is there any plans to fix this?
    Not to be snarky, but do you want it to work or not? There are the tools you have and the tools you wish you had, and you can't really do much with the ones you wish you had. I'm kind of assuming you are looking for a solution today, not a solution in 2013.
    Yes,  I believe two of us have confirmed this appears to be a bug.
    Plans to fix? Well, we can't really tell you. You could try asking Adobe, but that's not easy information to get out. But you can certainly open a support case at http://adobe.com/go/supportportal and ask. It's not like we have special information here...
    But you're probably better off filing a bug first, in that same fashion.
    But let's assume no one had filed the bug. CS6 is expected in the March/April 2012 timeframe. That means that they're probably just putting the finishing touches on it right now, and it's going to be very difficult to fix things in it now. So then the earliest you'd likely get it fixed in CS6.5/CS7/whatever which presumably comes out by 2Q2013, and that's assuming Adobe decides to fix it...
    I also can't find much documentation on how to update my table to a "CALS table", any examples?
    Try this thread:
    Re: Importing a CALS table into InDesign CS3

  • How to freeze column and row headers of a table

    How to freeze column and row headers of a table in jsp and javascript. An example is available in
    http://www.massless.org/_tests/grid1/ pls help to find a solutionj
    Thanks in anticipation
    Sreejesh

    At least I don't stop you from that. I also don't see any benefits in this topic.
    Success.

  • How to get the current selected column and row

    Hi,
    A difficult one, how do i know which column (and row would also be nice) of a JTable is selected?
    e.g.
    I have a JButton which is called "Edit" when i select a cell in the JTable and click the button "Edit" a new window must be visible as a form where the user can edit the a part of a row.
    Then the column which was selected in the JTable must be given (so i need to know current column) and then i want the TextField (the one needed to be edited) be active with requestFocus(). So it would be
    pricetextfield.requestFocus();
    Problem now is that i have to click every time in the window the JTextField which was selected in the JTable. I have chosen for this way of editing because my application is multi-user and it would be too difficult for me when everybody did editing directly (catch signals, reload data, etc.).
    My question is how do I know the current column and the current row in a JTable?

    I'm not sure what your mean by the "current" row or column, but the following utility methods return
    which row and column have focus within the JTable.
    public static int getFocusRow(JTable table) {
        return table.getSelectionModel().getLeadSelectionIndex();
    public static int getFocusColumn(JTable table) {
        return table.getColumnModel().getSelectionModel().getLeadSelectionIndex();
    }

  • How to make Column and Row headers bold in Web template?

    Hi Experts,
    I have a web application with a query in it. Now I would like to know how I could make the column and row headers of this webquery in bold font? I havent found any properties in any web item to make this possible. It looks like the only way to do this is CSS, but i dont have any experience with style sheets.
    Are there easier ways to do this?
    Thanks in advance.
    Rgds,
    Richard

    Tried this for fun using JavaScript.  It appears to work, but is pretty much a hack, and I didn't test it thoroughly.
    Place this in a function that is called during onload of the page:
         var eleid='';
         for(var ct=0;ct<1000;ct++) {
              eleid='ANALYSIS_interactive_mc'+ct+'_tv';
              if (document.getElementById(eleid)) {
                   if(document.getElementById(eleid).parentNode.className=='urLayoutPadless') {
                        document.getElementById(eleid).style.fontWeight='bold';

  • How do you hide purchased items when I only have an ipad air and don't own a Mac or a PC?

    How do you hide history of purchased apps from an iPad air when I don't own a Mac or a PC to log in and hide items?

    You're welcome. Sorry to be the bearer of bad news.

  • How to I hide column heading completely ?

    There is a similar post on 10g - How to I hide column heading completely ?
    The solution is - To achieve this, go to Edit Table View, open Table View Properties. Here you should see an option called 'Display table and column Headings'. Here set its value to 'No column or table headings'.
    I'm on 11.1.1.5 and when I go to Edit Table view -> Table View properties -> Display Folder & Column Headings , I see four values as below but there is no value 'No column or table headings'. The values are -
    -Only column headings
    -As separate rows
    -As Folder.column
    -As Folder.column (where needed)
    Is this 'No column or table headings' value no more available in 11.1.1.5 ? Is there any alternative method to achieve this?
    I'm able to hide the column header using various ways e.g. setting Display Heading option, but when I download the results it has either the header present or an empty row. In 10g the option 'No column or table headings' removed the header completely from the download file.
    Any suggestions please?

    Anybody has any thoughts on why 'No column or table headings' option is removed from 11g or is it just 11.1.1.5?
    Is this a bug or any other feature has been provided to achieve the same?

Maybe you are looking for