6 Replies Latest reply: Jun 17, 2011 12:11 PM by Narayan RSS

    help use JTable

    863138
      Good evening, I am writing because I have a problem.
      I'm doing a web application in JavaFX, and I need to use the JTable Java library.
      Although he has made some attempts, I have problems when I have to declare a two dimensional array object.
      I have done so, but I did not recognize.

      String[] columnNames = {"First Name","Second Name"}
      Object[][] data = { {"Kathy", "Smith"}};
      JTable table = new JTable(data, columnNames);

      Can anyone tell me the syntax that I must follow?
        • 1. Re: help use JTable
          jojorabbit
          Hi,
          in doc u can find and read this : http://download.oracle.com/javafx/2.0/api/javafx/scene/control/TableView.html.
          • 2. Re: help use JTable
            865474
            If your using javafx user TableView works better when using CSS and other manipulation such animation
            • 3. Re: help use JTable
              863138
              I saw it in JavaFX 2.0 beta is available this option, but I set the project on JavaFX 1.3 and now I'm forced to use the JTable
              • 4. Re: help use JTable
                jojorabbit
                Hi,
                here is tutorial for JTable http://download.oracle.com/javase/tutorial/uiswing/components/table.html
                • 5. Re: help use JTable
                  863138
                  yes, I took inspiration from that page to test the code in my program.
                  In my first post I wrote the lines of code tested on my application, but the program does not recognize the declaration of the two-dimensional object.
                  Help?
                  • 6. Re: help use JTable
                    Narayan
                    Hello unkus,

                    According to Javafx 1.3,
                    String[] columnNames = {"First Name","Second Name"}
                    Object[][] data = { {"Kathy", "Smith"}};
                    JTable table = new JTable(data, columnNames);
                    The above code is of Java not Javafx 1.3

                    So to make them run in javafx you must follow some syntax. like this:
                    var columnNames:String[] ={"First Name", "Second Name"};
                    var data:Object[][] = {{"Kathy", "Smith"}};
                    var table:JTable = new JTable(data,columnNames);
                    I think there are some issues on running swing inside Javafx.

                    Thanks.
                    Narayan