# HG changeset patch # User lana # Date 1311831739 25200 # Node ID f216403b828d0fbd264bbb8acdbde15258c9a5c7 # Parent e1bbe4597795637322993ab7fea1a91791dfb407# Parent c525c5fbb86c2c5afde49d8dac9667806716fc33 Merge diff -r e1bbe4597795 -r f216403b828d jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java Tue Jul 26 21:34:25 2011 +0200 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java Wed Jul 27 22:42:19 2011 -0700 @@ -49,11 +49,11 @@ private FilterComboBoxModel filterComboBoxModel; - protected JList directoryList = null; - protected JList fileList = null; + protected JList directoryList = null; + protected JList fileList = null; protected JTextField pathField = null; - protected JComboBox filterComboBox = null; + protected JComboBox filterComboBox = null; protected JTextField filenameTextField = null; private static final Dimension hstrut10 = new Dimension(10, 1); @@ -337,7 +337,7 @@ align(l); leftPanel.add(l); - filterComboBox = new JComboBox() { + filterComboBox = new JComboBox() { public Dimension getMaximumSize() { Dimension d = super.getMaximumSize(); d.height = getPreferredSize().height; @@ -557,7 +557,7 @@ } protected JScrollPane createFilesList() { - fileList = new JList(); + fileList = new JList(); if(getFileChooser().isMultiSelectionEnabled()) { fileList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); @@ -576,7 +576,7 @@ if (SwingUtilities.isLeftMouseButton(e) && !chooser.isMultiSelectionEnabled()) { int index = SwingUtilities2.loc2IndexFileList(fileList, e.getPoint()); if (index >= 0) { - File file = (File) fileList.getModel().getElementAt(index); + File file = fileList.getModel().getElementAt(index); setFileName(chooser.getName(file)); } } @@ -593,7 +593,7 @@ } protected JScrollPane createDirectoryList() { - directoryList = new JList(); + directoryList = new JList(); align(directoryList); directoryList.setCellRenderer(new DirectoryCellRenderer()); @@ -658,7 +658,7 @@ } } - protected class MotifDirectoryListModel extends AbstractListModel implements ListDataListener { + protected class MotifDirectoryListModel extends AbstractListModel implements ListDataListener { public MotifDirectoryListModel() { getModel().addListDataListener(this); } @@ -667,7 +667,7 @@ return getModel().getDirectories().size(); } - public Object getElementAt(int index) { + public File getElementAt(int index) { return getModel().getDirectories().elementAt(index); } @@ -694,7 +694,7 @@ } - protected class MotifFileListModel extends AbstractListModel implements ListDataListener { + protected class MotifFileListModel extends AbstractListModel implements ListDataListener { public MotifFileListModel() { getModel().addListDataListener(this); } @@ -711,7 +711,7 @@ return getModel().getFiles().indexOf(o); } - public Object getElementAt(int index) { + public File getElementAt(int index) { return getModel().getFiles().elementAt(index); } @@ -773,7 +773,8 @@ /** * Data model for a type-face selection combo-box. */ - protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, PropertyChangeListener { + protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, + PropertyChangeListener { protected FileFilter[] filters; protected FilterComboBoxModel() { super(); @@ -826,7 +827,7 @@ } } - public Object getElementAt(int index) { + public FileFilter getElementAt(int index) { if(index > getSize() - 1) { // This shouldn't happen. Try to recover gracefully. return getFileChooser().getFileFilter(); diff -r e1bbe4597795 -r f216403b828d jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java Tue Jul 26 21:34:25 2011 +0200 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java Wed Jul 27 22:42:19 2011 -0700 @@ -60,7 +60,7 @@ private JPanel centerPanel; private JLabel lookInLabel; - private JComboBox directoryComboBox; + private JComboBox directoryComboBox; private DirectoryComboBoxModel directoryComboBoxModel; private ActionListener directoryComboBoxAction = new DirectoryComboBoxAction(); @@ -76,7 +76,7 @@ private JPanel buttonPanel; private JPanel bottomPanel; - private JComboBox filterComboBox; + private JComboBox filterComboBox; private static final Dimension hstrut10 = new Dimension(10, 1); @@ -245,7 +245,7 @@ topPanel.add(Box.createRigidArea(new Dimension(8,0))); // CurrentDir ComboBox - directoryComboBox = new JComboBox() { + directoryComboBox = new JComboBox() { public Dimension getMinimumSize() { Dimension d = super.getMinimumSize(); d.width = 60; @@ -445,7 +445,7 @@ filterComboBoxModel = createFilterComboBoxModel(); fc.addPropertyChangeListener(filterComboBoxModel); - filterComboBox = new JComboBox(filterComboBoxModel); + filterComboBox = new JComboBox(filterComboBoxModel); ftl.setLabelFor(filterComboBox); filterComboBox.setRenderer(createFilterComboBoxRenderer()); fileAndFilterPanel.add(filterComboBox); @@ -1032,7 +1032,7 @@ /** * Data model for a type-face selection combo-box. */ - protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel { + protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel { Vector directories = new Vector(); int[] depths = null; File selectedDirectory = null; @@ -1149,7 +1149,7 @@ return directories.size(); } - public Object getElementAt(int index) { + public File getElementAt(int index) { return directories.elementAt(index); } } @@ -1189,7 +1189,8 @@ /** * Data model for a type-face selection combo-box. */ - protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, PropertyChangeListener { + protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, + PropertyChangeListener { protected FileFilter[] filters; protected FilterComboBoxModel() { super(); @@ -1242,7 +1243,7 @@ } } - public Object getElementAt(int index) { + public FileFilter getElementAt(int index) { if(index > getSize() - 1) { // This shouldn't happen. Try to recover gracefully. return getFileChooser().getFileFilter(); diff -r e1bbe4597795 -r f216403b828d jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTreeUI.java --- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTreeUI.java Tue Jul 26 21:34:25 2011 +0200 +++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTreeUI.java Wed Jul 27 22:42:19 2011 -0700 @@ -81,19 +81,22 @@ else { Rectangle beginRect = getPathBounds(tree, getPathForRow (tree, beginRow)); - Rectangle testRect = beginRect; - int beginY = beginRect.y; - int maxY = beginY + visRect.height; + if (beginRect != null) { + Rectangle testRect = beginRect; + int beginY = beginRect.y; + int maxY = beginY + visRect.height; - for(int counter = beginRow + 1; counter <= endRow; counter++) { - testRect = getPathBounds(tree, - getPathForRow(tree, counter)); - if((testRect.y + testRect.height) > maxY) - counter = endRow; + for(int counter = beginRow + 1; counter <= endRow; counter++) { + testRect = getPathBounds(tree, + getPathForRow(tree, counter)); + if(testRect != null && (testRect.y + testRect.height) > maxY) { + counter = endRow; + } + } + tree.scrollRectToVisible(new Rectangle(visRect.x, beginY, 1, + testRect.y + testRect.height- + beginY)); } - tree.scrollRectToVisible(new Rectangle(visRect.x, beginY, 1, - testRect.y + testRect.height- - beginY)); } } } diff -r e1bbe4597795 -r f216403b828d jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java --- a/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java Tue Jul 26 21:34:25 2011 +0200 +++ b/jdk/src/share/classes/java/awt/ScrollPaneAdjustable.java Wed Jul 27 22:42:19 2011 -0700 @@ -24,6 +24,8 @@ */ package java.awt; +import sun.awt.AWTAccessor; + import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.peer.ScrollPanePeer; @@ -156,6 +158,12 @@ if (!GraphicsEnvironment.isHeadless()) { initIDs(); } + AWTAccessor.setScrollPaneAdjustableAccessor(new AWTAccessor.ScrollPaneAdjustableAccessor() { + public void setTypedValue(final ScrollPaneAdjustable adj, + final int v, final int type) { + adj.setTypedValue(v, type); + } + }); } /** diff -r e1bbe4597795 -r f216403b828d jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java Tue Jul 26 21:34:25 2011 +0200 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboPopup.java Wed Jul 27 22:42:19 2011 -0700 @@ -63,8 +63,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup { // An empty ListMode, this is used when the UI changes to allow // the JList to be gc'ed. - private static class EmptyListModelClass implements ListModel, - Serializable { + private static class EmptyListModelClass implements ListModel, Serializable { public int getSize() { return 0; } public Object getElementAt(int index) { return null; } public void addListDataListener(ListDataListener l) {} diff -r e1bbe4597795 -r f216403b828d jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java --- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java Tue Jul 26 21:34:25 2011 +0200 +++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java Wed Jul 27 22:42:19 2011 -0700 @@ -810,10 +810,7 @@ putValue(Action.ACTION_COMMAND_KEY, FilePane.ACTION_CHANGE_TO_PARENT_DIRECTORY); } public void actionPerformed(ActionEvent e) { - Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); - if (focusOwner == null || !(focusOwner instanceof javax.swing.text.JTextComponent)) { - getFileChooser().changeToParentDirectory(); - } + getFileChooser().changeToParentDirectory(); } } diff -r e1bbe4597795 -r f216403b828d jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java --- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java Tue Jul 26 21:34:25 2011 +0200 +++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java Wed Jul 27 22:42:19 2011 -0700 @@ -444,7 +444,7 @@ * renderer installed on a Synth combo box is a JLabel. If this is changed, * then an assert will fail in SynthFileChooserUIImpl */ - private class SynthComboBoxRenderer extends JLabel implements ListCellRenderer, UIResource { + private class SynthComboBoxRenderer extends JLabel implements ListCellRenderer, UIResource { public SynthComboBoxRenderer() { super(); setName("ComboBox.renderer"); @@ -452,7 +452,7 @@ } @Override - public Component getListCellRendererComponent(JList list, Object value, + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { setName("ComboBox.listRenderer"); SynthLookAndFeel.resetSelectedUI(); diff -r e1bbe4597795 -r f216403b828d jdk/src/share/classes/javax/swing/text/html/FormView.java --- a/jdk/src/share/classes/javax/swing/text/html/FormView.java Tue Jul 26 21:34:25 2011 +0200 +++ b/jdk/src/share/classes/javax/swing/text/html/FormView.java Wed Jul 27 22:42:19 2011 -0700 @@ -725,11 +725,11 @@ } Object m = attr.getAttribute(StyleConstants.ModelAttribute); if (m instanceof OptionListModel) { - OptionListModel model = (OptionListModel)m; + OptionListModel