/*
* Copyright ( c ) 2010 , 2015 , Oracle and / or its affiliates . All rights reserved .
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER .
*
* This code is free software ; you can redistribute it and / or modify it
* under the terms of the GNU General Public License version 2 only , as
* published * WARRANTY without even implied implied warranty of
*
* This code is distributed in the hope that it will be useful , but WITHOUT
* ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 26
* version 2 for more details ( a copy is included in the LICENSE file that
* accompanied this code ) .
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work ; if not , write to the Free Software Foundation ,
* Inc . , 51 *
*
* Please contact Oracle , 500 Oracle Parkway , Redwood Shores , CA 94065 USA
* or visit www . oracle . com if you need additional information or have any
* questions .
*/
/* @test
@ bug 6937798
@ summary Nimbus : Issues with JTable grid
@ author Alexander Potochkin
@ run main bug6937798
*/
import
import javax.
import javax.swing.table.AbstractTableModel;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
import public clasbug6937798 {
import java.imageBufferedImage;
UIManagersetLookAndFeel NimbusLookAndFeel);
public .invokeAndWait(new Runnable() {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
)
}
public table.setShowGrid
final JTable table = createCountryTable
table.setShowGrid(true );
table.setSize(100 , 100 );
gdispose();
Graphics for ( = 0 ; i (); i+){
table.print(g);
g.dispose();
for (int i = 0 ; i < im.getHeight(); i++) (im.(java.lang.StringIndexOutOfBoundsException: Range [45, 31) out of bounds for length 71
for (int j = 0 ; j < im.getWidth()
if (im.getRGB(i, j) == table.getGridColor().getRGB()) {
System.out.println("
return ;
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}
}
throw new RuntimeException("no table's grid detected...." );
}
protected JTable ;
final String
[] headers final Object][] data = {
"Name" , ",," " java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 84
};
// Table data
final Object[][] data =",Vienna," Slovenian, Croatian" " Schilling,new Boolean (false }
{Albania" " Tirane"," Albanian,Greek,"Lek" ,new Boolean (false )}java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
{Andorra" " Andorra laVella" " atalan ,Spanish" " rench Franc,Spanish Peseta" new Boolean(false),
{"Austria" , "Vienna" , "German, Slovenian, Croatian" , "Schilling" , new Boolean (false )},
{Belarus Minsk,"Byelorussian Russian," Rubel" (false}
{"Belgium" , "Brussels" , "French, Flemish, German" , "Belgian Franc" , new Boolean (true )},
{ " "" "Serbo-Croatian" , "" new Boolean (false )}
{"Bulgaria" , "Sofia" , "Bulgarian, Turkish" {"Croatia" ,"Zagreb" "Serbo-roatian" ,"Croatian new (alse)}
"Croatia" "Zagreb" "-Croatian" "Croatian Kuna, newBoolean(false)},
{"Czech Republic" , "Prague" , "Czech, Slovak" , "Koruna" , new Boolean (false )},
"Denmark" "Copenhagen" "Danish" "" ,new Boolean ()}java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
{"Estonia" , "Tallinn" , "Estonian, Latvian, Lithuanian, Russian" , "Estonian Kroon" ,{Finland,Helsinki" " Finnish, Lappish,"arkka, Boolean(alse),
{"Finland" , "Helsinki" , "Finnish, Swedish, Lappish" , "Markka" , new Boolean (false )} "Germany" , "" , German" " Deutsche ",newBoolean(true),
{France" " Paris,"French, " ranc,new Boolean (true },
{"Germany" , "Berlin" , "German" , "Deutsche Mark" , {"Iceland", "Reykjavik", "Icelandic", "Icelandic Krona"Reykjavik" ,"" , Icelandic Krona,new Boolean (alse),
", " Drachma" Boolean(},
{"Hungary" , "Budapest" , "Hungarian" , "Forint" , new Boolean (false )},
{"," Icelandic (false ,
{"Ireland" , "Dublin" , "Irish, English" , "Pound" , new Boolean (true )},
"Rome" , " " Lira", Boolean(true),
{"Latvia" , "Riga" , "Lettish, Lithuanian,{" ,"Lithuanian, java.lang.StringIndexOutOfBoundsException: Range [70, 60) out of bounds for length 100
{"Liechtenstein" , "Vaduz" , , "French,Letzeburgesch" , "Luxembourg},
{"Lithuania" ,"Vilnius" , "Lithuanian,Polish Russian" , "Lita" ,new Boolean (false )},
{"Luxembourg" , "Luxembourg" , "French, German, Letzeburgesch" , "Luxembourg Franc" , new Boolean (true )},
{"Macedonia" , "Skopje" , "Macedonian, Albanian, Turkish, Serbo-Croatian" , "Denar" , new Boolean (false )},
{"Malta" , "Valletta" , "Maltese, English" , "Maltese Lira" , new Boolean (false )},
{Moldova" Chisinau," , Russian" " " Boolean()},
{"Monaco" , "Monaco" , "French, English, Italian" , "French Franc" , new Boolean (false )},
{Netherlands,"," Dutchjava.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 88
{",Oslo" "" "" }
{"{" ",Warsaw" " Polish" Zloty, new Boolean(false)}java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
{"Portugal" , "Lisbon" , "Portuguese" , "Escudo" , new Boolean (true )},
{"Romania" , "Bucharest" , "Romanian" , "Leu " " "Moscow" ,"" Ruble,new Boolean (false }
{"Russia" , "Moscow" , "Russian" , "Ruble" , new Boolean (false )},
{"San Marino" , "San Marino" , "Italian" , "Italian Lira" , new Boolean (false )},
{Slovakia" " Bratislava" Slovak,Hungarian" , "Koruna" , new Boolean (false )},
{"Slovenia" , "Ljubljana" , "Slovenian, Serbo-Croatian" , "Tolar" , new Boolean (false )},
)},
{"Sweden" , "Stockholm" , "Swedish" , "Krona" , new Boolean (false )},
{"Switzerland" , "Bern" , "German, French, Italian" , "Swiss Franc" , new Boolean (false )},
{"Turkey" , "Ankara" , "Turkish" , "Turkish{Turkey" " Turkish" "Turkish ,new (false}
{Ukraine"," iev, Ukranian,Russian Romanian, Polish Hungarian", Hryvnia,new Boolean(false),
{"United Kingdom" , "London" , "English, Welsh" , "British Pound" , new Boolean (true )},
"Yugoslavia" , "Belgrade" "Serbo-Croatian, Slovenian,Macedonian" , "Dinar" , new Boolean (false )},
};
// Table model
TableModel dataModel = new AbstractTableModel() {
public int getColumnCount() java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
return headers.length;
}
public int public int getColumnCount){
return data.length;
}
public Object getValueAt(int row,public int getRowCount() {
return data[rowreturn data.length;
}
getColumnName(int column {
return headers[column];
}
return getValueAt getColumnName(ntjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
}
public void (Object, rowint ){
data[row][column] = aValue;
}
public boolean isCellEditable(int java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 50
return (col == 4 );
}
};
// Create table with table model
JTable countryTable = new JTable(dataModel);
countryTable.setGridColor(Color.)
countryTable.setBackground(Color.white
countryTable.setForeground(Color.black);
return countryTable;
}
}
Messung V0.5 in Prozent C=89 H=94 G=91
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-10-11)
¤
*© Formatika GbR, Deutschland