com.sun.swingset3.demos.ResourceManager Java Examples

The following examples show how to use com.sun.swingset3.demos.ResourceManager. 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: PaletteChooser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public PaletteChooser(ResourceManager resourceManager) {
    this.resourceManager = resourceManager;
    palette = new Palette(MAX_COLOR - MIN_COLOR, MIN_COLOR, MAX_COLOR,
            Math.toRadians(R_ANGLE), Math.toRadians(G_ANGLE),
            Math.toRadians(B_ANGLE), R_STEPS, G_STEPS, B_STEPS);
    shower = new JPaletteShower(palette, 250, 25);

    //<snip>Use single change listener for several spinners
    changeListener = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            setPalette(createPalette());
            shower.setPalette(palette);
            repaint();
        }
    };
    //</snip>

    setBorder(BorderFactory.createTitledBorder(
            resourceManager.getString("SpinnerDemo.colorPalette")));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(shower);
    add(createControlPanel());
}
 
Example #2
Source File: PaletteChooser.java    From littleluck with Apache License 2.0 6 votes vote down vote up
public PaletteChooser(ResourceManager resourceManager) {
    this.resourceManager = resourceManager;
    palette = new Palette(MAX_COLOR - MIN_COLOR, MIN_COLOR, MAX_COLOR,
            Math.toRadians(R_ANGLE), Math.toRadians(G_ANGLE),
            Math.toRadians(B_ANGLE), R_STEPS, G_STEPS, B_STEPS);
    shower = new JPaletteShower(palette, 250, 25);

    //<snip>Use single change listener for several spinners
    changeListener = new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            setPalette(createPalette());
            shower.setPalette(palette);
            repaint();
        }
    };
    //</snip>

    setBorder(BorderFactory.createTitledBorder(
            resourceManager.getString("SpinnerDemo.colorPalette")));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(shower);
    add(createControlPanel());
}
 
Example #3
Source File: PaletteChooser.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
public PaletteChooser(ResourceManager resourceManager) {
    this.resourceManager = resourceManager;
    palette = new Palette(MAX_COLOR - MIN_COLOR, MIN_COLOR, MAX_COLOR,
            Math.toRadians(R_ANGLE), Math.toRadians(G_ANGLE),
            Math.toRadians(B_ANGLE), R_STEPS, G_STEPS, B_STEPS);
    shower = new JPaletteShower(palette, 250, 25);

    //<snip>Use single change listener for several spinners
    changeListener = new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            setPalette(createPalette());
            shower.setPalette(palette);
            repaint();
        }
    };
    //</snip>

    setBorder(BorderFactory.createTitledBorder(
            resourceManager.getString("SpinnerDemo.colorPalette")));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(shower);
    add(createControlPanel());
}
 
Example #4
Source File: PaletteChooser.java    From Darcula with Apache License 2.0 6 votes vote down vote up
public PaletteChooser(ResourceManager resourceManager) {
    this.resourceManager = resourceManager;
    palette = new Palette(MAX_COLOR - MIN_COLOR, MIN_COLOR, MAX_COLOR,
            Math.toRadians(R_ANGLE), Math.toRadians(G_ANGLE),
            Math.toRadians(B_ANGLE), R_STEPS, G_STEPS, B_STEPS);
    shower = new JPaletteShower(palette, 250, 25);

    //<snip>Use single change listener for several spinners
    changeListener = new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            setPalette(createPalette());
            shower.setPalette(palette);
            repaint();
        }
    };
    //</snip>

    setBorder(BorderFactory.createTitledBorder(
            resourceManager.getString("SpinnerDemo.colorPalette")));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(shower);
    add(createControlPanel());
}
 
Example #5
Source File: JMandelbrot.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public JMandelbrot(int width, int height, Palette palette,
        ResourceManager resourceManager) {
    setPreferredSize(new Dimension(width, height));
    setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
    calcConstants(width, height);
    setPalette(palette);
    setToolTipText(resourceManager.getString("SpinnerDemo.toolTip"));
    installListeners();
}
 
Example #6
Source File: MandelbrotControl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public MandelbrotControl(JMandelbrot mandelbrot,
        ResourceManager resourceManager) {
    this.mandelbrot = mandelbrot;
    this.resourceManager = resourceManager;
    createUI();
    installListeners();
}
 
Example #7
Source File: JMandelbrot.java    From littleluck with Apache License 2.0 5 votes vote down vote up
public JMandelbrot(int width, int height, Palette palette,
                   ResourceManager resourceManager) {
    setPreferredSize(new Dimension(width, height));
    setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
    calcConstants(width, height);
    setPalette(palette);
    setToolTipText(resourceManager.getString("SpinnerDemo.toolTip"));
    installListeners();
}
 
Example #8
Source File: MandelbrotControl.java    From littleluck with Apache License 2.0 5 votes vote down vote up
public MandelbrotControl(JMandelbrot mandelbrot,
                         ResourceManager resourceManager) {
    this.mandelbrot = mandelbrot;
    this.resourceManager = resourceManager;
    createUI();
    installListeners();
}
 
Example #9
Source File: JMandelbrot.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
public JMandelbrot(int width, int height, Palette palette,
                   ResourceManager resourceManager) {
    setPreferredSize(new Dimension(width, height));
    setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
    calcConstants(width, height);
    setPalette(palette);
    setToolTipText(resourceManager.getString("SpinnerDemo.toolTip"));
    installListeners();
}
 
Example #10
Source File: MandelbrotControl.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
public MandelbrotControl(JMandelbrot mandelbrot,
                         ResourceManager resourceManager) {
    this.mandelbrot = mandelbrot;
    this.resourceManager = resourceManager;
    createUI();
    installListeners();
}
 
Example #11
Source File: JMandelbrot.java    From Darcula with Apache License 2.0 5 votes vote down vote up
public JMandelbrot(int width, int height, Palette palette,
                   ResourceManager resourceManager) {
    setPreferredSize(new Dimension(width, height));
    setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
    calcConstants(width, height);
    setPalette(palette);
    setToolTipText(resourceManager.getString("SpinnerDemo.toolTip"));
    installListeners();
}
 
Example #12
Source File: MandelbrotControl.java    From Darcula with Apache License 2.0 5 votes vote down vote up
public MandelbrotControl(JMandelbrot mandelbrot,
                         ResourceManager resourceManager) {
    this.mandelbrot = mandelbrot;
    this.resourceManager = resourceManager;
    createUI();
    installListeners();
}
 
Example #13
Source File: LayoutControlPanel.java    From littleluck with Apache License 2.0 4 votes vote down vote up
LayoutControlPanel(ToggleButtonDemo demo, ResourceManager resourceManager) {
    this.demo = demo;

    // this.componentOrientationChanger = componentOrientationChanger;

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setAlignmentX(LEFT_ALIGNMENT);
    setAlignmentY(TOP_ALIGNMENT);

    JLabel l;

    // If SwingSet has a ComponentOrientationChanger, then include control
    // for choosing between absolute and relative positioning.  This will
    // only happen when we're running on JDK 1.2 or above.
    //
    // if(componentOrientationChanger != null ) {
    //     l = new JLabel("Positioning:");
    //     add(l);
    //
    //    ButtonGroup group = new ButtonGroup();
    //    PositioningListener positioningListener = new PositioningListener();
    //    JRadioButton absolutePos = new JRadioButton("Absolute");
    //    absolutePos.setMnemonic('a');
    //    absolutePos.setToolTipText("Text/Content positioning is independant of line direction");
    //    group.add(absolutePos);
    //    absolutePos.addItemListener(positioningListener);
    //    add(absolutePos);
    //
    //    JRadioButton relativePos = new JRadioButton("Relative");
    //    relativePos.setMnemonic('r');
    //    relativePos.setToolTipText("Text/Content positioning depends on line direction.");
    //    group.add(relativePos);
    //    relativePos.addItemListener(positioningListener);
    //    add(relativePos);
    //
    //    add(Box.createRigidArea(demo.VGAP20));
    //
    //    absolutePositions = false;
    //    relativePos.setSelected(true);
    //
    //    componentOrientationChanger.addActionListener( new OrientationChangeListener() );
    //} else {
    absolutePositions = true;
    //}

    DirectionPanel textPosition = new DirectionPanel(true, "E", new TextPositionListener());
    DirectionPanel labelAlignment = new DirectionPanel(true, "C", new LabelAlignmentListener());

    // Make sure the controls' text position and label alignment match
    // the initial value of the associated direction panel.
    for (JComponent control : demo.getCurrentControls()) {
        setPosition(control, RIGHT, CENTER);
        setAlignment(control, CENTER, CENTER);
    }

    l = new JLabel(resourceManager.getString("LayoutControlPanel.textposition_label"));
    add(l);
    add(textPosition);

    add(Box.createRigidArea(VGAP20));

    l = new JLabel(resourceManager.getString("LayoutControlPanel.contentalignment_label"));
    add(l);
    add(labelAlignment);

    add(Box.createGlue());
}
 
Example #14
Source File: LayoutControlPanel.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
LayoutControlPanel(ToggleButtonDemo demo, ResourceManager resourceManager) {
    this.demo = demo;

    // this.componentOrientationChanger = componentOrientationChanger;

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setAlignmentX(LEFT_ALIGNMENT);
    setAlignmentY(TOP_ALIGNMENT);

    JLabel l;

    // If SwingSet has a ComponentOrientationChanger, then include control
    // for choosing between absolute and relative positioning.  This will
    // only happen when we're running on JDK 1.2 or above.
    //
    // if(componentOrientationChanger != null ) {
    //     l = new JLabel("Positioning:");
    //     add(l);
    //
    //    ButtonGroup group = new ButtonGroup();
    //    PositioningListener positioningListener = new PositioningListener();
    //    JRadioButton absolutePos = new JRadioButton("Absolute");
    //    absolutePos.setMnemonic('a');
    //    absolutePos.setToolTipText("Text/Content positioning is independant of line direction");
    //    group.add(absolutePos);
    //    absolutePos.addItemListener(positioningListener);
    //    add(absolutePos);
    //
    //    JRadioButton relativePos = new JRadioButton("Relative");
    //    relativePos.setMnemonic('r');
    //    relativePos.setToolTipText("Text/Content positioning depends on line direction.");
    //    group.add(relativePos);
    //    relativePos.addItemListener(positioningListener);
    //    add(relativePos);
    //
    //    add(Box.createRigidArea(demo.VGAP20));
    //
    //    absolutePositions = false;
    //    relativePos.setSelected(true);
    //
    //    componentOrientationChanger.addActionListener( new OrientationChangeListener() );
    //} else {
    absolutePositions = true;
    //}

    DirectionPanel textPosition = new DirectionPanel(true, "E", new TextPositionListener());
    DirectionPanel labelAlignment = new DirectionPanel(true, "C", new LabelAlignmentListener());

    // Make sure the controls' text position and label alignment match
    // the initial value of the associated direction panel.
    for (JComponent control : demo.getCurrentControls()) {
        setPosition(control, RIGHT, CENTER);
        setAlignment(control, CENTER, CENTER);
    }

    l = new JLabel(resourceManager.getString("LayoutControlPanel.textposition_label"));
    add(l);
    add(textPosition);

    add(Box.createRigidArea(VGAP20));

    l = new JLabel(resourceManager.getString("LayoutControlPanel.contentalignment_label"));
    add(l);
    add(labelAlignment);

    add(Box.createGlue());
}
 
Example #15
Source File: LayoutControlPanel.java    From Darcula with Apache License 2.0 4 votes vote down vote up
LayoutControlPanel(ToggleButtonDemo demo, ResourceManager resourceManager) {
    this.demo = demo;

    // this.componentOrientationChanger = componentOrientationChanger;

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setAlignmentX(LEFT_ALIGNMENT);
    setAlignmentY(TOP_ALIGNMENT);

    JLabel l;

    // If SwingSet has a ComponentOrientationChanger, then include control
    // for choosing between absolute and relative positioning.  This will
    // only happen when we're running on JDK 1.2 or above.
    //
    // if(componentOrientationChanger != null ) {
    //     l = new JLabel("Positioning:");
    //     add(l);
    //
    //    ButtonGroup group = new ButtonGroup();
    //    PositioningListener positioningListener = new PositioningListener();
    //    JRadioButton absolutePos = new JRadioButton("Absolute");
    //    absolutePos.setMnemonic('a');
    //    absolutePos.setToolTipText("Text/Content positioning is independant of line direction");
    //    group.add(absolutePos);
    //    absolutePos.addItemListener(positioningListener);
    //    add(absolutePos);
    //
    //    JRadioButton relativePos = new JRadioButton("Relative");
    //    relativePos.setMnemonic('r');
    //    relativePos.setToolTipText("Text/Content positioning depends on line direction.");
    //    group.add(relativePos);
    //    relativePos.addItemListener(positioningListener);
    //    add(relativePos);
    //
    //    add(Box.createRigidArea(demo.VGAP20));
    //
    //    absolutePositions = false;
    //    relativePos.setSelected(true);
    //
    //    componentOrientationChanger.addActionListener( new OrientationChangeListener() );
    //} else {
    absolutePositions = true;
    //}

    DirectionPanel textPosition = new DirectionPanel(true, "E", new TextPositionListener());
    DirectionPanel labelAlignment = new DirectionPanel(true, "C", new LabelAlignmentListener());

    // Make sure the controls' text position and label alignment match
    // the initial value of the associated direction panel.
    for (JComponent control : demo.getCurrentControls()) {
        setPosition(control, RIGHT, CENTER);
        setAlignment(control, CENTER, CENTER);
    }

    l = new JLabel(resourceManager.getString("LayoutControlPanel.textposition_label"));
    add(l);
    add(textPosition);

    add(Box.createRigidArea(VGAP20));

    l = new JLabel(resourceManager.getString("LayoutControlPanel.contentalignment_label"));
    add(l);
    add(labelAlignment);

    add(Box.createGlue());
}