~ubuntu-branches/debian/stretch/insubstantial/stretch

« back to all changes in this revision

Viewing changes to substance/src/main/java/org/pushingpixels/substance/internal/contrib/randelshofer/quaqua/colorchooser/CrayonsChooser.java

  • Committer: Package Import Robot
  • Author(s): Felix Natter
  • Date: 2016-01-18 20:58:45 UTC
  • Revision ID: package-import@ubuntu.com-20160118205845-crbmrkda61qsi5qa
Tags: upstream-7.3+dfsg2
ImportĀ upstreamĀ versionĀ 7.3+dfsg2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * @(#)CrayonsChooser.java  1.1  2006-04-23
 
3
 *
 
4
 * Copyright (c) 2005-2006 Werner Randelshofer
 
5
 * Staldenmattweg 2, Immensee, CH-6405, Switzerland.
 
6
 * All rights reserved.
 
7
 *
 
8
 * This software is the confidential and proprietary information of
 
9
 * Werner Randelshofer. ("Confidential Information").  You shall not
 
10
 * disclose such Confidential Information and shall use it only in
 
11
 * accordance with the terms of the license agreement you entered into
 
12
 * with Werner Randelshofer.
 
13
 */
 
14
 
 
15
package org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.colorchooser;
 
16
 
 
17
 
 
18
import java.awt.*;
 
19
//import java.awt.event.*;
 
20
import java.beans.*;
 
21
import javax.swing.*;
 
22
import javax.swing.colorchooser.*;
 
23
import javax.swing.event.*;
 
24
import javax.swing.plaf.*;
 
25
 
 
26
import org.pushingpixels.substance.internal.contrib.randelshofer.quaqua.util.*;
 
27
 
 
28
 
 
29
/**
 
30
 * A color chooser which provides a choice of Crayons.
 
31
 *
 
32
 * @author  Werner Randelshofer
 
33
 * @version 1.2 2006-04-23 Retrieve labels from UIManager. 
 
34
 * <br>1.0.2 2005-11-07 Get "labels" resource bundle from UIManager.
 
35
 * <br>1.0.1 2005-09-11 Get icon from UIManager.
 
36
 * <br>1.0 August 28, 2005 Created.
 
37
 */
 
38
public class CrayonsChooser extends AbstractColorChooserPanel implements UIResource {
 
39
    private Crayons crayons;
 
40
    
 
41
    /**
 
42
     * Creates a new instance.
 
43
     */
 
44
    public CrayonsChooser() {
 
45
        initComponents();
 
46
 
 
47
        crayons = new Crayons();
 
48
        add(crayons);
 
49
        crayons.addPropertyChangeListener(new PropertyChangeListener() {
 
50
            @Override
 
51
            public void propertyChange(PropertyChangeEvent evt) {
 
52
                if (evt.getPropertyName().equals("Color")) {
 
53
                    setColorToModel(crayons.getColor());
 
54
                }
 
55
            }
 
56
        });
 
57
    }
 
58
    
 
59
    /** This method is called from within the constructor to
 
60
     * initialize the form.
 
61
     * WARNING: Do NOT modify this code. The content of this method is
 
62
     * always regenerated by the Form Editor.
 
63
     */
 
64
    private void initComponents() {//GEN-BEGIN:initComponents
 
65
 
 
66
    }//GEN-END:initComponents
 
67
    
 
68
    @Override
 
69
    protected void buildChooser() {
 
70
    }
 
71
    
 
72
    @Override
 
73
    public String getDisplayName() {
 
74
        return UIManager.getString("ColorChooser.crayons");
 
75
    }    
 
76
    
 
77
    @Override
 
78
    public javax.swing.Icon getLargeDisplayIcon() {
 
79
        return UIManager.getIcon("ColorChooser.crayonsIcon");
 
80
    }
 
81
    
 
82
    @Override
 
83
    public Icon getSmallDisplayIcon() {
 
84
        return getLargeDisplayIcon();
 
85
    }
 
86
    
 
87
    @Override
 
88
    public void updateChooser() {
 
89
        crayons.setColor(getColorFromModel());
 
90
    }
 
91
    public void setColorToModel(Color color) {
 
92
        getColorSelectionModel().setSelectedColor(color);
 
93
    }
 
94
    
 
95
    // Variables declaration - do not modify//GEN-BEGIN:variables
 
96
    // End of variables declaration//GEN-END:variables
 
97
    
 
98
}