org.eclipse.swt.layout.FillLayout Java Examples

The following examples show how to use org.eclipse.swt.layout.FillLayout. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiScope_ScopeWithDataAndProgression2Channels_2.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create contents of the window.
 */
protected static void createContents() {
	shell = new Shell();
	shell.setText("Nebula Oscilloscope");
	shell.setLayout(new FillLayout());

	// Create a single channel scope
	final Oscilloscope scope = new Oscilloscope(2, shell, SWT.NONE);
	scope.addControlListener(new ControlAdapter() {
		@Override
		public void controlResized(ControlEvent e) {
			scope.setProgression(0, ((Oscilloscope) e.widget).getSize().x);
			scope.setProgression(1, ((Oscilloscope) e.widget).getSize().x);
		}
	});

	scope.addStackListener(0, getStackAdapter());
	scope.addStackListener(1, getStackAdapter());

	scope.getDispatcher(0).dispatch();

}
 
Example #2
Source File: SWTTimeSeriesDemo.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.
 */
public static void main(String[] args) {
    final JFreeChart chart = createChart(createDataset());
    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(600, 300);
    shell.setLayout(new FillLayout());
    shell.setText("Time series demo for jfreechart running with SWT");
    ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true);
    frame.setDisplayToolTips(true);
    frame.setHorizontalAxisTrace(false);
    frame.setVerticalAxisTrace(false);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}
 
Example #3
Source File: SWTMultipleAxisDemo1.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.
 */
public static void main(String[] args)
{
    final JFreeChart chart = createChart();
    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(600, 300);
    shell.setLayout(new FillLayout());
    shell.setText("Test for jfreechart running with SWT");
    ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true);
    frame.setDisplayToolTips(false);
    frame.setHorizontalAxisTrace(true);
    frame.setVerticalAxisTrace(true);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}
 
Example #4
Source File: SWTBarChartDemo1.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.
 */
public static void main(String[] args) {
    JFreeChart chart = createChart(createDataset());
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(600, 300);
    shell.setLayout(new FillLayout());
    shell.setText("Test for jfreechart running with SWT");
    ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart,
            true);
    frame.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}
 
Example #5
Source File: GridSnippet2.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout(new FillLayout());

    Grid grid = new Grid(shell,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    grid.setHeaderVisible(true);
    GridColumn column = new GridColumn(grid,SWT.NONE);
    column.setText("Column 1");
    column.setWidth(100);
    GridColumn column2 = new GridColumn(grid,SWT.NONE);
    column2.setText("Column 2");
    column2.setWidth(100);
    GridItem item1 = new GridItem(grid,SWT.NONE);
    item1.setText("First Item");
    item1.setText(1,"xxxxxxx");
    GridItem item2 = new GridItem(grid,SWT.NONE);
    item2.setText("This cell spans both columns");
    item1.setText(1,"xxxxxxx");
    item2.setColumnSpan(0,1);
    GridItem item3 = new GridItem(grid,SWT.NONE);
    item3.setText("Third Item");
    item1.setText(1,"xxxxxxx");
    
    shell.setSize(200,200);
    shell.open ();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}
 
Example #6
Source File: CalendarComboTester.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param args
 */
public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display);
   shell.setText("Button Composite Tester");
   shell.setSize(200, 400);

   shell.setLayout(new FillLayout());
   Composite inner = new Composite(shell, SWT.None);
   GridLayout gl = new GridLayout(1, true);
   inner.setLayout(gl);

   createExample(inner);

   shell.open();

   while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
         display.sleep();
      }
   }
   display.dispose();
}
 
Example #7
Source File: GridViewerSnippetDisposePerformance.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param args
 */
public static void main(String[] args)
{
	Display display = new Display();

	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	new GridViewerSnippetDisposePerformance(shell, true);
	shell.open();

	while (!shell.isDisposed())
	{
		if (!display.readAndDispatch())
			display.sleep();
	}

	display.dispose();

}
 
Example #8
Source File: GridPrintExample.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Executes the GridPrint example.
 * 
 * @param args
 *            the command line arguments.
 */
public static void main(String[] args) {
	final Display display = new Display();

	Shell shell = new Shell(display, SWT.SHELL_TRIM);
	shell.setLayout(new FillLayout());
	shell.setSize(600, 600);

	final PrintViewer preview = new PrintViewer(shell, SWT.BORDER);
	preview.setPrint(createPrint());

	shell.open();

	while (!shell.isDisposed())
		if (!display.readAndDispatch())
			display.sleep();

	PaperClips.print(new PrintJob("GridPrintExample", createPrint()),
			new PrinterData());
}
 
Example #9
Source File: GridViewerSnippetDisposeTreeTest.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public static void main(String[] args)
{
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	new GridViewerSnippetDisposeTreeTest(shell);
	shell.open();

	while (!shell.isDisposed())
	{
		if (!display.readAndDispatch())
			display.sleep();
	}

	display.dispose();
}
 
Example #10
Source File: GridViewerShortTextPerformance.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param args
 */
public static void main(String[] args)
{
	Display display = new Display();

	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	new GridViewerShortTextPerformance(shell);
	shell.open();

	while (!shell.isDisposed())
	{
		if (!display.readAndDispatch())
			display.sleep();
	}

	display.dispose();

}
 
Example #11
Source File: GridViewerSnippetWithGridItemDataVisualizer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param args
 */
public static void main(String[] args) {
	Display display = new Display();

	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	new GridViewerSnippetWithGridItemDataVisualizer(shell);
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}

	display.dispose();

}
 
Example #12
Source File: BlurredPanel.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Show the blurred panel
 */
public void show() {
	if (parent.isDisposed()) {
		SWT.error(SWT.ERROR_WIDGET_DISPOSED);
	}

	panel = new Shell(parent, SWT.APPLICATION_MODAL | SWT.NO_TRIM);
	panel.setLayout(new FillLayout());

	panel.addListener(SWT.KeyUp, event -> {
		event.doit = false;
	});

	canvas = new Canvas(panel, SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED);
	canvas.addPaintListener(event -> {
		paintCanvas(event);
	});

	panel.setBounds(panel.getDisplay().map(parent, null, parent.getClientArea()));
	panel.open();

}
 
Example #13
Source File: CDTEditorSample.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param args
 */
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	new CDTEditorSample(shell);
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}

	display.dispose();

}
 
Example #14
Source File: TimelineComposite.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public TimelineComposite(Composite parent, int style) {
	super(parent, style);

	fResourceManager = new LocalResourceManager(JFaceResources.getResources(), this);

	final FillLayout layout = new FillLayout();
	layout.marginHeight = 10;
	layout.marginWidth = 10;
	setLayout(layout);

	setBackground(ColorConstants.black);

	final Canvas canvas = new Canvas(this, SWT.DOUBLE_BUFFERED);
	canvas.setBackground(ColorConstants.black);
	final LightweightSystem lightWeightSystem = new LightweightSystem(canvas);

	fRootFigure = new RootFigure(fResourceManager);
	fRootFigure.setFont(parent.getFont());
	lightWeightSystem.setContents(fRootFigure);

	// draw2d does not directly support mouseWheelEvents, so register on canvas
	canvas.addMouseWheelListener(new TimelineScaler(this));
}
 
Example #15
Source File: CompositeTableSnippet0.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setText("CompositeTable Snippet 0 -- Display a header and some rows");
    shell.setLayout(new FillLayout());

    CompositeTable table = new CompositeTable(shell, SWT.NULL);
    new Header(table, SWT.NULL); // Just drop the Header and Row in that order...
    new Row(table, SWT.NULL);
    table.setRunTime(true);
    table.setNumRowsInCollection(40); // some arbitrary number for now
    
    shell.setSize(500, 150);
    shell.open ();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}
 
Example #16
Source File: CompositeTableSnippet1.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setText("CompositeTable Snippet 1 -- Display first/last name");
    shell.setLayout(new FillLayout());

    CompositeTable table = new CompositeTable(shell, SWT.NULL);
    new Header(table, SWT.NULL); // Just drop the Header and Row in that order...
    new Row(table, SWT.NULL);
    table.setRunTime(true);
    table.setNumRowsInCollection(swtCommitters.length);
    
    // Note the JFace-like virtual table API
    table.addRowContentProvider((sender,currentObjectOffset,rowControl) -> {
			Row row = (Row) rowControl;
			row.firstName.setText(swtCommitters[currentObjectOffset].first);
			row.lastName.setText(swtCommitters[currentObjectOffset].last);
    });
    
    shell.setSize(500, 150);
    shell.open ();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}
 
Example #17
Source File: CalculatorSnippet.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setLayout(new FillLayout(SWT.VERTICAL));

	final Calculator calc = new Calculator(shell, SWT.NONE);

	calc.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(final ModifyEvent e) {
			System.out.println("New value is " + calc.getValue());

		}
	});

	shell.pack();
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();
}
 
Example #18
Source File: DarkPanel.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Show the dark panel
 */
public void show() {
	if (parent.isDisposed()) {
		SWT.error(SWT.ERROR_WIDGET_DISPOSED);
	}

	panel = new Shell(parent, SWT.APPLICATION_MODAL | SWT.NO_TRIM);
	panel.setLayout(new FillLayout());
	panel.setAlpha(alpha);

	panel.addListener(SWT.KeyUp, event -> {
		event.doit = false;
	});

	canvas = new Canvas(panel, SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED);
	canvas.addPaintListener(event -> {
		paintCanvas(event);
	});

	panel.setBounds(panel.getDisplay().map(parent, null, parent.getClientArea()));
	panel.open();
}
 
Example #19
Source File: CollapsibleButtonsExampleTab.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Control createControl(Composite parent) {

	itemImage24 = new Image(PlatformUI.getWorkbench().getDisplay(), PlatformUI.getWorkbench().getDisplay().getSystemImage(SWT.ICON_WORKING).getImageData().scaledTo(24, 24));
	itemImage16 = new Image(PlatformUI.getWorkbench().getDisplay(), PlatformUI.getWorkbench().getDisplay().getSystemImage(SWT.ICON_WORKING).getImageData().scaledTo(16, 16));

	parent.setLayout(new FillLayout());

	Composite inner = new Composite(parent, SWT.NONE);
	GridLayout gl = new GridLayout(1, true);
	gl.marginBottom = 0;
	gl.marginHeight = 0;
	gl.marginWidth = 0;
	gl.marginHeight = 0;
	inner.setLayout(gl);

	collapsibleButtons = new CollapsibleButtons(inner, SWT.NONE, IColorManager.SKIN_OFFICE_2007);
	collapsibleButtons.setLayoutData(
			new GridData(GridData.GRAB_VERTICAL | GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_END));

	for (int i = 0; i < 5; i++) {
		collapsibleButtons.addButton("Button " + i, "Tooltip " + i, itemImage24, itemImage16);
	}

	return collapsibleButtons;
}
 
Example #20
Source File: GridSnippet1.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout(new FillLayout());

    Grid grid = new Grid(shell,/*SWT.BORDER |*/ SWT.V_SCROLL | SWT.H_SCROLL);
  //  grid.setHeaderVisible(true);
    GridColumn column = new GridColumn(grid,SWT.NONE);
   // column.setTree(true);
   // column.setText("Column 1");
  //  column.setWidth(100);
    GridItem item1 = new GridItem(grid,SWT.NONE);
    item1.setText("Root Item");
    GridItem item2 = new GridItem(grid,SWT.NONE);
    item2.setText("Second item");
    GridItem item3 = new GridItem(grid,SWT.NONE);
    item3.setText("Third Item");
    
    shell.setSize(200,200);
    shell.open ();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}
 
Example #21
Source File: GridViewerSnippetWithAdaptedDataVisualizer.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @param args
 */
public static void main(String[] args) {
	Display display = new Display();

	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	new GridViewerSnippetWithAdaptedDataVisualizer(shell);
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}

	display.dispose();

}
 
Example #22
Source File: FirstPart.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
@PostConstruct
public void createComposite(final Composite parent) {
	parent.setLayout(new FillLayout());

	grid = new Grid(parent,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    grid.setHeaderVisible(true);
    GridColumn column = new GridColumn(grid,SWT.NONE);
    column.setTree(true);
    column.setText("Column 1");
    column.setWidth(100);
    GridItem item1 = new GridItem(grid,SWT.NONE);
    item1.setText("Root Item");
    GridItem item2 = new GridItem(item1,SWT.NONE);
    item2.setText("Second item");
    GridItem item3 = new GridItem(item2,SWT.NONE);
    item3.setText("Third Item");

	grid.setData(CSS_ID, "one");

}
 
Example #23
Source File: MultiScope_ScopeWithDataAndProgression2Channels_1.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create contents of the window.
 */
protected static void createContents() {
	shell = new Shell();
	shell.setText("Nebula Oscilloscope");
	shell.setLayout(new FillLayout());

	// Create a single channel scope
	final Oscilloscope scope = new Oscilloscope(2, shell, SWT.NONE);
	scope.addListener(SWT.Resize, e -> {
		scope.setProgression(0, ((Oscilloscope) e.widget).getSize().x);
		scope.setProgression(1, ((Oscilloscope) e.widget).getSize().x);
	});

	OscilloscopeStackAdapter stackAdapter = getStackAdapter();
	scope.addStackListener(0, stackAdapter);
	scope.addStackListener(1, stackAdapter);

	scope.getDispatcher(0).dispatch();

}
 
Example #24
Source File: SWTPieChartDemo1.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.
 */
public static void main(String[] args) 
{
    JFreeChart chart = createChart(createDataset());
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(600, 400);
    shell.setLayout(new FillLayout());
    shell.setText("Test for jfreechart running with SWT");
    final ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true);
    //frame.setDisplayToolTips(false);
    frame.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}
 
Example #25
Source File: GridSnippetBug472289.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());

	Grid grid = new Grid(shell, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	grid.setHeaderVisible(true);
	grid.setMoveOnTab(true);

	GridColumn column = new GridColumn(grid, SWT.NONE);
	column.setText("Column 1");
	column.setWidth(100);
	GridColumn column2 = new GridColumn(grid, SWT.NONE);
	column2.setText("Column 2");
	column2.setWidth(100);
	GridItem item1 = new GridItem(grid, SWT.NONE);
	item1.setText("First Item");
	item1.setText(1, "xxxxxxx");
	GridItem item2 = new GridItem(grid, SWT.NONE);
	item2.setText("This cell spans both columns");
	item1.setText(1, "xxxxxxx");
	item2.setColumnSpan(0, 1);
	GridItem item3 = new GridItem(grid, SWT.NONE);
	item3.setText("Third Item");
	item1.setText(1, "xxxxxxx");

	shell.setSize(200, 200);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
 
Example #26
Source File: GridViewerSnippet3.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	new GridViewerSnippet3(shell);
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}

	display.dispose();
}
 
Example #27
Source File: Snippet026TreeViewerTabEditing.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	new Snippet026TreeViewerTabEditing(shell);
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}

	display.dispose();
}
 
Example #28
Source File: Translator.java    From hop with Apache License 2.0 5 votes vote down vote up
public void open() {
  shell = new Shell( display );
  shell.setLayout( new FillLayout() );
  shell.setText( APP_NAME );
  shell.setImage( GuiResource.getInstance().getImageLogoSmall() );

  try {
    readFiles();
  } catch ( Exception e ) {
    new ErrorDialog(
      shell, "Error reading translations", "There was an unexpected error reading the translations", e );
  }

  // Put something on the screen
  sashform = new SashForm( shell, SWT.HORIZONTAL );
  sashform.setLayout( new FormLayout() );

  addLists();
  addGrid();
  addListeners();

  sashform.setWeights( new int[] { 30, 70 } );
  sashform.setVisible( true );

  shell.pack();

  refresh();

  wPackages.optWidth( true );
  wPackages.getTable().getColumn( 1 ).setWidth( 1 );

  BaseTransformDialog.setSize( shell);

  shell.open();
}
 
Example #29
Source File: TimelineUsingEMFModel.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Create contents of the window.
 */
protected void createContents() {
	shell = new Shell();
	shell.setSize(450, 300);
	shell.setText("SWT Application");
	shell.setLayout(new FillLayout(SWT.HORIZONTAL));

	populateModel(shell);
}
 
Example #30
Source File: HeapManagerSnippet.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());

	new HeapManager(shell, SWT.NONE);

	final int[] counter = new int[1];
	counter[0] = 1;

	display.timerExec(10, new Runnable() {

		@Override
		public void run() {
			for (int i = 0; i < 10000; i++) {
				@SuppressWarnings("unused")
				final String[] temp = new String[1000];
			}
			counter[0]++;
			if (counter[0] < 100) {
				display.timerExec(10, this);
			}
		}
	});

	shell.pack();
	shell.open();

	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
	display.dispose();
}