Button Color

Hi !
My program endlessly scans a jTable of 150 row indexes in lenth.
This jTable directly relates to 150 jButtons ... that depending on the status of thier function at any given time ... each change in color to reflect thier status. The buttons change in color 6 times ie; RED, GREEN, YELLOW,BLUE, GRAY or BLACK.
Currently I change the button color in this way :
import java.awt.Color;
//import .*;
* @author  Rick
public class ButtonColorYellow {
    /** Creates a new instance of ButtonColorYellow */
    public ButtonColorYellow() {
        String  F0 = AddRFSwitchMain.jButton500.getText(); // Source of the Room Numbers that equate to the jButtons
          if (F0.equals("101")){
            AddRFSwitchMain.jButton101.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("102")){
            AddRFSwitchMain.jButton102.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("103")){
            AddRFSwitchMain.jButton103.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("104")){
            AddRFSwitchMain.jButton104.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("105")){
            AddRFSwitchMain.jButton105.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("106")){
            AddRFSwitchMain.jButton106.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("107")){
            AddRFSwitchMain.jButton107.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("108")){
            AddRFSwitchMain.jButton108.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("109")){
            AddRFSwitchMain.jButton109.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("110")){
            AddRFSwitchMain.jButton110.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("111")){
            AddRFSwitchMain.jButton111.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("112")){
            AddRFSwitchMain.jButton112.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("113")){
            AddRFSwitchMain.jButton113.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("114")){
            AddRFSwitchMain.jButton114.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("115")){
            AddRFSwitchMain.jButton115.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("116")){
            AddRFSwitchMain.jButton116.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("117")){
            AddRFSwitchMain.jButton117.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("118")){
            AddRFSwitchMain.jButton118.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("119")){
            AddRFSwitchMain.jButton119.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("120")){
            AddRFSwitchMain.jButton120.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("121")){
            AddRFSwitchMain.jButton121.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("122")){
            AddRFSwitchMain.jButton122.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("123")){
            AddRFSwitchMain.jButton123.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("124")){
            AddRFSwitchMain.jButton124.setBackground(new Color(255,255,0)); // Yellow Color
        } if (F0.equals("125")){
..................  etc, etc, etc   ( room numbers are used for index references ie: 101,102, 103, etc)This code works well , but would think there must be a better wat to code it.
I will make the color itself a var like this:
AddRFSwitchMain.jButton124.setBackground(new Color( a , b , c ));...... but is there any way to adress the JButtons themselves in a var way??
ie:
AddRFSwitchMain.jButton( var X ).setBackground(new Color( a , b , c ));I know ya cant change the jButton lable itself ... but any way to reference the buttons in a like fashion ??
THANKS !!

You currently are creating 150 separate buttons each
independent and unrelated to each other. I would
reccomend creating an two arrays, one of buttons, and
another of button status which you can then loop
thorugh and change with logic
Something like this:
Button[] myButtonArray
int[] myButtonStatus
init() {
Button[] myButtonArray = new Button[150];
int myButtonStatus = new int[150];
for (int i = 0; i < 150 ; i++)
myButtonArray[i] = new Button("Button #" +
n #" + (i + 1) );
myButonStatus[i] = ** Get Status from
tus from jTable
then in Main Code soemthing like
for (int i=0 ; i < 150 ; i++)
if (myButtonStatus = 101) then
) then
{myButtonArray.setBackGround(Color.Yellow);
if (myButtonStatus = xyz ) then
{myButtonArray[i].setBackGrondr(Color.Black);
Hope this helps
JavaPython ....
Does not your code snip make for 150 lines of code entry listed below? : (
if (myButtonStatus = 101) then
) then
{myButtonArray.setBackGround(Color.Yellow);
if (myButtonStatus = 101) then
) then
{myButtonArray.setBackGround(Color.Yellow);

Similar Messages

  • Help with getting button color.

    I'm trying to make a little paint program. i want to be able to click on a color button and then assign the color of that button to a variable Color brushColor.
    funny thing is, when i compile this, it tells me that
    C:\java\javaprograms\TryPainting.java:21: getBackground() in java.awt.Component cannot be applied to (java.awt.Button)
              brushColor = paintTheBrush(getBackground(source));
    strange, getBackground is explicitly listed as a method that Button inherits from Component in the API.
    any suggestions on a way to accomplish this?
    thanks in advance,
    jason
    ------code follows-------
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import java.awt.event.*;
    //colored buttons of "paint"
    class OilPaint extends Button{
    Color brushColor = Color.white;
    OilPaint(String label, Color color) {
         setLabel(label);
         setForeground(color);
         setBackground(color);
         addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
         Button source = (Button)e.getSource();
         brushColor = getBackground(source);
         public Color paintTheBrush(Color color) {
              return color;
    // canvas to paint on - this isn't working yet. can't even get the
    // setSize to work, though it does compile.
    class Canvas extends JPanel{
         Canvas(){
              setBackground(Color.white);
              Dimension canSize = new Dimension(300,300);
              setSize(canSize);
    // displays the lsit of color button choices in a small panel at bottom
    // of window
    class ColorChoices extends JPanel{
         ColorChoices() {
              setBackground(new Color(220,255,255));
              add(new OilPaint("paint",Color.blue));
              add(new OilPaint("paint",Color.red));
              add(new OilPaint("paint",Color.green));
              add(new OilPaint("paint",Color.white));
              add(new OilPaint("paint",Color.black));
    //this is the main class of the program TryPainting.java
    class TryPainting {
         public static void main(String[] args) {
              JFrame window = new JFrame();
              Toolkit toolkit = window.getToolkit();
              Dimension winSize=toolkit.getScreenSize();
              window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              window.setBounds(5,5,winSize.width/2,winSize.height/2);
              Container content = window.getContentPane();
              content.setLayout(new BorderLayout());
              content.add("North",new Canvas());
              content.add("South",new ColorChoices());
              window.setVisible(true);

    duh.. thanks man, that did the trick. i'm pretty new at this. i really appreciate the help. i got stuck thinking of the getBackground() as a function, rather than a method. this oop stuff is wacky weird fun!
    jason

  • How to change button colors in a loop?

    I am working on a task that should imitate an elevator. I have two vertical
    rows of round buttons "Up" and "Down" When a circle is selected randomly by
    the program, the circle becomes yellow and the elevator moves to that
    button.
    Here is what I did:
    1. created a class Circle where I save buttons' parameters
    2. saved Circle objects in an array
    3. drew the buttons depending on their parameters
    4. generated a random number, matched it with an array index and assigned
    the object color to yellow.
    Everything is fine except that I can't figure out how to change colors of my
    buttons in a loop.
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    public class Elevator3 extends JPanel
    private int n = 40;
    private int width = 200;
    private int floors = 10;
    private int interval = 1000;
    private boolean selected = false;
    private Circle[] buttons = new Circle[2*(floors-1)];
    public Elevator3()
    build();
    JFrame frame = new JFrame("Elevator3");
    setBackground(Color.WHITE);
    setFont(new Font("SansSerif", Font.PLAIN, Math.round(n/3)));
    frame.getContentPane().add(this);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(width, n*(floors+2) );
    frame.setVisible(true);
    public void build()
    Random r = new Random();
    int buttonPick;
    int timeUntilNextButton = r.nextInt(interval);
    for (int k =0; ; k++)
    if (timeUntilNextButton-- ==0)
    buttonPick = r.nextInt(2*(floors-1));
    //populate my buttons array here - how??
    timeUntilNextButton = r.nextInt(interval);
    //adding "Down" buttons
    for (int i=1, count=0; i < floors; i++, count++)
    if (count == buttonPick)
    selected = true;
    else
    selected = false;
    buttons[count]= new Circle(n*2, n*i, selected, Math.round(n/2));
    //build an array of "Up" circles
    for (int i=2, count=floors-1; i < floors+1; i++, count++)
    if (count == buttonPick)
    selected = true;
    else
    selected = false;
    buttons[count]= new Circle(n, n*i, selected, Math.round(n/2));
    public static void main(String[] args)
    new Elevator3();
    protected void paintComponent(Graphics g)
    super.paintComponent(g);
    //draw buttons
    for (int i=0; i < buttons.length; i++)
    g.setColor(buttons.getColor());
    g.fillOval(buttons[i].getX(), buttons[i].getY(), buttons[i].getWidth(), buttons[i].getWidth());
    class Circle
    private int x;
    private int y;
    private Color c;
    private boolean pressed;
    private int width;
    public Circle(int xCoordinate, int yCoordinate, boolean selected, int diameter)
    x = xCoordinate;
    y = yCoordinate;
    pressed = selected;
    width = diameter;
    if (pressed)
    c = Color.YELLOW;
    else
    c = Color.LIGHT_GRAY;
    public Color getColor()
    return c;
    public int getX()
    return x;
    public int getY()
    return y;
    public int getWidth()
    return width;

    hi,
    am sorry, i couldn't make out what exactly the problem, but as ur subject line says...
    may be the code give below will help you to change button colors in a loop..
              for(int i = 0; i < button.length; i++){
                   int color1 = (int)(250*Math.random());
                   int color2 = (int)(250*Math.random());
                   int color3 = (int)(250*Math.random());
                   Color c = new Color(color1,color2,color3);
                   button[i] = new JButton("button name");
                   button.addActionListener(this);
                   //to check the r, g, b combination.
                   //System.out.println(c);
                   button[i].setBackground(c);
                   button[i].setForeground(Color.white);
    //adding into the panel
                   panel.add(button[i]);
    hope this would help you.

  • Change pressed button Color

    Hi,
    I want to change my pressed button Color and I haven't been able to find a way, I tried creating my own button and add a listener when it is pressed and then change its background color but it doesn't work! it works for enter and exit but not for pressed and released.
    any one has an idea?
    thanks
    Here's my code:
    package components;
    import javax.swing.*;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseAdapter;
    import java.awt.*;
    * JButton con una nueva propiedad de Color presionado
    * @author Ana Mar�a Franco
    * @version 1.0
    public class PressedColorButton extends JButton
        // Atributos ************************************************************************
        private Color unpressedButtonColor;
        private Color pressedButtonColor;
        // Constructores ********************************************************************
        public PressedColorButton()
            super();
            this.addMouseListener(new PressedColorButton_this_mouseAdapter(this));
        // M�todos **************************************************************************
         * Obtiene el color sin presionar
         * @return Color
        public Color getUnpressedButtonColor()
            return this.unpressedButtonColor;
         * Define el color sin presionar
         * @param nuevoColor Color
        public void setUnpressedButtonColor(Color nuevoColor)
            this.unpressedButtonColor = nuevoColor;
         * Obtiene el color presionado
         * @return Color
        public Color getPressedButtonColor()
            return this.pressedButtonColor;
         * Define el color presionado
         * @param nuevoColor Color
        public void setPressedButtonColor(Color nuevoColor)
            this.pressedButtonColor = nuevoColor;
        public void this_mouseExited(MouseEvent e)
            this.setBackground(unpressedButtonColor);
        public void this_mousePressed(MouseEvent e)
            this.setBackground(pressedButtonColor);
        public void this_mouseReleased(MouseEvent e)
            this.setBackground(unpressedButtonColor);
        public void this_mouseEntered(MouseEvent e)
            this.setBackground(pressedButtonColor);
    // Escuchadores *************************************************************************
    class PressedColorButton_this_mouseAdapter extends MouseAdapter
        private PressedColorButton adaptee;
        PressedColorButton_this_mouseAdapter(PressedColorButton adaptee)
            this.adaptee = adaptee;
        public void mouseExited(MouseEvent e)
            adaptee.this_mouseExited(e);
        public void mousePressed(MouseEvent e)
            adaptee.this_mousePressed(e);
        public void mouseReleased(MouseEvent e)
            adaptee.this_mouseReleased(e);
        public void mouseEntered(MouseEvent e)
            adaptee.this_mouseEntered(e);
    }

    Swing related questions should be posted in the Swing forum. Try setting the following properties on the button:
    setContentAreaFilled( false );
    setOpaque(true);

  • New button colors hard to see

    The new light gray colors are now rather difficult to see at a glance which one is greyed out and which one is active. It is so bad that I even looked at the Universal Access System Prefs pane and bumped up the contrast but even that doesn't seem to help. Why on Earth did anyone thing this was a good idea or makes the interface more appealing in any way? Or more importantly, is there a way to bring back the old button colors?

    Most likely your home button is worn out. There is really nothing that you can do, it's just usual wear and tear. You could set up a repair through Apple. Your phone is probably out of warrany if you don't have a plan set up on your phone. You could do a repair through Apple, get a third party to repair it, or pony up and get the iPhone 5!

  • Bizarre IRR Button Colors in IE (Only!)

    When we go to any "Action" dialog from an Interactive Report Region, the button colors, e.g. Apply, Cancel etc. are dark blue with brown writing in IE only We've tested with IE 8 and 9.
    This does not occur in FF, Chrome or Safari.
    Has anyone else encountered this and does anyone know of a fix. We are demoing this next week and; it isn't just aesthetic, the color combination is actually very difficult to read.
    (Yes, I, too, wish that IE would be forever stricken from the memory of Man)
    Thanks and Here's Hoping,
    -Joe

    Joe
    Ironically a combination of IE and Jive ate a lengthy response I made some hours ago, and I wasn't able to post again at that time.
    Joe Upshaw wrote:
    Sorry that this followup is more of a CSS question and less of an APEX question.That's OK. I know more about many aspects of CSS than I do about some of APEX!
    We have a CSS style sheet that we are including as part of the application (via a change to the template).When you say this do you mean that this style sheet replaces the default APEX theme CSS or that it is applied later in the cascade to augment/override the theme?
    However, we don't have any conditional* CSS formatting. I'm unsure of the syntax. I know I could paste the <style> section thgat you provided into the HTML Header section of the page but, as this is global, we'd prefer to do it in the CSS once for the whole app.There's no conditional processing in CSS. The browser applies the last rule it understands, which for this rule is roughly like this:
    /* Older IE & IE8/9/10 */
    filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr='#eee', endColorstr='#ddd');
    /* IE8/9/10 */
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#eee', endColorstr='#ddd')";
    /* Older Safari & Chrome */
    background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #EEE), color-stop(100%, #DDD));
    /* Safari & Chrome */
    background-image: -webkit-linear-gradient(top, #EEE,#DDD);
    /* Older Firefox */
    background-image: -moz-linear-gradient(top, #EEE,#DDD);
    /* Firefox 16 & IE10 */
    background-image: linear-gradient(top, #EEE,#DDD);So the problem with unconditionally including
    button.apexir-button {
    filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr='#eeeeee', endColorstr='#dddddd');
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#dddddd')"
    button.apexir-button:hover {
    filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr='#ffffff', endColorstr='#eeeeee');
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee')"
    }later in the cascade is that it will override <tt>background-image: linear-gradient(top, #EEE,#DDD)</tt> for IE10 as IE10 still supports Microsoft's proprietary <tt>filter</tt> property.
    That's why I suggested using conditional comments.
    I tried this:
    button.apexir-button {
    [if lt IE 10] filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr='#eeeeee', endColorstr='#dddddd');
    [if lt IE 10] -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#dddddd')"
    button.apexir-button:hover {
    [if lt IE 10] filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr='#ffffff', endColorstr='#eeeeee');
    [if lt IE 10] -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee')"
    }and it did not solve the problem.That's not valid CSS: there's no conditional processing in CSS. We have to use the IE conditional comments in HTML.
    I also directly pasted the style tag version that you pasted above into the example at apex.oracle.com in the HTML header of the page.
    It did not solve the problem there either. Works for me. Needs to pasted in the right place after the APEX theme style sheet to effect the override.
    My recommendation would be to put the override in an external style sheet that you feed to earlier IE versions using conditional comments in each page template, which is the approach that APEX takes for IE workarounds:
    <!--[if lt IE 10]><link rel="stylesheet" href="..." type="text/css" /><![endif]-->There also another alternative: fix the errant APEX CSS at <tt>/i/themes/theme_24/css/4_1.css</tt> if the powers that be will allow it.

  • Is there any way to change the color of the Firefox 4 menu button away from orange? It attracts my attention and as far as I can tell personas change everything but the menu button color.

    Is there any way to change the color of the Firefox 4 menu button away from orange? It attracts my attention and as far as I can tell personas change everything but the menu button color.

    You can change it with the App Button Color extension - https://addons.mozilla.org/firefox/addon/app-button-color

  • Push Button Color

    Dear Sirs,
    How can I change the Push Button Color in Forms 6i?
    Thanks
    Rehman Ghani
    Pakistan

    Hi,
    try to search in PL/SQL code in your form by the button name... May be it is changed dinamically at execution time?
    In what environment are you developing? client/server application? Ebusiness suite?...
    Jose L.

  • Change button color

    i have a group of buttons and when each one is clicked its color should change. when another button is clicked the color of previous button should change back to normal..plz help..thanks in advance

    Hi Srivatsa,
    You can do the same for chnanging your button icons if you have only tow icons to display ....one is default icon and the other one is the icon which you wnat to display when the button is clicked...
    Check the below code:
    Just replace the image path in the embed variable with your image path and check...
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
      <![CDATA[
       private var previousButtonClicked:Button;
       [Embed("assets/Rose20Icon.jpg") ]
             [Bindable]private var buttonIcon:Class;
             [Embed("assets/arrowIcon.JPG") ]
             [Bindable]private var buttonIconDefault:Class;
       private function buttonClickHandler(event:MouseEvent):void
        if(previousButtonClicked)
         previousButtonClicked.setStyle("icon",buttonIconDefault);
        previousButtonClicked = event.currentTarget as Button;
        Button(event.currentTarget).setStyle("icon",buttonIcon);
      ]]>
    </mx:Script>
    <mx:HBox>
      <mx:Button id="btn1" icon="{buttonIconDefault}" label="Button" color="green" click="buttonClickHandler(event);"/>
      <mx:Button id="btn2" icon="{buttonIconDefault}" label="Button" color="green" click="buttonClickHandler(event);"/>
      <mx:Button id="btn3" icon="{buttonIconDefault}" label="Button" color="green" click="buttonClickHandler(event);"/>
      <mx:Button id="btn4" icon="{buttonIconDefault}" label="Button" color="green" click="buttonClickHandler(event);"/>
      <mx:Button id="btn5" icon="{buttonIconDefault}" label="Button" color="green" click="buttonClickHandler(event);"/>
      <mx:Button id="btn6" icon="{buttonIconDefault}" label="Button" color="green" click="buttonClickHandler(event);"/>
      <mx:Button id="btn7" icon="{buttonIconDefault}" label="Button" color="green" click="buttonClickHandler(event);"/>
    </mx:HBox>
    </mx:Application>
    Thanks,
    Bhasker Chari 

  • Can you change the button color on a custom theme?

    I recently installed a nice theme called Fractal-01 Song of a morning breeze. I had to installan add-on to change the menus that were white and thus invisible, but I have not figured out how to get the grey buttons for like Home and Back and Reload black, and they are very hard to see with this theme.
    I tried changing them in Custom Theme Restorer, but nothing seems to change them to black. I can't imagine that the person who designed this theme would have made these washed out colors that blend into the theme the default, but maybe he or she did. It is a shame to give up on such a nice theme if I don't have to, but it helps if you can see your buttons.

    Hi sherylz,
    It is also possible to edit the theme, but it may be wise to make a copy of it:
    *[https://support.mozilla.org/en-US/questions/940165]
    *[https://developer.mozilla.org/en-US/Add-ons/Themes/Background MDN Reference]
    *Add on to make own skin: [https://addons.mozilla.org/en-Us/firefox/addon/bt-canvas/]

  • Pressed button color

    Hi,
    I have a JPopUpMenu containing JMenuItems. When it is pressed, I would like the JMenuItem to freeze for some time and change color. I freeze it with a simple Thread.sleep(time). My problem is to change the color.
    If I try to change the display in the actionPerformed, the HMI is not updated before the end of the actionPerformed, so the menu disappears.
    I tried to use the UIManager with "menuPressedItemB" and "menuPressedItemF" that I found here:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=183858
    But it looks effectless...
    Any help is welcome. Thx for your attention,
    lolo

    Swing related questions should be posted in the Swing forum. Try setting the following properties on the button:
    setContentAreaFilled( false );
    setOpaque(true);

  • Setting a buttons color

    I have been trying to change the color of a flex button to
    blue. If the canvas background is white, my button blends with the
    white. What property can I set to stop this. All I want is a solid
    blue button without having the background blend into it.
    sammy

    In the simplest of examples, does this not work on your
    machine?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    alpha="1.0" backgroundGradientAlphas="[1.0, 1.0]"
    backgroundGradientColors="[#FFFFFF, #FFFFFF]" width="200"
    height="200">
    <mx:Button label="Button" fillAlphas="[1.0, 1.0]"
    fillColors="[#1631F6, #1631F6]" color="#FFFFFF"/>
    </mx:Application>

  • Changing button color

    hi,
    i am writing an applet and i have many buttons. when you click on a button i want to check what color it currently is and change it appropiatly.
    i have hit a brick wall. i can set the color no probs with;
    onea.setBackGround(red);
    but how would you go about comparing onea's color with my two colors red and green?
    thanks

    Is this a project for school?
    Anyway, you could get the RGB int values and compare them one by one...Like
    int currentRed = someColor.getRed();
    int currentGreen = someColor.getGreen();
    int currentBlue = someColor.getBlue();
    int anotherRed = anotherColor.getRed();
    int anotherGreen = anotherColor.getGreen();
    int anottherBlue = anotherColor.getBlue();
    // now compare the two colors
    if ( currentRed == anotherRed &&
    currentGreen == anotherGreen &&
    currentBlue == anotherBlue )
    // if we get here then the two Colors are equivalent
    A more professional solution would be to create a custom Comparator by implementing the Comparator interface. From there you could manually call compare( currentColor, anotherColor );
    Also, with a custom Comparator you could store multiple Color objects in a List and then use the Arrays class with the Comparator to perform sorting and lookup.
    For simplicity sake, just create a convenience method to check two colors of your choosing. Like:
    public int myColorComparingMethod( Color colorA, Color colorB )
    // compare here and return an int based upon order
    Eric
    P.S. - you should offer Duke Dollars when you post, it will encourage more people to offer responses to your questions.

  • Changing simple button color

    It would seem as if this would be simple, but I'm not finding
    any documentation.
    I have a map of the US. Each U.S. state is a simple button.
    I'd like to change the button fill color (and potentially, the
    outline color) in AS3. I've created the buttons in Flash, not in
    AS3 (just graphically). How do I change the button fill color?
    Sample code:
    function addButtonListeners(btnInstance:SimpleButton) {
    btnInstance.addEventListener( MouseEvent.ROLL_OVER,
    handleRollover);
    btnInstance.addEventListener( MouseEvent.ROLL_OUT,
    handleRollover);
    addButtonListeners(Montana);
    addButtonListeners(NewMexico);
    addButtonListeners(Washington);
    Montana._color = 0xA6CsDA; //doesn't work

    I also tried this code, but I'm getting the error message:
    Access of possibly undefined property rgb through a reference
    with static type flash.geom:ColorTransform.
    Source: color.rgb = 0x00ff00;

  • TS2610 Can png menu overlays glitch in chroma button colors?

    I created a png overlay with blue dots for buttons. I created my buttons around the dots only. Next to the dots are text. When I chroma out the blue and change its activation color, all of the text begins to highlights in that same color. It looks hideous. Is there an explainationfor this? I've never had this happen to me before. It's not chroma keying the button boundaries, it's chroma keying the entire layer.

    Text highlights in DSP will never win the award for outstanding aestetics. It can be done but I personally avoid them. Stay away from red highlights and san serif fonts.
    The overlay layer can have up to three color highlights than can be assigned any RGB value.
    The colors are black, red, & blue.
    If you are trying to have the shape highlight appear with a highlight color and the text appear at the same time unfettered by color I would not include it in the overlay layer. Overlay should only be used to tell the program what you want to highlight. If DSP sees black it makes it color a, red? make it color b, blue? make it this color c.
    You could make the shape black & the text red. Assign different HL colors and then when the button is selected the they would appear with different highlights.
    A layered psd could solve this but I find that they  slow down menus so much that they aren't even worth considering. If including the text on the background(all the time) isn't a option than you could make duplicate menus with button auto jumps to give the user the illusion of the text coming on with the button highlight. But in reality the text isn't part of the highlight it just appears on the second menu. Since the menu is a duplicate only the text and the highlight change.

Maybe you are looking for

  • Windows - no disk

    I recieve this error message whenever Iopen iTunes. When connected my ipod is constantly in "do not disconnect" mode also. Can anyone explain what it is and how to get rid of it?

  • Purchase Order missing for some of the Sales Order for few customers

    Hi All, There are few sales orders for which corresponding PO is missing. But most of other Sales orders for the same set of customers, PO is coming. Could you please enlighten me how this PO is assigned to the Sales order or it is updated with the I

  • Change the look error in sharepoint 2013

    hi i want to change the Them of my site. go to Site Setting > Change the look and choice the them and click on Try it out link t but i get this error: what am i do?

  • Search help

    How to use a search help exit in module pool.

  • Third party -IDOC -ALE

    Hi friends, Is it posssible for third party sales interface between vendor and customer through ALE or IDOC ......if so then how? Thanks Ivy