当前位置: 首页>>代码示例>>Java>>正文


Java ControlListener类代码示例

本文整理汇总了Java中org.eclipse.swt.events.ControlListener的典型用法代码示例。如果您正苦于以下问题:Java ControlListener类的具体用法?Java ControlListener怎么用?Java ControlListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ControlListener类属于org.eclipse.swt.events包,在下文中一共展示了ControlListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createColumns

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
private void createColumns(final Table table) {
    table.setLayout(new TableLayout());

    final ControlListener layoutWhenResizedListener = new ControlAdapter() {
        @Override
        public void controlResized(final ControlEvent e) {
            ((TableColumn) e.widget).getParent().layout();
        }
    };

    for (int i = 0; i < COLUMN_DATA.length; i++) {
        final ColumnData columnData = COLUMN_DATA[i];

        final TableColumn column = new TableColumn(table, columnData.style);
        column.setWidth(columnData.defaultWidth);
        column.setResizable(columnData.resizable);
        if (columnData.label != null) {
            column.setText(columnData.label);
        }
        column.addControlListener(layoutWhenResizedListener);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:23,代码来源:QueryEditorControl.java

示例2: addControlListener

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
private void addControlListener(Table table, TableColumn tableColumn) {
	ControlListener controlistener= new ControlAdapter() {
		@Override
		public void controlResized(ControlEvent e) {
			for (TableColumn column : table.getColumns()) {
				column.setWidth(table.getSize().x / table.getColumnCount() - (4 - table.getColumnCount()));
			}
		}
	};
	table.addControlListener(controlistener);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:12,代码来源:SchemaPreviewPage.java

示例3: forceControlEvent

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
/***************************************************************************
 * Force a control resize event
 **************************************************************************/
public void forceControlEvent( Control ctrl )
{
	for(Listener lst : ctrl.getListeners(SWT.Resize))
	{
		if (lst instanceof ControlListener)
		{
			ControlListener clst = (ControlListener) lst;
			clst.controlResized(null);
		}
	}
}
 
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:15,代码来源:CodeViewer.java

示例4: addSWTListener

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
/**
     * Hook an SWT listener on the canvas where the chart is drawn.
     * The purpose of this method is to allow some degree of customization.
     *
     * @param listener The SWT listener to attach to the canvas.
     */
    public void addSWTListener(EventListener listener) {
        if (listener instanceof ControlListener) {
            this.canvas.addControlListener((ControlListener) listener);
        }
        else if (listener instanceof DisposeListener) {
            this.canvas.addDisposeListener((DisposeListener) listener);
//      }
//      else if (listener instanceof DragDetectListener) {
//          this.canvas.addDragDetectListener((DragDetectListener) listener);
        }
        else if (listener instanceof FocusListener) {
            this.canvas.addFocusListener((FocusListener) listener);
        }
        else if (listener instanceof HelpListener) {
            this.canvas.addHelpListener((HelpListener) listener);
        }
        else if (listener instanceof KeyListener) {
            this.canvas.addKeyListener((KeyListener) listener);
//      }
//      else if (listener instanceof MenuDetectListener) {
//          this.canvas.addMenuDetectListener((MenuDetectListener) listener);
        }
        else if (listener instanceof MouseListener) {
            this.canvas.addMouseListener((MouseListener) listener);
        }
        else if (listener instanceof MouseMoveListener) {
            this.canvas.addMouseMoveListener((MouseMoveListener) listener);
        }
        else if (listener instanceof MouseTrackListener) {
            this.canvas.addMouseTrackListener((MouseTrackListener) listener);
//      } else if (listener instanceof MouseWheelListener) {
//          this.canvas.addMouseWheelListener((MouseWheelListener) listener);
        }
        else if (listener instanceof PaintListener) {
            this.canvas.addPaintListener((PaintListener) listener);
        }
        else if (listener instanceof TraverseListener) {
            this.canvas.addTraverseListener((TraverseListener) listener);
        }
    }
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:47,代码来源:ChartComposite.java

示例5: getColumnControlListener

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
public ControlListener getColumnControlListener() {
	return _columnControlListener;
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:4,代码来源:ColumnDefinition.java

示例6: setControlListener

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
public void setControlListener(final ControlListener controlListener) {
	_columnControlListener = controlListener;
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:4,代码来源:ColumnDefinition.java

示例7: addControlListener

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
public void addControlListener(ControlListener listener) {
	column.addControlListener(listener);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:4,代码来源:TableColumnDelegate.java

示例8: removeControlListener

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
public void removeControlListener(ControlListener listener) {
	column.removeControlListener(listener);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:4,代码来源:TableColumnDelegate.java

示例9: addControlListener

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
public void addControlListener(ControlListener listener) {
	treeColumn.addControlListener(listener);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:4,代码来源:TreeColumnDelegate.java

示例10: removeControlListener

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
public void removeControlListener(ControlListener listener) {
	treeColumn.removeControlListener(listener);
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:4,代码来源:TreeColumnDelegate.java

示例11: addSWTListener

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
/**
 * Hook an SWT listener on the canvas where the chart is drawn.
 * The purpose of this method is to allow some degree of customization.
 *
 * @param listener The SWT listener to attach to the canvas.
 */
public void addSWTListener(EventListener listener) {
    if (listener instanceof ControlListener) {
        this.canvas.addControlListener((ControlListener) listener);
    }
    else if (listener instanceof DisposeListener) {
        this.canvas.addDisposeListener((DisposeListener) listener);
    }
    else if (listener instanceof DragDetectListener) {
        this.canvas.addDragDetectListener((DragDetectListener) listener);
    }
    else if (listener instanceof FocusListener) {
        this.canvas.addFocusListener((FocusListener) listener);
    }
    else if (listener instanceof HelpListener) {
        this.canvas.addHelpListener((HelpListener) listener);
    }
    else if (listener instanceof KeyListener) {
        this.canvas.addKeyListener((KeyListener) listener);
    }
    else if (listener instanceof MenuDetectListener) {
        this.canvas.addMenuDetectListener((MenuDetectListener) listener);
    }
    else if (listener instanceof MouseListener) {
        this.canvas.addMouseListener((MouseListener) listener);
    }
    else if (listener instanceof MouseMoveListener) {
        this.canvas.addMouseMoveListener((MouseMoveListener) listener);
    }
    else if (listener instanceof MouseTrackListener) {
        this.canvas.addMouseTrackListener((MouseTrackListener) listener);
    }
    else if (listener instanceof MouseWheelListener) {
        this.canvas.addMouseWheelListener((MouseWheelListener) listener);
    }
    else if (listener instanceof PaintListener) {
        this.canvas.addPaintListener((PaintListener) listener);
    }
    else if (listener instanceof TraverseListener) {
        this.canvas.addTraverseListener((TraverseListener) listener);
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:48,代码来源:ChartComposite.java

示例12: createContents

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
private void createContents() {
		// Create top and bottom composites
		topComposite = toolkit.createComposite(formComposite, SWT.NONE);
		btmComposite = toolkit.createComposite(formComposite, SWT.NONE);
		
		// Layouts
		GridLayout layout        = new GridLayout(3, Boolean.TRUE);
		layout.marginHeight      = 5;
		layout.marginWidth       = 5;
		layout.verticalSpacing   = 5;
		layout.horizontalSpacing = 5;
		GridData layoutData      = new GridData(SWT.FILL,
										   		SWT.FILL,
										   		Boolean.TRUE,
										   		Boolean.TRUE);		
		// Set composites layouts
		topComposite.setLayout(layout);
		topComposite.setLayoutData(layoutData);
		btmComposite.setLayout(layout);
		btmComposite.setLayoutData(layoutData);

//		topComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GREEN));	// TODO		
//		btmComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));	// TODO

		// 
		formComposite.addControlListener(new ControlListener() {

			private static final long serialVersionUID = 1L;

			@Override
			public void controlResized(ControlEvent event) {
				// Retrieve parent bounds
				Rectangle formBounds = ((Composite) event.getSource()).getBounds();
				int topCpteHeight    = (int) (formBounds.height * 0.65);
				int topCpteWidth     = (int) (formBounds.width);
				int btmCpteHeight    = (int) (formBounds.height * 0.35);
				int btmCpteWidth     = (int) (formBounds.width);
				
				topComposite.setSize(topCpteWidth, topCpteHeight);
				btmComposite.setBounds(btmComposite.getLocation().x,
									   topCpteHeight,
									   btmCpteWidth,
									   btmCpteHeight);
				// 
				topCompositeBounds    = topComposite.getBounds();
				bottomCompositeBounds = btmComposite.getBounds();
			}

			@Override
			public void controlMoved(ControlEvent e) {}
		});
	
		// Create contents of both main composites
		createTopContents(topComposite);
		createBottomContents(btmComposite);
	}
 
开发者ID:jaloncad,项目名称:redmine.rap,代码行数:57,代码来源:ProductEditor.java

示例13: fillScheduleSection

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
private void fillScheduleSection(Composite composite) {
		// Local composites	
		final Composite lblsComposite  = toolkit.createComposite(composite);
		final Composite ctrlsComposite = toolkit.createComposite(composite);
		
//		lblsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));	// TODO
//		ctrlsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));	// TODO
		
		// Layout
		RowData data     = new RowData();
		RowLayout layout = new RowLayout(SWT.VERTICAL);
		layout.justify   = Boolean.TRUE;

		lblsComposite.setLayout(layout);
		lblsComposite.setData(data);
		ctrlsComposite.setLayout(layout);
		ctrlsComposite.setData(data);

		// Labels
		lblStartDate   = new CLabel(lblsComposite, SWT.LEFT);
		lblReleaseDate = new CLabel(lblsComposite, SWT.LEFT);
		lblState       = new CLabel(lblsComposite, SWT.LEFT);
		lblDone        = new CLabel(lblsComposite, SWT.LEFT);
		lblToDo        = new CLabel(lblsComposite, SWT.LEFT);
		
		// Controls
		dtStartDate = new DateTime(ctrlsComposite, SWT.DATE
				 								 | SWT.DROP_DOWN
				 								 | SWT.BORDER);
		dtReleaseDate = new DateTime(ctrlsComposite, SWT.DATE
												   | SWT.DROP_DOWN
												   | SWT.BORDER);
		cboStates = new CCombo(ctrlsComposite, SWT.BORDER);
		txtDone   = new Text(ctrlsComposite, SWT.BORDER);
		txtToDo   = new Text(ctrlsComposite, SWT.BORDER);
		
		// Labels configuration
		lblStartDate.setText(START_DATE_LABEL);		
		lblReleaseDate.setText(RELEASE_DATE_LABEL);
		lblState.setText(STATE_LABEL);
		lblDone.setText(DONE_LABEL);
		lblToDo.setText(TO_DO_LABEL);

		// Controls configuration
		cboStates.setEditable(Boolean.FALSE);

		// Add decorations
		ViewUtils.addDecoration(txtDone);
		ViewUtils.addDecoration(txtToDo);

		// Set widgets sizes
		composite.addControlListener(new ControlListener() {

			private static final long serialVersionUID = 1L;

			@Override
			public void controlResized(ControlEvent event) {
				// Retrieves "scheduleSC" bounds
				Rectangle bounds = ((Composite) event.getSource()).getBounds();

				// Manage left and right bounds
				lblsComposite.setBounds(0, 0,
										(int) (bounds.width * 0.4),
										bounds.height);
				ctrlsComposite.setBounds((int) (bounds.width * 0.4), 0,
										 (int) (bounds.width * 0.6),
										 bounds.height);			
			}

			@Override
			public void controlMoved(ControlEvent e) {}
		});
	}
 
开发者ID:jaloncad,项目名称:redmine.rap,代码行数:74,代码来源:ProductEditor.java

示例14: fillMemoSection

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
private void fillMemoSection(Composite composite) {
		// Local composites	
		final Composite lblsComposite  = toolkit.createComposite(composite);
		final Composite ctrlsComposite = toolkit.createComposite(composite);
		
//		lblsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));	// TODO
//		ctrlsComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));	// TODO
		
		// Layout
		RowData data     = new RowData();
		RowLayout layout = new RowLayout(SWT.VERTICAL);

		lblsComposite.setLayout(layout);
		lblsComposite.setData(data);
		ctrlsComposite.setLayout(layout);
		ctrlsComposite.setData(data);

		// Labels
		lblDescription = new CLabel(lblsComposite, SWT.LEFT);
		lblComments    = new CLabel(lblsComposite, SWT.LEFT);

		// Controls
		txtDescription = new Text(ctrlsComposite, SWT.BORDER | SWT.MULTI);
		txtComments    = new Text(ctrlsComposite, SWT.BORDER | SWT.MULTI);
		
		// Labels configuration
		lblDescription.setText(DESCRIPTION_LABEL);		
		lblComments.setText(COMMENTS_LABEL);

		// Set widgets sizes
		composite.addControlListener(new ControlListener() {

			private static final long serialVersionUID = 1L;

			@Override
			public void controlResized(ControlEvent event) {
				
				// Retrieves "memoSCBounds" bounds
				Rectangle memoSCBounds   = ((Composite) event.getSource()).getBounds();
				int lblsCompositeWidth   = (int) (memoSCBounds.width * 0.4);
				int lblsCompositeHeight  = (int) (memoSCBounds.height);
				int ctrlsCompositeWidth  = (int) (memoSCBounds.width * 0.6);
				int ctrlsCompositeHeight = (int) (memoSCBounds.height);

				// Manage left and right bounds
				lblsComposite.setBounds(0, 0, lblsCompositeWidth, lblsCompositeHeight);
				ctrlsComposite.setBounds(lblsCompositeWidth, 0,
						 				 ctrlsCompositeWidth,
						 				 ctrlsCompositeHeight);
				
				int txtControlWidth  = (int) (ctrlsCompositeWidth * 0.8);
				int txtControlHeight = (int) (ctrlsCompositeHeight * 0.4);
				
				txtDescription.setSize(txtControlWidth, txtControlHeight);
				txtComments.setSize(txtControlWidth, txtControlHeight);
				
				lblComments.setLocation(lblComments.getLocation().x,
										txtControlHeight + CTRLS_SEPARATION);
				txtComments.setLocation(txtComments.getLocation().x,
										txtControlHeight + CTRLS_SEPARATION);
			}

			@Override
			public void controlMoved(ControlEvent e) {}
		});
	}
 
开发者ID:jaloncad,项目名称:redmine.rap,代码行数:67,代码来源:ProductEditor.java

示例15: createContents

import org.eclipse.swt.events.ControlListener; //导入依赖的package包/类
private void createContents() {
		// Create top and bottom composites
		topComposite = toolkit.createComposite(formComposite, SWT.NONE);
		btmComposite = toolkit.createComposite(formComposite, SWT.NONE);
		
		// Layouts		
		GridLayout layout = new GridLayout(3, Boolean.TRUE);
		GridData data     = new GridData(SWT.FILL,
								   	     SWT.FILL,
										 Boolean.TRUE,
										 Boolean.TRUE);
		layout.marginHeight      = 5;
		layout.marginWidth       = 5;
		layout.verticalSpacing   = 5;
		layout.horizontalSpacing = 5;

		// Set composites layouts
		topComposite.setLayout(layout);
		topComposite.setLayoutData(data);
		btmComposite.setLayout(layout);
		btmComposite.setLayoutData(data);

//		topComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GREEN));	// TODO		
//		btmComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));	// TODO

		// 
		formComposite.addControlListener(new ControlListener() {

			private static final long serialVersionUID = 1L;

			@Override
			public void controlResized(ControlEvent event) {
				// Retrieve parent bounds
				Rectangle formBounds = ((Composite) event.getSource()).getBounds();
				int topCpteHeight    = (int) (formBounds.height * 0.65);
				int topCpteWidth     = (int) (formBounds.width);
				int btmCpteHeight    = (int) (formBounds.height * 0.35);
				int btmCpteWidth     = (int) (formBounds.width);
				
				topComposite.setSize(topCpteWidth, topCpteHeight);
				btmComposite.setBounds(btmComposite.getLocation().x,
									   topCpteHeight,
									   btmCpteWidth,
									   btmCpteHeight);
				// 
				topCompositeBounds    = topComposite.getBounds();
				bottomCompositeBounds = btmComposite.getBounds();
				
//				generalExpandItem.setHeight((int) (topCpteHeight * 0.8));
//				iterationsExpandItem.setHeight((int) (btmCpteHeight * 0.7));
			}

			@Override
			public void controlMoved(ControlEvent e) {}
		});
	
		// Create contents of both main composites
		createTopContents(topComposite);
		createBottomContents(btmComposite);
	}
 
开发者ID:jaloncad,项目名称:redmine.rap,代码行数:61,代码来源:ReleaseEditor.java


注:本文中的org.eclipse.swt.events.ControlListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。