|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
25 | 25 |
|
26 | 26 | package sun.lwawt;
|
27 | 27 |
|
28 |
| -import javax.swing.*; |
29 |
| -import javax.swing.event.*; |
30 |
| -import java.awt.*; |
31 |
| -import java.awt.event.*; |
| 28 | +import java.awt.Component; |
| 29 | +import java.awt.Dimension; |
| 30 | +import java.awt.Font; |
| 31 | +import java.awt.Insets; |
| 32 | +import java.awt.List; |
| 33 | +import java.awt.Point; |
| 34 | +import java.awt.SystemColor; |
| 35 | +import java.awt.event.ActionEvent; |
| 36 | +import java.awt.event.ItemEvent; |
| 37 | +import java.awt.event.KeyEvent; |
| 38 | +import java.awt.event.MouseEvent; |
32 | 39 | import java.awt.peer.ListPeer;
|
33 | 40 | import java.util.Arrays;
|
34 | 41 |
|
| 42 | +import javax.swing.DefaultListModel; |
| 43 | +import javax.swing.JList; |
| 44 | +import javax.swing.JScrollBar; |
| 45 | +import javax.swing.JScrollPane; |
| 46 | +import javax.swing.JViewport; |
| 47 | +import javax.swing.ListCellRenderer; |
| 48 | +import javax.swing.ListSelectionModel; |
| 49 | +import javax.swing.event.ListSelectionEvent; |
| 50 | +import javax.swing.event.ListSelectionListener; |
| 51 | + |
35 | 52 | /**
|
36 | 53 | * Lightweight implementation of {@link ListPeer}. Delegates most of the work to
|
37 | 54 | * the {@link JList}, which is placed inside {@link JScrollPane}.
|
@@ -65,6 +82,7 @@ ScrollableJList createDelegate() {
|
65 | 82 | void initializeImpl() {
|
66 | 83 | super.initializeImpl();
|
67 | 84 | setMultipleMode(getTarget().isMultipleMode());
|
| 85 | + makeVisible(getTarget().getVisibleIndex()); |
68 | 86 | final int[] selectedIndices = getTarget().getSelectedIndexes();
|
69 | 87 | synchronized (getDelegateLock()) {
|
70 | 88 | getDelegate().setSkipStateChangedEvent(true);
|
|
0 commit comments