Dynamically adding a column to a jtable - simple & urgent

I am new to using JTables.
I have read the tutorial and looked at several examples, but I am still confused as to how to add/remove columns and how to add rows to the table.
I want to have a totally dynamic table which will allow me to add/remove columns and to add rows.
The table gets the data to be displayed (and the column header values) from an outside object. I thought about writing my own table model.
Here is the code for my simple table model:
import javax.swing.table.*;
import java.util.Vector;
public class MyTableModel extends AbstractTableModel{
   private Vector columnHeaders;
   private Vector data;
   // simple constructor
   public MyTableModel() {
      columnHeaders = new Vector();
      data = new Vector();  // data is a vector of vectors
   public int getColumnCount() {
      return columnHeaders.size();
   public int getRowCount() {
      if (data.size() == 0) {
          return 0;
      Vector columnData = (Vector)data.elementAt(0);
      return columnData.size();
   public Object getValueAt(int row, int column) {
      Vector columnData = (Vector)data.elementAt(column);
      return columnData.elementAt(row);
   // the method I call for dynamically adding a new empty column
   public void addNewEmptyColumn(String value) {
       columnHeaders.add(value);
       fireTableStructureChanged();
}Here is how I use the table model with my table
import javax.swing.*;
public class Demo extends JFrame{
    private JTable table;
    public Demo() {
        super("test");
        table = new JTable(new MyTableModel());
        getContentPane().add(table);
        pack();
        show();
    public void addColumn(String value) {
        MyTableModel model = (MyTableModel)table.getModel();
        model.addNewEmptyColumn(value);
    public static void main(String[] args) {
        Demo demo = new Demo();
        // here I am trying to add columns...
        demo.addColumn("one");
        demo.addColumn("two");
}I try to add columns, but nothing happens!!!
What am I doing wrong?
I would appreciate if someone who take himself/herslef to be a JTable expert could give me his/her e-mail and this way I won't bother the rest of the world with my stupid JTable questions...
Sincerely
Nir

I have another question.
What if I want to render the table headers in a certain way.
I would like to use:
TableColumn's setHeaderRenderer(TableCellRenderer headerRenderer).
But in order to do it, I need to get a TableColumn.
How do I get it from the model?
I thought about subclassing JTable and overriding:
public void tableChanged(TableModelEvent e)that function is called everytime I invoke fireTableStructureChanged().
In that function, I am assuming that a column has been added, however, when I query for JTable's getColumnCount(), I keep getting 0!

Similar Messages

  • Adding a Column to a JTable

    I have a simple gui where I query a database and return a result set in a JTable using a table model. I would like to be able to add a new column with checkboxes as the first column in the table. I've seen examples using checkboxes with boolen data from the database, but this column is not being returned from the database it is a new added column.
    The first task is to add the column and I am struggling with this. My code is below.
    import java.awt.BorderLayout;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    public class DatabaseTest extends JFrame {
      private QueryTableModel qtm;
      public DatabaseTest()
        super("JTable Test");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setSize(350, 200);
        qtm = new QueryTableModel();
        JTable table = new JTable(qtm);
        JScrollPane scrollpane = new JScrollPane(table);
        JPanel p1 = new JPanel();
        p1.setLayout(new GridLayout(3, 2));
        p1.add(new JLabel("Click here to Query the DB: "));
        JButton jb = new JButton("Search");
        jb.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e)
            qtm.Query();
        p1.add(jb);
        getContentPane().add(p1, BorderLayout.NORTH);
        getContentPane().add(scrollpane, BorderLayout.CENTER);
      public static void main(String args[]) {
        DatabaseTest tt = new DatabaseTest();
        tt.setVisible(true);
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.Statement;
    import java.util.Vector;
    import javax.swing.table.AbstractTableModel;
    class QueryTableModel extends AbstractTableModel {
      Vector cache;
      private int colCount;
      private String[] headers;
      Statement statement;
      private static Connection conn = null;
      public QueryTableModel() {
        cache = new Vector();
      public String getColumnName(int i) {
        return headers;
    public int getColumnCount() {
    return colCount;
    public int getRowCount() {
    return cache.size();
    public Object getValueAt(int row, int col) {
    return ((String[]) cache.elementAt(row))[col];
    public void Query() {
    cache = new Vector();
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:*****","******","*******");
    statement = conn.createStatement();
    ResultSet rs = statement.executeQuery("Select username from dba_users where rownum < 6");
    ResultSetMetaData meta = rs.getMetaData();
    colCount = meta.getColumnCount();
    // Now we must rebuild the headers array with the new column names
    headers = new String[colCount];
    for (int h = 1; h <= colCount; h++) {
    headers[h - 1] = meta.getColumnName(h);
    while (rs.next()) {
    String[] record = new String[colCount];
    for (int i = 0; i < colCount; i++) {
    record[i] = rs.getString(i + 1);
    cache.addElement(record);
    fireTableChanged(null);
    // Add column code here?
    } catch (Exception e) {
    cache = new Vector(); // blank it out and keep going.
    e.printStackTrace();
    }Not sure how to add the column. I've tried a few variations of the following code with no luck:TableColumn tc = new TableColumn(0, 120);
    tc.setHeaerValue("Name");
    table.getColumnModel().addColumn(tc);Any help would be appreciated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The first task is to add the column Well, I like the suggestions from the link given in the above posting :-) It shows you how to dynamically alter the TableModel after its initial creation, and is probably the best generic solution.
    But, just so you understand better how a TableModel works I"ll just put another thought in your mind. Maybe in this case you just create the TableModel correctly the first time so you don't need to do a dynamic change. The TableModel doesn't know where the data came from. It doesn't care that it came from a ResultSet. All it knows it that you have data in an array. So whats to prevent you from hard coding the first column to contain Boolean data?
    {code}headers = new String[colCount+1];
    headers[0] = "Boolean Column";
    for (int h = 1; h <= colCount; h++)
    headers[h] = meta.getColumnName(h);
    while (rs.next())
    String[] record = new String[colCount+1];
    record[0] = new Boolean.FALSE;
    for (int i = 1; i <= colCount; i++)
    record[i] = rs.getString(i);
    }{code}

  • Adding new columns in a JTable?

    How can i add a new column every time a button is pressed? I have
    String columns[][] = {{"1", "2", "3"}}But i don't know how to add a new {} row...
    Help?
    Or can someone show me a better way to do it?

    Use a Collection instead of arrays.
    Arrays are fixed-size. If you need a bigger array, you need to create the new one, copy the old content over and fill in the new values.
    Collections hide all that complexity from you by providing simple .add() and .remove() methods.
    Arrays: low-level mechanism.
    Collections: more comfortable high-level mechanism

  • Adding A Column into a JTable

    Hi
    I have a JTable with two soccer teams in. What i want to do is to add in a column between them that just says "VS". I ahev to do this when the user clicks a button as the table is constructed from details stored in a MySQL database.
    Can anyone give me any help?
    Jason

    the DefaultTableModel supports an addColumn() method, so:
    a) create your table and TableModel
    b) add a column to the end of the DefaultTableModel
    Now the TableColumnModel controls the order in which the columns are painted, so
    a) get the TableColumnModel from the table
    b) move the colum to the center

  • Adding/removing columns in jtable

    Hello everyone,
    i was looking for a way to add/remove columns from a jtable. The way i envision it working is... Initially have a predefined number of columns, of these only show the user say 5 of those on startup. but then provide a drop down (or list box etc) of the other column headings, so that when the user selects one... it adds it to the jtable. also to remove ..... is there a way to have a pop-up when the user right-clicks the table header and put a option to remove that column there? if not what is the best way to trigger a remove of a column? So i need a way to keep track of all the columns in case the user wants to add it again. anyone know how this can be done or any part of it?

    I need a intutive way for the user to remove a column from the gui (like with adding could be a dropdown box with column headers as labels).Create a custom ComboBoxModel. This model would simply contain TableColumns and display the header value in the combo box. The first combo box would display the currently showing columns. When you click on an item in the combo box:
    a) remove the TableColumn from the TableColumnModel
    b) remove the TableColumn from the model
    c) add the TableColumn to the "hidden" combo box model
    The same basic logic (but in reverse) would then apply when you click on the "hidden" combo box.

  • Adding the columns dynamically in crystal report

    Hi,
      I am developing a application using asp.net and crystal report. In a report the column is created dynamically( ie, the report gets input from a sp which returns N no. of columns). Since i dont know the column name and no. of columns at design time i am not able to create the report. If any of you have any idea on adding the columns dynamically please send me the code or the link.
    Thanks
    Sankar

    Hello Sankar,
    please see CS code for VS 2005 below to add a database field to a report using inproc RAS.
    This sampels retrieves the table column name from the database and adds it to the report.
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.ReportAppServer.Controllers;
    using CrystalDecisions.ReportAppServer.ClientDoc;
    using CrystalDecisions.ReportAppServer.DataDefModel;
    namespace CS_Add_Field_inproc
        public partial class Form1 : Form
            // CR Declarations
            ReportDocument boReportDocument;
            ISCDReportClientDocument boReportClientDocument;
            CrystalDecisions.ReportAppServer.ReportDefModel.Section boSection;
            CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject boFieldObject;
            public Form1()
                InitializeComponent();
                //Create a new ReportDocument
                boReportDocument = new ReportDocument();
                // load the RPT file
                boReportDocument.Load("..
    AddField.rpt");
                //Access the ReportClientDocument in the ReportDocument (EROM bridge)
                boReportClientDocument = boReportDocument.ReportClientDocument;
                //Get the first section in the details section
                   boSection = boReportClientDocument.ReportDefController.ReportDefinition.DetailArea.Sections[0];
                   //Create the field object that we will add to the report and set all of its properties
                   boFieldObject = new CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject();
                //Set which field to use for the data to be displayed
                   boFieldObject.DataSourceName = "{Customer.City}";
                   boFieldObject.FieldValueType = CrystalDecisions.ReportAppServer.DataDefModel.CrFieldValueTypeEnum.crFieldValueTypeStringField;
                   boFieldObject.Left = 4 * 1440; //1440 twips per inch
                   boFieldObject.Width = 3 * 1440;
                   boFieldObject.FontColor = new CrystalDecisions.ReportAppServer.ReportDefModel.FontColor();
                   boFieldObject.FontColor.Font.Name = "Arial";
                   boFieldObject.FontColor.Font.Size = 10;
                   boFieldObject.Format.HorizontalAlignment = CrystalDecisions.ReportAppServer.ReportDefModel.CrAlignmentEnum.crAlignmentLeft;
                   //Add the object to the report
                   boReportClientDocument.ReportDefController.ReportObjectController.Add(boFieldObject, boSection, -1);
                // show in reportviewer
                crystalReportViewer1.ReportSource = boReportDocument;
            private void button1_Click(object sender, EventArgs e)
                //Get the first section in the details section
                boSection = boReportClientDocument.ReportDefController.ReportDefinition.DetailArea.Sections[0];
                //Create the field object that we will add to the report and set all of its properties
                boFieldObject = new CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject();
                //Set which field to use for the data to be displayed
                boFieldObject.DataSourceName = "{Customer.City}";
                boFieldObject.FieldValueType = CrystalDecisions.ReportAppServer.DataDefModel.CrFieldValueTypeEnum.crFieldValueTypeStringField;
                boFieldObject.Left = 4 * 1440; //1440 twips per inch
                boFieldObject.Width = 3 * 1440;
                boFieldObject.FontColor = new CrystalDecisions.ReportAppServer.ReportDefModel.FontColor();
                boFieldObject.FontColor.Font.Name = "Arial";
                boFieldObject.FontColor.Font.Size = 10;
                boFieldObject.Format.HorizontalAlignment = CrystalDecisions.ReportAppServer.ReportDefModel.CrAlignmentEnum.crAlignmentLeft;
                //Add the object to the report
                boReportClientDocument.ReportDefController.ReportObjectController.Add(boFieldObject, boSection, -1);
                // show in reportviewer
                crystalReportViewer1.ReportSource = boReportDocument;

  • Adding mouse listener to the column header of a column in a JTable

    Hi
    I want to add a mouse listener to the column header of the 3rd column in a JTable. I dont find any appropriate method to do this. The code I have written to do this is below. But on using this code, the mouselistener is invoked if I click on any column header. Can anyone please help me to fix this.
    table.getTableHeader().addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    /* some actions */
    }

          table.getTableHeader().addMouseListener(new MouseAdapter(){
               public void mousePressed(MouseEvent me) {
                   int tableColumn  =table.columnAtPoint(me.getPoint());//it returns the column index
            });

  • Adding blank column in Oracel Answers OBIEE

    Good morning.
    I am attempting to add a 3 blank columns in OBIEE and then adding a formula to one of the blank columns to do a simple math calculation between 3 other columns. I used "CAST(Null as double)" in my column formula to make it a blank column and not pulll data from the field column that I added.
    This is what I have so far:
    Column1 formula = "Cast (Null as double)"
    Column2 formula = "Cast (Null as double)"
    Column3 formula = "Cast (Null as double)"
    Column4 formula = data already included from the column that I added.
    This is what i'm trying to do:
    Column3 = (Column4 - Column1 + Column2) <----- In excel I would do something like "=D4-E4+F4" (example)
    When I do my SUM function in OBIEE and try to add the columns, it pulls in "Cast(Null as double)" and not the actual column name that I custom edited.
    Any help would be appreciate on how to add a blank column and add a simple calculation formula to calculate data from the blank columns once I export my report to excel.
    Thank you,
    Edited by: 970040 on Nov 7, 2012 8:24 AM

    Thats correct. When I export the report I want to see blank values in the columns. so when I enter data into those blank fields on my excel spreadsheet, I want the totals column to calculate according to my formula specified. My issue is when I specify a null value in my columns in OBIEE, im unable to put a formula to calculate the values in my other columns.
    This is what I have so far in OBIEE:
    Column1 formula = "Cast (Null as double)"
    Column2 formula = "Cast (Null as double)"
    Column3 formula = "Cast (Null as double)"
    Column4 formula = data already included from the column that I added with values.
    This is what I’m trying to do:
    Column3 = (Column4 - Column1 + Column2) <----- In excel I would do something like "=D4-E4+F4" (example)
    How can I add a value to my column so that when I export it to excel, the column fields will have the formula already included such as "=D4-E4+F4" and also each row formula corresponding to the correct Row Number.

  • How to create Hyperlink column in a JTable

    Can anyone help in creating a hyperlink column in a JTable.
    Thanks in advance,
    Sridhar.

    If the parent is an Applet it is very simple .
    catch the mouse click on columns and execute the following code
    String url = getValueAt(i,j);
    getAppletContext().showDocument(new
    URL(url ), "_blank");
    thatz all .
    if ur program is an application use this getRuntime.exec() and use parameters to rundll32.exe url and iexplore.exe in Windows platform,
    if u have still doubts plz get back to me
    Renjith K.V

  • Dynamic Number of Column in a table

    Hi guys,
    I have a requirement that needs dynamic number of column in a tale.
    It is possible to do this in Adobe forms.
    Thanks,
    Chirantan

    Hello. It of course is possible in Adobe.
    You need to write a simple script using JavaScript or FormCalc to hide or show columns according to some special value. You will work with the presence attribute of the object. E.g. MYFIELD.presence = "visible" or "hidden" or "invisible". You will need to change your subforms content to flowed.
    Use these guides:
    http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_basics.pdf
    help.adobe.com/en_US/livecycle/es/FormCalc.pdf
    Hope this helps, good luck, Otto

  • Selective reordering of columns in a Jtable

    Hi
    I have this problem where I need to allow the first 8 columns to be reordered but not the remaining columns in a Jtable.
    I have tried a few approaches by adding listeners to the jtable header and identifying the column which is clicked for reordering and accordingly setting the rearrange policy / feature of the jtable to true/false.
    This works fine in almost all scenarios except for one where the user selects a column which can be reordered and drags it to a position beyond the allowed 8 columns, and now that column is frozen since it is beyond the permissible index of 8.
    I was wondering if there was a 'cleaner'/ better way to go about implementing this.

    Thanks for the link...
    I went through it but seems like a big change for the functionality I want to achieve.
    I am thinking about allowing the user to reorder the column and then if he has chosen an invalid column (one which cannot be rearranged) just undo that action using the moveColumn method.
    I tried overriding the columMoved method to inform me about a column reorder evernt but that method keeps getting fired while the user is rearranging.
    Is there anyway to get a notification once the user is done rearranging the column.
    Thanks

  • Show hidden columns in a JTable

    Hi,
    I have a requirement for hiding some columns of a JTable and showing them back based on user actions.
    I have gone through some topics about hiding columns. which can be done by table.removeColumn();
    But when I use table.addColumn(); it adds the column at the end of the table.It should add in the same location as the previous column.
    How to show /reveal the hidden column back?.

    * Hide_Columns.java
    * This code contains a table model that allows you to
    * specify the columns to be hidden in a boolean array.
    * To use the model:
    *       model = new MyTableModel(data, columnNames);
    *       table.setModel(model);
    * The most important method in the model is "getNumber()", which converts a column number
    * into the number corresponding to the data to be displayed.
    * Visible columns can be dynamically changed with
    * model.setVisibleColumns(0, column0.isSelected());
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class Hide_Columns extends JFrame {
        public Hide_Columns() {
            setTitle("Hide columns");
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            model = new MyTableModel(data, columnNames);
            table.setModel(model);
            getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
            for( int i=0; i<4; i++ ){
                final JCheckBox columnX = new JCheckBox("Column "+i);
                columnX.setSelected(true);
                final int col = i;
                columnX.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        model.setVisibleColumns(col, columnX.isSelected());
                toolBar.add(columnX);
            getContentPane().add(toolBar, BorderLayout.NORTH);
            setSize(400,300);
            setLocationRelativeTo(null);
            model.addRow(new Object[]{null,null,null,null});
            model.setValueAt("test0",0,0);
            model.setValueAt("test1",0,1);
            model.setValueAt("test2",0,2);
            model.setValueAt("test3",0,3);
        public static void main(String args[]) { new Hide_Columns().setVisible(true); }
        private JTable table = new JTable();
        private  JToolBar toolBar = new JToolBar();
        private   MyTableModel model;
        /** This is the data of the table*/
        private  Vector<Object> data = new Vector<Object>();
        /** Column names */
        Vector<String> columnNames = new Vector<String>();{
            columnNames.addElement("0");
            columnNames.addElement("1");
            columnNames.addElement("2");
            columnNames.addElement("3");
    class MyTableModel extends DefaultTableModel {
        /** Shows which columns are visible */
        private   boolean[] visibleColumns = new boolean[4];{
            visibleColumns[0] = true;
            visibleColumns[1] = true;
            visibleColumns[2] = true;
            visibleColumns[3] = true;
        public MyTableModel(Vector<Object> data, Vector<String> columnNames){
            super(data, columnNames);
        protected void setVisibleColumns(int col, boolean selection){
            visibleColumns[col] = selection;
            fireTableStructureChanged();
         * This function converts a column number of the table into
         * the right number of the data.
        protected int getNumber(int column) {
            int n = column;    // right number
            int i = 0;
            do {
                if (!(visibleColumns)) n++;
    i++;
    } while (i < n);
    // When we are on an invisible column,
    // we must go on one step
    while (!(visibleColumns[n])) n++;
    return n;
    // *** METHODS OF THE TABLE MODEL ***
    public int getColumnCount() {
    int n = 0;
    for (int i = 0; i < 4; i++)
    if (visibleColumns[i]) n++;
    return n;
    public Object getValueAt(int row, int column) {
    return super.getValueAt(row, getNumber(column));
    public void setValueAt(Object obj, int row, int column) {
    super.setValueAt(obj, row, getNumber(column));
    public String getColumnName(int column) {
    return super.getColumnName(getNumber(column));

  • Adding new column to production database

    I have to add a new timestamp column, that defaults to the current date/time, to an existing production database. The table is large - 150M records. I am trying to understand the ramifications of adding a new column to a table this large that gets hit often, mostly with inserts and reads. The column does allow null values and I am not going back and populating existing records with a value. Basically, I am looking for some best practice guidelines - how to prepare, what to expect, what other processes should be followed along with this schema update.

    Radiators wrote:
    Thanks, I have not found any %TYPE or %ROWTYPE dependencies on the table I am altering. But at the same time I do not understand how these types of dependencies would invalidate packages. I wouldn't be breaking any %TYPE dependency because I am not dropping columns, only adding a new one. And according to documentation for %ROWTYPE - "If columns are later added to or dropped from the table, your code can keep working without changes." Can you point me to Oracle documentation that describes your concern in detail? Thanks.you can test it yourself
    SQL> CREATE TABLE abc (c1 NUMBER);
    Table created.
    SQL> INSERT INTO abc
      2       VALUES (99);
    1 row created.
    SQL> CREATE OR REPLACE PROCEDURE test_proc
      2  AS
      3     v   abc%ROWTYPE;
      4  BEGIN
      5     SELECT c1
      6       INTO v
      7       FROM abc
      8       WHERE ROWNUM = 1;
      9  END;
    10  /
    Procedure created.
    SQL> SELECT object_name, status
      2    FROM user_objects
      3   WHERE object_name = 'TEST_PROC';
    OBJECT_NAME                STATUS
    TEST_PROC                    VALID
    SQL> ALTER TABLE abc ADD (c2 VARCHAR2(10));
    Table altered.
    SQL> SELECT object_name, status
      2    FROM user_objects
      3   WHERE object_name = 'TEST_PROC';
    OBJECT_NAME                 STATUS
    TEST_PROC                     INVALID
    SQL> you should also consider the chance that some where if people are using "select * into" using this table, which will fail since you added new column. i don't see any unusual performance bottlenecks by adding a new column. in case of the backups, yes the earlier backups will not have the column. if you restore it, you will see earlier table structure itself. i have one specific question. why are you not attempting this in development/test environment first? even if it is a simple insert, it's always important to do it in test environments before attempting on production db. one thing for sure i know is, after adding column, you will have to recompile all the invalid dependencies. i think, it's better if you attempt it in test db and come up with any issues you see rather than asking a general question where problematic scenarios are plenty and rarely unknown before hand.

  • Dynamic size of column header

    How do I make the header row of a column in a Jtable to dynamically adjust it's size to it's contents??
    Need this
    |HEADER COL1||HEADER COL2.....|H C3|
    Have this
    |HEADER C||HEADER C|H C3|
    Thanks!

    You need to get the column model and each column in turn and then set the width there.

  • Dynamically adding more attributes to cube dimension in SSAS 2008 R2

    I need to dynamically add more attributes to cube dimension in SSAS 2008 R2 because the dimension table the cube is based on is updated using dynamic pivoting and there is need to update the cube dimension attributes as more columns are added to the dimension
    table without making the changes through BIDS. Is there a way to dynamically adding more attributes to cube dimension in SSAS 2008 R2?
    Thanks
    BI Developer

    Definitely. You can use AMO to add dimension attributes on the server. I have definitely done this a few times for different clients of mine. Here is a generic AMO sample:
    http://msftasprodsamples.codeplex.com/wikipage?title=SS2008%21Readme_AMOAdventureWorks&referringTitle=Home
    Notice the parts which add attributes to a dimension.
    http://artisconsulting.com/Blogs/GregGalloway

Maybe you are looking for

  • Creation of Target group.

    Hi All, I having one urgent requirement, we have maintained the Ztable for maintaning the information of Vehicles against Business partners. The Fields in the said Ztables are Vehicle type, vehicle Reg Number and BP number. I want to send the mails u

  • Enbedding PL/SQL function in Pro Cobol

    HI, I am trying to compile an existing pro cobol program because of a small enhancement. I am trying to embed a pl/sql function in to the program..and the compiler is throwing errors.Can someone please tell me what i am doing wrong? Please look at th

  • OK, Apple Just Said it's done something to remedy SloMail...field reports?

    I just received this message, and have noticed some mail improvement in the last few days. I guess there's no way to know until the workweek kicks up. I am still very disappointed in Apple's response/communications re this problem. (yes, I may be con

  • Quick Question about charging port

    ---I had the issue today of my phone randomly making the "charge initiation" noise well after I had plugged it in. Almost as if it had stopped charging for a split second and then reinitiated. Very curious if this would be related to the charging por

  • Existing users not able to login to Application

    Hi all, For satisfying one of the security requirement. We secured Entity dimension and created new member access profile and new team. For the new user and we (Admin team) has assigned this newly created team. Now only we (Admin team) and new user i