Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 11 java.desktop.jmod - Desktop Module
JDK 11 java.desktop.jmod is the JMOD file for JDK 11 Desktop module.
JDK 11 Desktop module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\java.desktop.jmod.
JDK 11 Desktop module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Desktop module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\java.desktop.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ javax/swing/DefaultComboBoxModel.java
/*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javax.swing;
import java.util.Collection;
import java.util.Vector;
import java.io.Serializable;
/**
* The default model for combo boxes.
*
* @param <E> the type of the elements of this model
*
* @author Arnaud Weber
* @author Tom Santos
* @since 1.2
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public class DefaultComboBoxModel<E> extends AbstractListModel<E> implements MutableComboBoxModel<E>, Serializable {
Vector<E> objects;
Object selectedObject;
/**
* Constructs an empty DefaultComboBoxModel object.
*/
public DefaultComboBoxModel() {
objects = new Vector<E>();
}
/**
* Constructs a DefaultComboBoxModel object initialized with
* an array of objects.
*
* @param items an array of Object objects
*/
public DefaultComboBoxModel(final E items[]) {
objects = new Vector<E>(items.length);
int i,c;
for ( i=0,c=items.length;i<c;i++ )
objects.addElement(items[i]);
if ( getSize() > 0 ) {
selectedObject = getElementAt( 0 );
}
}
/**
* Constructs a DefaultComboBoxModel object initialized with
* a vector.
*
* @param v a Vector object ...
*/
public DefaultComboBoxModel(Vector<E> v) {
objects = v;
if ( getSize() > 0 ) {
selectedObject = getElementAt( 0 );
}
}
// implements javax.swing.ComboBoxModel
/**
* Set the value of the selected item. The selected item may be null.
*
* @param anObject The combo box value or null for no selection.
*/
public void setSelectedItem(Object anObject) {
if ((selectedObject != null && !selectedObject.equals( anObject )) ||
selectedObject == null && anObject != null) {
selectedObject = anObject;
fireContentsChanged(this, -1, -1);
}
}
// implements javax.swing.ComboBoxModel
public Object getSelectedItem() {
return selectedObject;
}
// implements javax.swing.ListModel
public int getSize() {
return objects.size();
}
// implements javax.swing.ListModel
public E getElementAt(int index) {
if ( index >= 0 && index < objects.size() )
return objects.elementAt(index);
else
return null;
}
/**
* Returns the index-position of the specified object in the list.
*
* @param anObject the object to return the index of
* @return an int representing the index position, where 0 is
* the first position
*/
public int getIndexOf(Object anObject) {
return objects.indexOf(anObject);
}
// implements javax.swing.MutableComboBoxModel
public void addElement(E anObject) {
objects.addElement(anObject);
fireIntervalAdded(this,objects.size()-1, objects.size()-1);
if ( objects.size() == 1 && selectedObject == null && anObject != null ) {
setSelectedItem( anObject );
}
}
// implements javax.swing.MutableComboBoxModel
public void insertElementAt(E anObject,int index) {
objects.insertElementAt(anObject,index);
fireIntervalAdded(this, index, index);
}
// implements javax.swing.MutableComboBoxModel
public void removeElementAt(int index) {
if ( getElementAt( index ) == selectedObject ) {
if ( index == 0 ) {
setSelectedItem( getSize() == 1 ? null : getElementAt( index + 1 ) );
}
else {
setSelectedItem( getElementAt( index - 1 ) );
}
}
objects.removeElementAt(index);
fireIntervalRemoved(this, index, index);
}
// implements javax.swing.MutableComboBoxModel
public void removeElement(Object anObject) {
int index = objects.indexOf(anObject);
if ( index != -1 ) {
removeElementAt(index);
}
}
/**
* Empties the list.
*/
public void removeAllElements() {
if ( objects.size() > 0 ) {
int firstIndex = 0;
int lastIndex = objects.size() - 1;
objects.removeAllElements();
selectedObject = null;
fireIntervalRemoved(this, firstIndex, lastIndex);
} else {
selectedObject = null;
}
}
/**
* Adds all of the elements present in the collection.
*
* @param c the collection which contains the elements to add
* @throws NullPointerException if {@code c} is null
*/
public void addAll(Collection<? extends E> c) {
if (c.isEmpty()) {
return;
}
int startIndex = getSize();
objects.addAll(c);
fireIntervalAdded(this, startIndex, getSize() - 1);
}
/**
* Adds all of the elements present in the collection, starting
* from the specified index.
*
* @param index index at which to insert the first element from the
* specified collection
* @param c the collection which contains the elements to add
* @throws ArrayIndexOutOfBoundsException if {@code index} does not
* fall within the range of number of elements currently held
* @throws NullPointerException if {@code c} is null
*/
public void addAll(int index, Collection<? extends E> c) {
if (index < 0 || index > getSize()) {
throw new ArrayIndexOutOfBoundsException("index out of range: " +
index);
}
if (c.isEmpty()) {
return;
}
objects.addAll(index, c);
fireIntervalAdded(this, index, index + c.size() - 1);
}
}
⏎ javax/swing/DefaultComboBoxModel.java
Or download all of them as a single archive file:
File name: java.desktop-11.0.1-src.zip File size: 7974380 bytes Release date: 2018-11-04 Download
⇒ JDK 11 java.instrument.jmod - Instrument Module
2022-08-06, ≈886🔥, 5💬
Popular Posts:
How to compare performances of various XML parsers with the jaxp\SourceValidator.jav aprovided in th...
Old version of xml-apis.jar. JAR File Size and Download Location: File name: xmlParserAPIs.jar File ...
commons-net-1.4.1.jar is the JAR file for Apache Commons Net 1.4.1, which implements the client side...
How to download and install JDK (Java Development Kit) 1.3? If you want to write Java applications, ...
How to download and install ojdbc6.jar for Oracle 11g R2? ojdbc6.jar for Oracle 11g R2 is a Java 6, ...