Package org.joshy.gfx.node.control

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


    public Slider brushHardnessSlider;
    public Slider brushOpacitySlider;

    public PixelToolbar(PixelDocContext context) throws IOException {
        this.setBoxAlign(Align.Top);
        pixelColorPicker = new SwatchColorPicker();
        this.add(pixelColorPicker);
        histogramColorPicker = new HistogramColorPicker(context);
        this.add(histogramColorPicker);
        this.add(new Label("W:"));
        brushWidthSlider = new Slider(false).setValue(10).setMin(1).setMax(100);
View Full Code Here


        //pencilTool.enable();
        selectButtonForTool(pencilTool);



        fg = new SwatchColorPicker();
        fg.onColorSelected(new Callback<ChangedEvent>() {
            public void call(ChangedEvent event) throws Exception {
                getDocument().setForegroundColor(fg.getSelectedColor());
            }
        });
        toolbar.add(fg);

        final SwatchColorPicker bg = new SwatchColorPicker();
        bg.onColorSelected(new Callback<ChangedEvent>() {
            public void call(ChangedEvent event) throws Exception {
                getDocument().setBackgroundColor(bg.getSelectedColor());
            }
        });
        toolbar.add(bg);
        EventBus.getSystem().addListener(ChangedEvent.ColorChanged, new Callback<ChangedEvent>() {
            public void call(ChangedEvent event) throws Exception {
                if(event.getSource() == getDocument()) {
                    fg.setSelectedColor(getDocument().getForegroundColor());
                    bg.setSelectedColor(getDocument().getBackgroundColor());
                }
            }
        });


        //swap fg and bg
        EventBus.getSystem().addListener(getCanvas(), KeyEvent.KeyTyped, new Callback<KeyEvent>() {
            public void call(KeyEvent keyEvent) throws Exception {
                if('x' == keyEvent.getKeyChar()) {
                    FlatColor c1 = fg.getSelectedColor();
                    FlatColor c2 = bg.getSelectedColor();
                    fg.setSelectedColor(c2);
                    bg.setSelectedColor(c1);
                }
            }
        });

    }
View Full Code Here

TOP

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

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.