Getting a whole table into a JTable?

Is there a short way to insert all table data (contained in a database) into a DefaultTableModel?

What do you mean by "short"? The DefaultTableModel expects its data to be a Vector of Vectors or a two dimensional array and its headers to be a vector or array. So you're going to have to take the database data and put it into one of those structures. You can do that when you instantiate the DTM or use a the setDataVector(. . .) methods.
Or, maybe extend DTM so that you can give it a ResultSet as its data and header info.
Cheers
DB

Similar Messages

  • Best approach to get the source tables into Target

    Hi
    I am new to Goldengate and I would like to know what is the best approach to get the Source tables to be replicated into the target (oracle to oracle) before performing the initial load without using exp/expdp . Is there any native Goldengate utility which i can use during the initial load or before that will create the tables on the target before loading the data ?
    Thanks

    i dont think so, for the initial load replication your struncture should be available at target machine. once your machines are in sync then you can use goldengate ddl setup for automatically replicate the table with data. 
    Batter approach for you to create a structure on target machine using export improt.  In export use conect=metadata_only for copy the structure only.....
    like
    EXPDP <<user>>/<<password>>@connection_string schemas=abc directory=TEST_DIR dumpfile= gg.dmp Content = metadata_only logfile= gg.log

  • Re: getting the source tables into models in designer

    Hi all
    i need help while extracting the source table's to ODI designer
    my source: Oracle
    Question:
    i have given the source schema information. with that information i created logical and physical schema in topology manager.
    And trying to create a model to extract source tables to ODI.
    As i don't have all tables in the same schema (some tables were coming from different users and i don't have the information of those users) am unable to see the those tables when in selective reverse tab.
    i requested them to give select privileges for those tables in the schema which am using.
    after getting the select privileges for those tables.
    will i would be able to see those tables in selective reverse tab?
    Could some one guide me steps in this.
    Thanks

    917704 wrote:
    Hi Alastair
    firstly thank you for your reply.
    my soure is oracle erp.
    i cannot create physical/logical schemas for that user bez as it is head user in oracle erp, i dont have the access for that user.Hi, I've done change data capture from ebusiness suite using ODI, what we did was this :
    get a 'read only' database account set up in the ebiz suite database, this is your connecting user and your work schema (for CDC objects).
    grant select any table, or be more specific if you wish on the objects you need to read data from to ODI, then connect as your read only user but map the physical schemas as you wish.
    Back to your original question, a model can only have one logical schema, which in turn maps to one phyiscal schema - so I think your stuck needing to read across more than one schema on the source system.

  • Get value from Table/Recordset Cell into a JSP variable

    Can anyone please help with this ?...
    I need to get a cell value from a selected row of a table into a variable to pass to a java bean.
    1 - The dynamic table is populated by a recordset named "rs" and has a submit button for each row .
    2 - The user clicks on the corresponding button to select the row.
    3 - The recordset retrieved the ID for that row in the query, but does not display it in the table.
    I have tried :
    <% String ID = rs.getString("bookid");%>
    <% Library.bookConfirm(ID);%>
    But this fails saying that it "cannot resolve variable rs..."
    Yet the recordset populates correctly and its name is "rs"
    Is there another way to do this perhaps ?... ie: put the id in a column of the table and get the cell value ?...
    What would be the syntax to get the ID cell value of that selected row on the button click ?...
    Your feed back would be greatly appreciated.
    Thank you.

    Create a new rs
    ResultSet rs1 = statement.executeQuery(query);
    and use getstring to access the individual cell.

  • How to get the column names of the table into the Dashboard prompt

    how to get the column names of the table into the Dashboard prompt
    Thanks & Regards
    Kishore P

    Hey john,
    My requirement is as follows
    I have created a Rank for Total sales by Region wise i.e RANK(SUM(Dollars By Region)) in a pivot table.
    My pivot table looks like this
    COLUMN SELECTOR: TOTAL US , REGION , DISTRICT , MARKET
    ---------------------------------------------------- JAN 2009          FEB 2009        MAR 2009
    RANK              REGION                  DOLLARS           DOLLARS        DOLLARS DOLLARS
    1 CENTRAL 10 20 30 40
    2 SOUTHERN 10 30 30 70
    3 EASTERN 20 20 20 60
    4 WESTERN 10 20 30 40
    When i select the District in column selector
    Report has to display rank based on Total Sales by District. i.e
    ------------------------------------------------- JAN 2009         FEB 2009       MAR 2009
    RANK             DISTRICT              DOLLARS           DOLLARS        DOLLARS DOLLARS
    for this i need to change the fx of rank i.e RANK(SUM(Dollars By Region)) to RANK(SUM(Dollars By District)) and fx of Region i.e Markets.Region to Markets.District dynamically.
    so , i need to capture column name of the value selected from the column selector and dynamically i need to update the fx 0f RANK & fx of region.
    do you have any solution for this?
    http://rapidshare.com/files/402337112/Presentation1.jpg.html
    Thanks & Regards
    Edited by: Kishore P on Jun 24, 2010 7:24 PM
    Edited by: Kishore P on Jun 24, 2010 7:28 PM

  • How to get the plsql table data into output cursor

    Hi,
    Could anybody please help me.
    Below is an example of the scenario..
    CREATE OR REPLACE PACKAGE chck IS
    PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR);
    TYPE get_rec is record (ename varchar2(20),
    eno number(12));
    TYPE t_recs IS TABLE OF get_rec INDEX BY BINARY_INTEGER;
    emp_tab t_recs;
    END chck;
    CREATE OR REPLACE PACKAGE BODY chck AS
    PROCEDURE getdata(dept_no IN VARCHAR2,oc_result_cursor OUT sys_REFCURSOR)
    is
    BEGIN
    select ename, eno
    bulk collect into emp_tab
    from emp;
    open oc_result_cursor for select * from table(emp_tab); -- I believe something is wrong here ....
    END;
    END chck;
    the above package is giving me an error:
    LINE/COL ERROR
    10/29 PL/SQL: SQL Statement ignored
    10/43 PL/SQL: ORA-22905: cannot access rows from a non-nested table
    item
    let me know what needs to be changed
    Thanks
    Manju

    manjukn wrote:
    once i get the data into a plsql table, how to get this plsql table data into the cursor?There is no such thing as a PL/SQL table - it is an array.
    It is nothing at all like a table. It cannot be indexed, partitioned, cluster, etc. It does not exist in the SQL engine as an object that can be referenced. It resides in expensive PGA memory and needs to be copied (lock, stock and barrel) to the SQL engine as a bind variable.
    It is an extremely primitive structure - and should never be confused as being just like a table.
    Its use in SQL statements is also an exception to the rule. Sound and valid technical reasons need to justify why one want to push a PL/SQL array to the SQL engine to run SELECT 's against it.

  • Get multiple selection data of Table into an internal table

    Hi Guys,
    I have a Table in my view layout and selected 'SelectionMode' as 'Multi' in the table properties.How to get the selected data into an internal table when rows selected on the table output.For example,I have a 10 rows in the table and selected only 5 rows,need to get these 5 rows into an internal table?
    Regards
    Nandana

    Hi,
    Here is some sample code. Please try this and let me know if you are still getting any errors.
    DATA lo_nd_table_node TYPE REF TO if_wd_context_node.
      DATA lo_el_table_node TYPE REF TO if_wd_context_element.
      DATA ls_table_node TYPE wd_this->element_table_node.
      DATA lt_table_node TYPE wd_this->elements_table_node.
      DATA lt_table TYPE wdr_context_element_set.
      lo_nd_table_node = wd_context->get_child_node( name = wd_this->wdctx_table_node ).
      lt_table = lo_nd_table_node->get_selected_elements( including_lead_selection = abap_true ).
      LOOP AT lt_table INTO lo_el_table_node.
        lo_el_table_node->get_static_attributes(
          IMPORTING
            static_attributes = ls_table_node ).
        APPEND ls_table_node TO lt_table_node.
        CLEAR ls_table_node.
      ENDLOOP.
    lt_table_node contains the selected rows.

  • Cannot get text file to print in jtable. Using text file as a database

    Instead of doing JDBC i am using text file as database. I cant get data from text file to print into JTable when i click find button. Goal is to find a record and print that record only, but for now i am trying to print all the records. Once i get that i will change my code to search desired record and print it. when i click the find button nothing happens. Can you please take a look at my code, dbTest() method. thanks.
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.*;
    import java.io.*;
    public class GUIdirectory extends JFrame
    implements ActionListener {
    // Define the components and the layout
    JLabel inputLabel_lastname = new JLabel("Last Name");
    JTextField inputText_lastname = new JTextField("Last Name",15);
    JLabel inputLabel_firstname = new JLabel("First Name");
    JTextField inputText_firstname = new JTextField(" ",15);
    JLabel inputLabel_middleinitial = new JLabel("Middle Initial");
    JTextField inputText_middleinitial = new JTextField(" ",4);
    JButton inputButton = new JButton("Find");
    JPanel inputLayout = new JPanel(new FlowLayout(FlowLayout.CENTER,5,5));
    JButton jButton1 = new JButton();
    //create a new table and scrollpane
    JTable dataTable = new JTable();
    JScrollPane dataTableScrollPane = new JScrollPane();
    public static void main(String args[]) {
    GUIdirectory gui = new GUIdirectory("Telephone Directory");
    gui.show();
    gui.pack();
    //TokenTest tt = new TokenTest();
    //gui.dbTest();
    public GUIdirectory(String Title) {
    super(Title);
    // Add ourselves as a listener for the window closing
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
    exitWindow(1); }
    inputLabel_lastname.setLabelFor(inputText_lastname);
    inputText_lastname.setHorizontalAlignment(JTextField.RIGHT);
    inputText_lastname.addActionListener(this);
    inputLabel_firstname.setLabelFor(inputText_firstname);
    inputText_firstname.setHorizontalAlignment(JTextField.RIGHT);
    inputText_firstname.addActionListener(this);
    inputLabel_middleinitial.setLabelFor(inputText_middleinitial);
    inputText_middleinitial.setHorizontalAlignment(JTextField.RIGHT);
    inputText_middleinitial.addActionListener(this);
    inputButton.addActionListener(this);
    inputLayout.add(inputLabel_lastname);
    inputLayout.add(inputText_lastname);
    inputLayout.add(inputLabel_firstname);
    inputLayout.add(inputText_firstname);
    inputLayout.add(inputLabel_middleinitial);
    inputLayout.add(inputText_middleinitial);
    inputLayout.add(inputButton);
    getContentPane().setLayout(new BorderLayout(5,5));
    getContentPane().add("North",inputLayout);
    dataTableScrollPane.setViewportView(dataTable);
    getContentPane().add("Center",dataTableScrollPane);
    // A default method, primarily used for testing.
    public void actionPerformed(ActionEvent evt) {
    GUIdirectory gui = new GUIdirectory();
    gui.dbTest();
    void dbTest() {
    DataInputStream dis = null;
    String dbRecord = null;
    String hold;
    try {
    File f = new File("customer.txt");
    FileInputStream fis = new FileInputStream(f);
    BufferedInputStream bis = new BufferedInputStream(fis);
    dis = new DataInputStream(bis);
    Vector dataVector = new Vector();
    Vector headVector = new Vector(2);
    Vector row = new Vector();
    // read the record of the text database
    while ( (dbRecord = dis.readLine()) != null) {
    StringTokenizer st = new StringTokenizer(dbRecord, ",");
    while (st.hasMoreTokens()) {
    row.addElement(st.nextToken());
    System.out.println("Inside nested loop: " + row);
    System.out.println("inside loop: " + row);
    dataVector.addElement(row);
    System.out.println("outside loop: " + row);
    headVector.addElement("Title");
    headVector.addElement("Type");
    dataTable = new JTable(dataVector, headVector);
    dataTableScrollPane.setViewportView(dataTable);
    } catch (IOException e) {
    // catch io errors from FileInputStream or readLine()
    System.out.println("Uh oh, got an IOException error!" + e.getMessage());
    } finally {
    // if the file opened okay, make sure we close it
    if (dis != null) {
    try {
    dis.close();
    } catch (IOException ioe) {
    } // end if
    } // end finally
    } // end dbTest
    // Exits the program upon closing the window
    public void exitWindow(int i) {
    System.exit(i);
    public GUIdirectory() {
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    private void jbInit() throws Exception {
    jButton1.setText("jButton1");
    this.getContentPane().add(jButton1, BorderLayout.CENTER);

    Nothing happens because in the actionPerformed() method you are creating a new version of GUIdirectory. You just want to execute the dbTest() method of the current instance of GUIdirectory.
    The code should be:
    public void actionPerformed(ActionEvent evt)
    //GUIdirectory gui = new GUIdirectory();
    //gui.dbTest();
    dbTest();

  • Trying to import from different csv files into multiple JTables

    This might seem like something that isn't commonly done, but I'll see if anyone has done this before anyways.
    I currently have a JTable (tab #1) and it successfully reads in the data from a CSV file to populate the cells. Now, I am looking into making 3 more JTables. I can tab between the four different tables, but I can't seem to figure out how to get the data to go to the correct JTable. Tab #1 = table, Tab #2 = table2, Tab #3 = table3, Tab #4 = table4.
    Thanks.
            try
                FileInputStream fileInput = new FileInputStream ("upcoming.csv");
                BufferedReader InputCSV = new BufferedReader (new InputStreamReader (fileInput));
                line = InputCSV.readLine(); //start reading into the records.
                    //Create data for the table.
                    //the row variable = starting row
                int row = 0;
                while(line != null)
                    tmp = line.split(",");
                    for (int col = 0; col < columnNames.length; ++col)
                        data[row][col] = tmp[col]; //store cells' data to the 2-dimensional array.
                    row++;
                    line = InputCSV.readLine();
                }//end of WHILE-statement.
            } //END of TRY-statement.
            catch(Exception e)
                System.out.println(e);
            }

    I have been successful in my quest to get 4 different datasets into 4 different JTables. The previous posters suggestion to use the Table model led me to this page:
    http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/table/TableModel.html
            TableModel myData = new MyTableModel();
            JTable table = new JTable(myData);I had some very similar code in my program. I use the DefaultTableModel and the SortFilterModel before having 4 different JTables.
            DefaultTableModel model = new DefaultTableModel(data, columnNames);
            DefaultTableModel model2 = new DefaultTableModel(data2, columnNames);
            DefaultTableModel model3 = new DefaultTableModel(data3, columnNames);
            DefaultTableModel model4 = new DefaultTableModel(data4, columnNames);I use the code in the first post 4 times, and only change the filename and the data#.
    I also have some code that counts the number of lines that will be needed.
    Thanks.

  • Linked images in a table showing visted and messing with the the whole table

    Help Please.
    I have never had this happen in any other version of dreamweaver.  Using dreamweaver CC right now.
    I have an image created in photoshop. cut into slices. load the html and images into dreamweaver.  Dreamweaver then creates a table.  If i upload just like that, site looks fine.  Once I choose an image slice, create a link to it and then upload the site, there is a purple border around the image therefore wrecking my whole table.  The site shows breaks between each image slice.
    THank you

    The only real advice I can give, that will help you in the long run, would be to take some time to learn at least the basics of html and css. Photoshop's way of doing things will almost always blow your site to pieces as soon as you start changing content around. To create professional websites with DW, you are expected to understand HTML and CSS (and to a lesser degree, javascript). Without a firm understanding of HTML and CSS though, little issues like the IE border problem can become huge problems.
    There are tons of places online to get tutorials on all of this, I personally like the following links, for the basics...
    HTML: http://w3schools.com/html
    CSS: http://w3schools.com/css
    Once you understand what's going on behind the scenes in DW, it's much easier to work with the program. Once you understand how to work with the code the program gives you, Photoshop can be left to do the work it was designed for, image manipulation.

  • Disable JTable draggable? // reimporting into a JTable?

    How do I disable the ability to drag and drop the colons of a JTable?
    I am making a database where I am importing from a file (to view, but not edit it). How can I reimport the file after I have imported it into the JTable?
    This is my code at the moment.
        public void reload()
            ArrayList<String> ve = new ArrayList<String>(9); // imports the file into an ArrayList of lines
            try
                BufferedReader reader = new BufferedReader(new FileReader(source));
                String line = null;
                while ((line = reader.readLine()) != null)
                    ve.add(line);
                reader.close();
            catch (IOException e)
                System.out.println("Error reading file.");
            ve.trimToSize();
            String [][] data = new String[ve.size()/9][];
            for(int i = 0; i < data.length; i++)
                data[i] = new String[9];
                String name = ve.get(9*i);
                data[0] = name;
    String mobile = ve.get(9*i+1);
    data[i][1] = mobile;
    String dest = ve.get(9*i+2);
    data[i][2] = dest;
    String tranOut = ve.get(9*i+3);
    data[i][3] = tranOut;
    String tranIn = ve.get(9*i+4);
    data[i][4] = tranIn;
    String adult = ve.get(9*i+5);
    data[i][5] = adult;
    String number = ve.get(9*i+6);
    data[i][6] = number;
    String dep = ve.get(9*i+7);
    data[i][7] = dep;
    String arr = ve.get(9*i+8);
    data[i][8] = arr;
    sort(data); // run quickSort
    table = new JTable(data, columnNames);
    scrollPane = new JScrollPane(table);
    }It works the first time it is run, but not when I try to call it later (from the menus).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    In future, Swing questions should be asked in the [Swing Forum.|http://forums.sun.com/forum.jspa?forumID=57]
    The header row of a JTable is really an instance of JTableHeader . Take a look at the API and see if there are any methods that would be of use. (Hint: there are!)

  • Moving a ResultSet into a JTable, cheaply and efficiently.

    Hi,
    This may be something interesting for the more advanced Java programmers.
    I've recently run into an issue, with moving a ResultSet into a JTable. Now, this may seem simple, and believe me it is, but, all the ways I have seen it done, and tried, just don't suite my need.
    DBSql dbsql = new DBSql(); // My database handler class
    tableResults.setModel(new javax.swing.table.DefaultTableModel(dbsql.execute(script), dbsql.getColumns()));
    * Queries the DataBase and populates
    * the values into a two-dimensional object array
    * @param SqlQry
    * @return Object[][]
    public Object[][] execute(String SqlQry) throws SQLException {
    Object[][] obj = null;
    select = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    ResultSet rs = select.executeQuery(SqlQry);
    rsmd = rs.getMetaData();
    try {
    if (rs.next()) {
    boolean found = true;
    rs.last();
    recordCount = rs.getRow();
    rs.first();
    obj = new Object[recordCount][rsmd.getColumnCount()];
    int i = 0;
    while (found) {
    for (int j = 0; j < rsmd.getColumnCount(); j++) {
    obj[i][j] = rsmd.getColumnType(j + 1) != Constants.TYPE_INTEGER ? rs.getString(j + 1) : rs.getInt(j + 1);
    i++;
    found = rs.next();
    } else {
    recordCount = 0;
    return null;
    } catch(OutOfMemoryError oome) {
    System.gc();
    throw new SQLException("Out Of Memory");
    if(rs != null) rs.close();
    return obj;
    The application I have created is used to connect to any database I want. I have tested it with JavaDB, Microsoft Access, and DB2. The problem is, most DB2's have tables with many records and columns, while most new Relational Databases, have small tables with few records. This code works fantastic with a couple thousand records, with very few columns. But, doesn't cut it when it comes to 50000 records or more. For, instance I queried a DB2 table that has 34000 records and 117 columns ("select * from table"), it doesn't take too long, but it uses way too much memory. If I run that query the application resources 298mb, then when I run it again, it uses a little more and throws an OutOfMemoryError.
    The second issue I have is, I queried another table that has 147000 records and selected 4 columns. No OutOfMemoryError this time - 70mb resourcing - but, the application did take at least 20 minutes to collect those records.
    I have tried using the Vector<Vector<String>> type into the JTable, but, frankly that's just asking for an OutOfMemoryError.
    I have tried creating my own custom table model, with a created data object.
    I have tried inserting rows into a table model in the method itself and returning the table model.
    Eg.
    while (found) {
    Object[] obj = new Object[rsmd.getColumnCount()];
    for (int j = 0; j < rsmd.getColumnCount(); j++) {
    obj[j] = rsmd.getColumnType(j + 1) != Constants.TYPE_INTEGER ? rs.getString(j + 1) : rs.getInt(j + 1);
    tablemodel.insertRow(obj);
    found = rs.next();
    ^I think you can use a vector for this too.
    So far, nothing has solved my problem.
    One thing I have not tried however, is a different table component for this kind of thing.
    I'm basically looking for, a method of doing this, with less overhead and quicker table population.
    Any Ideas?
    Regards,
    That_Gui

    Thanks for the reply.
    "1) Swing related questions should be posted in the Swing forum."
    Apologies, I was caught between swing and essentials, as it seemed to me as, more of a "better ways to do things" kind of question.
    "Also, the approach you are using requires two copies of the data, one in the ResultSet and one in the TableModel."
    I understand that transferring a ResultSet into an Object Array may probably be resource intensive, my delphi colleague made mention of that to me, not too long ago. That is why I'm trying to transfer the ResultSet directly into the table. That is why I used the ListTableModel, which also uses a lot of memory, I have looked at that - I had forgotten to mention that.
    "I have seen approaches where you try to only read a specific number of records. Then as you scroll additional records are read as needed. I can't point you to any specific solution though."
    Using an approach of reading the data as you scroll, sounds great, but also sounds like unnecessary work for the program to do, just like this Object/Vector story. In RPG, if you are working with subfiles (like a JTable), you will display 10 records at a time, and if the user hits the Page Down button you will display the next 10, that is how I'm understanding it.
    "I rarely use DefaultTableModel, creating your own model from AbstractTableModel is a lot more flexible when it comes to how you organise your storage, and it's pretty simple once you get the hang of it."
    This is the dream, I just need to design one that works as I need it.
    "You'd do a select count(*) on your query first to get the total rows expected. Of course one of the problems is that the databased table may change after you've retrieved the length or the items."
    Unfortunately, this is not an option for me, it wont work for what I need.
    I'm going to give the ResultSetTableModel a go - which I think it is actually similar to the ListTableModel - and I will get back to you.

  • JButtons into a JTable

    Is it possible for me to get a JButton into and JTable? The Table contents come from the code below.
    server myserver= new server();//make object of this class
    network mynetwork= new network(myserver);// make network objectand pass server as refrence
    int row,col;
              //initialise string database for hosts
              for (row=0;row<50;row++){               
                   myserver.hostdb[row][0]=""+iconButtons;
                   for (col=1;col<8;col++){
                   myserver.hostdb[row][col]="";
    Any help would be appriciated thanks.

    Yes
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender

  • High CPU issue due to table.setForeground() in JTable renderer

    Hi,
    I have a JTable with a renderer to set the text color for the row if certain conditions exist.
    The code below "works" although I have two issues:-
    1. The command "table.setForeground(Color.BLUE);" in the code below causes 50% CPU utilisation (Win XP, service pack 3). Very strange and consistent - tested on two different PCs.
    2. At times, the first column below the intended column changes color. The rest of the intended column has color set correctly.
    I'm using beans binding with the table concerned so can't post the table model - I believe the binding effectively has it's own model.
    Be greatful for any insight as it seems v. strange.....
    Thanks,
    </code>
            masterTable.setDefaultRenderer(String.class, textColour);
        TableCellRenderer textColour = new TableCellRenderer() {
            @Override
            public Component getTableCellRendererComponent(JTable table, Object value,
                    boolean isSelected, boolean hasFocus, int row, int column) {
                MailingList mL = (MailingList) queryList.get((table.convertRowIndexToModel(row)));
                table.setForeground(Color.BLACK);
                if (mL.getApplicationAppId() != null) {
                    if (mL.getApplicationAppId().getSembookingsCollection() != null) {
                        Collection sB = mL.getApplicationAppId().getSembookingsCollection();
                        if (!sB.isEmpty()) {
    //                        table.setForeground(Color.BLUE);  //this line causes 50% CPU utilisation ???
                TableCellRenderer delegate = table.getDefaultRenderer(Object.class);
                return delegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Here's my latest attempt, but still some questions and issues.
    I create a textColour class and this time attempt to set the colour on the component rather than the whole table in a similar fashion to the prepareRenderer(&hellip;) method.
    This appears to work and the CPU is no longer 50% utilisation.
    However, I still have the following questions/issues/observations:-
    1. I now need to set a renderer for each type of data. Perhaps this is the way it "should" be done. For example, I need to add " masterTable.setDefaultRenderer(Date.class, new textColour());" and then reformat the dates otherwise they don't change color. Would have been nice to set the colour for the whole row BUT can't see how as I can't use the preparedRenderer method?
    2. Perhaps related to the above, as I now return "comp", I don't call the default tableRenderer : i.e. " return delegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);" {code} Is there a cleaner/"better" way to do this? If I do return the above, I don't see any colour change as my changed "comp" is replaced by returning the component from the default call above.
    3. Persumably I'm no longer in a loop as CPU is "normal" and no where near 50% (more like 0%). I still set the row to be BLACK first otherwise all rows change colour (BLUE) but looks like the row isn't rendered until the component is returned.
    4. I no longer have the second issue of colour being incorrect for the first column of one row. So that's good!
    Here's the latest ver of the code.......
    Thanks,
    {code:java}
            masterTable.setDefaultRenderer(String.class, new textColour());
            masterTable.setDefaultRenderer(Date.class, new textColour());
          public class textColour extends DefaultTableCellRenderer {
            @Override
            public Component getTableCellRendererComponent(JTable table, Object value,
                    boolean isSelected, boolean hasFocus, int row, int column) {
                MailingList mL = (MailingList) queryList.get((table.convertRowIndexToModel(row)));
                Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                if (value instanceof java.util.Date) {
                    this.setText(shortDf.format((Date) value));
                comp.setForeground(Color.BLACK);
                if (mL.getApplicationAppId() != null) {
                    if (mL.getApplicationAppId().getSembookingsCollection() != null) {
                        Collection sB = mL.getApplicationAppId().getSembookingsCollection();
                        if (!sB.isEmpty()) {
                            comp.setForeground(Color.BLUE);
    //            TableCellRenderer delegate = table.getDefaultRenderer(Object.class);
    //            return delegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                return comp;
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Rendering xml-table into logical filename in SAP R/3

    Hi,
    I am trying to translate an xml-table with bytes into a logical filepath in SAP R3.
    Do I have to use the method gui-download or shall I loop the internal xml-table?
    When I tried to loop the xml-table into a structure, and then transfering the structure into the logical filename, I get problems with the line breaks in my xml-file. How do I get the lines to break exactly the same as I wrote them in my ABAP-code?
    Edited by: Kristina Hellberg on Jan 10, 2008 4:24 PM

    I believe you posted in the wrong forum.
    This forum is dedicated to development and deployment of .Net applications that connect and interact with BusinessObjects Enterprise, BusinessObjects Edge, or Crystal Reports Server. This includes the development of applications using the BusinessObjects Enterprise, Report Application Server, Report Engine, and Web Services SDKs.
    Ludek

Maybe you are looking for

  • Creative Cloud Enterprise: Is there a way to choose where the package temp files are downloaded?

    I am an Enterprise Admin and have to use a Windows computer to download and create different Creative Cloud packages. The temp package files first download to the C:\ (system drive) and then the actual package in the location you specified; usually o

  • New mac vs ppc laptop

    I got afew questions about the new mac laptops and intel chip.. 1) when apple came out with the new line of intel macbook,macbook pro..how come they didn't up the mem to at least 4 gig and just stay at the 2 gig... 2) when running an intel macbook wi

  • Pass query to servlet through midlet

    Hi, I have a problem here. I would like to control the SQL Statement to be executed by the servlet using the mobile midlet. Like this one: midlet -> will call servlet with parameter statement -> servlet will execute the statement parameter passed by

  • Hi in ecc 6.0 version - it is possible to get pdf print from list.

    Hi, In ECC 6.0 it is possible to print the pdf format  from o/p. PLs resolve this problem Regards , Rani.

  • Multithreaded Swing and a "Cancel Button"

    I have a Swing-based app that runs some lengthy JDBC queries. Currently when the user hits the "Run Query" button a small dialog pops up to say that the process is running, please wait, etc. I'd like to add a working Cancel button to that dialog that