下面列出了java.awt.Color#ORANGE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public Color getSWCcolor() {
switch (swcType) {
case Path.SWC_SOMA:
return Color.BLUE;
case Path.SWC_DENDRITE:
return Color.GREEN;
case Path.SWC_APICAL_DENDRITE:
return Color.CYAN;
case Path.SWC_AXON:
return Color.RED;
case Path.SWC_FORK_POINT:
return Color.ORANGE;
case Path.SWC_END_POINT:
return Color.PINK;
case Path.SWC_CUSTOM:
return Color.YELLOW;
case Path.SWC_UNDEFINED:
default:
return SimpleNeuriteTracer.DEFAULT_DESELECTED_COLOR;
}
}
@Override
public Color getTextColor()
{
int count = getCount();
if (count >= GraveyardRoom.MIN_SCORE)
{
return Color.GREEN;
}
else if (count == 0)
{
return Color.RED;
}
else
{
return Color.ORANGE;
}
}
public static Color color(float i) {
if (i == 0)
return Color.black;
if (i == 1)
return Color.RED;
if (i <= 3)
return Color.ORANGE;
if (i <= 10)
return Color.YELLOW;
if (i <= 20)
return Color.GREEN;
if (i <= 50)
return Color.CYAN;
if (i <= 100)
return Color.BLUE;
return Color.MAGENTA;
}
public static Color rainbowColor(float i) { // 根据数值大小范围,在8种彩虹色中取值
if (i == 0)
return Color.BLACK;
if (i == 1)
return Color.RED;
if (i <= 3)
return Color.ORANGE;
if (i <= 10)
return Color.YELLOW;
if (i <= 20)
return Color.GREEN;
if (i <= 50)
return Color.CYAN;
if (i <= 100)
return Color.BLUE;
return Color.MAGENTA;
}
public static Color color(float i) {
if (i == 0)
return Color.black;
if (i == 1)
return Color.RED;
if (i <= 3)
return Color.ORANGE;
if (i <= 10)
return Color.YELLOW;
if (i <= 20)
return Color.GREEN;
if (i <= 50)
return Color.CYAN;
if (i <= 100)
return Color.BLUE;
return Color.MAGENTA;
}
public static Color color(float i) {
if (i == 0)
return Color.black;
if (i == 1)
return Color.RED;
if (i <= 3)
return Color.ORANGE;
if (i <= 10)
return Color.YELLOW;
if (i <= 20)
return Color.GREEN;
if (i <= 50)
return Color.CYAN;
if (i <= 100)
return Color.BLUE;
return Color.MAGENTA;
}
public void paintComponent(Graphics g){
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.BLACK);
ring1.draw(g2);
ring2.draw(g2);
Color[] colors = new Color[]{
Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.ORANGE};
int i= 0;
g2.setColor(Color.BLUE);
for(CirculinearContinuousCurve2D cont :
CirculinearCurves2D.splitIntersectingContours(ring1, ring2)){
g2.setColor(colors[i++]);
cont.draw(g2);
}
}
@Override
public Color getTextColor()
{
int count = getCount();
if (count >= GraveyardRoom.MIN_SCORE)
{
return Color.GREEN;
}
else if (count == 0)
{
return Color.RED;
}
else
{
return Color.ORANGE;
}
}
@ConfigItem(
position = 5,
keyName = "hexColorTransTrap",
name = "Transitioning trap",
description = "Color of transitioning trap timer",
titleSection = "colorsTitle"
)
default Color getTransTrapColor()
{
return Color.ORANGE;
}
@ConfigItem(
keyName = "brawlerColor",
name = "Brawler color",
description = "Color of highlighted Brawlers.",
position = 10
)
default Color brawlerColor()
{
return Color.ORANGE;
}
@Alpha
@ConfigItem(
keyName = "Progress arc color",
name = "Progress arc color",
description = "Change the color of the progress arc in the xp orb",
position = 7
)
default Color progressArcColor()
{
return Color.ORANGE;
}
private static Color color(float i) {
if (i <= 1)
return Color.RED;
if (i <= 3)
return Color.ORANGE;
if (i <= 10)
return Color.YELLOW;
if (i <= 20)
return Color.GREEN;
if (i <= 50)
return Color.CYAN;
if (i <= 100)
return Color.BLUE;
return Color.MAGENTA;
}
public void snapshotHeap(GridLineSet gridLineSet) {
RPSScanner.Edge[] edges = edgeHeap.getEdgeList();
for (int i=0; i<edgeHeap.size(); ++i) {
Color colour = (i == 0) ? Color.ORANGE : Color.RED;
RPSScanner.Edge e = edges[i];
gridLineSet.addLine(e.u.x, e.u.y, e.v.x, e.v.y, colour);
}
}
public void paintComponent(Graphics g){
Graphics2D g2 = (Graphics2D) g;
ring1 = new Circle2D(150, 150, 100);
ring2 = new Circle2D(250, 150, 100);
ring3 = new Circle2D(200, 230, 100);
g2.setColor(Color.BLACK);
ring1.draw(g2);
ring2.draw(g2);
ring3.draw(g2);
ArrayList<CirculinearContour2D> rings = new ArrayList<CirculinearContour2D>(3);
rings.add(ring1);
rings.add(ring2);
rings.add(ring3);
Color[] colors = new Color[]{
Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.ORANGE};
int i= 0;
g2.setColor(Color.BLUE);
for(CirculinearContour2D cont :
CirculinearCurves2D.splitIntersectingContours(rings)){
g2.setColor(colors[i++]);
cont.draw(g2);
}
}
public void snapshotHeap(GridLineSet gridLineSet) {
Edge[] edges = edgeHeap.getEdgeList();
for (int i=0; i<edgeHeap.size(); ++i) {
Color colour = (i == 0) ? Color.ORANGE : Color.RED;
Edge e = edges[i];
gridLineSet.addLine(e.u.x, e.u.y, e.v.x, e.v.y, colour);
}
}
protected JComponent createColorPicker() {
Color[] colors = {Color.BLACK,
Color.DARK_GRAY,
Color.GRAY,
Color.LIGHT_GRAY,
Color.WHITE,
Color.CYAN,
Color.BLUE,
Color.MAGENTA,
Color.YELLOW,
Color.ORANGE,
Color.RED,
Color.PINK,
Color.GREEN};
JPanel colorsPanel = new JPanel(new GridLayout(-1, 6, 4, 4));
colorsPanel.setOpaque(false);
for (Color color : colors) {
ColorLabel colorLabel = new ColorLabel(color);
colorLabel.setDisplayName(ColorCodes.getName(color));
colorLabel.setHoverEnabled(true);
colorLabel.setMaximumSize(colorLabel.getPreferredSize());
colorLabel.setMinimumSize(colorLabel.getPreferredSize());
colorLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
setSelectedColor(colorLabel.getColor());
}
});
colorsPanel.add(colorLabel);
}
return colorsPanel;
}
@Override
public Dimension render(Graphics2D graphics)
{
List<RockRespawn> respawns = plugin.getRespawns();
if (respawns.isEmpty())
{
return null;
}
Instant now = Instant.now();
for (RockRespawn rockRespawn : respawns)
{
LocalPoint loc = LocalPoint.fromWorld(client, rockRespawn.getWorldPoint());
if (loc == null)
{
continue;
}
float percent = (now.toEpochMilli() - rockRespawn.getStartTime().toEpochMilli()) / (float) rockRespawn.getRespawnTime();
Point point = Perspective.localToCanvas(client, loc, client.getPlane(), rockRespawn.getZOffset());
if (point == null || percent > 1.0f)
{
continue;
}
Rock rock = rockRespawn.getRock();
// Only draw timer for veins on the same level in motherlode mine
LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
if (rock == Rock.ORE_VEIN && isUpstairsMotherlode(localLocation) != isUpstairsMotherlode(loc))
{
continue;
}
Color pieFillColor = Color.YELLOW;
Color pieBorderColor = Color.ORANGE;
// Recolour pie on motherlode veins or Lovakite ore during the portion of the timer where they may respawn
if ((rock == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD)
|| (rock == Rock.DAEYALT_ESSENCE && percent > DAEYALT_RANDOM_PERCENT_THRESHOLD)
|| (rock == Rock.LOVAKITE && percent > LOVAKITE_ORE_RANDOM_PERCENT_THRESHOLD))
{
pieFillColor = config.progressPieColorMotherlode();
}
if (config.progressPieInverted())
{
percent = 1.0f - percent;
}
pieBorderColor = pieFillColor.darker();
ProgressPieComponent ppc = new ProgressPieComponent();
ppc.setDiameter(config.progressPieDiameter());
ppc.setBorderColor(pieBorderColor);
ppc.setFill(pieFillColor);
ppc.setPosition(point);
ppc.setProgress(percent);
ppc.render(graphics);
}
return null;
}
public static Paint getColor(Kind k) {
switch (k) {
case CONSTRAINTS:
return Color.BLUE;
case TYPESIDE:
return Color.WHITE;
case SCHEMA:
return Color.GRAY;
case INSTANCE:
return Color.black;
case MAPPING:
return Color.LIGHT_GRAY;
case TRANSFORM:
return Color.DARK_GRAY;
case QUERY:
return Color.RED;
case PRAGMA:
return Color.GREEN;
case GRAPH:
return Color.YELLOW;
case COMMENT:
return Color.PINK;
case SCHEMA_COLIMIT:
return Color.ORANGE;
case THEORY_MORPHISM:
return Color.gray;
case APG_instance:
return Color.black;
case APG_typeside:
return Color.WHITE;
case APG_morphism:
return Color.gray;
case APG_mapping:
return Color.red;
case APG_schema:
return Color.pink;
default:
break;
}
return Util.anomaly();
}
public static String getCaptcha(HttpServletRequest request, HttpServletResponse response) {
try {
Delegator delegator = (Delegator) request.getAttribute("delegator");
final String captchaSizeConfigName = StringUtils.defaultIfEmpty(request.getParameter("captchaSize"), "default");
final String captchaSizeConfig = EntityUtilProperties.getPropertyValue("captcha", "captcha." + captchaSizeConfigName, delegator);
final String[] captchaSizeConfigs = captchaSizeConfig.split("\\|");
final String captchaCodeId = StringUtils.defaultIfEmpty(request.getParameter("captchaCodeId"), ""); // this is used to uniquely identify in the user session the attribute where the captcha code for the last captcha for the form is stored
final int fontSize = Integer.parseInt(captchaSizeConfigs[0]);
final int height = Integer.parseInt(captchaSizeConfigs[1]);
final int width = Integer.parseInt(captchaSizeConfigs[2]);
final int charsToPrint = UtilProperties.getPropertyAsInteger("captcha", "captcha.code_length", 6);
final char[] availableChars = EntityUtilProperties.getPropertyValue("captcha", "captcha.characters", delegator).toCharArray();
//It is possible to pass the font size, image width and height with the request as well
Color backgroundColor = Color.gray;
Color borderColor = Color.DARK_GRAY;
Color textColor = Color.ORANGE;
Color circleColor = new Color(160, 160, 160);
Font textFont = new Font("Arial", Font.PLAIN, fontSize);
int circlesToDraw = 6;
float horizMargin = 20.0f;
double rotationRange = 0.7; // in radians
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = (Graphics2D) bufferedImage.getGraphics();
g.setColor(backgroundColor);
g.fillRect(0, 0, width, height);
//Generating some circles for background noise
g.setColor(circleColor);
for (int i = 0; i < circlesToDraw; i++) {
int circleRadius = (int) (Math.random() * height / 2.0);
int circleX = (int) (Math.random() * width - circleRadius);
int circleY = (int) (Math.random() * height - circleRadius);
g.drawOval(circleX, circleY, circleRadius * 2, circleRadius * 2);
}
g.setColor(textColor);
g.setFont(textFont);
FontMetrics fontMetrics = g.getFontMetrics();
int maxAdvance = fontMetrics.getMaxAdvance();
int fontHeight = fontMetrics.getHeight();
String captchaCode = RandomStringUtils.random(6, availableChars);
float spaceForLetters = -horizMargin * 2 + width;
float spacePerChar = spaceForLetters / (charsToPrint - 1.0f);
for (int i = 0; i < captchaCode.length(); i++) {
// this is a separate canvas used for the character so that
// we can rotate it independently
int charWidth = fontMetrics.charWidth(captchaCode.charAt(i));
int charDim = Math.max(maxAdvance, fontHeight);
int halfCharDim = (charDim / 2);
BufferedImage charImage = new BufferedImage(charDim, charDim, BufferedImage.TYPE_INT_ARGB);
Graphics2D charGraphics = charImage.createGraphics();
charGraphics.translate(halfCharDim, halfCharDim);
double angle = (Math.random() - 0.5) * rotationRange;
charGraphics.transform(AffineTransform.getRotateInstance(angle));
charGraphics.translate(-halfCharDim, -halfCharDim);
charGraphics.setColor(textColor);
charGraphics.setFont(textFont);
int charX = (int) (0.5 * charDim - 0.5 * charWidth);
charGraphics.drawString("" + captchaCode.charAt(i), charX,
((charDim - fontMetrics.getAscent()) / 2 + fontMetrics.getAscent()));
float x = horizMargin + spacePerChar * (i) - charDim / 2.0f;
int y = ((height - charDim) / 2);
g.drawImage(charImage, (int) x, y, charDim, charDim, null, null);
charGraphics.dispose();
}
// Drawing the image border
g.setColor(borderColor);
g.drawRect(0, 0, width - 1, height - 1);
g.dispose();
response.setContentType("image/jpeg");
ImageIO.write(bufferedImage, "jpg", response.getOutputStream());
HttpSession session = request.getSession();
Map<String, String> captchaCodeMap = UtilGenerics.checkMap(session.getAttribute("_CAPTCHA_CODE_"));
if (captchaCodeMap == null) {
captchaCodeMap = new HashMap<>();
session.setAttribute("_CAPTCHA_CODE_", captchaCodeMap);
}
captchaCodeMap.put(captchaCodeId, captchaCode);
} catch (IOException | IllegalArgumentException | IllegalStateException ioe) {
Debug.logError(ioe.getMessage(), module);
}
return "success";
}
public MText sampleText(String text, Integer fontSize) {
final MStyle style = new MStyleImpl("French Script MT", fontSize, Color.ORANGE, Color.BLUE, MStyle.FONT_BOLD);
return new MTextImpl(text, style);
}