Results 1 to 4 of 4
  1. #1
    msambasiva is offline Member
    Join Date
    Jun 2013
    Posts
    14
    Rep Power
    0

    Default Unable to display JTable

    Hi,

    We are using SwiXML to create UI. We are getting empty screen while displaying JTable.

    Following are Java program and XML used to display JTable.

    Java Code:
    import javax.swing.*;
    import javax.swing.table.DefaultTableModel;
    import org.swixml.*;
    
    public class TableSample {
        public JTable myTable;
    
        public TableSample() throws Exception {
            DefaultTableModel myTableModel = new DefaultTableModel();
            myTableModel.addColumn("col1", new Object[]{"row1-a", "row1-b",
            "row1-c"});
            myTableModel.addColumn("col2", new Object[]{"row2-a", "row2-b",
            "row2-c"});
            myTable = new JTable();
                  myTable.setModel(myTableModel);
                (new SwingEngine(this)).render("table_sample.xml").setVisible(true);
        }
    
        public static void main(String[] args) throws Exception {
            TableSample tableSample = new TableSample();
        }
    }

    Java Code:
    <?xml version="1.0" encoding="windows-1252" ?>
    <frame name="frame" size="300,300" title="Table Demo"
           background="FFCCEE" layout="BorderLayout" defaultCloseOperation="JFrame.EXIT_ON_CLOSE">
    
        <panel layout="BorderLayout">
                <panel name="EHDD" constraints="BorderLayout.NORTH"
                       layout="GridBagLayout">
                      <scrollPane constraints="BorderLayout.CENTER">
                        <table id="myTable"/>
                      </scrollPane>
                </panel>
        </panel>
    </frame>
    Please suggest, if iam doing some thing wrong.

    If we replace <table> tag with <tree>, we are getting Tree structure. Suspecting issue with Table model creation.

    Thanks,
    Samba.
    Last edited by msambasiva; 08-21-2013 at 07:17 AM.

  2. #2
    msambasiva is offline Member
    Join Date
    Jun 2013
    Posts
    14
    Rep Power
    0

    Default Re: Unable to display JTable

    Has any one else got input for me?

    Thanks,
    Samba.

    Quote Originally Posted by msambasiva View Post
    Hi,

    We are using SwiXML to create UI. We are getting empty screen while displaying JTable.

    Following are Java program and XML used to display JTable.

    Java Code:
    import javax.swing.*;
    import javax.swing.table.DefaultTableModel;
    import org.swixml.*;
    
    public class TableSample {
        public JTable myTable;
    
        public TableSample() throws Exception {
            DefaultTableModel myTableModel = new DefaultTableModel();
            myTableModel.addColumn("col1", new Object[]{"row1-a", "row1-b",
            "row1-c"});
            myTableModel.addColumn("col2", new Object[]{"row2-a", "row2-b",
            "row2-c"});
            myTable = new JTable();
                  myTable.setModel(myTableModel);
                (new SwingEngine(this)).render("table_sample.xml").setVisible(true);
        }
    
        public static void main(String[] args) throws Exception {
            TableSample tableSample = new TableSample();
        }
    }

    Java Code:
    <?xml version="1.0" encoding="windows-1252" ?>
    <frame name="frame" size="300,300" title="Table Demo"
           background="FFCCEE" layout="BorderLayout" defaultCloseOperation="JFrame.EXIT_ON_CLOSE">
    
        <panel layout="BorderLayout">
                <panel name="EHDD" constraints="BorderLayout.NORTH"
                       layout="GridBagLayout">
                      <scrollPane constraints="BorderLayout.CENTER">
                        <table id="myTable"/>
                      </scrollPane>
                </panel>
        </panel>
    </frame>
    Please suggest, if iam doing some thing wrong.

    If we replace <table> tag with <tree>, we are getting Tree structure. Suspecting issue with Table model creation.

    Thanks,
    Samba.

  3. #3
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,029
    Rep Power
    6

    Default Re: Unable to display JTable

    'Anyone else' would imply that someone answered - this is not the case.

    And the fact that nobody answers already is the answer to your question. Perhaps you should just let go of using this third party XML stuff and just build the Swing GUI by hand which is quite easy once you get the hang of it - when you do that you have at least a handful of people in this forum who are ready, willing and able to help you out with any problems you have. If you want to keep using it - well good luck finding a forum where users of this SwiXML go to.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    msambasiva is offline Member
    Join Date
    Jun 2013
    Posts
    14
    Rep Power
    0

    Default Re: Unable to display JTable

    Thanks for your suggestion !!

    Quote Originally Posted by gimbal2 View Post
    'Anyone else' would imply that someone answered - this is not the case.

    And the fact that nobody answers already is the answer to your question. Perhaps you should just let go of using this third party XML stuff and just build the Swing GUI by hand which is quite easy once you get the hang of it - when you do that you have at least a handful of people in this forum who are ready, willing and able to help you out with any problems you have. If you want to keep using it - well good luck finding a forum where users of this SwiXML go to.

Similar Threads

  1. Unable to Display Two Objects in Frame
    By AryanArs in forum AWT / Swing
    Replies: 4
    Last Post: 02-26-2012, 06:56 PM
  2. Unable to Display Two Objects in Frame
    By AryanArs in forum New To Java
    Replies: 2
    Last Post: 02-26-2012, 06:43 AM
  3. Unable to display gif image
    By rameshiit19 in forum JavaServer Pages (JSP) and JSTL
    Replies: 5
    Last Post: 05-09-2011, 10:43 AM
  4. Replies: 2
    Last Post: 04-09-2009, 11:59 PM
  5. Unable to display JDialog from JFrame
    By jv5 in forum NetBeans
    Replies: 2
    Last Post: 02-04-2009, 04:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •