diff --git a/src/share/classes/java/beans/XMLEncoder.java b/src/share/classes/java/beans/XMLEncoder.java index e7884ef631af147224d01ff280d93937b06f2dee..e13c8262c884776e4fc2952dba5c81f42929ada4 100644 --- a/src/share/classes/java/beans/XMLEncoder.java +++ b/src/share/classes/java/beans/XMLEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-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 @@ -214,8 +214,8 @@ public class XMLEncoder extends Encoder { private Object owner; private int indentation = 0; private boolean internal = false; - private Map valueToExpression; - private Map targetToStatementList; + private Map valueToExpression; + private Map> targetToStatementList; private boolean preambleWritten = false; private NameGenerator nameGenerator; @@ -287,8 +287,8 @@ public class XMLEncoder extends Encoder { this.declaration = declaration; this.indentation = indentation; this.out = new OutputStreamWriter(out, cs.newEncoder()); - valueToExpression = new IdentityHashMap(); - targetToStatementList = new IdentityHashMap(); + valueToExpression = new IdentityHashMap(); + targetToStatementList = new IdentityHashMap>(); nameGenerator = new NameGenerator(); } @@ -331,13 +331,12 @@ public class XMLEncoder extends Encoder { } } - private Vector statementList(Object target) { - Vector list = (Vector)targetToStatementList.get(target); - if (list != null) { - return list; + private List statementList(Object target) { + List list = targetToStatementList.get(target); + if (list == null) { + list = new ArrayList(); + targetToStatementList.put(target, list); } - list = new Vector(); - targetToStatementList.put(target, list); return list; } @@ -363,13 +362,13 @@ public class XMLEncoder extends Encoder { } d.marked = true; Object target = exp.getTarget(); + mark(exp); if (!(target instanceof Class)) { statementList(target).add(exp); // Pending: Why does the reference count need to // be incremented here? d.refs++; } - mark(exp); } private void mark(Statement stm) { @@ -463,9 +462,9 @@ public class XMLEncoder extends Encoder { preambleWritten = true; } indentation++; - Vector roots = statementList(this); - for(int i = 0; i < roots.size(); i++) { - Statement s = (Statement)roots.get(i); + List statements = statementList(this); + while (!statements.isEmpty()) { + Statement s = statements.remove(0); if ("writeObject".equals(s.getMethodName())) { outputValue(s.getArguments()[0], this, true); } @@ -513,7 +512,7 @@ public class XMLEncoder extends Encoder { } private ValueData getValueData(Object o) { - ValueData d = (ValueData)valueToExpression.get(o); + ValueData d = valueToExpression.get(o); if (d == null) { d = new ValueData(); valueToExpression.put(o, d); @@ -619,11 +618,11 @@ public class XMLEncoder extends Encoder { } if (d.name != null) { - writeln(""); - return; + outputXML(isArgument ? "object" : "void", " idref=" + quote(d.name), value); + } + else if (d.exp != null) { + outputStatement(d.exp, outer, isArgument); } - - outputStatement(d.exp, outer, isArgument); } private static String quoteCharCode(int code) { @@ -683,13 +682,6 @@ public class XMLEncoder extends Encoder { String tag = (expression && isArgument) ? "object" : "void"; String attributes = ""; ValueData d = getValueData(value); - if (expression) { - if (d.refs > 1) { - String instanceName = nameGenerator.instanceName(value); - d.name = instanceName; - attributes = attributes + " id=" + quote(instanceName); - } - } // Special cases for targets. if (target == outer) { @@ -706,13 +698,19 @@ public class XMLEncoder extends Encoder { else { d.refs = 2; getValueData(target).refs++; - outputValue(target, outer, false); - if (isArgument) { - outputValue(value, outer, false); + List statements = statementList(target); + if (!statements.contains(exp)) { + statements.add(exp); } + outputValue(target, outer, false); + outputValue(value, outer, isArgument); return; } - + if (expression && (d.refs > 1)) { + String instanceName = nameGenerator.instanceName(value); + d.name = instanceName; + attributes = attributes + " id=" + quote(instanceName); + } // Special cases for methods. if ((!expression && methodName.equals("set") && args.length == 2 && @@ -730,8 +728,11 @@ public class XMLEncoder extends Encoder { else if (!methodName.equals("new") && !methodName.equals("newInstance")) { attributes = attributes + " method=" + quote(methodName); } + outputXML(tag, attributes, value, args); + } - Vector statements = statementList(value); + private void outputXML(String tag, String attributes, Object value, Object... args) { + List statements = statementList(value); // Use XML's short form when there is no body. if (args.length == 0 && statements.size() == 0) { writeln("<" + tag + attributes + "/>"); @@ -745,8 +746,8 @@ public class XMLEncoder extends Encoder { outputValue(args[i], null, true); } - for(int i = 0; i < statements.size(); i++) { - Statement s = (Statement)statements.get(i); + while (!statements.isEmpty()) { + Statement s = statements.remove(0); outputStatement(s, value, false); } diff --git a/src/share/classes/javax/swing/JTable.java b/src/share/classes/javax/swing/JTable.java index 16ffec41a54109040f283b63cc241024346bc8a1..236e59102c12e2d944dfe20d37d26e80bc791fa4 100644 --- a/src/share/classes/javax/swing/JTable.java +++ b/src/share/classes/javax/swing/JTable.java @@ -2506,10 +2506,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable Color old = this.selectionForeground; this.selectionForeground = selectionForeground; firePropertyChange("selectionForeground", old, selectionForeground); - if ( !selectionForeground.equals(old) ) - { - repaint(); - } + repaint(); } /** @@ -2547,10 +2544,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable Color old = this.selectionBackground; this.selectionBackground = selectionBackground; firePropertyChange("selectionBackground", old, selectionBackground); - if ( !selectionBackground.equals(old) ) - { - repaint(); - } + repaint(); } /** diff --git a/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java b/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java index 2e967b73019a9a49de8aba5dba5c31596da45163..f3115cde3b9b8d9bebaef2aa533ee37eb802c390 100644 --- a/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java +++ b/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java @@ -62,6 +62,7 @@ public class SynthScrollBarUI extends BasicScrollBarUI (scrollbar.getLayout() instanceof UIResource)) { scrollbar.setLayout(this); } + configureScrollBarColors(); updateStyle(scrollbar); } diff --git a/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java b/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java index a2e30e5933277807a6c7704632a961df9f50fedd..4c16e0b81bcaf4a7ed9ce1f91d9fcdc9616d8a06 100644 --- a/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java +++ b/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java @@ -45,8 +45,7 @@ import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.LookAndFeel; import javax.swing.border.Border; -import javax.swing.plaf.ComponentUI; -import javax.swing.plaf.UIResource; +import javax.swing.plaf.*; import javax.swing.plaf.basic.BasicTableUI; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.JTableHeader; @@ -158,7 +157,7 @@ public class SynthTableUI extends BasicTableUI if (gridColor == null) { gridColor = style.getColor(context, ColorType.FOREGROUND); } - table.setGridColor(gridColor); + table.setGridColor(gridColor == null ? new ColorUIResource(Color.GRAY) : gridColor); } useTableColors = style.getBoolean(context, diff --git a/src/share/classes/javax/swing/text/DefaultEditorKit.java b/src/share/classes/javax/swing/text/DefaultEditorKit.java index 32c5c1fda3b2f4b75c6b25ecca58adaffc5685c3..7651b9f2e7db87c55a582a9938882430298bc905 100644 --- a/src/share/classes/javax/swing/text/DefaultEditorKit.java +++ b/src/share/classes/javax/swing/text/DefaultEditorKit.java @@ -1461,13 +1461,17 @@ public class DefaultEditorKit extends EditorKit { // Make sure the new visible location contains // the location of dot, otherwise Caret will // cause an additional scroll. - adjustScrollIfNecessary(target, newVis, initialY, - newIndex); - if (select) { - target.moveCaretPosition(newIndex); - } - else { - target.setCaretPosition(newIndex); + int newY = getAdjustedY(target, newVis, newIndex); + + if (direction == -1 && newY <= initialY || direction == 1 && newY >= initialY) { + // Change index and correct newVis.y only if won't cause scrolling upward + newVis.y = newY; + + if (select) { + target.moveCaretPosition(newIndex); + } else { + target.setCaretPosition(newIndex); + } } } } catch (BadLocationException ble) { } @@ -1513,34 +1517,27 @@ public class DefaultEditorKit extends EditorKit { } /** - * Adjusts the rectangle that indicates the location to scroll to + * Returns adjustsed {@code y} position that indicates the location to scroll to * after selecting index. */ - private void adjustScrollIfNecessary(JTextComponent text, - Rectangle visible, int initialY, - int index) { + private int getAdjustedY(JTextComponent text, Rectangle visible, int index) { + int result = visible.y; + try { Rectangle dotBounds = text.modelToView(index); - if (dotBounds.y < visible.y || - (dotBounds.y > (visible.y + visible.height)) || - (dotBounds.y + dotBounds.height) > - (visible.y + visible.height)) { - int y; - - if (dotBounds.y < visible.y) { - y = dotBounds.y; - } - else { - y = dotBounds.y + dotBounds.height - visible.height; - } - if ((direction == -1 && y < initialY) || - (direction == 1 && y > initialY)) { - // Only adjust if won't cause scrolling upward. - visible.y = y; + if (dotBounds.y < visible.y) { + result = dotBounds.y; + } else { + if ((dotBounds.y > visible.y + visible.height) || + (dotBounds.y + dotBounds.height > visible.y + visible.height)) { + result = dotBounds.y + dotBounds.height - visible.height; } } - } catch (BadLocationException ble) {} + } catch (BadLocationException ble) { + } + + return result; } /** diff --git a/test/java/beans/XMLEncoder/Test5023550.java b/test/java/beans/XMLEncoder/Test5023550.java new file mode 100644 index 0000000000000000000000000000000000000000..b48d85c6e44634b2596148f09dec6eb2d2db498b --- /dev/null +++ b/test/java/beans/XMLEncoder/Test5023550.java @@ -0,0 +1,122 @@ +/* + * 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 5023550 + * @summary Tests complex references to owner + * @author Sergey Malenkov + */ + +import java.beans.DefaultPersistenceDelegate; +import java.beans.Encoder; +import java.beans.Expression; +import java.beans.XMLDecoder; +import java.beans.XMLEncoder; + +public class Test5023550 extends AbstractTest { + public static void main(String[] args) { + new Test5023550().test(true); + } + + private final Owner owner = new Owner(); + + @Override + protected void initialize(XMLEncoder encoder) { + encoder.setOwner(this.owner); + encoder.setPersistenceDelegate(A.class, new ADelegate()); + encoder.setPersistenceDelegate(B.class, new BDelegate()); + encoder.setPersistenceDelegate(C.class, new CDelegate()); + } + + @Override + protected void initialize(XMLDecoder decoder) { + decoder.setOwner(this.owner); + } + + protected Object getObject() { + return this.owner.newA(this.owner.newB().newC()); + } + + public static class Owner { + public A newA(C c) { + return new A(c); + } + + public B newB() { + return new B(); + } + } + + public static class A { + private final C c; + + private A(C c) { + this.c = c; + } + + public C getC() { + return this.c; + } + } + + public static class B { + public C newC() { + return new C(this); + } + } + + public static class C { + private final B b; + + private C(B b) { + this.b = b; + } + + public B getB() { + return this.b; + } + } + + public static class ADelegate extends DefaultPersistenceDelegate { + protected Expression instantiate(Object old, Encoder out) { + XMLEncoder encoder = (XMLEncoder) out; + A a = (A) old; + return new Expression(old, encoder.getOwner(), "newA", new Object[] { a.getC() }); + } + } + + public static class BDelegate extends DefaultPersistenceDelegate { + protected Expression instantiate(Object old, Encoder out) { + XMLEncoder encoder = (XMLEncoder) out; + return new Expression(old, encoder.getOwner(), "newB", new Object[0]); + } + } + + public static class CDelegate extends DefaultPersistenceDelegate { + protected Expression instantiate(Object old, Encoder out) { + C c = (C) old; + return new Expression(c, c.getB(), "newC", new Object[0]); + } + } +} diff --git a/test/java/beans/XMLEncoder/Test5023557.java b/test/java/beans/XMLEncoder/Test5023557.java new file mode 100644 index 0000000000000000000000000000000000000000..10563701acafed43905bc62e6f800cae506fde1f --- /dev/null +++ b/test/java/beans/XMLEncoder/Test5023557.java @@ -0,0 +1,99 @@ +/* + * 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 5023557 + * @summary Tests complex references + * @author Sergey Malenkov + */ + +import java.beans.DefaultPersistenceDelegate; +import java.beans.Encoder; +import java.beans.Expression; +import java.beans.XMLEncoder; + +public class Test5023557 extends AbstractTest { + public static void main(String[] args) { + new Test5023557().test(true); + } + + @Override + protected void initialize(XMLEncoder encoder) { + encoder.setPersistenceDelegate(B.class, new BDelegate()); + encoder.setPersistenceDelegate(C.class, new CDelegate()); + } + + protected Object getObject() { + A a = new A(); + return a.newC(a.newB()); + } + + public static class A { + public B newB() { + return new B(this); + } + + public C newC(B b) { + return new C(b); + } + } + + public static class B { + private final A a; + + private B(A a) { + this.a = a; + } + + public A getA() { + return this.a; + } + } + + public static class C { + private final B b; + + private C(B b) { + this.b = b; + } + + public B getB() { + return this.b; + } + } + + public static class BDelegate extends DefaultPersistenceDelegate { + protected Expression instantiate(Object old, Encoder out) { + B b = (B) old; + return new Expression(b, b.getA(), "newB", new Object[0]); + } + } + + public static class CDelegate extends DefaultPersistenceDelegate { + protected Expression instantiate(Object old, Encoder out) { + C c = (C) old; + return new Expression(c, c.getB().getA(), "newC", new Object[] { c.getB() }); + } + } +} diff --git a/test/java/beans/XMLEncoder/Test6921644.java b/test/java/beans/XMLEncoder/Test6921644.java new file mode 100644 index 0000000000000000000000000000000000000000..5dc2fed86763d89ec17ad0bed5c85246fec2b588 --- /dev/null +++ b/test/java/beans/XMLEncoder/Test6921644.java @@ -0,0 +1,197 @@ +/* + * 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 6921644 + * @summary Tests references to cached integer + * @author Sergey Malenkov + */ + +import java.beans.ConstructorProperties; +import java.util.ArrayList; +import java.util.List; + +public final class Test6921644 extends AbstractTest { + public static void main(String[] args) { + new Test6921644().test(true); + } + + protected Object getObject() { + Owner o = new Owner(100); // it works if ID >= 128 + + Category c = new Category(o); + + Document d1 = new Document(o); + Document d2 = new Document(o); + Document d3 = new Document(o); + + Author a1 = new Author(o); + Author a2 = new Author(o); + Author a3 = new Author(o); + + o.getList().add(a1); + o.getList().add(a2); + o.getList().add(a3); + + a3.setRef(o.getId()); + + d2.setCategory(c); + d3.setCategory(c); + + a1.addDocument(d1); + a1.addDocument(d2); + a3.addDocument(d3); + + c.addDocument(d2); + c.addDocument(d3); + + return o; + } + + public static class Owner { + private int id; + private List list = new ArrayList(); + + @ConstructorProperties("id") + public Owner(int id) { + this.id = id; + } + + public int getId() { + return this.id; + } + + public List getList() { + return this.list; + } + + public void setList(List list) { + this.list = list; + } + } + + public static class Author { + private int id; + private int ref; + private Owner owner; + private List list = new ArrayList(); + + @ConstructorProperties("owner") + public Author(Owner owner) { + this.owner = owner; + this.id = owner.getId(); + } + + public Owner getOwner() { + return this.owner; + } + + public Integer getId() { + return this.id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getRef() { + return this.ref; + } + + public void setRef(Integer ref) { + this.ref = ref; + } + + public List getList() { + return this.list; + } + + public void setList(List list) { + this.list = list; + } + + public void addDocument(Document document) { + this.list.add(document); + document.setAuthor(this); + } + } + + public static class Category { + private Owner owner; + private List list = new ArrayList(); + + @ConstructorProperties("owner") + public Category(Owner owner) { + this.owner = owner; + } + + public Owner getOwner() { + return this.owner; + } + + public List getList() { + return this.list; + } + + public void setList(List list) { + this.list = list; + } + + public void addDocument(Document document) { + this.list.add(document); + document.setCategory(this); + } + } + + public static class Document { + private Owner owner; + private Author author; + private Category category; + + @ConstructorProperties("owner") + public Document(Owner owner) { + this.owner = owner; + } + + public Owner getOwner() { + return this.owner; + } + + public Author getAuthor() { + return this.author; + } + + public void setAuthor(Author author) { + this.author = author; + } + + public Category getCategory() { + return this.category; + } + + public void setCategory(Category category) { + this.category = category; + } + } +} diff --git a/test/javax/swing/JEditorPane/6917744/bug6917744.java b/test/javax/swing/JEditorPane/6917744/bug6917744.java new file mode 100644 index 0000000000000000000000000000000000000000..553213d23fd6faaecb58194858384ef1a00ac6fc --- /dev/null +++ b/test/javax/swing/JEditorPane/6917744/bug6917744.java @@ -0,0 +1,113 @@ +/* + * 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 6917744 + * @summary JScrollPane Page Up/Down keys do not handle correctly html tables with different cells contents + * @author Pavel Porvatov + * @run main bug6917744 + */ + +import java.awt.*; +import java.awt.event.KeyEvent; +import java.io.IOException; +import javax.swing.*; + +import sun.awt.SunToolkit; + +public class bug6917744 { + private static JFrame frame; + + private static JEditorPane editorPane; + + private static JScrollPane scrollPane; + + private static Robot robot; + + public static void main(String[] args) throws Exception { + SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); + + robot = new Robot(); + robot.setAutoDelay(100); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame = new JFrame(); + + editorPane = new JEditorPane(); + + try { + editorPane.setPage(bug6917744.class.getResource("/test.html")); + } catch (IOException e) { + throw new RuntimeException("HTML resource not found", e); + } + + scrollPane = new JScrollPane(editorPane); + + frame.getContentPane().add(scrollPane); + frame.setSize(400, 300); + frame.setVisible(true); + } + }); + + toolkit.realSync(); + + for (int i = 0; i < 50; i++) { + robot.keyPress(KeyEvent.VK_PAGE_DOWN); + } + + toolkit.realSync(); + + // Check that we at the end of document + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel(); + + if (model.getValue() + model.getExtent() != model.getMaximum()) { + throw new RuntimeException("Invalid HTML position"); + } + } + }); + + toolkit.realSync(); + + for (int i = 0; i < 50; i++) { + robot.keyPress(KeyEvent.VK_PAGE_UP); + } + + toolkit.realSync(); + + // Check that we at the begin of document + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel(); + + if (model.getValue() != model.getMinimum()) { + throw new RuntimeException("Invalid HTML position"); + } + + frame.dispose(); + } + }); + } +} diff --git a/test/javax/swing/JEditorPane/6917744/test.html b/test/javax/swing/JEditorPane/6917744/test.html new file mode 100644 index 0000000000000000000000000000000000000000..7532c9e9e156c4b28dc2eb3b7c169aac894aceab --- /dev/null +++ b/test/javax/swing/JEditorPane/6917744/test.html @@ -0,0 +1,494 @@ + + + + + + + + +
  + + + TEST FOR JScrollPane BUG
+
+ +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+This is a test html file. +
+ + END OF TEST FOR JScrollPane BUG
+
+
+
 
+ + diff --git a/test/javax/swing/JScrollBar/6924059/bug6924059.java b/test/javax/swing/JScrollBar/6924059/bug6924059.java new file mode 100644 index 0000000000000000000000000000000000000000..11eb3e8f2075cd9cc66b1c49a959e3b283388cdd --- /dev/null +++ b/test/javax/swing/JScrollBar/6924059/bug6924059.java @@ -0,0 +1,56 @@ +/* + * 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 6924059 + * @summary SynthScrollBarUI.configureScrollBarColors() should have spec different from the overridden method + * @author Pavel Porvatov + * @run main bug6924059 + */ + +import javax.swing.*; +import javax.swing.plaf.synth.SynthLookAndFeel; +import javax.swing.plaf.synth.SynthScrollBarUI; + +public class bug6924059 { + private static boolean isMethodCalled; + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(new SynthLookAndFeel()); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + new JScrollBar().setUI(new SynthScrollBarUI() { + protected void configureScrollBarColors() { + super.configureScrollBarColors(); + isMethodCalled = true; + } + }); + + if (!isMethodCalled) { + throw new RuntimeException("The configureScrollBarColors was not called"); + } + } + }); + } +} diff --git a/test/javax/swing/JTable/6913768/bug6913768.java b/test/javax/swing/JTable/6913768/bug6913768.java new file mode 100644 index 0000000000000000000000000000000000000000..d7a6a6fa2e8eb874213b9ff75334c362abdaa0e6 --- /dev/null +++ b/test/javax/swing/JTable/6913768/bug6913768.java @@ -0,0 +1,53 @@ +/* + * 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 6913768 + * @summary With default SynthLookAndFeel instance installed new JTable creation leads to throwing NPE + * @author Pavel Porvatov + * @run main bug6913768 + */ + +import javax.swing.*; +import javax.swing.plaf.synth.SynthLookAndFeel; + +public class bug6913768 { + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel(new SynthLookAndFeel()); + + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + JFrame frame = new JFrame(); + + JTable table = new JTable(new Object[][]{{"1", "2"}, {"3", "4"}}, + new Object[]{"col1", "col2"}); + + frame.getContentPane().add(new JScrollPane(table)); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setSize(300, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + }); + } +}