Skip to content

Commit

Permalink
8017179: [macosx] list1 and list2 vistble item isn't desired
Browse files Browse the repository at this point in the history
Reviewed-by: kizune
  • Loading branch information
mrserb committed Oct 21, 2020
1 parent 2ee2b4a commit 9e9f5e6
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/java.desktop/macosx/classes/sun/lwawt/LWListPeer.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. 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
Expand All @@ -25,13 +25,30 @@

package sun.lwawt;

import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;
import java.awt.List;
import java.awt.Point;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.peer.ListPeer;
import java.util.Arrays;

import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JViewport;
import javax.swing.ListCellRenderer;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

/**
* Lightweight implementation of {@link ListPeer}. Delegates most of the work to
* the {@link JList}, which is placed inside {@link JScrollPane}.
Expand Down Expand Up @@ -65,6 +82,7 @@ ScrollableJList createDelegate() {
void initializeImpl() {
super.initializeImpl();
setMultipleMode(getTarget().isMultipleMode());
makeVisible(getTarget().getVisibleIndex());
final int[] selectedIndices = getTarget().getSelectedIndexes();
synchronized (getDelegateLock()) {
getDelegate().setSkipStateChangedEvent(true);
Expand Down

1 comment on commit 9e9f5e6

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 9e9f5e6 Oct 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.