FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
processing/app/src/processing/app/tools/ColorSelector.java at master · unexCoder/processing · GitHub
unexCoder
processing
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
processing
/
app
/
src
/
processing
/
app
/
tools
/
ColorSelector.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
83 lines (64 loc) · 2.45 KB
Breadcrumbs
processing
/
app
/
src
/
processing
/
app
/
tools
/
ColorSelector.java
Copy path
File metadata and controls
83 lines (64 loc) · 2.45 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2006-14 Ben Fry and Casey Reas
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package
processing
.
app
.
tools
;
import
processing
.
app
.*;
import
processing
.
app
.
ui
.
ColorChooser
;
import
processing
.
app
.
ui
.
Toolkit
;
import
java
.
awt
.
Color
;
import
java
.
awt
.
datatransfer
.
Clipboard
;
import
java
.
awt
.
datatransfer
.
StringSelection
;
import
java
.
awt
.
event
.*;
/**
* Color selector tool for the Tools menu.
* <p/>
* Using the keyboard shortcuts, you can copy/paste the values for the
* colors and paste them into your program. We didn't do any sort of
* auto-insert of colorMode() or fill() or stroke() code cuz we couldn't
* decide on a good way to do this.. your contributions welcome).
*/
public
class
ColorSelector
implements
Tool
{
/**
* Only create one instance, otherwise we'll have dozens of animation
* threads going if you open/close a lot of editor windows.
*/
private
static
volatile
ColorChooser
selector
;
private
Base
base
;
public
String
getMenuTitle
() {
return
Language
.
text
(
"menu.tools.color_selector"
);
}
public
void
init
(
Base
base
) {
this
.
base
=
base
;
}
public
void
run
() {
if
(
selector
==
null
) {
synchronized
(
ColorSelector
.
class
) {
if
(
selector
==
null
) {
selector
=
new
ColorChooser
(
base
.
getActiveEditor
(),
false
,
Color
.
WHITE
,
Language
.
text
(
"menu.edit.copy"
),
new
ActionListener
() {
@
Override
public
void
actionPerformed
(
ActionEvent
e
) {
Clipboard
c
=
Toolkit
.
getSystemClipboard
();
c
.
setContents
(
new
StringSelection
(
selector
.
getHexColor
()),
null
);
}
});
}
}
}
selector
.
show
();
}
}
Back
|
FazBrowse Home
|
New Git URL