Package javax.swing.colorchooser

Examples of javax.swing.colorchooser.ColorSelectionModel


    chooser.getSelectionModel().addChangeListener(this);
  }

  @Override
  public void stateChanged(ChangeEvent e) {
    ColorSelectionModel model = (ColorSelectionModel) e.getSource();
    label.setForeground(model.getSelectedColor());
  }
View Full Code Here


        assertSame(DefaultColorSelectionModel.class, ch.getSelectionModel().getClass());
        assertNull(ch.accessibleContext);
        assertEquals(Color.WHITE, ch.getColor());
        ch = new JColorChooser(Color.BLACK);
        assertEquals(Color.BLACK, ch.getColor());
        ColorSelectionModel model = new DefaultColorSelectionModel();
        ch = new JColorChooser(model);
        assertFalse(propertyChangeController.isChanged());
        assertSame(model, ch.getSelectionModel());
        assertSame(BorderLayout.class, ch.getLayout().getClass());
    }
View Full Code Here

        assertSame(JColorChooser.AccessibleJColorChooser.class, ch.accessibleContext.getClass());
    }

    public void testSetGetSelectionModel() throws Exception {
        assertNotNull(ch.getSelectionModel());
        ColorSelectionModel oldModel = ch.getSelectionModel();
        ColorSelectionModel model = new DefaultColorSelectionModel();
        ch.setSelectionModel(model);
        assertTrue(propertyChangeController.isChanged(JColorChooser.SELECTION_MODEL_PROPERTY));
        assertSame(model, ((PropertyChangeEvent) propertyChangeController.getLastEvent())
                .getNewValue());
        assertSame(oldModel, ((PropertyChangeEvent) propertyChangeController.getLastEvent())
View Full Code Here

    public ColorSelectionModel getSelectionModel() {
        return colorSelectionModel;
    }

    public void setSelectionModel(ColorSelectionModel newModel) {
        ColorSelectionModel oldModel = colorSelectionModel;
        colorSelectionModel = newModel;
        firePropertyChange(SELECTION_MODEL_PROPERTY, oldModel, newModel);
    }
View Full Code Here

        assertSame(DefaultColorSelectionModel.class, ch.getSelectionModel().getClass());
        assertNull(ch.accessibleContext);
        assertEquals(Color.WHITE, ch.getColor());
        ch = new JColorChooser(Color.BLACK);
        assertEquals(Color.BLACK, ch.getColor());
        ColorSelectionModel model = new DefaultColorSelectionModel();
        ch = new JColorChooser(model);
        assertFalse(propertyChangeController.isChanged());
        assertSame(model, ch.getSelectionModel());
        assertSame(BorderLayout.class, ch.getLayout().getClass());
    }
View Full Code Here

        assertSame(JColorChooser.AccessibleJColorChooser.class, ch.accessibleContext.getClass());
    }

    public void testSetGetSelectionModel() throws Exception {
        assertNotNull(ch.getSelectionModel());
        ColorSelectionModel oldModel = ch.getSelectionModel();
        ColorSelectionModel model = new DefaultColorSelectionModel();
        ch.setSelectionModel(model);
        assertTrue(propertyChangeController.isChanged(JColorChooser.SELECTION_MODEL_PROPERTY));
        assertSame(model, ((PropertyChangeEvent) propertyChangeController.getLastEvent())
                .getNewValue());
        assertSame(oldModel, ((PropertyChangeEvent) propertyChangeController.getLastEvent())
View Full Code Here

    add(lblPrev);
  }


  public void stateChanged(ChangeEvent e) {
    ColorSelectionModel csm = (ColorSelectionModel)e.getSource();
    lblCurrColor.setBackground(csm.getSelectedColor());
  }
View Full Code Here

  class PreviewListener
    implements ChangeListener
  {
    public void stateChanged(ChangeEvent e)
    {
      ColorSelectionModel model = (ColorSelectionModel) e.getSource();
      if (previewPanel != null)
      {
        previewPanel.setForeground(model.getSelectedColor());
        previewPanel.repaint();
      }
    }
View Full Code Here

TOP

Related Classes of javax.swing.colorchooser.ColorSelectionModel

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.