本文整理匯總了Java中org.eclipse.swt.widgets.ScrollBar.addListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ScrollBar.addListener方法的具體用法?Java ScrollBar.addListener怎麽用?Java ScrollBar.addListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.ScrollBar
的用法示例。
在下文中一共展示了ScrollBar.addListener方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: installListeners
import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
void installListeners() {
// Listeners on this popup's table and scroll bar
proposalTable.addListener(SWT.FocusOut, this);
ScrollBar scrollbar = proposalTable.getVerticalBar();
if (scrollbar != null) {
scrollbar.addListener(SWT.Selection, this);
}
// Listeners on this popup's shell
getShell().addListener(SWT.Deactivate, this);
getShell().addListener(SWT.Close, this);
// Listeners on the target control
control.addListener(SWT.MouseDoubleClick, this);
control.addListener(SWT.MouseDown, this);
control.addListener(SWT.Dispose, this);
control.addListener(SWT.FocusOut, this);
// Listeners on the target control's shell
Shell controlShell = control.getShell();
controlShell.addListener(SWT.Move, this);
controlShell.addListener(SWT.Resize, this);
}
示例2: ControlEditor
import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
/**
* Creates a ControlEditor for the specified Composite.
*
* @param parent
* the Composite above which this editor will be displayed
*
*/
public ControlEditor(Composite parent) {
this.parent = parent;
controlListener = new Listener() {
public void handleEvent(Event e) {
layout();
}
};
for (int i = 0; i < EVENTS.length; i++) {
parent.addListener(EVENTS[i], controlListener);
}
scrollbarListener = new Listener() {
public void handleEvent(Event e) {
scroll(e);
}
};
ScrollBar hBar = parent.getHorizontalBar();
if (hBar != null)
hBar.addListener(SWT.Selection, scrollbarListener);
ScrollBar vBar = parent.getVerticalBar();
if (vBar != null)
vBar.addListener(SWT.Selection, scrollbarListener);
}
示例3: ScrollBarImpl
import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
ScrollBarImpl(final ScrollBar scrollBar) {
Assert.paramNotNull(scrollBar, "scrollBar");
this.scrollBar = scrollBar;
final Listener visibilityListener = new Listener() {
@Override
public void handleEvent(final Event event) {
fireVisibilityStateChanged(isVisible());
}
};
scrollBar.addListener(SWT.Hide, visibilityListener);
scrollBar.addListener(SWT.Show, visibilityListener);
}
示例4: doCommand
import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
@Override
public boolean doCommand(ILayerCommand command) {
boolean b = super.doCommand(command);
if (command instanceof ClientAreaResizeCommand && command.convertToTargetLayer(this)) {
ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command;
final ScrollBar vBar = clientAreaResizeCommand.getScrollable().getVerticalBar(); // 垂直滾動條
Listener[] listeners = vBar.getListeners(SWT.Selection);
for (Listener listener : listeners) { // 清除默認的 Selection 監聽(在類 ScrollBarHandlerTemplate 中添加的)
vBar.removeListener(SWT.Selection, listener);
}
vBar.addListener(SWT.Selection, new Listener() {
private ViewportLayer viewportLayer = HorizontalViewportLayer.this;
private IUniqueIndexLayer scrollableLayer = viewportLayer.getScrollableLayer();
public void handleEvent(Event event) {
// 滾動滾動條前提交當前處於編輯狀態的文本段
HsMultiActiveCellEditor.commit(true);
ScrollBar scrollBar = (ScrollBar) event.widget;
int position = scrollableLayer.getRowPositionByY(scrollBar.getSelection());
viewportLayer.invalidateVerticalStructure();
viewportLayer.setOriginRowPosition(position);
vBar.setIncrement(viewportLayer.getRowHeightByPosition(0));
// HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent());
}
});
}
return b;
}
示例5: doCommand
import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
@Override
public boolean doCommand(ILayerCommand command) {
boolean b = super.doCommand(command);
if (command instanceof ClientAreaResizeCommand && command.convertToTargetLayer(this)) {
ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command;
final ScrollBar vBar = clientAreaResizeCommand.getScrollable().getVerticalBar(); // 垂直滾動條
Listener[] listeners = vBar.getListeners(SWT.Selection);
for (Listener listener : listeners) { // 清除默認的 Selection 監聽(在類 ScrollBarHandlerTemplate 中添加的)
vBar.removeListener(SWT.Selection, listener);
}
vBar.addListener(SWT.Selection, new Listener() {
private ViewportLayer viewportLayer = HorizontalViewportLayer.this;
private IUniqueIndexLayer scrollableLayer = viewportLayer.getScrollableLayer();
public void handleEvent(Event event) {
// 滾動滾動條前提交當前處於編輯狀態的文本段
if (TeActiveCellEditor.isValid())
TeActiveCellEditor.commit();
ScrollBar scrollBar = (ScrollBar) event.widget;
int position = scrollableLayer.getRowPositionByY(scrollBar.getSelection());
viewportLayer.invalidateVerticalStructure();
viewportLayer.setOriginRowPosition(position);
vBar.setIncrement(viewportLayer.getRowHeightByPosition(0));
}
});
}
return b;
}
示例6: doCommand
import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
@Override
public boolean doCommand(ILayerCommand command) {
boolean b = super.doCommand(command);
if (command instanceof ClientAreaResizeCommand && command.convertToTargetLayer(this)) {
ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command;
final ScrollBar vBar = clientAreaResizeCommand.getScrollable().getVerticalBar(); // 垂直滾動條
Listener[] listeners = vBar.getListeners(SWT.Selection);
for (Listener listener : listeners) { // 清除默認的 Selection 監聽(在類 ScrollBarHandlerTemplate 中添加的)
vBar.removeListener(SWT.Selection, listener);
}
vBar.addListener(SWT.Selection, new Listener() {
private ViewportLayer viewportLayer = HorizontalViewportLayer.this;
private IUniqueIndexLayer scrollableLayer = viewportLayer.getScrollableLayer();
public void handleEvent(Event event) {
// 滾動滾動條前提交當前處於編輯狀態的文本段
HsMultiActiveCellEditor.commit(true);
ScrollBar scrollBar = (ScrollBar) event.widget;
int position = scrollableLayer.getRowPositionByY(scrollBar.getSelection());
viewportLayer.invalidateVerticalStructure();
viewportLayer.setOriginRowPosition(position);
vBar.setIncrement(viewportLayer.getRowHeightByPosition(0));
HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent());
}
});
}
return b;
}
示例7: init
import org.eclipse.swt.widgets.ScrollBar; //導入方法依賴的package包/類
public void init(IPageBookViewPage page, IConsole console)
{
if (console.getType() != IDebugUIConstants.ID_PROCESS_CONSOLE_TYPE || !(page instanceof TextConsolePage))
{
return;
}
TextConsolePage consolePage = (TextConsolePage) page;
TextConsoleViewer textViewer = consolePage.getViewer();
if (!(textViewer instanceof IOConsoleViewer))
{
return;
}
final IOConsoleViewer viewer = (IOConsoleViewer) textViewer;
scrollActionEnabled = viewer.isAutoScroll();
final IToolBarManager toolBarManager = consolePage.getSite().getActionBars().getToolBarManager();
IAction slAction = null;
// Look for the ScrollLockAction
for (IContributionItem item : toolBarManager.getItems())
{
if (item instanceof ActionContributionItem)
{
IAction action = ((ActionContributionItem) item).getAction();
if (action instanceof ScrollLockAction)
{
slAction = action;
break;
}
}
}
textWidget = viewer.getTextWidget();
listener = new ConsoleListener(viewer, toolBarManager, slAction);
// Based on Eclipse Snippet191 - Detects scrolling that were initiated by the user.
textWidget.addListener(SWT.MouseDown, listener);
textWidget.addListener(SWT.MouseMove, listener);
textWidget.addListener(SWT.MouseUp, listener);
textWidget.addListener(SWT.KeyDown, listener);
textWidget.addListener(SWT.KeyUp, listener);
ScrollBar vBar = textWidget.getVerticalBar();
if (vBar != null)
{
vBar.addListener(SWT.Selection, listener);
}
}