OpenJDK / amber / amber
changeset 5589:5e4f59f34eea
6768387: REGRESSION: JTable no longer serializable
Reviewed-by: rupashka
author | alexp |
---|---|
date | Tue, 25 May 2010 20:39:52 +0400 |
parents | 57eca0aa621e |
children | 3ec077d7e893 |
files | jdk/src/share/classes/sun/swing/table/DefaultTableCellHeaderRenderer.java jdk/test/javax/swing/JTable/6768387/bug6768387.java |
diffstat | 2 files changed, 63 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/jdk/src/share/classes/sun/swing/table/DefaultTableCellHeaderRenderer.java Tue May 25 20:30:54 2010 +0400 +++ b/jdk/src/share/classes/sun/swing/table/DefaultTableCellHeaderRenderer.java Tue May 25 20:39:52 2010 +0400 @@ -24,6 +24,8 @@ */ package sun.swing.table; +import sun.swing.DefaultLookup; + import java.awt.Component; import java.awt.Color; import java.awt.FontMetrics; @@ -31,12 +33,11 @@ import java.awt.Insets; import java.awt.Point; import java.awt.Rectangle; +import java.io.Serializable; import javax.swing.*; import javax.swing.plaf.UIResource; import javax.swing.border.Border; import javax.swing.table.*; -import sun.swing.DefaultLookup; - public class DefaultTableCellHeaderRenderer extends DefaultTableCellRenderer implements UIResource { @@ -186,7 +187,7 @@ return new Point(x, y); } - private class EmptyIcon implements Icon { + private class EmptyIcon implements Icon, Serializable { int width = 0; int height = 0; public void paintIcon(Component c, Graphics g, int x, int y) {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/JTable/6768387/bug6768387.java Tue May 25 20:39:52 2010 +0400 @@ -0,0 +1,59 @@ +/* + * Copyright 2010 Sun Microsystems, Inc. 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 by the Free Software Foundation. + * + * 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 PURPOSE. See the GNU General Public License + * 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 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* @test + @bug 6768387 + @summary REGRESSION: JTable no longer serializable + @author Alexander Potochkin + @run main bug6768387 +*/ + +import javax.swing.*; +import javax.swing.table.AbstractTableModel; +import java.io.*; + +public class bug6768387 { + + private static void createGui() { + JTable table = new JTable(); + OutputStream os; + ObjectOutputStream out; + try { + os = new ByteArrayOutputStream(); + out = new ObjectOutputStream(os); + out.writeObject(table); + out.close(); + } + catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + bug6768387.createGui(); + } + }); + } +}