< prev index next >

src/java.desktop/windows/classes/sun/awt/windows/WListPeer.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1996, 2014, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1996, 2015, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 37,50 **** } // ListPeer implementation @Override - @SuppressWarnings("deprecation") public int[] getSelectedIndexes() { List l = (List)target; ! int len = l.countItems(); int sel[] = new int[len]; int nsel = 0; for (int i = 0 ; i < len ; i++) { if (isSelected(i)) { sel[nsel++] = i; --- 37,49 ---- } // ListPeer implementation @Override public int[] getSelectedIndexes() { List l = (List)target; ! int len = l.getItemCount(); int sel[] = new int[len]; int nsel = 0; for (int i = 0 ; i < len ; i++) { if (isSelected(i)) { sel[nsel++] = i;
*** 91,104 **** } native void addItems(String[] items, int index, int width); @Override public native void delItems(int start, int end); - @SuppressWarnings("deprecation") public void clear() { List l = (List)target; ! delItems(0, l.countItems()); } @Override public native void select(int index); @Override public native void deselect(int index); --- 90,102 ---- } native void addItems(String[] items, int index, int width); @Override public native void delItems(int start, int end); public void clear() { List l = (List)target; ! delItems(0, l.getItemCount()); } @Override public native void select(int index); @Override public native void deselect(int index);
*** 129,139 **** @Override native void create(WComponentPeer parent); @Override - @SuppressWarnings("deprecation") void initialize() { List li = (List)target; fm = getFontMetrics( li.getFont() ); --- 127,136 ----
*** 142,152 **** if (f != null) { setFont(f); } // add any items that were already inserted in the target. ! int nitems = li.countItems(); if (nitems > 0) { String[] items = new String[nitems]; int maxWidth = 0; int width = 0; for (int i = 0; i < nitems; i++) { --- 139,149 ---- if (f != null) { setFont(f); } // add any items that were already inserted in the target. ! int nitems = li.getItemCount(); if (nitems > 0) { String[] items = new String[nitems]; int maxWidth = 0; int width = 0; for (int i = 0; i < nitems; i++) {
*** 158,168 **** } addItems(items, 0, maxWidth); } // set whether this list should allow multiple selections. ! setMultipleSelections(li.allowsMultipleSelections()); // select the item if necessary. int sel[] = li.getSelectedIndexes(); for (int i = 0 ; i < sel.length ; i++) { select(sel[i]); --- 155,165 ---- } addItems(items, 0, maxWidth); } // set whether this list should allow multiple selections. ! setMultipleSelections(li.isMultipleMode()); // select the item if necessary. int sel[] = li.getSelectedIndexes(); for (int i = 0 ; i < sel.length ; i++) { select(sel[i]);
< prev index next >