org.eclipse.swt.widgets

## Class Tray

- java.lang.Object
- - org.eclipse.swt.widgets.Widget
  - - org.eclipse.swt.widgets.Tray

All Implemented Interfaces:
  Adaptable

    public class Tray
    extends Widget

Instances of this class represent the system tray that is part of the task bar status area on some operating systems.

Styles:
  (none)
Events:
  (none)

IMPORTANT: This class is not intended to be subclassed.

Since:
  1.4
See Also:
  `Display.getSystemTray()`

### Constructor Summary

Constructors
Constructor and Description
`Tray()`

### Method Summary

Methods
`TrayItem` `getItem(int index)` Returns the item at the given, zero-relative index in the receiver.
`int` `getItemCount()` Returns the number of items contained in the receiver.
`TrayItem[]` `getItems()` Returns an array of `TrayItem`s which are the items in the receiver.

### Methods inherited from class org.eclipse.swt.widgets.Widget

`addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getAdapter, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### Tray

    public Tray()

### Method Detail

#### getItem

    public TrayItem getItem(int index)

Returns the item at the given, zero-relative index in the receiver. Throws an exception if the index is out of range.

Parameters:
  `index` - the index of the item to return
Returns:
  the item at the given index
Throws:
  `java.lang.IllegalArgumentException` -
  - ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
  `SWTException` -
  - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
Since:
  1.4

#### getItemCount

    public int getItemCount()

Returns the number of items contained in the receiver.

Returns:
  the number of items
Throws:
  `SWTException` -
  - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
Since:
  1.4

#### getItems

    public TrayItem[] getItems()

Returns an array of `TrayItem`s which are the items in the receiver.

Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.

Returns:
  the items in the receiver
Throws:
  `SWTException` -
  - ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
Since:
  1.4

Copyright (c) EclipseSource and others 2002, 2017. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0