Applet to draw rectanlge changing color randomly

hello ,
i am new to java and learning applets . i want to draw a rectangle which changes its color randomly .
my issue is i dont know how to set variable in
function setColor()
please help me to implement this applet .
thanks in advance !
gagan

I've done something like so:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import javax.swing.JPanel;
import javax.swing.Timer;
public class AppletPanel extends JPanel
  private static final int DELAY = 160;
  private static final int RANDOM_COLOR_COUNT = 100;
  // use some of the standard colors in an array
  private Color[] colors =
    Color.white, Color.black, Color.red, Color.orange,
    Color.green, Color.blue, Color.cyan, Color.magenta, Color.YELLOW 
  private Color myColor = Color.white;
  List<Color> colorList = new ArrayList<Color>();
  private Random random = new Random();
  private int delay = DELAY;
  Timer timer = new Timer(delay, new ActionListener()
    public void actionPerformed(ActionEvent e)
      myColor = colorList.get(random.nextInt(colorList.size()));
      setBackground(myColor);
  public AppletPanel()
    setPreferredSize(new Dimension(250, 250));
    for (int i = 0; i < colors.length; i++)
      // here we use a Color List to hold the standard colors
      colorList.add(colors);
for (int i = 0; i < RANDOM_COLOR_COUNT; i++)
Color c = new Color(
random.nextInt(256),
random.nextInt(256),
random.nextInt(256));
// and now stuff the list with random colors too!
colorList.add(c);
timer.start();
and for the applet part:
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.BorderFactory;
import javax.swing.JApplet;
public class AppletPanelTest extends JApplet
  public void init()
    try
      javax.swing.SwingUtilities.invokeAndWait(new Runnable()
        public void run()
          createGUI();
    catch (Exception e)
      System.err.println("createGUI didn't successfully complete");
  private void createGUI()
    setSize(new Dimension(400, 300));
    AppletPanel panel = new AppletPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
    Container contentPane = getContentPane();
    contentPane.setLayout(new FlowLayout());
    contentPane.add(panel);

Similar Messages

  • Why the lookandfeel change color randomly?

    why the lookandfeel change color randomly?
    after my API moves JDK1.4 to 1.5, the problem appeared.
    the Max/Min/Close button of JFrame also change to other style.

    yes, I have reset the Theme of MetalLookAndFeel.setCurrentTheme() to myself, but sometime it looks useless. It will use oceanTheme or myTheme randomly.
    Then I add a loop to check the current theme till it use mytheme.
    The new problem the min/max/close button changed randomly, though that is much less frequent.

  • Change color randomly of object

    Hi,
    I wrote a small application simulating a road traffic. I am using threads to do the animation.
    this is the code:
    public class TestProject extends Frame implements Runnable
       public static int frame;   // int variable for frame (animation)
        int delay = 100;    // delay for animation
        Thread animator, light;    // thread name
         * Create a thread and start it.
        public void start()
            animator = new Thread(this);    // create new thread
            animator.start();               // start thread
         * This method is called by the thread that was created in
         * the start method. It does the main animation.
        public void run()
            // Remember the starting time
            long tm = System.currentTimeMillis();   // get time (ms) and store it in tm
            while (Thread.currentThread() == animator)
                // Display the next frame of animation.
                if (frame==(200*roadArrangement.size()+50)) // if object reaches "end" reset
                    frame =-50; // "reset" frame
                repaint();  // repaint object
                // Delay depending on how far we are behind.
                try
                    tm += delay;    // delay
                    Thread.sleep(Math.max(0, tm - System.currentTimeMillis()));
                catch (InterruptedException e) // catch exception for thread
                    System.out.println("error in thread interrupt!");
                    break;
                frame++;    // Advance the frame
        } // end of run
         * Set the animator variable to null so that the
         * thread will exit before displaying the next frame.
        public void stop()
            animator = null;
         * Paint a frame of animation.
        public void paint(Graphics g)
            for(int i = 0; i < roadArrangement.size(); i++)
                String tempType = roadArrangement.elementAt(i).toString();
                char roadType = tempType.charAt(0);
                g.setColor(Color.darkGray);
                if(roadType == 'r')
                    g.setColor(Color.darkGray);
                    g.fill3DRect(10+(i*210),100,210,60,true);
                else if(roadType == 'j')
                    g.setColor(Color.darkGray);
                    g.fill3DRect(10+(i*210),100,210,60,true);
                    g.fill3DRect(85+(i*210),160,60,70,true);
                    g.fill3DRect(85+(i*210),30,60,70,true);
                    g.setColor(Color.green); // traffic light color
                    g.fillOval(10+(i*210)+50,30+100,10,10); // traffic light
                    Color clr = g.getColor();
                    int red = clr.getRed();
                    if((frame == (10+(i*210)+50))&&(red==255))
                        stop(); // stop thread to stop cars
                        System.out.println("STOP");  
    }In the code I have "oval" traffic lights where I set the colours.
    Now, what I want to do is that traffic lights change independently and randomly their colour so that cars stop and drive.
    How can I do this? Will I need a second thread? If yes, how to implement that?
    thanks in advance.

    Use [url http://java.sun.com/j2se/1.5.0/docs/api/java/util/Random.html]Random class and call nextInt every time in paint method than match a color to the int you get back.

  • How Do I change color randomly of a MovieClip in a Timer event?

    I have created a MovieClip named "Target" and called it from actionscript. Inside this movie clip I have created an 'action' layer and written the code in it:
    import fl.motion.Animator;
    import fl.motion.MotionEvent;
    var this_xml:XML = <Motion duration="30" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
        <source>
            <Source frameRate="12" x="202" y="169.15" scaleX="1" scaleY="1" rotation="0" elementType="movie clip" symbolName="Target">
                <dimensions>
                    <geom:Rectangle left="-32.05" top="-30.85" width="64.05" height="61.7"/>
                </dimensions>
                <transformationPoint>
                    <geom:Point x="0.5003903200624512" y="0.5"/>
                </transformationPoint>
            </Source>
        </source>
        <Keyframe index="0" tweenSnap="true" tweenSync="true">
            <tweens>
                <SimpleEase ease="0"/>
            </tweens>
        </Keyframe>
        <Keyframe index="29" scaleX="2.096" scaleY="2.096"/>
    </Motion>;
    var this_animator:Animator = new Animator(this_xml, this);
    this_animator.play();
    this_animator.addEventListener(MotionEvent.MOTION_END, removeTarget);
    function removeTarget(event:MotionEvent):void
        this.parent.removeChild(this);
    In the main timeline I also have created another 'action' layer and written the code like this:
    var timer:Timer;
    var targetCount:uint;
    var container:MovieClip;
    function initGame():void
        container = new MovieClip();
        addChild(container);
        targetCount = 10;
        timer = new Timer(1000, targetCount);
        timer.addEventListener(TimerEvent.TIMER, generateTarget);
        timer.start();
    function generateTarget(event:TimerEvent):void
        var target:MovieClip = new Target();
         target.x = Math.random() * stage.stageWidth;
        target.y = Math.random() * stage.stageHeight;
        container.addChild(target);
    initGame();
    Now I can get 10 animating circles in different places of the stage after every second. And every circles will leave the stage after completing the animation. Though I have given 'pink' color in that circle, that's why its generating with 'pink' color always. How do I change the color of each circle while it will generate?
    Regards
    Dipesh Pal.

    I have tried in this way......
    function generateTarget(event:TimerEvent):void
        var target:MovieClip = new Target();
        var colorT:ColorTransform = new ColorTransform();
        colorT.redOffset = Math.round(Math.random() * 510) - 255;
        colorT.greenOffset = Math.round(Math.random() * 510) - 255;
        target.transform.colorTransform = colorT;
        target.x = Math.random() * stage.stageWidth;
        target.y = Math.random() * stage.stageHeight;
        container.addChild(target);
    but its not working......
    infact i have used function 'circleColor' which holds this random color transform.... and call that function from 'generateTarget' function also....but it doesnt work too...
    then how do I change the color of every circle which is randomly generating in the stage....?

  • Need help with classes in Applets and drawing buildings.

    I'm trying to create an Applet that draws a starfield (I got that right) and then searches for any parameters in the Applet tag. The Applet then draws as many buldings as there are parameters in the Applet tag, and uses the number in the parameter as the height. I have it working OK, but it won't draw the buildings. Here is me code:
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.geom.*;
    import java.util.*;
    import javax.swing.*;
    public class Skyline extends Applet {
    public void init() {
    setBackground(Color.black);
    public void paint(Graphics g) {
    Graphics2D pen = (Graphics2D) g;
    Random generator = new Random();
    Stars starField = new Stars();
    starField.drawStars(pen, getWidth(), getHeight());
    int n = 1;
    String param = null;
    while((param = getParameter("param" + n)) != null) {
    n++;
    int startX = 0;
    int startY = getHeight();
    int height = 0;
    int width = getWidth() / (n + 2);
    Building structure = new Building();
    structure.drawBuilding(pen, height, width, startX, startY, n);
    class Stars {
    public void drawStars(Graphics2D pen, int Width, int Height) {
    Random generator = new Random();
    int runs = 1;
    while (runs <= 1000) {
    int Xcord = generator.nextInt(Width - 3);
    int Ycord = generator.nextInt(Height - 3);
    Ellipse2D.Double star
    = new Ellipse2D.Double(Xcord, Ycord, 3, 3);
    pen.setColor(Color.white);
    pen.fill(star);
    runs++;
    class Building {
    public void drawBuilding(Graphics2D pen, int height, int width, int startX, int startY, int n) {
    Random generator = new Random();
    int n2 = 1;
    int runs = 1;
    String input = "";
    int red = generator.nextInt(100),
    green = generator.nextInt(100),
    blue = generator.nextInt(100);
    pen.setColor(new Color(red, green, blue));
    while (runs <= n) {
    input = getParameter("building" + n2);
    height = Integer.parseInt(input);
    height = startY - height;
    Rectangle building = new Rectangle(startX, startY, height, width);
    pen.fill(building);
    startY = startY + width;
    n2++;
    runs++;
    Can anyone help me?

    That didn't work, so I looked at the code again and found some errors. I decided to rewrite it, here is the updated code...
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.geom.*;
    import java.util.*;
    import javax.swing.*;
    public class Skyline extends Applet {
    public void init() {
    setBackground(Color.black);
    public void paint(Graphics g) {
    Graphics2D pen = (Graphics2D) g;
    Random generator = new Random();
    Stars starField = new Stars();
    starField.drawStars(pen, getWidth(), getHeight());
    Building structure = new Building();
    structure.drawBuilding(pen);
    class Stars {
    public void drawStars(Graphics2D pen, int Width, int Height) {
    Random generator = new Random();
    int runs = 1;
    while (runs <= 1000) {
    int Xcord = generator.nextInt(Width - 3);
    int Ycord = generator.nextInt(Height - 3);
    Ellipse2D.Double star
    = new Ellipse2D.Double(Xcord, Ycord, 3, 3);
    pen.setColor(Color.white);
    pen.fill(star);
    runs++;
    class Building {
    public void drawBuilding(Graphics2D pen) {
    Random generator = new Random();
    int n = 1;
    int n2 = 1;
    int runs = 1;
    String input = "";
    String param = "";
    while ((param = getParameter("building" + n)) != null) {
    n++;
    int height = getHeight();
    int width = getWidth();
    int startX = 0;
    int startY = height;
    int red = generator.nextInt(100),
    green = generator.nextInt(100),
    blue = generator.nextInt(100);
    pen.setColor(new Color(red, green, blue));
    while (runs <= n) {
    height = getHeight();
    input = getParameter("building" + n2);
    height = Integer.parseInt(input);
    height = startY - height;
    Rectangle building = new Rectangle(startY, startX, height, width);
    pen.fill(building);
    startX = startX + width;
    n2++;
    runs++;
    I can get it to draw one large black building, but that's it.

  • Pacman now needs to change color, but the types are incompatible ...

    Hi, my book sucks and I need your help again , Thanks In Advance !!!
    OK, now pacman can move in all directions and make a random move, but there needs to be a button to make him change color...
    I have come up with the following code but when I try to compile I get incompatible types for my new Pacmancolors...
    package pacman;
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Autopacman extends Applet implements ActionListener
    boolean Packleur1;
    boolean Packleur2;
    boolean Packleur3;
    boolean Packleur4;
    boolean Packleur5;
    boolean Packleur6;
    int klikken = 1;
    int x = 200, y = 200; //beginpositie pacman
    int width = 50, height = 50; //formaat pacman
    int stap = 20; //standaard stapgrootte
    int stapVerander = 10; //stapgrootte wijziging
    int angleA = 5; //beginhoeken pacman
    int angleB = 345;
    public void init(){
    Button links = new Button("links"); //knoppen worden gemaakt en gelabeld
    Button rechts = new Button("rechts");
    Button omhoog = new Button("omhoog");
    Button omlaag = new Button("omlaag");
    Button harder = new Button("harder");
    Button zachter = new Button("zachter");
    Button random = new Button("Random actie");
    Button kleur = new Button("Kleur veranderen");
    links.addActionListener(this); //action events worden aan knoppen gekoppeld
    rechts.addActionListener(this);
    omhoog.addActionListener(this);
    omlaag.addActionListener(this);
    harder.addActionListener(this);
    zachter.addActionListener(this);
    random.addActionListener(this);
    kleur.addActionListener(this);
    add( links ); //knoppen worden op canvas gezet
    add( rechts );
    add( omhoog );
    add( omlaag );
    add( harder );
    add( zachter );
    add( random );
    add( kleur );
    public void paint(Graphics g){
    g.setColor( Color.black);
    g.drawLine( 0, 34, 600, 34 );
    Packleur1 = g.setColor( Color.yellow );
    Packleur2 = g.setColor( Color.red );
    Packleur3 = g.setColor( Color.blue );
    Packleur4 = g.setColor( Color.green );
    Packleur5 = g.setColor( Color.white );
    Packleur6 = g.setColor( Color.black );
    g.fillArc(x, y, width, height, angleA, angleB); //teken de pacman voor het eerst
    public void actionPerformed(ActionEvent e){
    String str = e.getActionCommand();
    if( str.equals("Kleur veranderen")){
    klikken++;
    if( klikken = 2 )
    {Packleur2 = true;}
    if( klikken = 3 )
    {Packleur3 = true;}
    if( klikken = 4 )
    {Packleur4 = true;}
    if( klikken = 5 )
    {Packleur5 = true;}
    if( klikken = 6 )
    {Packleur6 = true;}
    return false;
    if(klikken == 7)
    {klikken = 1;}
    if( str.equals("Random actie") ){       //Die stomme random functie
    int i = (int)(Math.random() * 10);
    switch(i){
    case 1: case 7 : str = "omlaag"; break;
    case 2: case 8 : str = "omhoog"; break;
    case 3: case 9 : str = "links"; break;
    case 4: case 10 : str = "rechts"; break;
    case 5: case 0: str = "harder"; break;
    case 6: str = "zachter"; break;}
    if( str.equals("harder") ){ stap = stap + stapVerander;} //stap wordt 10 groter
    if( str.equals("zachter") ){ stap = stap - stapVerander;} //stap wordt 10 kleiner
    if( stap < 0){stap = 1;} //Stapgrootte wordt nooit negatief of nul
    if( str.equals("links") ){ x -= stap;     //linksknop laat pacman links kijken en bewegen
    angleA = 185;
    angleB = 345;}
    if( str.equals("rechts") ){ x += stap;    //rechtsknop laat pacman rechts kijken en bewegen
    angleA = 5;
    angleB = 345;}
    if( str.equals("omhoog") ){ y -= stap;    //omhoogknop laat pacman omhoog kijken en bewegen
    angleA = 95;
    angleB = 345;}
    if( str.equals("omlaag") ){ y += stap;    //omlaagknop laat pacman omlaag kijken en bewegen
    angleA = 275;
    angleB = 345;}
    if( x <= 0){ x = 0;} // houdt de pacman tegen als hij links/rechts wil verdwijnen
    if( x > 550){ x = 550;}
    if( y <= 35){ y = 35;} // houdt de pacman tegen als hij boven/onder wil verdwijnen
    if( y > 550){ y = 550;}
    repaint(); // zet de pacman opnieuw op het canvas
    Can anyone help me with this?
    Thanks a bundle!
    Menno.

    Thanks a lot!
    Say if you want to see how it works just compile this source :
    /* Autopacman spelletje
    Menno Hagens, I108
    2001
    Autopacman.
    Maak via overerving van de klasse Packman uit week 4 een nieuwe klasse 'AutoPackman'.
    Deze klasse moet de volgende extra functionaliteit bevatten.
    De kleur van de Packman moet kunnen worden ingesteld.
    Er moet een methode komen die een willekeurige opdracht aan de Packman geeft.
    (naarLinks, naarRechts, gaSneller, gaTrager, etc.)
    Maak vervolgens een applet met vier Packmannetjes en ��n knop 'Beweeg'.
    Als je op deze knop drukt, moeten alle Packmannetjes ��n stap in een willekeurige
    richting doen.
    Programmeer dit efficient met arrays en loops.
    Als je na afloop nog moed hebt kun je de klasse en de applet zo aanpassen dat een
    spel ontstaat, waarbij een Packman die op de positie van een andere komt, de andere
    Packman opeet. Degene die overblijft heeft gewonnen.
    package pacman;
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Autopacman extends Applet implements ActionListener
    boolean Packleur1;
    boolean Packleur2;
    boolean Packleur3;
    boolean Packleur4;
    boolean Packleur5;
    boolean Packleur6;
    int klikken = 1;
    int x = 200, y = 200; //beginpositie pacman
    int width = 50, height = 50; //formaat pacman
    int stap = 20; //standaard stapgrootte
    int stapVerander = 10; //stapgrootte wijziging
    int angleA = 5; //beginhoeken pacman
    int angleB = 345;
    public void init(){
    Button links = new Button("links"); //knoppen worden gemaakt en gelabeld
    Button rechts = new Button("rechts");
    Button omhoog = new Button("omhoog");
    Button omlaag = new Button("omlaag");
    Button harder = new Button("harder");
    Button zachter = new Button("zachter");
    Button random = new Button("Random actie");
    Button kleur = new Button("Kleur veranderen");
    links.addActionListener(this); //action events worden aan knoppen gekoppeld
    rechts.addActionListener(this);
    omhoog.addActionListener(this);
    omlaag.addActionListener(this);
    harder.addActionListener(this);
    zachter.addActionListener(this);
    random.addActionListener(this);
    kleur.addActionListener(this);
    add( links ); //knoppen worden op canvas gezet
    add( rechts );
    add( omhoog );
    add( omlaag );
    add( harder );
    add( zachter );
    add( random );
    add( kleur );
    public void paint(Graphics g){
    g.setColor( Color.black);
    g.drawLine( 0, 34, 600, 34 );
    g.setColor( Color.yellow);
    if( klikken == 1 )
    {g.setColor(Color.yellow);}
    if( klikken == 2 )
    {g.setColor(Color.red);}
    if( klikken == 3 )
    {g.setColor(Color.blue);}
    if( klikken == 4 )
    {g.setColor(Color.black);}
    if( klikken == 5 )
    {g.setColor(Color.green);}
    if( klikken == 6 )
    {g.setColor(Color.white);}
    g.fillArc(x, y, width, height, angleA, angleB); //teken de pacman voor het eerst
    public void actionPerformed(ActionEvent e){
    String str = e.getActionCommand();
    if( str.equals("Kleur veranderen")){klikken++;}
    if(klikken == 7)
    {klikken = 1;}
    if( str.equals("Random actie") ){       //Die stomme random functie
    int i = (int)(Math.random() * 17);
    switch(i){
    case 1: case 7 : case 11: case 15 : str = "omlaag"; break;
    case 2: case 8 : case 12: case 16 : str = "omhoog"; break;
    case 3: case 9 : case 13: case 17 : str = "links"; break;
    case 4: case 10 : case 14: case 0 :str = "rechts"; break;
    case 5: str = "harder"; break;
    case 6: str = "zachter"; break;}
    if( str.equals("harder") ){ stap = stap + stapVerander;} //stap wordt 10 groter
    if( str.equals("zachter") ){ stap = stap - stapVerander;} //stap wordt 10 kleiner
    if( stap < 0){stap = 1;} //Stapgrootte wordt nooit negatief of nul
    if( str.equals("links") ){ x -= stap;     //linksknop laat pacman links kijken en bewegen
    angleA = 185;
    angleB = 345;}
    if( str.equals("rechts") ){ x += stap;    //rechtsknop laat pacman rechts kijken en bewegen
    angleA = 5;
    angleB = 345;}
    if( str.equals("omhoog") ){ y -= stap;    //omhoogknop laat pacman omhoog kijken en bewegen
    angleA = 95;
    angleB = 345;}
    if( str.equals("omlaag") ){ y += stap;    //omlaagknop laat pacman omlaag kijken en bewegen
    angleA = 275;
    angleB = 345;}
    if( x <= 0){ x = 0;} // houdt de pacman tegen als hij links/rechts wil verdwijnen
    if( x > 550){ x = 550;}
    if( y <= 35){ y = 35;} // houdt de pacman tegen als hij boven/onder wil verdwijnen
    if( y > 550){ y = 550;}
    repaint(); // zet de pacman opnieuw op het canvas

  • How to create moving, fading and changing color movie

    Hi
    I want to make a simple movie where a graphic shaped as a !
    (exp. mark) randomly appears on canvas, fading in and out and
    changing colors. I have studied the tutorial but I need a little
    help. Can you help me?

    re-sizing frames, stacking video tracks and motion keyframes. The way I would imagine >accomplishing this, would be a very tedious process, and I was wondering if there might be some >more efficient way.
    This is how you would do it.
    There's no "canned" way to control the various elements.
    My suggestion is to put on the coffee pot, get started, then reap the benefits of your work.
    BTW: I liked the vid as I've been to most of those places in NZ.
    Al

  • Change color on a scrollbar

    Hi!
    I have tried to find an answer to this problem in several places, books and forums, everywhere. I need a code snippet on how to change color on a scrollbar. Things like:
    scrollbar-base-color
    scrollbar-face-color
    scrollbar-track-color
    ....and so on....
    I'm working on an applet basket and I simply need the color to match the color of the webpage..:)
    You can take a look at www.kennet.wasadata.com, put a sample object in the basket and it should turn up in an applet. If you put more then two things in the basket a scrollbar appears, that?s the scrollbar I need to repaint so to speak???I work with the AWT library no swing. If the webpage doesn?t load fast enough it?s due to that dying server of mine..J
    Thanks in advance.
    Kennet Carlsen

    Here is an example:
    BODY {
    SCROLLBAR-BASE-COLOR: #486591;
    By the way, this seems not to work on Moailla Firefox 0.9.3 on Windows.

  • Changing colors of individual bars in a XY Graph

    I am using an XY Graph (bar style) to display 50 voltages. I have limit settings (low alarm,low warning, high warning, high alarm)that I would like to impose on each of the 50 bars in the XY graph. My problem is that any way I try it the limits are only imposed on the first bar on the graph and all the following bars change colors along with the first bar no matter what value they have. Is it possible to control the properties of individual bars inside an XY Graph ??

    > I am using an XY Graph (bar style) to display 50 voltages. I have
    > limit settings (low alarm,low warning, high warning, high alarm)that I
    > would like to impose on each of the 50 bars in the XY graph. My
    > problem is that any way I try it the limits are only imposed on the
    > first bar on the graph and all the following bars change colors along
    > with the first bar no matter what value they have. Is it possible to
    > control the properties of individual bars inside an XY Graph ??
    >
    The short answer is no. All of the elements in a plot use the same
    colors to draw. To get the display you want, you need four plots.
    Write a subVI that takes in your array and returns the four that you
    need. It will index the elements and generates a value in four othe
    r
    arrays such that three of them are NaN and the fourth contains your
    value depending on the alarm status keeping the same X value with all
    four plots. As an example, if the value is lower than the low alarm
    limit, the value will be placed in the low array and NaNs in the other
    three arrays.
    Now wire the four arrays to the graph as a multiplot, you will either
    use a build array or a Build Clustered array depending on the XY type.
    The plots will overlay, with only one point being non-NaN for each X
    location. It will use the color for plot 0, 1, 2, or 3 depending on
    which array the value was in.
    Greg McKaskle

  • Changing color of arrow button in JComboBox

    Hi all,
    Can somebody please help me to change the color of arrow button in JComboBox

    The default color uses to draw the arrow is UIManager.getColor("controlShadow"), so if you put a different color there, that would be used for the arrow buttons. Of course, that color is likely used other places as well, and so any other place where it is used would get your changed color too. For example, the scrollbar buttons for the scrollbar in the popup list would likely use that color.
    Further, the current look and feel can override this; for example, the Metal L&F creates its own button, which uses its own icon which ends up using a hard-coded color of black when painting the arrow.
    : jay

  • Apple Menu Logo Changes Colors

    I've been trying to figure out why the Apple Logo on he menu bar changes color, seemingly at random, starting from the dark gray of graphite theme, then cycling through reds, oranges, yellows, etc--sometimes multicolored.
    I've never played around with "skins" or tried to alter appearance in any other way.
    Anyone Have similar experience / explanation?
    Corrupt Files?

    Hi,
    It'd be cool to have that happen on my menu bar.
    IF, this is a serious system issue than you would hope that you don't have it to.
    Dimaxum

  • GUI lines changing colors

    I am creating a GUI where ultimately I would like to have 3 lines painted in a panel first. Then when a play button is hit i would like the lines to start changing colors. However to start it I had decided to have the Thread draw the line (using getGraphics). Right now the line will sometimes draw but will not stay painted until the next line would be painted. It just flashes quickly. Sometimes it wil go through the whole loop of colors and other times it will only flash the first color. When it does flash more than the first color the line is usually only half the length of what it should be. Are there any suggestions of how to fix his problem?!?!
    class Runner extends Thread {
    public SimulationPanel sp;
    public Runner(SimulationPanel simpanel){
    this.sp=simpanel;
    public void run() {
    System.out.println("The Thread is working");
    Graphics comp = sp.getGraphics();
    Graphics2D comp2D = (Graphics2D) comp;
    BasicStroke line2 = new BasicStroke(5);
    Line2D.Float ln1 = new Line2D.Float(500F, 200F, 800F, 400F);
    Color colors[] = {Color.RED, Color.GREEN, Color.BLUE, Color.MAGENTA };
    for(int i = 0; i <= 4; i++) {
    comp2D.setColor(colors);
    comp2D.draw(ln1);
    delay(1000);
    void delay(int milliseconds) {
    try {
    Thread.sleep(milliseconds);
    catch (InterruptedException e) { }

    Thanks for the help. But Im kind of confused. How will the line be changed in the SimulationPanel?
    class SimulationPanel extends JPanel {
         public void paintComponent(Graphics comp) {     
              super.paintComponent(comp);
              Graphics2D comp2D = (Graphics2D) comp;
              Font titleFont = new Font("Serif", Font.BOLD , 24);
              setFont(titleFont);
              String str = "Simulation";
              comp2D.drawString(str, 15, 50);
              comp2D.setColor(Color.black);
              BasicStroke line2 = new BasicStroke(2);
              Line2D.Float ln1 = new Line2D.Float(500F,200F,900F,400F);
              Line2D.Float ln2 = new Line2D.Float(400F,200F,150F,400F);
              Line2D.Float ln3 = new Line2D.Float(200F,450F,850F,450F);
              Line2D.Float ln4 = new Line2D.Float(100F,100F,100F,600F);
              comp2D.setStroke(line2);
              comp2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
              comp2D.draw(ln1);
              comp2D.draw(ln2);
              comp2D.draw(ln3);
              Image myImage;
              myImage = Toolkit.getDefaultToolkit().getImage("C:/Users/Renee/Pictures/NGOone.jpg");
              comp.drawImage(myImage, 410, 150, this);
              comp.drawImage(myImage, 50, 415, this);
              comp.drawImage(myImage, 875, 415, this);
              String trial = "Tentative list area";
              comp.drawString(trial, 650 , 100);
              comp.drawString(trial, 100, 550);
              comp.drawString(trial, 775, 550);
    Edited by: rstepler on Jun 17, 2008 8:39 AM

  • Calendar Appointments Unexpectedly Changing Color

    In our office we are using Outlook 2010 (v14.0.7116.5000) with Exchange accounts on Exchange Server 2010 (v14.02.0387.000), and we share calendars between staff members.  We have specifically assigned category colors for certain appointments. 
    We have one shared calendar where appointments will randomly change color.  The appointments are always red on this calendar when viewed from the owner's account.  But when other staff members view this shared calendar, the appointments will sometimes
    turn yellow (even though the category still says red.)  This issue seems to appear at random, surfacing for a few days and then returning to normal.  The color changing only affects certain users at any one time, as the appointments will appear yellow
    for certain staff and then red for others.  And this issue is isolated to only one shared calendar; we have no issues with the 30+ other shared calendars.  Any ideas what could be going only?
    Any help is greatly appreciated!
    -Anthony

    Hi Anthony,
    There is no feature in Exchange side to manage calendar view in Outlook. Since the issue only happens to one specific shared calendar and specific users, I suggest we can ask a question in
    Outlook form
    for further troubleshooting.
    Personal suggestion, please start the specific users' Outlook in safe mode to have a try.
    Regards,
    Winnie Liang
    TechNet Community Support

  • Changing color though it does not change

    Using CS3, I double click on the foreground color and enter CMYK colors and use the Rectangle tool to draw a shape on screen.
    Next, I double click on the foreground color again and enter different CMYK colors and use the Rectangle tool to draw a new shape. Even though the foreground color properly reflects the newly added second color, it still uses the original color.
    What am I doing wrong?
    Thanks.

    After you draw the fist rectangle, you have to click on the Color swatch at the far right of the Rectangle Tool option bar to change colors.

  • Change colors Sem_BSC

    Hello
    I use the Sem_BSC standard BSP application from BW. I want to change the colors to tables. I change the colors in css file, but the pages causeandeffect.htm and overview.htm use applet. In the pages causeandeffect.htm and overview.htm when the applet is invoqued there are some colors, but when I change this colors there are some colors that I can´t change. Where are this colors? How can I change the colors for applet that is show in causeandeffect.htm and overview.htm pages?
    Thanks
    Maria Teresa

    Hello Beat,
    Thanks for your help, I changed the colors in all the parameters of the overview.htm
    <PARAM NAME = "COLOR_STRATEGY_BACKGROUND" VALUE = "0xD6E3F7">
    <!-- set the background to the around box background color -->
            <PARAM NAME = "COLOR_COMBO_BACKGROUND" VALUE = "0xBEC8D4">
            <PARAM NAME = "COLOR_APPLET_BACKGROUND" VALUE = "0xFFFFFF">
            <PARAM NAME = "COLOR_SELECTED_OBJECTIVE_BACKGROUND" VALUE = "0xE4E2E2">
            <PARAM NAME = "COLOR_OBJECTIVE_BACKGROUND" VALUE = "0xFFFFFF">
            <PARAM NAME = "COLOR_OBJECTIVE_ITEM_BACKGROUND" VALUE = "0x6699CC">
            <PARAM NAME = "COLOR_MEASURE_OR_INITIATIVE_BACKGROUND" VALUE = "0xD6E3F7">
    But there are some objects that not changed colors. Are there other page where I have to change colors?
    Thanks
    Maria Teresa

Maybe you are looking for

  • Delivered qty and put in stock qty not updated after GR reversal

    Hi, We encountered a strange issue while making a 102 movement for a production order. Planned order qty  - X Production order qty  - X+Y Confirmed Qty  - X GR posted for Splits of Qty X GR Posted for Qty Y At this time Quantities in Production shows

  • Is there a way to open a chat window with lookout?

    I know there is a windows-chat embeded in Windows but our IT department has it blocked in all the machines. So I created, using a run object, a wordpad window to chat remotelly with the operator of the system using VNC4.0. Problem is that as soon as

  • 10.4.5 SCREWED up my Photoshop CS2

    I repaired permissions before and after my update to 10.4.5. Now it seems that when photoshop is open, i can't open other files by dragging them to the PS icon on my dock. Anyone experience this or have a fix? I hate this upgrade. Expose has frozen u

  • External hard-drive does not reconnect after sleep

    Hi everyone I am trying to use my Energy Saver to SLEEP my iMac after 1 hour. It goes to sleep no problem, but on wake-up, my external USB hard drive does not reconnect. There is also an error message that I didn't disconnect the drive properly. I fe

  • Territory Management in CRM7.0

    Experts, It seems that with CRM 7.0, the Territory Management has been changed a bit. The attributes you used to assign to a territory is now has to be done through Rule Builder.  I created the Rule Policy Type 'TR'. I can see all the attributes at t