Java Code Examples for org.eclipse.swt.layout.FillLayout

The following examples show how to use org.eclipse.swt.layout.FillLayout. These examples are extracted from open source projects. 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 Project: openstock   Source File: SWTBarChartDemo1.java    License: 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 2
Source Project: openstock   Source File: SWTPieChartDemo1.java    License: 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 3
/**
 * 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 Project: openstock   Source File: SWTTimeSeriesDemo.java    License: 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 5
Source Project: nebula   Source File: CalendarComboTester.java    License: 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 6
/**
 * @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 7
Source Project: nebula   Source File: GridPrintExample.java    License: 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 8
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 9
/**
 * @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 10
/**
 * @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 11
Source Project: nebula   Source File: BlurredPanel.java    License: 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 12
/**
 * @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 13
Source Project: nebula   Source File: CDTEditorSample.java    License: 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 Project: nebula   Source File: TimelineComposite.java    License: 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 Project: nebula   Source File: CompositeTableSnippet0.java    License: 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 Project: nebula   Source File: CompositeTableSnippet1.java    License: 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 Project: nebula   Source File: CalculatorSnippet.java    License: 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 Project: nebula   Source File: DarkPanel.java    License: 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
@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 Project: nebula   Source File: GridSnippet1.java    License: 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 Project: nebula   Source File: FirstPart.java    License: 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 22
/**
 * 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 23
/**
 * 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 24
Source Project: nebula   Source File: InternalCompositeTable.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Initialize the sliderHolder and slider. The SliderHolder is a Composite
 * that is responsible for showing and hiding the vertical slider upon
 * request.
 */
private void createVSliderHolder() {
	GridData gd = getVSliderGridData();
	vSliderHolder = new Composite(this, SWT.NULL);
	vSlider = new Slider(vSliderHolder, SWT.VERTICAL);
	vSlider.addSelectionListener(sliderSelectionListener);
	vSliderHolder.setLayout(new FillLayout());
	vSliderHolder.setLayoutData(gd);
	vSliderHolder.setTabList(new Control[] {});
}
 
Example 25
Source Project: nebula   Source File: InternalCompositeTable.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Initialize the sliderHolder and slider. The SliderHolder is a Composite
 * that is responsible for showing and hiding the vertical slider upon
 * request.
 */
private void createHSliderHolder() {
	GridData gd = getHSliderGridData();
	hSliderHolder = new Composite(this, SWT.NULL);
	hSlider = new Slider(hSliderHolder, SWT.HORIZONTAL);
	hSlider.setMinimum(0);
	hSlider.setIncrement(20);
	hSlider.addSelectionListener(sliderSelectionListener);
	hSliderHolder.setLayout(new FillLayout());
	hSliderHolder.setLayoutData(gd);
	hSliderHolder.setTabList(new Control[] {});
	hSlider.addSelectionListener(hSliderSelectionListener);
}
 
Example 26
Source Project: MergeProcessor   Source File: WorkspaceMergeDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create the table viewer for showing warnings.
 * 
 * @param parent the parent composite of the table viewer
 * @return the table viewer
 */
private static ListViewer createWarningsTableViewer(final Composite parent) {
	final Composite composite = new Composite(parent, SWT.NONE);
	composite.setLayout(new FillLayout());
	GridDataFactory.fillDefaults().span(2, 1).grab(true, true).exclude(true).applyTo(composite);
	final ListViewer tableViewer = new ListViewer(composite);
	tableViewer.setContentProvider(ArrayContentProvider.getInstance());
	tableViewer.setLabelProvider(new LabelProvider());
	return tableViewer;
}
 
Example 27
Source Project: MergeProcessor   Source File: HtmlDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Control createDialogArea(Composite parent) {
	final Composite parent2 = (Composite) super.createDialogArea(parent);
	parent2.setLayout(new FillLayout());
	final Browser browser = new Browser(parent2, SWT.NONE);
	browser.setUrl(url);
	return parent2;
}
 
Example 28
Source Project: nebula   Source File: HeapManagerSnippet.java    License: 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();
}
 
Example 29
Source Project: hop   Source File: Translator.java    License: 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 30
Source Project: nebula   Source File: GeoMapTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
protected Widget createUI(Display display) {
	Shell shell = new Shell(display, SWT.SHELL_TRIM);
	shell.setText("GeoMap Widget - SWT Native Map Browsing, Map data from openstreetmap.org");
	shell.setSize(600, 710);
	shell.setLocation(10, 10);
	shell.setLayout(new FillLayout());

	createControls(shell);
	shell.open();

	return shell;
}