WRAP JTable Column Name into 2 lines

I have a JTable with a long column Name. Can I wrap the Column Name into multiple (2) lines.

baskaraninfo wrote:> set the following to a table column,<html><body>Employee<br>Name</body></html>>The break tag got lost cos you didnt use the code tags
<html><body>Employee<br>Name</body></html>

Similar Messages

  • Adding column name into tables.

    Hi guys,
    i have a panel which consist of a scroll table which i am not sure how to i add column names tru this type of coding. and some more i have to retrieve info from the database and display into this table. can someone pls guide me how to i add in the column names and how do i retrieve info out from db and displying it onto the table? a million thanks! :)
          * This method initializes jScrollPane_viewLogTable     
          * @return javax.swing.JScrollPane     
         private JScrollPane getJScrollPane_viewLogTable() {
              if (jScrollPane_viewLogTable == null) {
                   jScrollPane_viewLogTable = new JScrollPane();
                   jScrollPane_viewLogTable.setBounds(new java.awt.Rectangle(27,30,460, 200));
                   jScrollPane_viewLogTable.setViewportView(getJTable_viewLogTable());
              return jScrollPane_viewLogTable;
          * This method initializes jTable_viewLogTable     
          * @return javax.swing.JTable     
         private JTable getJTable_viewLogTable() {
              if (jTable_viewLogTable == null) {
                   jTable_viewLogTable = new JTable();
              return jTable_viewLogTable;
         }Titus

    It's not my code, it's just Java.
    C'mon, read the javadocs.
    Or look at this:
    http://www.exampledepot.com/egs/java.sql/GetRsColCount.html
    %

  • Changing column name in Line chart

    Hello All,
    We are BO 4.0 SP6.
    We are creating WEBI reports which includes charts as well.
    We have two columns " Current Period" and "Last Period" and using them in WEBI report and Line chart.
    In the table I am displaying the column name " Current period " as "Oct-14" using some formula.
    But I am not able to change the name in the chart.
    Can we change the column name in the graph using some formulas? Please advice.
    PFA the screenshot for your reference.
    Regards
    Prasad Ambati

    Hi,
    Do not Drag it inside chart area .
    Align Them above Legend Text ( Current Period ),
    so that Actual Legend Text will be hidden .

  • JTable column names with custom model

    I'm having problems with column names in a JTable which uses a custom model. For some reason, the colums are being shown as A, B, C etc. The data, however, displays fine.
    This is the code which constructs the table.
    MyTableModel tableModel = new MyTableModel(myArrayList);
      myTable = new JTable(tableModel);
      myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      myTable.setFillsViewportHeight(true);This is the class, MyTableModel
    class MyTableModel extends AbstractTableModel {
            private ArrayList<Account> data;
            private String[] colNames = {"", "Name","Type","Group","Created","Modified"};
            public MyTableModel(ArrayList<Account> data) {
                this.data = data;
            public int getRowCount() {
                return data.size();
            public int getColumnCount() {
                return 6;
            public Object getValueAt(int row, int col) {
                Account account = (Account)data.get(row);
                switch(col) {
                    case 0:
                        return account.getIcon();
                    case 1:
                        return account.getName();
                    case 2:
                        return account.getType();
                    case 3:
                        return account.getGroup();
                    case 4:
                        return account.getDateCreated();
                    case 5:
                        return account.getDateModified();
                    default:
                        return "";
            public String getColumName(int index) {
             System.out.println("N:"+colNames[index]);
                return colNames[index];
        }When the table is displayed, nothing's displayed to the console, but I'd have thought getColumnName would print the current column name. Am I missing something obvious?

    Oh great. I'll go back under my rock.
    Thanks =)

  • JTable, column names not appearing!

    I am using the following code:
    Vector columnNames = new Vector();
            Vector data = new Vector();
            try
                //  Connect to the Database
                Common.Data.DataAccesser da = new Common.Data.DataAccesser();
                Connection connection = da.getConnection();
                //  Read data from a table
                String sql = "Select * from schedule1";
                Statement stmt = connection.createStatement();
                ResultSet rs = stmt.executeQuery( sql );
                ResultSetMetaData md = rs.getMetaData();
                int columns = md.getColumnCount();
                //  Get column names
                for (int i = 1; i <= columns; i++)
                    columnNames.addElement( md.getColumnName(i) );
                //  Get row data
                while (rs.next())
                    Vector row = new Vector(columns);
                    for (int i = 1; i <= columns; i++)
                        row.addElement( rs.getObject(i) );
                    data.addElement( row );
                rs.close();
                stmt.close();
            catch(Exception e)
                System.out.println( e );
            //  Create table with database data
            JTable table = new JTable(data, columnNames);
            jPanel2.setLayout(new java.awt.BorderLayout());
            jPanel2.add(table, BorderLayout.CENTER);I know its a bit messy, wat im tryin to do is add the table to the panel. the rows are showing perfectly but the column names do not show! Can anyone help?

    1) Please ask Swing questions in the Swing forum.
    2) Don't forget to specifically make the table header display. You do this by adding the table header to the jpanel in the borderlayout NORTH position, and you get the table header by calling getTableHeader. Have a look here for instance:
    http://forum.java.sun.com/thread.jspa?threadID=5235339&tstart=0

  • JTable Column Names Not Displaying

    Hi there
    I create a JTable by passing the JTable constructor my custom TableModel which extends AbstractTableModel.
    For column names I have a String[] containing the column names in my custom TavleModel and have coded the TableModel methods accordingly.
    For some reason when I run the code the table is displayed, but the column names are not!?!
    Any advance is appreciated!

    Sorted!
    After looking at sample code in the JTable tutorial, it seems the table likes/needs to be added to a JScrollPane, as once I did this the column headings started appearing.
    e.g. JScrollPane scrollPane = new JScrollPane(table);

  • Changing JTable column names

    I have a JTable where the user can right click on the table header to change what data is displayed. When the user selects different data to display, I would like to change the column name to reflect this. What is the best way to do this?
    TIA
    ZeroFK

    table.getColumnModel().getColumn(???).setHeaderValue(???).

  • Store Column-Name into variable

    Hello from germany
    I got stuck with following:
    How is it possible to store the name of a column into a variable or is it possible to put an index "on" a column?
    The reason for this: I need to fill and check a complete column!
    Thanks for Your help!
    Best regards
    Marlon

    Those sure are unrelated questions. Lets say we have a table like this:
    SQL> CREATE TABLE t (
      2    a  number,
      3    b  varchar2(8),
      4    c  date );
    Table created.You can get a column name like this:
    SQL> set serveroutput on
    SQL> DECLARE
      2    second_col   VARCHAR2 (30);
      3  BEGIN
      4    SELECT column_name
      5      INTO second_col
      6      FROM user_tab_columns
      7     WHERE table_name = 'T'
      8       AND column_id = 2;
      9    DBMS_OUTPUT.PUT_line(second_col);
    10  END;
    11  /
    B
    PL/SQL procedure successfully completed.
    SQL> You can put an index on a column like this:
    SQL> CREATE INDEX t_n1 ON t(b);
    Index created.And you can add data to the table like this:
    SQL> insert into t(a, b) values (4, 'asdf');
    1 row created.
    SQL> select * from t;
             A B        C
             4 asdf
    SQL>

  • Easier way to set post-constructor JTable column names?

    I have a class that extends JTable. It also has a pair of inner classes that extend DefaultTableCellRenderer and AbstractTableModel so I can dynamicaly adjust the number of rows and their contents. That's not the problem - that part works fine. The problem is the column headers. My table doesn't currently have any but I want to add them.
    The column quantity is constant at 3 and should always be the same 3 Strings. It would be nice if I could use the JTable constructors that take a Vector or Object[] of column names from the start in my new class' constructor. But I don't think I can because at that point I don't know how many rows there will be or what they'll contain. Trying to set rowData to null just caused runtime exceptions.
    So the alternative seems to be to call setColumnModel() within the constructor, passing it a DefaultTableColumnModel. Which then requires I call addColumn() three times. Each time passing it a new TableColumn object. Each of which requires that I separately call setHeaderValue() after I construct it to set the header name. Am I right in that is the only way to do it? It just seems overly complex.

    I'll post a streamlined version of my class in case that will help...
    public class TotalsTable extends JTable
       private static int NUM_COLUMNS = 3;
       static final public String columnNames[] = {
             "Col Name 1", "Col Name 2", "Col Name 3"};
       protected Vector data = null;
       private TotalsModel tableModel;
       public TotalsTable()
          tableModel = new TotalsModel();
          setModel(tableModel);
          TableCellRenderer renderer = new TotalsCellRenderer();
          setDefaultRenderer(Object.class, renderer);
       public void updateTable(Vector pData)
          data = pData;
          tableModel.update();
       class TotalsCellRenderer extends DefaultTableCellRenderer
          public Component getTableCellRendererComponent
             (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
             super.getTableCellRendererComponent(table, value, isSelected,
                                                 hasFocus, row, column);
             if (column == 0) {
                setForeground(Color.blue);
             else {
                setForeground(Color.black);
             return this;
       class TotalsModel extends AbstractTableModel
          public TotalsModel()
             super();
          protected void update()
             fireTableStructureChanged();
           * Retrieves number of columns
           * (Necessary for AbstractTableModel implementation)
          public synchronized int getColumnCount()
             return NUM_COLUMNS;
          public synchronized int getRowCount()
             if (playerData == null)
                System.out.println("No rows found in table");
                return 0;
             else
                return playerData.size();
           * Returns cell information of a record at location row,column
           * (Necessary for AbstractTableModel implementation)
          public synchronized Object getValueAt(int row, int column)
             try
                MyObject p = (MyObject) data.elementAt(row);
                switch (column)
                   case 0:
                      return p.getName();
                   case 1:
                      return ("" + p.getDataItem2());
                   case 2:
                      return ("" + p.getDataItem3());
                   default:
                      System.out.println("getValueAt() Error: Invalid column");
             catch (Exception e)
                System.out.println("Exception in getValueAt(): " +
                                   e.getMessage());
             return "";
          public String getColumnName(int col)
             if (col < NUM_COLUMNS)
                return columnNames[col];
             else
                return "";
          public Class getColumnClass(int c)
             return getValueAt(0, c).getClass();
    }

  • UIX get EO column names into a messageChoice

    I'm working on building a search function into my form which will allow the user to enter an arbitrary search string into a text box and then provides a list of columns in the table to be searched on. Is there any way to populate that list box (messageChoice) with the column names from the database dynamically? And if so, could I have the value set to those and the label set to the 'human readable' label text used on my forms?
    Nick

    Try looking at the section "Apply a filter to the Lov Window" here:
    http://otn.oracle.com/products/jdev/howtos/10g/adf_uix_lov_ht/index.html

  • Get column names into a VB program, for an SQL query that joins tables

    use [mydatabase]
    select * from InvNum inum
    left join _btblInvoiceLines ilin
    on inum.autoindex = ilin.iinvoiceid
    left join stkitem s
    on ilin.istockcodeid = s.stocklink where InvNumber = 'IVQ0834' or InvNumber = 'IVQ0835'
    I need to get out the column names in a VB program in the same order they would appear in the SQL query above...
    I want to use something like:
    select column_name from information_schema.columns where TABLE_NAME = ....
    except there are several tables involved above so I dont know the format!

    If you execute the query in your program using the SqlDataReader.ExecuteReader method, the column names will be available via the GetName method of the returned reader.  But note that your query may return multiple columns with the same name.
    Dim reader As SqlDataReader = command.ExecuteReader()
    For x = 0 To reader.FieldCount - 1
    Console.WriteLine(reader.GetName(x))
    Next x
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • JTable Column Names

    Hi, how can I change the names of the columns of a JTable that gets its data from a database;

    Thanks mate, but I cannot use this constructor since my table automaticaly gets its data (what you declare as rowData) from an external database.
    I found the solution to my problem to the next lines of code...
    JTable table = new JTable;
    TableColumnModel tcm = table.getColumnModel();
    TableColumn tc = tcm.getColumn(0);
    tc.setHeaderValue( "ABC" );
    thanks anyway

  • Storing Column-Name into variable? Possible?

    Hello from germany
    I got stuck with following:
    How is it possible to store the name of a column into a variable or is it possible to put an index "on" a column?
    The reason for this: I need to fill and check a complete column!
    Thanks for Your help!
    Best regards
    Marlon

    Your question is not clear. Howver, this is what I guess you want to do.
    Example, Check that the Emplyee Number I enter is KING. Check and Print message accordingly.
    Here i user PL/SQL run in SQLPlus
    SET VERIFY OFF
    SET SERVEROUTPUT ON
    DECLARE
         EMP_NAME VARCHAR(30);
    BEGIN
         SELECT ENAME
         INTO EMP_NAME
         FROM EMP
         WHERE EMPNO = &EMP_NUMBER;
         IF EMP_NAME = 'KING'
         THEN
              DBMS_OUTPUT.PUT_LINE('The Emplyee Name is: '||EMP_Name);
         ELSIF EMP_NAME != 'KING'
         THEN
              DBMS_OUTPUT.PUT_LINE('The Emplyee is not KING but: '||EMP_Name);
         END IF;
    EXCEPTION
         WHEN NO_DATA_FOUND
         THEN
              DBMS_OUTPUT.PUT_LINE('The Employee Number Entered is Invalid');
    END;
    /

  • Jtable column name

    Hi frds,
    I developed a JTable for my java application and it is working fine but I need some modifications which i'm unable to do.my JTable is actually linked with mysql database and the data in Jtable comes from the database.my requirement is when i change data in the JTable, the change must reflect in the database.can u plz help me out..

    hi,
    if you have taken the data from the database,this means that you have no problem with java database connectivity.to inform the database you have to run some sql commands.
    http://www.cab.u-szeged.hu/local/doc/pgsql/sql-commands.html
    in the previous link you will find the sql commands.
    i think that you want update,so click the hyperlink with the name update.
    if something wrong is going wrong let me know.

  • How to call the column names into the prompt and display values dynamically

    Hi,
    i have a typical requirement where I have to call 3 columns into the AGE Prompt (I know we can use the Column Selector to call the columns) .Below is the Screen Shot.
    !http://i46.tinypic.com/2qjfukh.jpg!
    2nd Requirement)
    The three columns I have are order Date, Ship Date and Entry Date.
    Whenever I click on Orderdate from the Prompt, It should dynamically show its values in the report.
    and When I click on the Ship Date from the Prompt, it should display the corresponding values in the report.
    and so on with the Entry Date.
    Can anybody help me how to acheive this.
    Thanks a ton.

    Ok so then you can use a fake column prompt. Here's one quick approach (nicer and cleaner with LOV tables but I don't if you have any of those).
    - Create a fresh prompt using any column you want.
    - Open the column formula using the fx button and replace the formula with 'abc'.
    - Use "SqL Results" as the "Show" option.
    - SQL:
    select case when 1=0 the Markets.Region else 'Order Date' from Paint.Markets UNION ALL
    select case when 1=0 the Markets.Region else 'Ship Date' from Paint.Markets UNION ALL
    select case when 1=0 the Markets.Region else 'Entry Date' from Paint.Markets
    - Set Variable = Presentation Variable = @{vPresVarSelectedDate}{Order Date}
    - Label = Date
    Then in the request, you change the column formula for the date. I'm going to make it short and just assume you called your time dimension alias(es) like the lowest grain:
    "@{vPresVarSelectedDate}{Order Date}"."@{vPresVarSelectedDate}{Order Date}"
    Cheers,
    C.

Maybe you are looking for

  • 30 GIG Video iPod, Video Options not available - Please help!

    Hi. I have a 30 GIG iPod Video 5th gen, with the latest iPod updater software installer on it. But when I look at the iPod preferences, when it's plugged in via USB, all Video options (manual vs automatic etc) are all greyed out and not available for

  • Aspect ratio filter not working properly

    I am running LR3.5 on Mac OS 10.6.8 and recently discovered that the aspect ratio filter is not working when used on folders created a few years ago. Specifically, a great many images shot in landscape mode are included with the portrait mode filter

  • CSV File Creation

    I have 2 queries related to CSV file creation using ODI. 1) I need to generate CSV file out of data contained in Oracle DB Table. When the data gets extracted into CSV file, it needs to be sorted on one particular column ( e.g Account_Number). Is thi

  • I can't find the reset firefox command button - even after trying the menu and the trouble-shooting page as per the directions.

    I want to reset firefox but all I get to after following the directions in Mozilla support is every more descriptions/explanations of what the commands mean. But I never get to the actual command 'reset firefox'. Where is it?

  • Ca't find libjava.so

    Hi all, I am trying to install oracle 10gon OEL 64 bit, but while running the OUI i am getting error can;t find libjava.so pls suggest me...