我有一個JTable的多維數組。但它不是在JTable正確顯示數據的顯示像這樣由升轉降的每一行:嵌套循環顯示不正確的多維數組
nidRbc nidRbc nidRbc nidRbc nidRbc nidRbc nidRbc nidRbc nidRbc
INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER
RBC identity RBC identity RBC identity RBC identity RBC identity RBC identity RBC identity RBC identity RBC identity
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0
NULL NULL NULL NULL NULL NULL NULL NULL NULL
0:16382 0:16382 0:16382 0:16382 0:16382 0:16382 0:16382 0:16382 0:16382
maxRouteLength maxRouteLength maxRouteLength maxRouteLength maxRouteLength maxRouteLength maxRouteLength maxRouteLength maxRouteLength
NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3
Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route Maximum length (km) of a locked route
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2
0 0 0 0 0 0 0 0 0
50 50 50 50 50 50 50 50 50
###.### ###.### ###.### ###.### ###.### ###.### ###.### ###.### ###.###
minRouteLength minRouteLength minRouteLength minRouteLength minRouteLength minRouteLength minRouteLength minRouteLength minRouteLength
INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER
Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route Minimum length (m) of a locked route
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
3 3 3 3 3 3 3 3 3
0 0 0 0 0 0 0 0 0
300 300 300 300 300 300 300 300 300
0:1000 0:1000 0:1000 0:1000 0:1000 0:1000 0:1000 0:1000 0:1000
maxMALength maxMALength maxMALength maxMALength maxMALength maxMALength maxMALength maxMALength maxMALength
NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3 NUMBER:3
Max length (km) for a Movement Authority Max length (km) for a Movement Authority Max length (km) for a Movement Authority Max length (km) for a Movement Authority Max length (km) for a Movement Authority Max length (km) for a Movement Authority Max length (km) for a Movement Authority Max length (km) for a Movement Authority Max length (km) for a Movement Authority
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
4 4 4 4 4 4 4 4 4
0 0 0 0 0 0 0 0 0
50 50 50 50 50 50 50 50 50
###.### ###.### ###.### ###.### ###.### ###.### ###.### ###.### ###.###
minMAExtension minMAExtension minMAExtension minMAExtension minMAExtension minMAExtension minMAExtension minMAExtension minMAExtension
INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER
Min length (m) to extend an existing MA Min length (m) to extend an existing MA Min length (m) to extend an existing MA Min length (m) to extend an existing MA Min length (m) to extend an existing MA Min length (m) to extend an existing MA Min length (m) to extend an existing MA Min length (m) to extend an existing MA Min length (m) to extend an existing MA
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
5 5 5 5 5 5 5 5 5
0 0 0 0 0 0 0 0 0
NULL NULL NULL NULL NULL NULL NULL NULL NULL
0:1000 0:1000 0:1000 0:1000 0:1000 0:1000 0:1000 0:1000 0:1000
minTrainSeparation minTrainSeparation minTrainSeparation minTrainSeparation minTrainSeparation minTrainSeparation minTrainSeparation minTrainSeparation minTrainSeparation
INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER
Min distance (m) between two trains Min distance (m) between two trains Min distance (m) between two trains Min distance (m) between two trains Min distance (m) between two trains Min distance (m) between two trains Min distance (m) between two trains Min distance (m) between two trains Min distance (m) between two trains
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
6 6 6 6 6 6 6 6 6
0 0 0 0 0 0 0 0 0
NULL NULL NULL NULL NULL NULL NULL NULL NULL
0:1000 0:1000 0:1000 0:1000 0:1000 0:1000 0:1000 0:1000 0:1000
siteOwner siteOwner siteOwner siteOwner siteOwner siteOwner siteOwner siteOwner siteOwner
STRING STRING STRING STRING STRING STRING STRING STRING STRING
Country and owner of line (for communication identities) Country and owner of line (for communication identities) Country and owner of line (for communication identities) Country and owner of line (for communication identities) Country and owner of line (for communication identities) Country and owner of line (for communication identities) Country and owner of line (for communication identities) Country and owner of line (for communication identities) Country and owner of line (for communication identities)
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
7 7 7 7 7 7 7 7 7
0 0 0 0 0 0 0 0 0
NULL NULL NULL NULL NULL NULL NULL NULL NULL
[^/]{1,5}/[^/]{1,5} [^/]{1,5}/[^/]{1,5} [^/]{1,5}/[^/]{1,5} [^/]{1,5}/[^/]{1,5} [^/]{1,5}/[^/]{1,5} [^/]{1,5}/[^/]{1,5} [^/]{1,5}/[^/]{1,5} [^/]{1,5}/[^/]{1,5} [^/]{1,5}/[^/]{1,5}
siteName siteName siteName siteName siteName siteName siteName siteName siteName
STRING STRING STRING STRING STRING STRING STRING STRING STRING
Name of line (for communication identities) Name of line (for communication identities) Name of line (for communication identities) Name of line (for communication identities) Name of line (for communication identities) Name of line (for communication identities) Name of line (for communication identities) Name of line (for communication identities) Name of line (for communication identities)
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
8 8 8 8 8 8 8 8 8
0 0 0 0 0 0 0 0 0
NULL NULL NULL NULL NULL NULL NULL NULL NULL
[^/]{1,15} [^/]{1,15} [^/]{1,15} [^/]{1,15} [^/]{1,15} [^/]{1,15} [^/]{1,15} [^/]{1,15} [^/]{1,15}
docNoSiteDataReport docNoSiteDataReport docNoSiteDataReport docNoSiteDataReport docNoSiteDataReport docNoSiteDataReport docNoSiteDataReport docNoSiteDataReport docNoSiteDataReport
STRING STRING STRING STRING STRING STRING STRING STRING STRING
Document number for site data report Document number for site data report Document number for site data report Document number for site data report Document number for site data report Document number for site data report Document number for site data report Document number for site data report Document number for site data report
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
9 9 9 9 9 9 9 9 9
0 0 0 0 0 0 0 0 0
NULL NULL NULL NULL NULL NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL NULL NULL NULL
docNoBaliseList docNoBaliseList docNoBaliseList docNoBaliseList docNoBaliseList docNoBaliseList docNoBaliseList docNoBaliseList docNoBaliseList
STRING STRING STRING STRING STRING STRING STRING STRING STRING
Document number for balise list Document number for balise list Document number for balise list Document number for balise list Document number for balise list Document number for balise list Document number for balise list Document number for balise list Document number for balise list
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
10 10 10 10 10 10 10 10 10
0 0 0 0 0 0 0 0 0
NULL NULL NULL NULL NULL NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL NULL NULL NULL
docNoGeographicalReport docNoGeographicalReport docNoGeographicalReport docNoGeographicalReport docNoGeographicalReport docNoGeographicalReport docNoGeographicalReport docNoGeographicalReport docNoGeographicalReport
STRING STRING STRING STRING STRING STRING STRING STRING STRING
Document number for geographical report Document number for geographical report Document number for geographical report Document number for geographical report Document number for geographical report Document number for geographical report Document number for geographical report Document number for geographical report Document number for geographical report
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
11 11 11 11 11 11 11 11 11
0 0 0 0 0 0 0 0 0
NULL NULL NULL NULL NULL NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL NULL NULL NULL
nidC nidC nidC nidC nidC nidC nidC nidC nidC
INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER
Country identity Country identity Country identity Country identity Country identity Country identity Country identity Country identity Country identity
0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1
12 12 12 12 12 12 12 12 12
0 0 0 0 0 0 0 0 0
NULL NULL NULL NULL NULL NULL NULL NULL NULL
1:1023 1:1023 1:1023 1:1023 1:1023 1:1023 1:1023 1:1023 1:1023
但我希望它顯示從左不右各數據從上往下
所以應該是這樣的:
nidRbc INTEGER RBC 1 1 1 0 NULL 0:16382
maxRouteLength NUMBER:3 Maximum 1 1 2 0 50 ###.###
minRouteLength INTEGER . ... . etc etc..
這是現在我的代碼:
// Create a list of node and compile the xpath expression
NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(
xmlDocument, XPathConstants.NODESET);
System.out.println("nodelist length : " + nodeList.getLength());
System.out.println("constant length : "
+ constants.getParamColumns().length);
// Create a new string for the array
arr = new String[nodeList.getLength()][constants.getParamColumns().length];
// Loop through the list and save the data in a string array.
for (int i = 0; i < nodeList.getLength(); i++) {
for (int j = 0; j < constants.getParamColumns().length; j++) {
System.out.println("content : "
+ nodeList.item(i).getTextContent());
arr[i][j] = nodeList.item(i).getTextContent();
// System.out.println("Param : " + Arrays.toString(arr));
}
}
@kai幾乎工作它顯示正確,但相同的數據的所有它從未顯示該行的時間:maxRouteLength NUMBER:3最大1 1 2 0 50 #### ## – Sembrano