本文整理匯總了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);
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
示例5: getColumnControlListener
import org.eclipse.swt.events.ControlListener; //導入依賴的package包/類
public ControlListener getColumnControlListener() {
return _columnControlListener;
}
示例6: setControlListener
import org.eclipse.swt.events.ControlListener; //導入依賴的package包/類
public void setControlListener(final ControlListener controlListener) {
_columnControlListener = controlListener;
}
示例7: addControlListener
import org.eclipse.swt.events.ControlListener; //導入依賴的package包/類
public void addControlListener(ControlListener listener) {
column.addControlListener(listener);
}
示例8: removeControlListener
import org.eclipse.swt.events.ControlListener; //導入依賴的package包/類
public void removeControlListener(ControlListener listener) {
column.removeControlListener(listener);
}
示例9: addControlListener
import org.eclipse.swt.events.ControlListener; //導入依賴的package包/類
public void addControlListener(ControlListener listener) {
treeColumn.addControlListener(listener);
}
示例10: removeControlListener
import org.eclipse.swt.events.ControlListener; //導入依賴的package包/類
public void removeControlListener(ControlListener listener) {
treeColumn.removeControlListener(listener);
}
示例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);
}
}
示例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);
}
示例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) {}
});
}
示例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) {}
});
}
示例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);
}