Group columns in jtable

Hi,
i'm looking for a solution to group columns in a table header. I found some very old posts in the web but they don't help.
I think there is no standard solution in Swing?
It confuse me that no other people ask this here in the last months/years. I think this is a requirement for many desktop apps.
Can anybody give me a tip how can i do this.
Thanks

I mean to group logical columns together so they have a multi line column header, the first line is the group name and in the second line i have the column names
Edited by: broemme747 on Apr 9, 2010 10:45 AM

Similar Messages

  • What is difference between distribution list and share point group? Can we add distribution list into person and group column of share point list?

    what is difference between distribution list and share point group? Can we add distribution list into person and group column of share point list?

    there is a workaround you can try, create audience and add DL to them and deal with the audience or convert DL to groups
    https://social.technet.microsoft.com/Forums/en-US/02f0d773-8188-4d94-a448-0c04d838b0cf/distribution-lists-in-sharepoint?forum=sharepointgenerallegacy
    Kind Regards,
    John Naguib
    Technical Consultant/Architect
    MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation
    Please remember to mark your question as answered if this solves your problem

  • Hiding a column in jtable made from DefaultTableModel.

    I have made my jtable from DefaultTableModel.
    I want to keep one column in the jtable as hidden storing some data containing neccessary information like the "path of the file"
    which need not be shown to the user.
    Please tell me how I can hide one column in the Jtable.
    please provide siome link or code for the same.
    Tia,
    Sarwa

    dayanandabv wrote:
    [http://search.sun.com/search/onesearch/index.jsp?qt=hide+column%2B+JTable&rfsubcat=&col=developer-forums]
    My thought exactly.
    db

  • How to set different renderers to different cells in same column of JTable?

    Hello Friends,
    I need your help again...
    Does any body knows, how to set different renderer's for different cells of same column in JTable..??
    For ex.
    Col1 Col2 Col3 Col4
    A       A       A      A
    A       A       A      B
    A       A       A      C
    A       A      A       D
    Where A B C D would be different Renderers.  I want set exactly same ,,, ie. one column with different renderer at different cell positions..
    Right now i m setting renderer using statement bellow :
    table.getColumnModel().getColumn(int).setCellRenderer(rederer_Instance);But with this, effect in the last renderer is applicable whole column....
    Can any body help me out ?????????
    please refer this thread for similar kind of discussion...
    http://forums.sun.com/thread.jspa?forumID=57&threadID=571445Thanks
    Suyog

    Please refer to the first reply of [this thread|http://forums.sun.com/thread.jspa?forumID=57&threadID=571445] for the answer. If you have a specific problem implementing it, post you code with a specific question.

  • Unable to select SOME external users in person or group column in SharePoint O365

    Here's a head scratcher.
    We have an O365 SharePoint(G3) instance.
    Sent external users invites to join the site from the SharePoint Group that the external user will be placed.
    External users accepted invitations and now have access to the site with the correct permissions.
    Permissions assigned to SharePoint Group.
    Some external users can be selected for "Assigned to" field (person or group column type).
    Some external users canNOT be selected for "Assigned to" field (person or group column type).
    When typing external users name that canNOT be selected, the error message "No results found" appears.
    Went to Site Settings > Site Permisisons > Check Permissions and typed in external users name that canNOT be selected, the error message "No results found" appears.
    I have no idea why this would happen for some external users and not others.
    External users that can be selected and those that canNOT be selected are in the same SharePoint Group and have the same permissions.
    Could this be due to how the external user set up their account?
    Help me please. This is driving my crazy.
    Thanks in advance.
    Tamara
    The Stumped SharePointer
    Tamara Bredemus SharePoint Minion...working up to Maven

    Hi Miikka,
    can you try cleaning up the user information list via powershell and reconfigure the userprofile sync.  following url contains the powershell script for user information clean up
    http://blog.fpweb.net/how-to-clean-up-sharepoint-user-information-list-with-powershell/#.VPrbn_mUeSo
    Regards  Roy Joyson
    Please remember to mark your question as "answered"/"Vote helpful" if this solves/helps your problem.
    Roy Joyson

  • Add and remove columns from JTable

    Help me please!
    A try to remove column from JTable. It's removed, but when I try to add column in table, then I get all old (removed early) columns + new column....
    I completely confused with it.....
    Here is my code for remove column:
    class DelC implements ActionListener
              public void actionPerformed (ActionEvent e )
                   int [] HowManyColDelete = table.getSelectedColumns();
                   if (HowManyColDelete.length !=0)
                        TableColumnModel tableCModel = table.getColumnModel();
                        for (int i = HowManyColDelete.length-1; i>-1; i--)
                             table.getColumnModel().removeColumn (tableCModel.getColumn (HowManyColDelete [ i ]));
                   else
                          JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
         }

    It's little ex for me, I just try understand clearly how it's work (table models i mean). Here is code. All action with tables take place through menu items.
    My brain is boiled, I've try a lot of variants of code, but did't get right result :((
    It's code represent problem, which I've describe above. If you'll try remove column and then add it again, it will be ma-a-a-any colunms...
    I understand, that my code just hide columns, not delete from table model....
    But now I have not any decision of my problem...
    Thanks a lot for any help. :)
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import javax.swing.table.DefaultTableModel;
    class JTableF extends JFrame
         Object [] [] data = new Object [0] [2];
         JTable table;
         DefaultTableModel model;
         String [] columnNames = {"1", "2"};
         TableColumnModel cm;
         JTableF()
              super("Table features");
              setDefaultLookAndFeelDecorated( true );
              setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
              JMenuBar MBar = new JMenuBar();
              JMenu [] menus =  {new JMenu("A"), new JMenu("B")};
              JMenuItem [] menu1 =  {new JMenuItem("Add row"), new JMenuItem("Delete row", 'D'),  new JMenuItem("Add column"), new JMenuItem("Delete column")};
              menu1 [ 0 ].addActionListener(new AddL());
              menu1 [ 1 ].addActionListener(new DelL());
              menu1 [ 2 ].addActionListener(new AddC());
              menu1 [ 3 ].addActionListener(new DelC());
              for (int i=0; i<menu1.length; i++)
                   menus [ 0 ].add( menu1 [ i ]);
              for (int i=0; i<menus.length; i++)
                   MBar.add(menus );
              JPanel panel = new JPanel ();
              model = new DefaultTableModel( data, columnNames );
              table = new JTable (model);
              cm = table.getColumnModel();
              panel.add (new JScrollPane(table));
              JButton b = new JButton ("Add row button");
              b.addActionListener(new AddL());
              panel.add (b);
              setJMenuBar (MBar);
              getContentPane().add(panel);
              pack();
              setLocationRelativeTo (null);
              setVisible (true);
         class DelC implements ActionListener
              public void actionPerformed (ActionEvent e )
                   int [] HowManyColDelete = table.getSelectedColumns();
                   if (HowManyColDelete.length !=0)
                        TableColumnModel tableCModel = table.getColumnModel();
                        for (int i = HowManyColDelete.length-1; i>-1; i--)
                             int vizibleCol = table.convertColumnIndexToView(HowManyColDelete [ i ]);
                             tableCModel.removeColumn (tableCModel.getColumn (vizibleCol));
                        //cm = tableCModel;
                   else
                        JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
         class AddC implements ActionListener
              public void actionPerformed (ActionEvent e)
                   //table.setColumnModel(cm);
                   Object NewColumnName = new String();
                   NewColumnName = JOptionPane.showInputDialog ("Input new column name", "Here");
                   int i = model.getRowCount();
                   int j = model.getColumnCount();
                   Object [] newData = new Object [ i ];
                   model.addColumn ( NewColumnName, newData);
         class AddL implements ActionListener
              public void actionPerformed (ActionEvent e)
                   int i = model.getColumnCount();
                   Object [] Row = new Object [ i ];
                   model.addRow ( Row );
         class DelL implements ActionListener
              public void actionPerformed (ActionEvent e)
                   int [] HowManyRowsDelete = table.getSelectedRows();
                   if (HowManyRowsDelete.length !=0)
                        for (int k = HowManyRowsDelete.length-1; k>-1; k--)
                             model.removeRow (HowManyRowsDelete[k]);
                   else
                        JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Row is not selected!");
         public static void main (String [] args)
              javax.swing.SwingUtilities.invokeLater(new Runnable()
                   public void run()
                        JTableF inst = new JTableF();

  • Keyboard Access For a Column in JTable with default editor as JComboBox

    I want to get Key board access for a column in JTable.
    The user should be able to select from a drop down list for the column with default
    editor set as JComboBox.
    Presently,it works fine with mouse,also I am able to focus it with Keyboard using
    ALT+Up keys,but how to make drop down list appear.
    Plz help,it's urgent.
    Thanks in Advance

    Hi,
    In addition to setting DO_SUM = 'X' you need to specify function in H_FTYPE field. It should be set to 'AVG' in your case.
    ls_fielcat-do_sum = 'X'.
    ls_fieldcat-h_ftype = 'AVG.

  • Filter base on Person or Group column does not work correctly in sharepoint 2013

    I have a list that contain "Person or Group"column that set "Allow Multiple Selections" to yes.
    In sharepoint 2010 I create view and filter it base on this person or group column equal to [Me]. And it's work correctly.
    Now in sharepoint 2013 when I filter view, base on this person or group column equal to [Me], it does not show me any items, although list has data that person or group column set to me.
    What's wrong?
    Thanks.

    If you want to filter the list view when current user is in the group, then I recommend to use theMembership comparator in the
    query and add it to the view page in SharePoint Designer:
    <Where><Or><Membership Type="CurrentUserGroups"><FieldRef Name="AssignedTo"/></Membership><Eq><FieldRef Name="AssignedTo"/><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Or></Where>
    More reference:
    http://decodesharepoint.blogspot.com/2010/01/filter-list-views-by-user-groups.html

  • Serial number column in Jtable

    Apologies for this distraction.
    I read at this forum about a year ago how to add a s/n column in Jtable such that all the nos are automatically updated/adjusted when a row is added/deleted. the count starts from the top down serially and unaffected by sorting.
    pls help!

    thanks a million BaltimoreJohn and especially camickr whose solutions to problems have been most helpful. applying the referenced post, i worked around the problem by resetting the values of the column having the serial number, based on table rowCount every time there is an operation on it(deleting, addition etc)

  • Hide group columns

    Whilie reducing the size of the cell minimizes the real estate consumed by the report, it doesn't resolve the issue of having the group columns in the output. When a report is exported to Excel, these columns create merged cells which limit functionality
    in the worksheet.
    For example: I have a tablix with 3 groups. When the report exports to Excel, my data begins in Column D instead of starting in Column A.
    I have tried hiding the individual cells, hiding the columns (using the hidden property of the column), hiding the group (removes all data), and deleting the columns (removes the groups).
    How can I hide or remove the column without affecting the grouping?

    Never mind. I found the answer in the most obviious place.
    I was deleting the column  and clicking through the acceptance. The default is to delete the column and the group both.
    When I slowed down, I found the option to delete the column only. This resolved my issue.
    My data now starts in Column A as expected.

  • Problem with Hiding Columns in JTable

    Hi.
    Who knows how to hide column in JTable.
    I try to get column:
    MyTab.getColumnModel().getColumn(i)But there is no methods like SetVisible(false)
    What to DO???

    http://www.google.com/search?hl=en&q=%2Bhide+%2Bcolumn+%2Bjtable&btnG=Google+Search

  • Programmatically Sorting columns in JTable

    Hi,
    How can I programmatically sort a particular column in JTable without having to click on column header.
    Thanks.

    to sort the desired column w/o click on header
    int columnIndexToSort = 1;
    RowSorter.SortKey sortKey = new RowSorter.SortKey(columnIndexToSort,SortOrder.ASCENDING);
    ArrayList alist = new ArrayList(1);
    alist.add(sortKey);
    ((DefaultRowSorter)table.getRowSorter()).setSortable(columnIndexToSort , true);
    ((DefaultRowSorter)table.getRowSorter()).setSortKeys(alist);
    ((DefaultRowSorter)table.getRowSorter()).sort();expecting dukestars..

  • Freezing columns in JTable....  -  Need Suggestions!!!!!!!!!

    Hai Friends,
    i need suggestions for the following,
    How to freeze the columns in swing JTable.?????????????
    I need to freeze 3 columns in JTable... how it can be done?
    eg: its like the option used in excel for freezing the panes. like that, i need to freeze the column in JTable. so that, it wont be scrolled while scrolling the records, it should also be done in colmns of jtable for horizontal scroll n row for vertical scroll. is this can be done in JTable. Can u pls help me out in this...?
    Regards,
    Ciya.

    Did you actually try the code which was pointed out to you when you [url http://forum.java.sun.com/thread.jspa?threadID=701198]asked this question before? It does just what you want...

  • Hidden Columns in JTable

    I wont to hide a elected column in JTable.
    how it to do

    TableColumnModel tcm = table.getColumnModel();
    TableColumn column = tcm.getColumn( modelIndex );
    tcm.removeColumn( column );
    Next time, search the forum first. There are at least a dozen posts asking this question.

  • AdvancedDataGridRendererProvider spanning Grouping Column

    Hi,
    I am trying to span just the Grouping Column.
    Sample Data:
    Southwest
                        Northern California          Lauren Ipsum
                        Arizona                         Dana Binn
    The above data is displayed in AdvancedDataGrid.  What I want is when I loan, I want to span the row where Southwest is displayed with one Renderer where it shows a Text Southwest and then a ComboBox.
    How can I span all three columns for that perticular row? I looked into AdvancedDataGridRendererProvider, but I can't seem to figure out how to do the Grouping Column.  What ever I try, it spans the leaf notes, but not the Southwest. Does anyone know how to archieve this? Thanks.

    Hi,
    I was able to span the Grouping Column, but I am loosing the Children and the renderer is only rendering in the first cell, not all three columns even though the all three columns are spanned.
    This is what I have done in summary to span the Grouping row.
                    var rp : AdvancedDataGridRendererProvider = new AdvancedDataGridRendererProvider();
                    rp.renderer = new ClassFactory(TestRenderer);
    //              rp.dataField = "Region";
                    rp.columnIndex = 0;
                    rp.columnSpan = 2;
                    rp.depth = 1;
    If I uncomment the line above I loose this spanning and it just shows the hierarchical data with the default renderer and it does not even render my renderer. Please help. Thanks.
    Full code:
    testAdvancedDataGridSpanningColumn.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
         <mx:Script>
              <![CDATA[
                   import mx.containers.HBox;
                   import mx.controls.advancedDataGridClasses.AdvancedDataGridRendererProvider;
                   import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
                   import mx.collections.GroupingCollection;
                   import mx.collections.GroupingField;
                   import mx.collections.Grouping;
                   import mx.collections.ArrayCollection;
                [Bindable]
                private var dpFlat : ArrayCollection = new ArrayCollection([
                  {Region:"Southwest", Territory:"Arizona",
                      Territory_Rep:"Barbara Jennings", Actual:38865, Estimate:40000},
                  {Region:"Southwest", Territory:"Arizona",
                      Territory_Rep:"Dana Binn", Actual:29885, Estimate:30000}, 
                  {Region:"Southwest", Territory:"Central California",
                      Territory_Rep:"Joe Smith", Actual:29134, Estimate:30000}, 
                  {Region:"Southwest", Territory:"Nevada",
                      Territory_Rep:"Bethany Pittman", Actual:52888, Estimate:45000}, 
                  {Region:"Southwest", Territory:"Northern California",
                      Territory_Rep:"Lauren Ipsum", Actual:38805, Estimate:40000},
                  {Region:"Southwest2", Territory:"Northern California",
                      Territory_Rep:"T.R. Smith", Actual:55498, Estimate:40000}, 
                  {Region:"Southwest2", Territory:"Southern California",
                      Territory_Rep:"Alice Treu", Actual:44985, Estimate:45000},
                  {Region:"Southwest2", Territory:"Southern California",
                      Territory_Rep:"Jane Grove", Actual:44913, Estimate:45000, Test:"Worked"}
                [Bindable]
                public var myGCol1 : GroupingCollection = new GroupingCollection();
                private var myGrp : Grouping = new Grouping();
                private function initDG() : void
                     // Initialize the GroupingCollection instance
                        myGCol1.source = dpFlat;
                        // The Grouping instance defines the grouping fields
                        // in the collection, and the order of the groups
                        // in the hierarchy.
                        myGrp.fields = [new GroupingField("Region")];
                        // The grouping property contains a Grouping instance
                        myGCol1.grouping = myGrp;
                        // Specify the GroupedCollection as the data provider for
                     // the AdvancedDataGrid control.
                     myADG2.dataProvider = myGCol1;
                     // Refresh the display
                     myGCol1.refresh();                    
                private function createColumns() : void
                     var cols: Array = myADG2.columns;
                        cols.push( new AdvancedDataGridColumn("Region"));
                     cols.push( new AdvancedDataGridColumn("Territory"));
                     cols.push( new AdvancedDataGridColumn("Territory_Rep"));
                     myADG2.columns = cols;
                     var testTypes : ArrayCollection = new ArrayCollection();
                     testTypes.addItem("test 1");
                     testTypes.addItem("test 2");
                     var rend : TestRenderer = new TestRenderer();
                     rend.types = testTypes; 
                     var rp : AdvancedDataGridRendererProvider = new AdvancedDataGridRendererProvider();
                     rp.renderer = new ClassFactory(TestRenderer);
    //                 rp.dataField = "Region";
                     rp.columnIndex = 0;
                     rp.columnSpan = 2;
                        rp.depth = 1;
                     myADG2.rendererProviders.push(rp);
                     myADG2.validateNow();
              ]]>
         </mx:Script>
         <mx:Panel
              title="Advanced DataGrid Control Example"
              height="75%"
              width="75%"
              layout="horizontal"
              paddingTop="10"
              paddingBottom="10"
              paddingLeft="10"
              paddingRight="10">
              <mx:AdvancedDataGrid
                   id="myADG2"
                   width="100%"
                   height="100%"
                   creationComplete="initDG()" initialize="createColumns();"  sortExpertMode="true" showHeaders="false" >
              </mx:AdvancedDataGrid>     
         </mx:Panel>
    </mx:Application>
    TestRenderer.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:HBox
         xmlns:mx="http://www.adobe.com/2006/mxml"
         width="100%" height="100%">
         <mx:Script>
              <![CDATA[
                   import mx.collections.ArrayCollection;
                   import mx.events.FlexEvent;
                   [Bindable]
                   public var types : ArrayCollection;
                   override public function set data(value : Object) : void
                    if(value != null) 
                        super.data = value;
                    // Dispatch the dataChange event.
                    dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
              ]]>
         </mx:Script>
         <mx:Label text="{data.GroupLabel}" />
         <mx:ComboBox dataProvider="{types}" />
    </mx:HBox>

Maybe you are looking for

  • How do I get Firefox/Mozilla to work with Constant Contact?

    Constant Contact freezes up every time I use Mozilla/Firefox to access the website and, particularly, when I access my contact file. I know I can't be alone in needing that marketing tool and can't imagine why it doesn't work with our favorite, Mozil

  • How to remove (or move) Here Maps

    I'm short of space on my Lumia 535 since I downloaded a lot of maps. How can I remove some or all of them or move them onto the SD card? Thanks for your input. Solved! Go to Solution.

  • ECC6 and PI integration design question

    Hello experts, We have a customer that is going for ECC6 and going to use PI to integrate with external systems. We are designing the way to design the logic for distributing materials so two options are on the desk and I wanted to ask which one you

  • Knowing an image's size

    Hi, well i'm a Java newbie, and i'll confess i'm still not even 1/3 of my way through my big big java book, lol, but i'm trying to do something and i don't know how to and any help will be very much appreciated... my problem is i want to check the si

  • Apple TV & iPod Touch

    Hello All, I am currently using an iPod Touch, and want to get an apple TV. I have 1 question before buying: I LOVE to watch podcasts. I am wondering if will be able to SYNC both of my devices to iTunes. For example. if I have 3 episodes of CommandN