提交 5e15d645 编写于 作者: A alexp

6768387: REGRESSION: JTable no longer serializable

Reviewed-by: rupashka
上级 a57cac1d
......@@ -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.Graphics;
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 @@ public class DefaultTableCellHeaderRenderer extends DefaultTableCellRenderer
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) {}
......
/*
* 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();
}
});
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册