1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
2639
2640 /* If the JList.selectionModel property changes, remove our listener,
2641 * listSelectionListener from the old selectionModel and add it to the new one.
2642 */
2643 else if (propertyName == "selectionModel") {
2644 ListSelectionModel oldModel = (ListSelectionModel)e.getOldValue();
2645 ListSelectionModel newModel = (ListSelectionModel)e.getNewValue();
2646 if (oldModel != null) {
2647 oldModel.removeListSelectionListener(listSelectionListener);
2648 }
2649 if (newModel != null) {
2650 newModel.addListSelectionListener(listSelectionListener);
2651 }
2652 updateLayoutStateNeeded |= modelChanged;
2653 redrawList();
2654 }
2655 else if (propertyName == "cellRenderer") {
2656 updateLayoutStateNeeded |= cellRendererChanged;
2657 redrawList();
2658 }
2659 else if (propertyName == "font") {
2660 updateLayoutStateNeeded |= fontChanged;
2661 redrawList();
2662 }
2663 else if (propertyName == "prototypeCellValue") {
2664 updateLayoutStateNeeded |= prototypeCellValueChanged;
2665 redrawList();
2666 }
2667 else if (propertyName == "fixedCellHeight") {
2668 updateLayoutStateNeeded |= fixedCellHeightChanged;
2669 redrawList();
2670 }
2671 else if (propertyName == "fixedCellWidth") {
2672 updateLayoutStateNeeded |= fixedCellWidthChanged;
2673 redrawList();
2674 }
2675 else if (propertyName == "selectionForeground") {
2676 list.repaint();
2677 }
2678 else if (propertyName == "selectionBackground") {
2679 list.repaint();
|
1 /*
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
2639
2640 /* If the JList.selectionModel property changes, remove our listener,
2641 * listSelectionListener from the old selectionModel and add it to the new one.
2642 */
2643 else if (propertyName == "selectionModel") {
2644 ListSelectionModel oldModel = (ListSelectionModel)e.getOldValue();
2645 ListSelectionModel newModel = (ListSelectionModel)e.getNewValue();
2646 if (oldModel != null) {
2647 oldModel.removeListSelectionListener(listSelectionListener);
2648 }
2649 if (newModel != null) {
2650 newModel.addListSelectionListener(listSelectionListener);
2651 }
2652 updateLayoutStateNeeded |= modelChanged;
2653 redrawList();
2654 }
2655 else if (propertyName == "cellRenderer") {
2656 updateLayoutStateNeeded |= cellRendererChanged;
2657 redrawList();
2658 }
2659 else if (propertyName == "font"
2660 || propertyName == "graphicsConfiguration") {
2661 updateLayoutStateNeeded |= fontChanged;
2662 redrawList();
2663 }
2664 else if (propertyName == "prototypeCellValue") {
2665 updateLayoutStateNeeded |= prototypeCellValueChanged;
2666 redrawList();
2667 }
2668 else if (propertyName == "fixedCellHeight") {
2669 updateLayoutStateNeeded |= fixedCellHeightChanged;
2670 redrawList();
2671 }
2672 else if (propertyName == "fixedCellWidth") {
2673 updateLayoutStateNeeded |= fixedCellWidthChanged;
2674 redrawList();
2675 }
2676 else if (propertyName == "selectionForeground") {
2677 list.repaint();
2678 }
2679 else if (propertyName == "selectionBackground") {
2680 list.repaint();
|