本文整理匯總了Java中org.eclipse.swt.widgets.Canvas.setLayoutData方法的典型用法代碼示例。如果您正苦於以下問題:Java Canvas.setLayoutData方法的具體用法?Java Canvas.setLayoutData怎麽用?Java Canvas.setLayoutData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Canvas
的用法示例。
在下文中一共展示了Canvas.setLayoutData方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createPartControl
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
/**
* This operation sets up the Composite that contains the VisIt canvas and
* create the VisIt widget.
*
* @param parent
* The parent Composite to create the Control in.
*/
@Override
public void createPartControl(Composite parent) {
// Create a top level composite to hold the canvas or text
vizComposite = new Composite(parent, SWT.NONE);
vizComposite.setLayout(new GridLayout(1, true));
// Set up the canvas where the graph is displayed
plotCanvas = new Canvas(vizComposite, SWT.BORDER);
plotCanvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// MAGIC
lws = new LightweightSystem(plotCanvas);
return;
}
示例2: createPartControl
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
/**
* This is a callback that will allow us
* to create the viewer and initialize it.
*/
@Override
public void createPartControl(Composite parent) {
paintCanvas = new Canvas(parent, SWT.NONE);
GridData gridData = new GridData(GridData.FILL_BOTH);
paintCanvas.setLayoutData(gridData);
// paintSurface
paintSurface = new PaintSurface(paintCanvas, parent.getDisplay().getSystemColor(
SWT.COLOR_WHITE));
tooltip = new ToolTipHandler(parent.getShell());
tooltip.activateHoverHelp(paintCanvas);
PlatformUI.getWorkbench().getHelpSystem().setHelp(paintCanvas,
"de.loskutov.eclipse.jdepend.jdepend"); //$NON-NLS-1$
if (packages != null) {
redrawPackages(packages);
}
}
示例3: initialize
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
private void initialize(Composite composite) {
GridData gridData;
downSpeedCanvas = new Canvas(composite, SWT.DOUBLE_BUFFERED);
gridData = new GridData(GridData.FILL_BOTH);
downSpeedCanvas.setLayoutData(gridData);
downSpeedGraphic = SpeedGraphic.getInstance();
downSpeedGraphic.initialize(downSpeedCanvas);
//downSpeedGraphic.setAutoAlpha(true);
SWTSkinProperties skinProperties = SWTSkinFactory.getInstance().getSkinProperties();
Color cBG1 = skinProperties.getColor("color.topbar.speed.bg1");
Color cBG2 = skinProperties.getColor("color.topbar.speed.bg2");
Color cBG3 = skinProperties.getColor("color.topbar.speed.bg3");
downSpeedGraphic.setColors(cBG1, cBG2, cBG3);
downSpeedGraphic.setLineColors(skinProperties.getColor("color.topbar.speed.average"),
skinProperties.getColor("color.topbar.speed.value0"),
skinProperties.getColor("color.topbar.speed.overhead"),
skinProperties.getColor("color.topbar.speed.value1"),
skinProperties.getColor("color.topbar.speed.value2plus"),
skinProperties.getColor("color.topbar.speed.trimmed"));
}
示例4: main
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
/**
* main() method for constructing the layout.
*
* @param args
*/
public static void main( String[] args )
{
Display display = Display.getDefault( );
Shell shell = new Shell( display );
shell.setSize( 600, 400 );
shell.setLayout( new GridLayout( ) );
Canvas cCenter = new Canvas( shell, SWT.NONE );
AutoDataBindingViewer adbv = new AutoDataBindingViewer( );
cCenter.setLayoutData( new GridData( GridData.FILL_BOTH ) );
cCenter.addPaintListener( adbv );
shell.open( );
while ( !shell.isDisposed( ) )
{
if ( !display.readAndDispatch( ) )
display.sleep( );
}
display.dispose( );
}
示例5: main
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
/**
* main() method for constructing the layout.
*
* @param args
*/
public static void main( String[] args )
{
Display display = Display.getDefault( );
Shell shell = new Shell( display );
shell.setSize( 600, 400 );
shell.setLayout( new GridLayout( ) );
Canvas cCenter = new Canvas( shell, SWT.NONE );
StyleChartViewer cv = new StyleChartViewer( );
cCenter.setLayoutData( new GridData( GridData.FILL_BOTH ) );
cCenter.addPaintListener( cv );
shell.open( );
while ( !shell.isDisposed( ) )
{
if ( !display.readAndDispatch( ) )
display.sleep( );
}
display.dispose( );
}
示例6: createPreviewArea
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
private void createPreviewArea( Composite parent )
{
Composite cmpPreview = ChartUIUtil.createCompositeWrapper( parent );
{
GridData gridData = new GridData( GridData.FILL_BOTH );
gridData.widthHint = CENTER_WIDTH_HINT;
gridData.heightHint = 200;
cmpPreview.setLayoutData( gridData );
}
Label label = new Label( cmpPreview, SWT.NONE );
{
label.setFont( JFaceResources.getBannerFont( ) );
label.setText( Messages.getString( "TaskSelectData.Label.ChartPreview" ) ); //$NON-NLS-1$
}
previewCanvas = new Canvas( cmpPreview, SWT.BORDER );
{
GridData gd = new GridData( GridData.FILL_BOTH );
previewCanvas.setLayoutData( gd );
previewCanvas.setBackground( Display.getDefault( )
.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) );
}
}
示例7: createTopPreviewArea
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
protected void createTopPreviewArea( Composite parent )
{
Composite cmpPreview = new Composite( parent, SWT.NONE );
cmpPreview.setLayout( new GridLayout( ) );
GridData gridData = new GridData( GridData.FILL_BOTH );
gridData.horizontalSpan = 2;
gridData.heightHint = 270;
cmpPreview.setLayoutData( gridData );
Label label = new Label( cmpPreview, SWT.NONE );
{
label.setText( getChartPreviewTitle( ) );
}
previewCanvas = new Canvas( cmpPreview, SWT.BORDER );
previewCanvas.setLayoutData( new GridData( GridData.FILL_BOTH ) );
previewCanvas.setBackground( Display.getDefault( )
.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ) );
previewPainter = createPreviewPainter( );
}
示例8: createCompositeOutputHeader
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
/**
* This method initializes compositeOutputHeader
*
*/
private void createCompositeOutputHeader() {
final Color background = getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
GridLayout gridLayout3 = new GridLayout();
gridLayout3.numColumns = 2;
GridData gridData1 = new org.eclipse.swt.layout.GridData();
gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
gridData1.grabExcessHorizontalSpace = true;
gridData1.grabExcessVerticalSpace = false;
gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
compositeOutputHeader = new Composite(compositeOutput, SWT.NONE);
compositeOutputHeader.setBackground(background);
compositeOutputHeader.setLayoutData(gridData1);
compositeOutputHeader.setLayout(gridLayout3);
createToolBar();
GridData gridData6 = new org.eclipse.swt.layout.GridData();
gridData6.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
gridData6.heightHint = 16;
gridData6.widthHint = 104;
gridData6.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
canvas = new Canvas(compositeOutputHeader, SWT.NONE);
canvas.setLayoutData(gridData6);
canvas.setVisible(true);
}
示例9: createCompositeOutputHeader
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
private void createCompositeOutputHeader() {
final Color background = getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
GridLayout gridLayout3 = new GridLayout();
gridLayout3.numColumns = 2;
GridData gridData1 = new org.eclipse.swt.layout.GridData();
gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
gridData1.grabExcessHorizontalSpace = true;
gridData1.grabExcessVerticalSpace = false;
gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
compositeOutputHeader = new Composite(compositeOutput, SWT.NONE);
compositeOutputHeader.setBackground(background);
compositeOutputHeader.setLayoutData(gridData1);
compositeOutputHeader.setLayout(gridLayout3);
createToolBar();
GridData gridData6 = new org.eclipse.swt.layout.GridData();
gridData6.horizontalAlignment = org.eclipse.swt.layout.GridData.END;
gridData6.heightHint = 16;
gridData6.widthHint = 104;
gridData6.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING;
canvas = new Canvas(compositeOutputHeader, SWT.NONE);
canvas.setLayoutData(gridData6);
canvas.setVisible(false);
}
示例10: createEyeViewControl
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
public void createEyeViewControl(Composite parent) {
Canvas canvas = new Canvas(parent, SWT.NONE);
canvas.setLayoutData(new GridData(GridData.FILL_BOTH));
LightweightSystem liSystem = new LightweightSystem(canvas);
ScalableFreeformRootEditPart rootEditPart = ((ScalableFreeformRootEditPart) dbToolGefEditor.getGraphicalViewer().getRootEditPart());
ScrollableThumbnail thumbnail = new ScrollableThumbnail((Viewport) rootEditPart.getFigure());
thumbnail.setSource(rootEditPart.getLayer(LayerConstants.SCALABLE_LAYERS));
liSystem.setContents(thumbnail);
}
示例11: main
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
public static void main(String[] args) {
Shell shell = new Shell(new Display());
shell.setSize(1200, 500);
shell.setLayout(new GridLayout());
shell.setLocation(100, 150);
Figure root = new Figure();
root.setFont(shell.getFont());
// XYLayout layout = new XYLayout();
// root.setLayoutManager(layout);
org.eclipse.draw2d.GridLayout layout = new org.eclipse.draw2d.GridLayout(2,false);
layout.horizontalSpacing = 100;
root.setLayoutManager(layout);
Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
canvas.setBackground(ColorConstants.white);
canvas.setLayoutData(new GridData(GridData.FILL_BOTH));
createDiagram(root);
LightweightSystem lws = new LightweightSystem(canvas);
lws.setContents(root);
Display display = shell.getDisplay();
shell.open();
while (!shell.isDisposed()) {
while (!display.readAndDispatch()) {
display.sleep();
}
}
}
示例12: main
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
public static void main(String[] args) {
Shell shell = new Shell(new Display());
shell.setSize(1200, 500);
shell.setLayout(new GridLayout());
shell.setLocation(100, 150);
Figure root = new Figure();
root.setFont(shell.getFont());
// XYLayout layout = new XYLayout();
// root.setLayoutManager(layout);
org.eclipse.draw2d.GridLayout layout = new org.eclipse.draw2d.GridLayout(2,false);
layout.horizontalSpacing = 100;
root.setLayoutManager(layout);
Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
canvas.setBackground(ColorConstants.white);
canvas.setLayoutData(new GridData(GridData.FILL_BOTH));
MatrixWidget widget = new MatrixWidget();
MockArray array = new MockArray("int[]", new int[]{1,2,3}, new int[]{4,5,6}, new int[]{7,8,9}, new int[]{10,11,12});
root.add(widget.createFigure(array));
LightweightSystem lws = new LightweightSystem(canvas);
lws.setContents(root);
Display display = shell.getDisplay();
shell.open();
while (!shell.isDisposed()) {
while (!display.readAndDispatch()) {
display.sleep();
}
}
}
示例13: main
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
public static void main(String[] args) {
Shell shell = new Shell(new Display());
shell.setSize(365, 280);
shell.setLayout(new GridLayout());
Figure root = new Figure();
root.setFont(shell.getFont());
XYLayout layout = new XYLayout();
root.setLayoutManager(layout);
Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
canvas.setBackground(ColorConstants.white);
canvas.setLayoutData(new GridData(GridData.FILL_BOTH));
VarParser parser = new VarParser("src/pt/iscte/pandionj/tests/Test.java");
parser.run();
System.out.println(parser.toText());
createDiagram(root, parser);
LightweightSystem lws = new LightweightSystem(canvas);
lws.setContents(root);
Display display = shell.getDisplay();
shell.open();
while (!shell.isDisposed()) {
while (!display.readAndDispatch()) {
display.sleep();
}
}
}
示例14: createAnnotationInformation
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
private void createAnnotationInformation(Composite parent, final Annotation annotation) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 2;
layout.marginWidth = 2;
layout.horizontalSpacing = 0;
composite.setLayout(layout);
final Canvas canvas = new Canvas(composite, SWT.NO_FOCUS);
GridData gridData = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
gridData.widthHint = 17;
gridData.heightHint = 16;
canvas.setLayoutData(gridData);
canvas.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
e.gc.setFont(null);
fMarkerAnnotationAccess.paint(annotation, e.gc, canvas, new Rectangle(0, 0, 16, 16));
}
});
StyledText text = new StyledText(composite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
text.setLayoutData(data);
String annotationText = annotation.getText();
if (annotationText != null)
text.setText(annotationText);
}
示例15: createAnnotationInformation
import org.eclipse.swt.widgets.Canvas; //導入方法依賴的package包/類
private void createAnnotationInformation(Composite parent, final Annotation annotation) {
Composite composite= new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
GridLayout layout= new GridLayout(2, false);
layout.marginHeight= 2;
layout.marginWidth= 2;
layout.horizontalSpacing= 0;
composite.setLayout(layout);
final Canvas canvas= new Canvas(composite, SWT.NO_FOCUS);
GridData gridData= new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
gridData.widthHint= 17;
gridData.heightHint= 16;
canvas.setLayoutData(gridData);
canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setFont(null);
fMarkerAnnotationAccess.paint(annotation, e.gc, canvas, new Rectangle(0, 0, 16, 16));
}
});
StyledText text= new StyledText(composite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
GridData data= new GridData(SWT.FILL, SWT.FILL, true, true);
text.setLayoutData(data);
String annotationText= annotation.getText();
if (annotationText != null)
text.setText(annotationText);
}