Beispiel #1
0
 /**
  * Constructs a new instance of this class given its parent (which must be a <code>ToolBar</code>
  * ), a style value describing its behavior and appearance, and the index at which to place it in
  * the items maintained by its parent.
  *
  * <p>The style value is either one of the style constants defined in class <code>SWT</code> which
  * is applicable to instances of this class, or must be built by <em>bitwise OR</em>'ing together
  * (that is, using the <code>int</code> "|" operator) two or more of those <code>SWT</code> style
  * constants. The class description lists the style constants that are applicable to the class.
  * Style bits are also inherited from superclasses.
  *
  * @param parent a composite control which will be the parent of the new instance (cannot be null)
  * @param style the style of control to construct
  * @param index the zero-relative index to store the receiver in its parent
  * @exception IllegalArgumentException
  *     <ul>
  *       <li>ERROR_NULL_ARGUMENT - if the parent is null
  *       <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the
  *           parent (inclusive)
  *     </ul>
  *
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  *       <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  *     </ul>
  *
  * @see SWT#PUSH
  * @see SWT#CHECK
  * @see SWT#RADIO
  * @see SWT#SEPARATOR
  * @see SWT#DROP_DOWN
  * @see Widget#checkSubclass
  * @see Widget#getStyle
  */
 public ToolItem(ToolBar parent, int style, int index) {
   super(parent, checkStyle(style));
   this.parent = parent;
   int count = parent.getItemCount();
   if (!(0 <= index && index <= count)) {
     error(SWT.ERROR_INVALID_RANGE);
   }
   createWidget(index);
 }
Beispiel #2
0
 /**
  * Constructs a new instance of this class given its parent (which must be a <code>ToolBar</code>)
  * and a style value describing its behavior and appearance. The item is added to the end of the
  * items maintained by its parent.
  *
  * <p>The style value is either one of the style constants defined in class <code>SWT</code> which
  * is applicable to instances of this class, or must be built by <em>bitwise OR</em>'ing together
  * (that is, using the <code>int</code> "|" operator) two or more of those <code>SWT</code> style
  * constants. The class description lists the style constants that are applicable to the class.
  * Style bits are also inherited from superclasses.
  *
  * @param parent a composite control which will be the parent of the new instance (cannot be null)
  * @param style the style of control to construct
  * @exception IllegalArgumentException
  *     <ul>
  *       <li>ERROR_NULL_ARGUMENT - if the parent is null
  *     </ul>
  *
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  *       <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  *     </ul>
  *
  * @see SWT#PUSH
  * @see SWT#CHECK
  * @see SWT#RADIO
  * @see SWT#SEPARATOR
  * @see SWT#DROP_DOWN
  * @see Widget#checkSubclass
  * @see Widget#getStyle
  */
 public ToolItem(ToolBar parent, int style) {
   super(parent, checkStyle(style));
   this.parent = parent;
   createWidget(parent.getItemCount());
 }