org.eclipse.draw2d.ActionListener Java Examples

The following examples show how to use org.eclipse.draw2d.ActionListener. 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: DropDownMenuFigure.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public DropDownMenuFigure(final ImageFigure image,IFigure parent, IFigure layer, String tooltip){
	super(image);
	setToolTip(new Label(tooltip));
	this.parent = parent ;
	this.layer = layer;
	location = parent.getBounds().getLocation().getCopy();
	listeners = new ArrayList<Listener>() ;
	ButtonModel bModel = createDefaultModel();
	bModel.addActionListener(new ActionListener() {

		public void actionPerformed(ActionEvent arg0) {
			switchVisible();
			fireVisibilityChanged() ;
		}
	});
	setModel(bModel);

}
 
Example #3
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 #4
Source File: RoundDetailsPart.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private Figure makeHeader ()
{
    this.button = new CheckBox ( "Active" );

    this.button.getModel ().addActionListener ( new ActionListener () {

        @Override
        public void actionPerformed ( final ActionEvent event )
        {
            setEnabled ( RoundDetailsPart.this.button.getModel ().isSelected () );
        }
    } );

    return this.button;
}
 
Example #5
Source File: BooleanAlarmDetails.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private Figure makeHeader ()
{
    this.button = new CheckBox ( Messages.BooleanAlarmDetails_active );

    this.button.getModel ().addActionListener ( new ActionListener () {

        @Override
        public void actionPerformed ( final ActionEvent event )
        {
            setEnabled ( BooleanAlarmDetails.this.button.getModel ().isSelected () );
        }
    } );

    return this.button;
}
 
Example #6
Source File: InputScaleDetails.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private Figure makeHeader ()
{
    this.button = new CheckBox ( "Active" );

    this.button.getModel ().addActionListener ( new ActionListener () {

        @Override
        public void actionPerformed ( final ActionEvent event )
        {
            setEnabled ( InputScaleDetails.this.button.getModel ().isSelected () );
        }
    } );

    return this.button;
}
 
Example #7
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;
}