本文整理匯總了Java中org.eclipse.swt.events.ControlAdapter類的典型用法代碼示例。如果您正苦於以下問題:Java ControlAdapter類的具體用法?Java ControlAdapter怎麽用?Java ControlAdapter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ControlAdapter類屬於org.eclipse.swt.events包,在下文中一共展示了ControlAdapter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addTabFolderToPropertyWindow
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
/**
* Adds the tab folder to property window.
*
* @return the tab folder
*/
public CTabFolder addTabFolderToPropertyWindow(){
CTabFolder tabFolder = new CTabFolder(container, SWT.NONE);
GridData tabFolderGridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
tabFolder.setLayoutData(tabFolderGridData);
tabFolder.addListener(SWT.FOCUSED,getMouseClickListener() );
container.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
tabFolderGridData.heightHint = container.getBounds().height - 500;
}
});
tabFolder.addListener(SWT.FOCUSED,getMouseClickListener() );
return tabFolder;
}
示例2: arrangeTableViewerColumns
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
/**
* Arrange the columns size in equal ratio
*/
private void arrangeTableViewerColumns() {
tableViewerComposite.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
int totalWidth = tableViewer.getTable().getColumnCount() * COLUMN_WIDTH;
int widthDifference = tableViewerComposite.getSize().x - totalWidth;
if (widthDifference > 0) {
widthDifference = widthDifference / tableViewer.getTable().getColumnCount();
for (TableColumn tableColumn : tableViewer.getTable().getColumns()) {
tableColumn.setWidth(COLUMN_WIDTH+widthDifference);
}
}
}
});
}
示例3: createColumns
import org.eclipse.swt.events.ControlAdapter; //導入依賴的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);
}
}
示例4: TableLayoutComposite
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
/**
* Creates a new <code>TableLayoutComposite</code>.
*
* @param parent
* the parent composite
* @param style
* the SWT style
*/
public TableLayoutComposite(Composite parent, int style) {
super(parent, style);
addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
Rectangle area = getClientArea();
Table table = (Table) getChildren()[0];
Point preferredSize = computeTableSize(table);
int width = area.width - 2 * table.getBorderWidth();
if (preferredSize.y > area.height) {
// Subtract the scrollbar width from the total column
// width
// if a vertical scrollbar will be required
Point vBarSize = table.getVerticalBar().getSize();
width -= vBarSize.x;
}
layoutTable(table, width, area,
table.getSize().x < area.width);
}
});
}
示例5: setupScrolledComposite
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
/**
* Do layout. Several magic #s in here...
*
* @param scrolledComposite
*/
private void setupScrolledComposite() {
setAlwaysShowScrollBars(true);
scrolledCanvas = new Composite(this, SWT.NONE);
GridLayoutFactory.fillDefaults().spacing(0, 0).applyTo(scrolledCanvas);
setMinWidth(100);
setMinHeight(100);
setExpandHorizontal(true);
setExpandVertical(true);
setMinHeight(1);
Point size = scrolledCanvas.computeSize(getParent().getSize().x,
SWT.DEFAULT, true);
scrolledCanvas.setSize(size);
addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
doUpdateContentSize();
updateScrollIncrements();
}
});
setContent(scrolledCanvas);
}
示例6: createPartControl
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
@Override
public void createPartControl(Composite parent) {
scrollComp = new ScrolledComposite(parent, SWT.V_SCROLL);
scrollComp.setLayoutData(new GridData(GridData.FILL_BOTH));
scrollComp.setLayout(new GridLayout(1,false));
scrollComp.setExpandVertical(true);
scrollComp.setExpandHorizontal(true);
scrollComp.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
refreshScrolledHeight();
}
});
mainContainer = new Composite(scrollComp, SWT.BORDER);
mainContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scrollComp.setContent(mainContainer);
mainContainer.setLayout(new ButtonFillLayout());
IWorkbenchPart editor = getContributingPart();
if (editor instanceof CachedSelectionProvider){
CachedSelectionProvider cachedSelEditor = (CachedSelectionProvider)editor;
cachedSelEditor.getSelectionCache().addSelectionChangeListener(selectionListener);
}
}
示例7: install
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
/**
* @param tb
*/
public void install(final GamaToolbar2 tb) {
// We add a control listener to the toolbar in order to install the
// gesture once the control to resize have been created.
tb.addControlListener(new ControlAdapter() {
@Override
public void controlResized(final ControlEvent e) {
final Control c = view.getSizableFontControl();
if (c != null) {
c.addGestureListener(gl);
// once installed the listener removes itself from the
// toolbar
tb.removeControlListener(this);
}
}
});
tb.button("console.increase2", "Increase font size", "Increase font size", e -> changeFontSize(2), SWT.RIGHT);
tb.button("console.decrease2", "Decrease font size", "Decrease font size", e -> changeFontSize(-2), SWT.RIGHT);
tb.sep(16, SWT.RIGHT);
}
示例8: autoAdjustColumnWidth
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
private void autoAdjustColumnWidth(final TableColumn col, final Table table) {
final Composite comp = table.getParent();
comp.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
Rectangle area = comp.getClientArea();
Point preferredSize = comp.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int width = area.width - 2 * comp.getBorderWidth();
if (preferredSize.y > area.height + table.getHeaderHeight()) {
if(comp.getVerticalBar() != null) {
Point vBarSize = comp.getVerticalBar().getSize();
width -= vBarSize.x;
}
}
col.setWidth(width - 75 > 0 ? width - 75 : 0);
comp.setSize(area.width, area.height);
}
});
}
示例9: TableLayoutComposite
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
/**
* Creates a new <code>TableLayoutComposite</code>.
*/
public TableLayoutComposite(Composite parent, int style) {
super(parent, style);
addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
Rectangle area= getClientArea();
Table table= (Table)getChildren()[0];
Point preferredSize= computeTableSize(table);
int width= area.width - 2 * table.getBorderWidth();
if (preferredSize.y > area.height) {
// Subtract the scrollbar width from the total column width
// if a vertical scrollbar will be required
Point vBarSize = table.getVerticalBar().getSize();
width -= vBarSize.x;
}
layoutTable(table, width, area, table.getSize().x < area.width);
}
});
}
示例10: createUI
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
private void createUI(final Composite parent) {
_tk = new FormToolkit(parent.getDisplay());
_scrolledContainer = new ScrolledComposite(parent, SWT.V_SCROLL);
{
_scrolledContent = _tk.createComposite(_scrolledContainer);
GridDataFactory.fillDefaults().applyTo(_scrolledContent);
GridLayoutFactory.swtDefaults().numColumns(1).applyTo(_scrolledContent);
{
createUI_10_StatisticsContainer(_scrolledContent);
}
// setup scrolled container
_scrolledContainer.setExpandVertical(true);
_scrolledContainer.setExpandHorizontal(true);
_scrolledContainer.addControlListener(new ControlAdapter() {
@Override
public void controlResized(final ControlEvent e) {
onResizeScrolledContainer(_scrolledContent);
}
});
_scrolledContainer.setContent(_scrolledContent);
}
}
示例11: defineColumn_30_ColorImage
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
/**
* Column: Color image
*/
private void defineColumn_30_ColorImage() {
final TableViewerColumn tvc = new TableViewerColumn(_colorViewer, SWT.LEAD);
final TableColumn tc = tvc.getColumn();
tc.setWidth(_pc.convertWidthInCharsToPixels(COLUMN_WITH_COLOR_IMAGE));
_tcProfileImage = tc;
_columnIndexProfileImage = _colorViewer.getTable().getColumnCount() - 1;
tc.addControlListener(new ControlAdapter() {
@Override
public void controlResized(final ControlEvent e) {
onResizeImageColumn();
}
});
tvc.setLabelProvider(new CellLabelProvider() {
// !!! set dummy label provider, otherwise an error occures !!!
@Override
public void update(final ViewerCell cell) {}
});
}
示例12: createUI_30_ProfileImage
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
private void createUI_30_ProfileImage(final Composite parent) {
/*
* profile image
*/
_canvasProfileImage = new ImageCanvas(parent, SWT.DOUBLE_BUFFERED);
GridDataFactory.fillDefaults()//
.grab(true, true)
// .minSize(SWT.DEFAULT, 20)
.hint(_pc.convertWidthInCharsToPixels(20), SWT.DEFAULT)
.applyTo(_canvasProfileImage);
_canvasProfileImage.addControlListener(new ControlAdapter() {
@Override
public void controlResized(final ControlEvent e) {
drawProfileImage();
}
});
}
示例13: createUI_52_VertexScrolledContainer
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
private Composite createUI_52_VertexScrolledContainer(final Composite parent) {
// scrolled container
_vertexScrolledContainer = new ScrolledComposite(parent, SWT.V_SCROLL);
GridDataFactory.fillDefaults().grab(true, true).applyTo(_vertexScrolledContainer);
_vertexScrolledContainer.setExpandVertical(true);
_vertexScrolledContainer.setExpandHorizontal(true);
// vertex container
final Composite vertexContainer = new Composite(_vertexScrolledContainer, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).applyTo(vertexContainer);
GridLayoutFactory.fillDefaults()//
.numColumns(6)
.applyTo(vertexContainer);
// vertexContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
_vertexScrolledContainer.setContent(vertexContainer);
_vertexScrolledContainer.addControlListener(new ControlAdapter() {
@Override
public void controlResized(final ControlEvent e) {
_vertexScrolledContainer.setMinSize(vertexContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
});
return vertexContainer;
}
示例14: createUI_568_IL_SpeedTourType_ScrolledContainer
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
private Composite createUI_568_IL_SpeedTourType_ScrolledContainer(final Composite parent) {
// scrolled container
_speedTourType_ScrolledContainer = new ScrolledComposite(parent, SWT.V_SCROLL);
GridDataFactory.fillDefaults().grab(true, true).applyTo(_speedTourType_ScrolledContainer);
_speedTourType_ScrolledContainer.setExpandVertical(true);
_speedTourType_ScrolledContainer.setExpandHorizontal(true);
// container
final Composite speedTTContainer = new Composite(_speedTourType_ScrolledContainer, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).applyTo(speedTTContainer);
GridLayoutFactory
.fillDefaults()//
.numColumns(5)
.applyTo(speedTTContainer);
_speedTourType_ScrolledContainer.setContent(speedTTContainer);
_speedTourType_ScrolledContainer.addControlListener(new ControlAdapter() {
@Override
public void controlResized(final ControlEvent e) {
_speedTourType_ScrolledContainer.setMinSize(speedTTContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
});
return speedTTContainer;
}
示例15: createUI_72_VertexScrolledContainer
import org.eclipse.swt.events.ControlAdapter; //導入依賴的package包/類
private Composite createUI_72_VertexScrolledContainer(final Composite parent) {
// scrolled container
_vertexScrolledContainer = new ScrolledComposite(parent, SWT.V_SCROLL);
GridDataFactory.fillDefaults().grab(false, true).applyTo(_vertexScrolledContainer);
_vertexScrolledContainer.setExpandVertical(true);
_vertexScrolledContainer.setExpandHorizontal(true);
// vertex container
final Composite vertexContainer = new Composite(_vertexScrolledContainer, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(3).applyTo(vertexContainer);
_vertexScrolledContainer.setContent(vertexContainer);
_vertexScrolledContainer.addControlListener(new ControlAdapter() {
@Override
public void controlResized(final ControlEvent e) {
_vertexScrolledContainer.setMinSize(vertexContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
});
return vertexContainer;
}