Java Code Examples for org.eclipse.swt.SWT#ARROW

The following examples show how to use org.eclipse.swt.SWT#ARROW . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: nebula   File: PGroupToolItem.java    License: Eclipse Public License 2.0 6 votes vote down vote up
void onMouseDown(Event e) {
	if ((getStyle() & SWT.DROP_DOWN) == 0) {
		setSelection(!getSelection());
		notifyListeners(SWT.Selection, new Event());
	} else {
		if ( ((getStyle() & SWT.PUSH) == SWT.PUSH) && ( dropdownArea == null || !dropdownArea.contains(e.x, e.y))) {
			notifyListeners(SWT.Selection, new Event());
		} else {
			Event event = new Event();
			event.detail = SWT.ARROW;
			event.x = bounds.x;
			event.y = bounds.y + bounds.height;
			notifyListeners(SWT.Selection, event);
		}
	}
}
 
Example 2
/**
 * This function should only make the Menu visible if necessary. Nothing
 * inside the Menu will be changed.
 */
@Override
public void handleEvent(Event event) {
	// We want to align the menu with the bottom-left corner of the ToolItem
	// arrow.

	// event.detail == SWT.ARROW means the arrow has been clicked.
	// event.detail == SWT.NONE means the button has been clicked.
	if (event.detail == SWT.ARROW || event.detail == SWT.NONE) {
		Rectangle r = toolItem.getBounds();
		Point p = new Point(r.x, r.y + r.height);
		p = toolItem.getParent().toDisplay(p.x, p.y);
		menu.setLocation(p.x, p.y);
		menu.setVisible(true);
	}

	return;
}
 
Example 3
/**
 * Create the content of the widget
 *
 * @param style style of the widget
 */
private void createContent(final int style) {
	final boolean readOnly = (style & SWT.READ_ONLY) == SWT.READ_ONLY;
	final boolean flat = (style & SWT.FLAT) == SWT.FLAT;
	final int buttonStyle = SWT.ARROW | (flat ? SWT.FLAT : SWT.NONE);

	if (alignment == ALIGNMENT.BOTH) {
		createMinusButton(buttonStyle);
		createText(readOnly);
		createPlusButton(buttonStyle);
	} else if (alignment == ALIGNMENT.LEFT) {
		createMinusButton(buttonStyle);
		createPlusButton(buttonStyle);
		createText(readOnly);
	} else {
		createText(readOnly);
		createMinusButton(buttonStyle);
		createPlusButton(buttonStyle);
	}
}
 
Example 4
Source Project: ADT_Frontend   File: AbapGitStagingView.java    License: MIT License 6 votes vote down vote up
/**
 * Action for switching a repository
 */
private void createRepositorySelectionToolbarAction() {
	this.actionSwitchRepository = new Action(Messages.AbapGitStaging_switch_repository, SWT.DROP_DOWN) {
		@Override
		public void runWithEvent(Event event) {
			Widget widget = event.widget;
			if (widget instanceof ToolItem) {
				ToolItem item = (ToolItem) widget;
				Rectangle bounds = item.getBounds();
				event.detail = SWT.ARROW;
				event.x = bounds.x;
				event.y = bounds.y + bounds.height;
				item.notifyListeners(SWT.Selection, event);
			}
		}
	};
	this.actionSwitchRepository
			.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(AbapGitUIPlugin.PLUGIN_ID, "icons/obj/repository.png")); //$NON-NLS-1$
	this.actionSwitchRepository.setMenuCreator(new SwitchRepositoryMenuCreator(this, this.stagingUtil));
}
 
Example 5
Source Project: Rel   File: SorterPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void addRow(SorterPanel.SortedAttribute attribute, int rowNum, boolean last) {
	Label lblNewLabel = new Label(this, SWT.NONE);
	lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	lblNewLabel.setText(attribute.getName());
	labelAttributes.add(lblNewLabel);

	SortOrderPicker ordering = new SortOrderPicker(this, SWT.NONE);
	ordering.setState(attribute.getSort());
	orderAttributes.add(ordering);

	Composite buttonPanel = new Composite(this, SWT.NONE);
	buttonPanel.setLayout(new FillLayout(SWT.HORIZONTAL));
	Button btnUp = new Button(buttonPanel, SWT.ARROW | SWT.UP | SWT.ARROW_UP);
	btnUp.addListener(SWT.Selection, e -> moveAttributeRow(rowNum, rowNum - 1));
	btnUp.setVisible(!(rowNum == 0));
	btnUp.setToolTipText("Move up; increase sort priority.");
	
	Button btnDown = new Button(buttonPanel, SWT.ARROW | SWT.DOWN | SWT.ARROW_DOWN);
	btnDown.addListener(SWT.Selection, e -> moveAttributeRow(rowNum, rowNum + 1));
	btnDown.setVisible(!last);
	btnDown.setToolTipText("Move down; decrease sort priority.");
}
 
Example 6
Source Project: birt   File: SpinnerYear.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private void initComponents( )
{
	up = new Button( this, SWT.ARROW | SWT.UP );
	down = new Button( this, SWT.ARROW | SWT.DOWN );
	text = new SpinnerText( this, SWT.NONE );
	label = new Label( this, SWT.NONE );

	label.setBackground( Display.getCurrent( )
			.getSystemColor( SWT.COLOR_WHITE ) );
	//		Font font = new Font( Display.getCurrent( ), "Dialog", 12, SWT.BOLD
	// ); //$NON-NLS-1$
	//		text.setFont( font );
	text.setFont( FontManager.getFont( "Dialog", 12, SWT.BOLD ) ); //$NON-NLS-1$

	text.setTextLimit( 5 );

}
 
Example 7
private void createNavBar() {
	GridLayout gridLayout = new GridLayout();
	gridLayout.numColumns = 3;
	GridData gridData1 = new org.eclipse.swt.layout.GridData();
	gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.CENTER;
	gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER;
	navBar = new Composite(sShell, SWT.NONE);
	navBar.setLayoutData(gridData1);
	navBar.setLayout(gridLayout);
	left = new Button(navBar, SWT.LEFT | SWT.ARROW);
	left.addSelectionListener(previous);
	startDateLabel = new Label(navBar, SWT.NONE);
	right = new Button(navBar, SWT.RIGHT | SWT.ARROW);
	right.addSelectionListener(next);
}
 
Example 8
Source Project: nebula   File: DateChooser.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates the header of the calendar. The header contains the label
 * displaying the current month and year, and the two buttons for navigation :
 * previous and next month.
 */
private void createHeader() {
	monthPanel = new Composite(this, SWT.NONE);
	GridLayoutFactory.fillDefaults().numColumns(3).spacing(HEADER_SPACING, 0).margins(HEADER_SPACING, 2).applyTo(monthPanel);
	GridDataFactory.fillDefaults().applyTo(monthPanel);
	monthPanel.addListener(SWT.MouseDown, listener);

	prevMonth = new Button(monthPanel, SWT.ARROW | SWT.LEFT | SWT.FLAT);
	prevMonth.addListener(SWT.MouseUp, listener);
	prevMonth.addListener(SWT.FocusIn, listener);

	currentMonth = new Label(monthPanel, SWT.CENTER);
	currentMonth.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	currentMonth.addListener(SWT.MouseDown, listener);

	nextMonth = new Button(monthPanel, SWT.ARROW | SWT.RIGHT | SWT.FLAT);
	nextMonth.addListener(SWT.MouseUp, listener);
	nextMonth.addListener(SWT.FocusIn, listener);

	monthsMenu = new Menu(getShell(), SWT.POP_UP);
	currentMonth.setMenu(monthsMenu);
	for (int i = 0; i < 12; i++) {
		final MenuItem item = new MenuItem(monthsMenu, SWT.PUSH);
		item.addListener(SWT.Selection, listener);
		item.setData(new Integer(i));
	}
	monthsMenu.addListener(SWT.Show, listener);
}
 
Example 9
Source Project: nebula   File: VControl.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Javadoc out of date // TODO: update javadoc
 * @param panel
 * @param style
 */
public VControl(VPanel panel, int style) {
	setParent(panel);

	this.style = style;
	bounds = new Rectangle(0, 0, 0, 0);

	if((style & SWT.OK) != 0) {
		setPolygon(Points_OK);
		setForeground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GREEN));
	} else if((style & SWT.CANCEL) != 0) {
		setPolygon(Points_Cancel);
		setForeground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_RED));
	} else if((style & SWT.ARROW) != 0) {
		if((style & SWT.DOWN) != 0) {
			setPolygon(Points_Down);
		} else if((style & SWT.LEFT) != 0) {
			setPolygon(Points_Left);
		} else if((style & SWT.RIGHT) != 0) {
			setPolygon(Points_Right);
		} else if((style & SWT.UP) != 0) {
			setPolygon(Points_Up);
		}
	} else if((style & SWT.UP) != 0) {
		setPolygon(Points_Add);
	} else if((style & SWT.DOWN) != 0) {
		setPolygon(Points_Subtract);
	}

	if(foreground == null) {
		setForeground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
	}
	if(fill == null) {
		setFill(getForeground());
	}
}
 
Example 10
Source Project: nebula   File: CDatePanel.java    License: Eclipse Public License 2.0 5 votes vote down vote up
private void createHeader() {
	header = new VPanel(panel, SWT.NONE);
	VGridLayout layout = new VGridLayout(3, true);
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	header.setLayout(layout);
	header.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));

	VButton b = new VButton(header, SWT.ARROW | SWT.LEFT | SWT.NO_FOCUS);
	b.setFill(getDisplay().getSystemColor(SWT.COLOR_GRAY));
	b.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
	b.addListener(SWT.Selection, event -> {
		calendar.add(Calendar.MONTH, -1);
		updateMonths();
	});

	b = new VButton(header, SWT.PUSH | SWT.NO_FOCUS);
	b.setText("Today");
	b.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	b.addListener(SWT.Selection, event -> {
		calendar.setTimeInMillis(System.currentTimeMillis());
		updateMonths();
	});

	b = new VButton(header, SWT.ARROW | SWT.RIGHT | SWT.NO_FOCUS);
	b.setFill(getDisplay().getSystemColor(SWT.COLOR_GRAY));
	b.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
	b.addListener(SWT.Selection, event -> {
		calendar.add(Calendar.MONTH, 1);
		updateMonths();
	});

	headerSize = header.computeSize(-1, -1).y;
}
 
Example 11
public void onSelect(SelectionEvent event) {
	if( event.detail == SWT.ARROW ) {
		this.openMenu();
	} else {
		this.selectionListener.widgetSelected(event);
	}
}
 
Example 12
@Override
public void widgetSelected(final SelectionEvent e) {
	switch (code) {
		case REVERT:
			modifyAndDisplayValue(applyRevert());
			break;
		case PLUS:
			modifyAndDisplayValue(applyPlus());
			break;
		case MINUS:
			modifyAndDisplayValue(applyMinus());
			break;
		case EDIT:
			applyEdit();
			break;
		case INSPECT:
			applyInspect();
			break;
		case BROWSE:
			applyBrowse();
			break;
		case CHANGE:
			if (e.detail != SWT.ARROW) { return; }
			applyChange();
			break;
		case DEFINE:
			applyDefine();
			break;
	}
}
 
Example 13
/**
 * @param offset
 * @param document
 */
private boolean isValidAutoAssistLocation(KeyEvent e, StyledText styledText)
{
	// Don't pop up CA if we pressed a Ctrl or Command character. On Linux, Unicode characters can be inserted with
	// Ctrl + Shift + u + key sequence, but at this point, all we get is the character, no modifiers.
	if (e.stateMask == SWT.MOD1)
	{
		return false;
	}

	int keyCode = e.keyCode;
	if (keyCode == SWT.ESC || keyCode == SWT.BS || keyCode == SWT.DEL || keyCode == SWT.ARROW
			|| (keyCode & SWT.KEYCODE_BIT) != 0)
	{
		return false;
	}

	int offset = styledText.getCaretOffset();
	IContentAssistProcessor processor = getProcessor(fContentAssistSubjectControlAdapter, offset);
	if (processor instanceof ICommonContentAssistProcessor)
	{
		ICommonContentAssistProcessor cp = (ICommonContentAssistProcessor) processor;
		// are we typing a valid identifier, and the previous "location" (character or lexeme) should pop up CA
		return cp.isValidIdentifier(e.character, keyCode)
				&& isAutoActivationLocation(cp, styledText, e.character, keyCode);
	}
	else
	{
		return false;
	}
}
 
Example 14
/**
 * 
 */
private void placeComponents( )
{
	// THE LAYOUT OF THIS COMPOSITE (FILLS EVERYTHING INSIDE IT)
	FillLayout flMain = new FillLayout( );
	flMain.marginHeight = 0;
	flMain.marginWidth = 0;
	setLayout( flMain );

	// THE LAYOUT OF THE OUTER COMPOSITE (THAT GROWS VERTICALLY BUT ANCHORS
	// ITS CONTENT NORTH)
	cmpContentOuter = new Composite( this, SWT.NONE );
	GridLayout glContentOuter = new GridLayout( );
	glContentOuter.verticalSpacing = 0;
	glContentOuter.horizontalSpacing = 0;
	glContentOuter.marginHeight = 0;
	glContentOuter.marginWidth = 0;
	glContentOuter.numColumns = 1;
	cmpContentOuter.setLayout( glContentOuter );

	// THE LAYOUT OF THE INNER COMPOSITE (ANCHORED NORTH AND ENCAPSULATES
	// THE CANVAS + BUTTON)
	cmpContentInner = new Composite( cmpContentOuter, SWT.BORDER );
	GridLayout glContentInner = new GridLayout( );
	glContentInner.verticalSpacing = 0;
	glContentInner.horizontalSpacing = 0;
	glContentInner.marginHeight = 0;
	glContentInner.marginWidth = 0;
	glContentInner.numColumns = 2;
	cmpContentInner.setLayout( glContentInner );
	GridData gdContentInner = new GridData( GridData.FILL_HORIZONTAL );
	cmpContentInner.setLayoutData( gdContentInner );

	// THE CANVAS
	cnvSelection = new FillCanvas( cmpContentInner,
			SWT.NONE,
			this.bAutoEnabled,
			wizardContext == null ? null
					: wizardContext.getImageServiceProvider( ) );
	cnvSelection.setTextIndent( 8 );
	GridData gdCNVSelection = new GridData( GridData.FILL_BOTH );
	gdCNVSelection.heightHint = iSize;
	cnvSelection.setLayoutData( gdCNVSelection );

	initFill( );

	// THE BUTTON
	btnDown = new Button( cmpContentInner, SWT.ARROW | SWT.DOWN );
	GridData gdBDown = new GridData( GridData.FILL );
	gdBDown.verticalAlignment = GridData.BEGINNING;
	gdBDown.widthHint = iSize - 2;
	gdBDown.heightHint = iSize;
	btnDown.setLayoutData( gdBDown );
	btnDown.addSelectionListener( this );

	addDisposeListener( this );

	Listener listener = new Listener( ) {

		public void handleEvent( Event event )
		{
			handleEventCanvas( event );
		}
	};

	int[] textEvents = {
			SWT.KeyDown,
			SWT.MouseDown,
			SWT.Traverse,
			SWT.FocusIn,
			SWT.FocusOut
	};
	for ( int i = 0; i < textEvents.length; i++ )
	{
		cnvSelection.addListener( textEvents[i], listener );
	}

}
 
Example 15
private void init() {
  GridLayout layout = new GridLayout( 2, false );
  layout.marginBottom = 0;
  layout.marginTop = 0;
  layout.marginLeft = 0;
  layout.marginRight = 0;
  layout.marginWidth = 0;
  layout.marginHeight = 0;
  setLayout( layout );
  displayText = new Text( this, SWT.SINGLE );
  displayText.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );

  arrow = new Button( this, SWT.ARROW | SWT.DOWN );
  arrow.setBackground( Display.getCurrent().getSystemColor( SWT.COLOR_BLUE ) );
  arrow.setSize( 25, 25 );
  arrow.setLocation( displayText.getLocation() );
  arrow.addMouseListener( new MouseAdapter() {
    @Override
    public void mouseDown( MouseEvent event ) {
      super.mouseDown( event );
      if ( floatShell == null || floatShell.isDisposed() ) {
        initFloatShell();
      } else {
        closeShellAndUpdate();
      }
    }
  } );
}
 
Example 16
@Override
public void handleEvent(Event event){
	if (event.detail == SWT.ARROW || event.type == SWT.Selection) {
		Rectangle rect = item.getBounds();
		Point pt = new Point(rect.x, rect.y + rect.height);
		pt = fParent.toDisplay(pt);
		menu.setLocation(pt.x, pt.y);
		menu.setVisible(true);
	}
}
 
Example 17
Source Project: nebula   File: CTreeCombo.java    License: Eclipse Public License 2.0 4 votes vote down vote up
/**
 * The CTreeCombo class represents a selectable user interface object
 * that combines a text field and a tree and issues notification
 * when an item is selected from the tree.
 * <p>
 * Note that although this class is a subclass of <code>Composite</code>,
 * it does not make sense to add children to it, or set a layout on it.
 * </p>
 * <dl>
 * <dt><b>Styles:</b>
 * <dd>BORDER, READ_ONLY, FLAT</dd>
 * <dt><b>Events:</b>
 * <dd>DefaultSelection, Modify, Selection, Verify</dd>
 * </dl>
 */
public CTreeCombo(Composite parent, int style) {
	super(parent, style = checkStyle(style));

	int textStyle = SWT.SINGLE;
	if ((style & SWT.READ_ONLY) != 0) {
		textStyle |= SWT.READ_ONLY;
	}
	if ((style & SWT.FLAT) != 0) {
		textStyle |= SWT.FLAT;
	}
	text = new Text(this, textStyle);
	int arrowStyle = SWT.ARROW | SWT.DOWN;
	if ((style & SWT.FLAT) != 0) {
		arrowStyle |= SWT.FLAT;
	}
	arrow = new Button(this, arrowStyle);

	listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			if (popup == event.widget) {
				popupEvent(event);
				return;
			}
			if (text == event.widget) {
				textEvent(event);
				return;
			}
			if (tree == event.widget) {
				treeEvent(event);
				return;
			}
			if (arrow == event.widget) {
				arrowEvent(event);
				return;
			}
			if (CTreeCombo.this == event.widget) {
				comboEvent(event);
				return;
			}
			if (getShell() == event.widget) {
				getDisplay().asyncExec(new Runnable() {
					@Override
					public void run() {
						if (isDisposed()) {
							return;
						}
						handleFocus(SWT.FocusOut);
					}
				});
			}
		}
	};
	filter = (event) -> {
		final Shell shell = ((Control) event.widget).getShell();
		if (shell == CTreeCombo.this.getShell()) {
			handleFocus(SWT.FocusOut);
		}
	};

	final int[] comboEvents = { SWT.Dispose, SWT.FocusIn, SWT.Move, SWT.Resize };
	for (int i = 0; i < comboEvents.length; i++) {
		addListener(comboEvents[i], listener);
	}

	final int[] textEvents = { SWT.DefaultSelection, SWT.KeyDown, SWT.KeyUp, SWT.MenuDetect, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.MouseDoubleClick, SWT.MouseWheel, SWT.Traverse, SWT.FocusIn, SWT.Verify };
	for (int i = 0; i < textEvents.length; i++) {
		text.addListener(textEvents[i], listener);
	}

	final int[] arrowEvents = { SWT.MouseDown, SWT.MouseUp, SWT.Selection, SWT.FocusIn };
	for (int i = 0; i < arrowEvents.length; i++) {
		arrow.addListener(arrowEvents[i], listener);
	}

	createPopup(null, null);
	initAccessible();
}
 
Example 18
Source Project: nebula   File: MultiChoice.java    License: Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Constructs a new instance of this class given its parent.
 *
 * @param parent a widget which will be the parent of the new instance (cannot
 *            be null)
 * @param style not used
 * @param elements list of elements displayed by this widget
 *
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the parent</li>
 *                </ul>
 */
public MultiChoice(final Composite parent, final int style, final List<T> elements) {
	super(parent, style);

	final GridLayout gridLayout = new GridLayout(2, false);
	gridLayout.horizontalSpacing = gridLayout.verticalSpacing = gridLayout.marginWidth = gridLayout.marginHeight = 0;
	setLayout(gridLayout);

	int readOnlyStyle;
	if ((style & SWT.READ_ONLY) == SWT.READ_ONLY) {
		readOnlyStyle = SWT.READ_ONLY;
	} else {
		readOnlyStyle = SWT.NONE;
	}

	this.text = new Text(this, SWT.SINGLE | readOnlyStyle | SWT.BORDER);
	this.text.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
	this.text.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));

	this.arrow = new Button(this, SWT.ARROW | SWT.RIGHT);
	this.arrow.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));

	createGlobalListener();
	addListeners();

	this.filter = new Listener() {
		@Override
		public void handleEvent(final Event event) {
			final Shell shell = ((Control) event.widget).getShell();
			if (shell == MultiChoice.this.getShell()) {
				handleFocusEvents(SWT.FocusOut);
			}
		}
	};

	this.selection = new LinkedHashSet<>();
	this.elements = elements;
	this.separator = ",";
	this.labelProvider = new MultiChoiceDefaultLabelProvider();

	createPopup();
	setLabel();
}
 
Example 19
private void initControls( )
{
	// THE LAYOUT OF THIS COMPOSITE (FILLS EVERYTHING INSIDE IT)
	FillLayout flMain = new FillLayout( );
	flMain.marginHeight = 0;
	flMain.marginWidth = 0;
	setLayout( flMain );

	// THE LAYOUT OF THE INNER COMPOSITE (ANCHORED NORTH AND ENCAPSULATES
	// THE CANVAS + BUTTON)
	cmpContent = new Composite( this, SWT.BORDER );
	GridLayout glContentInner = new GridLayout( );
	glContentInner.verticalSpacing = 0;
	glContentInner.horizontalSpacing = 0;
	glContentInner.marginHeight = 0;
	glContentInner.marginWidth = 0;
	glContentInner.numColumns = 2;
	cmpContent.setLayout( glContentInner );

	final int iSize = itemHeight;
	// THE CANVAS
	cnvSelection = createChoice( cmpContent, null );
	GridData gdCNVSelection = new GridData( GridData.FILL_BOTH );
	gdCNVSelection.heightHint = iSize;
	cnvSelection.setLayoutData( gdCNVSelection );
	cnvSelection.setValue( iCurrentValue );
	cnvSelection.addListener( SWT.KeyDown, canvasListener );
	cnvSelection.addListener( SWT.Traverse, canvasListener );
	cnvSelection.addListener( SWT.FocusIn, canvasListener );
	cnvSelection.addListener( SWT.FocusOut, canvasListener );
	cnvSelection.addListener( SWT.MouseDown, canvasListener );

	// THE BUTTON
	btnDown = new Button( cmpContent, SWT.ARROW | SWT.DOWN );
	GridData gdBDown = new GridData( GridData.FILL );
	gdBDown.verticalAlignment = GridData.BEGINNING;
	gdBDown.widthHint = iSize - 1;
	gdBDown.heightHint = iSize;
	btnDown.setLayoutData( gdBDown );
	btnDown.addListener( SWT.Selection, new Listener( ) {

		public void handleEvent( Event event )
		{
			toggleDropDown( );
		}
	} );

	layout( );

	initAccessible( );
}
 
Example 20
Source Project: birt   File: SpinnerTime.java    License: Eclipse Public License 1.0 4 votes vote down vote up
private void initComponents( )
{
	hour = new SpinnerTimeText( this,
			SWT.NONE,
			24,
			IPropertyEventConstants.HOUR_CHANGE_EVENT );
	firstLabel = new Label( this, SWT.NONE );
	min = new SpinnerTimeText( this,
			SWT.NONE,
			60,
			IPropertyEventConstants.MIN_CHANGE_EVENT );
	lastLabel = new Label( this, SWT.NONE );
	sec = new SpinnerTimeText( this,
			SWT.NONE,
			60,
			IPropertyEventConstants.SECOND_CHANGE_EVENT );

	//		Font font = new Font( Display.getCurrent( ), "Dialog", 10, SWT.BOLD
	// ); //$NON-NLS-1$
	Font font = FontManager.getFont( "Dialog", 10, SWT.BOLD ); //$NON-NLS-1$

	firstLabel.setBackground( Display.getCurrent( )
			.getSystemColor( SWT.COLOR_WHITE ) );
	lastLabel.setBackground( Display.getCurrent( )
			.getSystemColor( SWT.COLOR_WHITE ) );
	firstLabel.setFont( font );
	lastLabel.setFont( font );

	firstLabel.setForeground( Display.getCurrent( )
			.getSystemColor( SWT.COLOR_BLACK ) );
	lastLabel.setForeground( Display.getCurrent( )
			.getSystemColor( SWT.COLOR_BLACK ) );

	firstLabel.setText( ":" ); //$NON-NLS-1$
	lastLabel.setText( ":" ); //$NON-NLS-1$

	up = new Button( this, SWT.ARROW | SWT.UP );
	down = new Button( this, SWT.ARROW | SWT.DOWN );
	label = new Label( this, SWT.NONE );

	label.setBackground( Display.getCurrent( )
			.getSystemColor( SWT.COLOR_WHITE ) );

	//added by gao 2004.07.08
	//font.dispose( );
}