Package org.joshy.gfx.node.control

Examples of org.joshy.gfx.node.control.Button


            toolbar.add(button);
        }
        EventBus.getSystem().addListener(ActionEvent.Action, new Callback<ActionEvent>(){
            public void call(ActionEvent event) {
                if(event.getSource() == group) {
                    Button btn = group.getSelectedButton();
                    CanvasTool tool = tools.getValue(btn);
                    setSelectedTool(tool);
                }
            }
        });
View Full Code Here


                int n = e.getView().getSelectedIndex();
                setSelectedFill(patternList.getModel().get(n));
                popup.setVisible(false);
            }
        });
        Button addButton = new Button("add image");
        addButton.onClicked(new Callback<ActionEvent>() {
            public void call(ActionEvent actionEvent) throws Exception {
                FileDialog fd = new FileDialog((Frame) null);
                fd.setMode(FileDialog.LOAD);
                fd.setTitle("Open Pattern Image");
                fd.setVisible(true);
                if (fd.getFile() != null) {
                    File file = new File(fd.getDirectory(), fd.getFile());
                    u.p("opening a file" + file);
                    try {
                        PatternPaint pat = PatternPaint.create(file);
                        manager.patternManager.addPattern(pat);
                    } catch (IOException ex) {
                        ex.printStackTrace();
                    }
                }
            }
        });
        Button createButton = new Button("create new");
        createButton.onClicked(new Callback<ActionEvent>() {
            public void call(ActionEvent event) throws Exception {
                final PatternBuilder builder = new PatternBuilder();
                final Stage stage = Stage.createStage();
                Callback<ActionEvent> closeAction = new Callback<ActionEvent>() {
                    public void call(ActionEvent event) throws Exception {
                        PatternPaint pattern = builder.getPattern();
                        manager.patternManager.addPattern(pattern);
                        stage.hide();
                    }
                };
                Callback<ActionEvent> cancelAction = new Callback<ActionEvent>() {
                    public void call(ActionEvent event) throws Exception {
                        stage.hide();
                    }
                };
                stage.setContent(new VFlexBox()
                        .add(builder, 1)
                        .add(new HFlexBox()
                                .add(new Button("cancel").onClicked(cancelAction), 0)
                                .add(new Button("save").onClicked(closeAction), 0)
                                ,0)
                );
                stage.setWidth(600);
                stage.setHeight(350);
                stage.centerOnScreen();
View Full Code Here

        });
        final PopupMenuButton switcher = new PopupMenuButton();
        final ArrayListModel<Palette> palettes = manager.colorManager.getPalettes();
        switcher.setModel(palettes);

        Button addButton = new Button("+");
        addButton.onClicked(new Callback<ActionEvent>() {
            public void call(ActionEvent actionEvent) throws Exception {
                if(!palettes.get(switcher.getSelectedIndex()).isEditable()) {
                    return;
                }
                final Stage dialog = Stage.createStage();
                dialog.setTitle("Color");

                final ColorPickerPanel picker = new ColorPickerPanel();

                Callback<ActionEvent> okay = new Callback<ActionEvent>() {
                    public void call(ActionEvent event) {
                        FlatColor color = picker.getColor();
                        manager.colorManager.addSwatch(color);
                        dialog.hide();
                    }
                };
                Callback<ActionEvent> canceled = new Callback<ActionEvent>() {
                    public void call(ActionEvent event) {
                        dialog.hide();
                    }
                };
                dialog.setContent(new VFlexBox()
                        .add(picker)
                        .add(new HFlexBox()
                                .add(new Button("okay").onClicked(okay))
                                .add(new Button("cancel").onClicked(canceled))
                        )
                );
                dialog.setWidth(400);
                dialog.setHeight(370);
                dialog.centerOnScreen();
View Full Code Here

                    .createColumn(50,GridBox.Align.Right)
                    .createColumn(50,GridBox.Align.Fill)
                    .addControl(new Label("Please visit Flickr and grant Leo access to your account"))
                    .nextRow()
                    .addControl(new Spacer())
                    .addControl(new Button("Goto Flickr").onClicked(new Callback<ActionEvent>() {
                        public void call(ActionEvent event) {
                            OSUtil.openBrowser(url.toExternalForm());
                        }
                    }))
                    .nextRow()
                    .addControl(new Button(getString("dialog.cancel")).onClicked(new Callback<ActionEvent>(){
                        public void call(ActionEvent event) {
                            stage.hide();
                        }
                    }))
                    .addControl(new Button("Continue >").onClicked(new Callback<ActionEvent>(){
                        public void call(ActionEvent event) {
                            stage.hide();
                            try {
                                Auth auth = authInterface.getToken(frob);
                                System.out.println("Authentication success");
View Full Code Here

        grid.nextRow();
        final Checkbox documentBounds = new Checkbox("full document bounds");
        documentBounds.setSelected(includeDocumentBounds);
        grid.addControl(documentBounds);
        grid.nextRow();
        Button cancelButton = new Button("cancel");
        cancelButton.onClicked(new Callback<ActionEvent>() {
            public void call(ActionEvent actionEvent) throws Exception {
                stage.hide();
            }
        });
        grid.addControl(cancelButton);
        Button continueButton = new Button("continue");
        continueButton.onClicked(new Callback<ActionEvent>() {
            public void call(ActionEvent actionEvent) throws Exception {
                stage.hide();
                includeBackground = backgroundCheckbox.isSelected();
                includeDocumentBounds = documentBounds.isSelected();
                SavePNGAction.super.execute();
View Full Code Here

TOP

Related Classes of org.joshy.gfx.node.control.Button

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.