org.eclipse.draw2d.Button Java Examples

The following examples show how to use org.eclipse.draw2d.Button. 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: XYGraphToolbar.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void addSnapshotButton() {
	Button snapShotButton = new Button(XYGraphMediaFactory.getInstance().getImage("images/camera.png"));
	snapShotButton.setToolTip(new Label("Save Snapshot to PNG file"));
	addButton(snapShotButton);
	snapShotButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent event) {
			// Have valid name, so get image
			ImageLoader loader = new ImageLoader();
			Image image = xyGraph.getImage();
			loader.data = new ImageData[] { image.getImageData() };
			image.dispose();
			// Prompt for file name
			String path = SingleSourceHelper2.getImageSavePath();
			if (path == null || path.length() <= 0)
				return;
			// Assert *.png at end of file name
			if (!path.toLowerCase().endsWith(".png"))
				path = path + ".png";
			// Save
			loader.save(path, SWT.IMAGE_PNG);
		}
	});
}
 
Example #2
Source File: ImageTest.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
private static Figure createContents() {
	Figure contents = new Figure();
	XYLayout layout = new XYLayout();
	contents.setLayoutManager(layout);

	Button button = new Button("Hello World");
	layout.setConstraint(button, new Rectangle(0, 0, -1, -1));
	contents.add(button);

	button.addActionListener(new ActionListener() {

		public void actionPerformed(ActionEvent actionevent) {
			setBrightness();
		}
	});

	String path = "C:\\Users\\Public\\Pictures\\Sample Pictures\\Oryx Antelope.jpg";
	image = new Image(Display.getDefault(), path);
	imageFigure = new ImageFigure(image);

	layout.setConstraint(imageFigure, new Rectangle(0, 30, -1, -1));

	contents.add(imageFigure);

	return contents;
}
 
Example #3
Source File: ImageTest.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private static Figure createContents() {
    final Figure contents = new Figure();
    final XYLayout layout = new XYLayout();
    contents.setLayoutManager(layout);

    final Button button = new Button("Hello World");
    layout.setConstraint(button, new Rectangle(0, 0, -1, -1));
    contents.add(button);

    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent actionevent) {
            setBrightness();
        }
    });

    final String path = "C:\\Users\\Public\\Pictures\\Sample Pictures\\Oryx Antelope.jpg";
    image = new Image(Display.getDefault(), path);
    imageFigure = new ImageFigure(image);

    layout.setConstraint(imageFigure, new Rectangle(0, 30, -1, -1));

    contents.add(imageFigure);

    return contents;
}