Easy JLabel color question

I want all the labels on a JPanel in blue,
is there a way to avoid to write each time?:
label1.setForeground(Color.blue);
label2.setForeground(Color.blue);
label3.setForeground(Color.blue);
label10.setForeground(Color.blue);
I have try panel.setForeground(Color.blue);
..where panel is the container of the labels with no success.
?�

You can always create a subclass of JLabel and have the default settings in the constructor to be blue. Then you just use these labels than the regular JLabels.
I hope this helps.

Similar Messages

  • Change MetalLookAndFeel JLabel Color?

    I am wanting to use the MetalLookAndFeel in my application, but want the color for all my JLabels to be Black instead of the purpleish color I understand how to create your own custom color themes but cannot find out how to change the JLabel color does anybody know what needs to be in myCustom theme that will change that color to black?

    Not sure if this is exactly what you are after but...
    JLabels are usually transparent to start with and show the underlying component's background colour. If you want to change the background, you have to set the color and then use setOpaque(true).

  • About Java 2 opaque font color question, help needed!

    About Java 2 opaque font color question, help needed!
    I was trying to test opaque font (the string has a foreground color and a background color), but i can't find the method for doing that.
    i can change foreground by Graphics2D.setPaint(Color.black).
    Anybody know how to change the background of the string?
    Thanks!

    Hi. The way I'd do it would be to use the font metrics to find the length of a string and draw a rectangle and then drawstring over the rectangle. If you want an example, I can post it although I suspect theres a better way.

  • Div Color Questions

    Alright, I'm brand new to CSS and to Dreamweaver so please be easy on me if this is a completely idiotic question .  I have just started some code for a site I'm working on.  I have it almost set up how I want it minus the bells and whistles.  My only issue is I can't get my "left" and "right" div background colors to change.  I've tried playing with the code, I've tried playing with the dreamweaver features, but there's no changes.  I was hoping somebody could give me a hand?  I'm sure once I see what I'm doing wrong it will be a d'oh moment.  I have CSS Rules made for each section and have tried to click into it and change the background color, but nothing updates.  The font, etc won't change either.  What the heck am I doing wrong? Thanks in advance for any assistance!  The section of code is below:
    <body>
    <div id="shadow">
      <div id="Wrapper">
        <div id="Banner">
          <blockquote><a href="index.html"><img src="images/BDBBanner.gif" alt="Bully Dog Bakery Banner" width="800" height="200" /></a></blockquote>
        </div>
        <div id="Navigation">Home | About Us | Nutrition | Products | Specials | Our Customers | Contact</div>
    <div id="bodyArea">
      <div id="left">
        <p>Info Here</p>
      </div>
      <div id="right"><p>News and Pictures will go here.</p></div>
        </div>
        <div id="footer"><p>Copyright info will go here</p></div>
      </div>
      </div>
    </body>

    I can't see where in YOUR css that light green colour is coming from?
    That's why I'm suggesting it may be Tripod taking over your page a bit. Unfortunately you pay a price for FREE web hosting and in the case of Tripod they cram your page with 'unwanted' adverts. The light green is behind the advert which appears at the foot of the page.
    If I take just your html and css then the page works ok to the point whereby you can see the left and right column colors.
    If you haven't introduced the light green color into your page then someone else did and that someone else is Tripod.

  • Please Help!!  Easy Application Tuning Question

    Ok - this should be an easy one for seasoned vets (but not for a newbie like me)
    I've been asked by the boss-man to "find and tune the SQL that's causing the slowdown . . . " I'm on Oracle 817 running Peoplesoft Application. I've located the main problems with the Application and have some solid ideas about how to improve the SQL. So - my question. How the heck do I get into the Peoplesoft (or any other Application for that matter) SQL code to change it. Everything I read says, " . . . and then you can go in and tune the SQL . . . " but never exaplins how exactly to 'get in'. I can't imaging there is a File-->Open-->SQL Code feature, it must be more complex than that. So what am I missing here and how do I get to the place where I can change the Application's SQL for tuning?!?!?!?
    Thanks in advance for any help you give.

    Peoplesoft owns the application code. So you can't change the application code. However, you can examine the code and see if there are some indices that you can create to improve the query. Also, you will need to rebuild your statistics. As a matter of maintenance, you should rebuild your indices and statistics on a regular schedule. Especially if your optimizer parameter is choose and you have high volatility.
    Alternatively, you could ask Peoplesoft to provide you with a patch.
    Maybe someone else has another idea?
    LM

  • JButton background color question

    Hi everybody,
    I have a feeling I'm going to get slammed for this, but I have to ask a very general question and hope for an answer.
    I have a JDialog on which buttons don't seem to hold their background color. That is, when I use setBackground, the only color change I get is a very thin outline of the color, and the rest of the button is white. The strange thing about the button is that the white center actually seems transparent--if I change the panel the button is on to another color besides white, the center of the button turns that color.
    I've tried to solve this problem with setOpaque( true ), setContentAreaFilled( true ), setBackground( color ), setForeground( color ), and I'm pretty sure every combination of those.
    Unfortunately, I haven't been able to reproduce this in a test case, so I can't give a SSCCE, although I've tried for a while now to make one.
    So...has anyone ever run into a problem like this and can give me some advice? I'm sorry I can't be more specific, if anyone has a question I'll do my best to answer.
    Thanks,
    Jezzica85

    I have a feeling I'm going to get slammed for this, but I have to ask a very general question and hope for an answer.Why would people be harsh on you? The only risk you take is: vague question => vague answer (or random).
    So...has anyone ever run into a problem like this and can give me some advice? I'm sorry I can't be more specific, if anyone has a question I'll do my best to answer.Never seen that myself, so I'll add a few random questions/thoughts:
    I have a JDialog on which buttons don't seem to hold their background color. That is, when I use setBackground, the only color change I get is a very thin outline of the color, and the rest of the button is white.- are you using a custom JButton subclass? If yes are you certain the subclass does not override paintComponent()?
    - If not, the button is painted by its ButtonUI. Can you tell which UI class is used (sysout(+theButton.getUI()+)?
    The UI is set according to the LookAndFeel.
    - Do you set any special LookAndFeel (+UIManager.setLookAndFeel(...)+, or look and feel's UIDefault properties in your app (generally that is done at startup)?
    - If not, can you tell the current look and feel when you bring up the dialog (+UIManager.getLookAndFeel(...)+, although that can be inferred from the ButtonUI subclass' name.
    I've tried to solve this problem with setOpaque( true ), setContentAreaFilled( true ), setBackground( color ), setForeground( color ), and I'm pretty sure every combination of those.FYI, the ButtonUI paints the button however it sees fit; in particular it doesn't have to respect the colors, opacity, filling... properties.
    Eventually:
    - are you using a custom JDialog subclass (probably, as that's generally how people write dialogs; not the best way IMHO, but there are cases where this is hard to avoid).
    I see you can't provide an SSCCE right ow, but maybe you can try to narrow the list of suspects in your side?
    - Do you reproduce the same problem at startup, if you bring the JDialog up as soon as possible?
    - Do you reproduce the problem with a mere JOPtionpane.showMessageDialog(..., theButton,...)?
    - Do you reproduce the problem outside of the JDialog context (I see you mention using a different JPanel, but is that in the dialog or somewhere else?
    Good luck with your investigations.
    Edited by: jduprez on Sep 30, 2009 8:20 AM

  • Discmakers Project: Color Question

    Hi,
    Using Photoshop and Illustrator CS3 I'm wrapping up a project for a Discmakers digipac. My color management settings are synced...setting: North American General Purpose 2. All my linked images are 300 dpi. The photos were originally RGB then desaturated in Photoshop and given a sepia tone, then saved as CMYK as required by the printer. Everyting looks fine in both Adobe programs but the photos have a strong green tint in any other program. Actually, the same is true for any CMYK desaturated photo. Greyscale black and whites look fine.
    My question is: when this goes to the printer will I get the colors I see in Illustrator or the green tinted ones?
    I'd be grateful for any suggestions. Thanks.
    This is a link to the Discmakers guide:
    http://www.discmakers.com/templates/faq.asp

    I'm guessing you'll get the color seen in Illustrator.  Not all applications are color managed and preview images are unreliable at best.  You should, for your own piece-of-mind, have the job contract proofed ( see a local reputable print shop ) before sending it off to the print vendor.  You should also supply a contract proof along with the disk so that the print provider has something to match.  Then, when the provider runs the file ( get their workflow specs before you have it proofed on your end ) through their prepress department's equipment, they can supply you with a matched proof of their own and, with any luck, they both match and it's off to the races.

  • Color question

    Running Photoshop CS3 intel mac leopard. I made a .psd file with spot PMS 307 chosen from the PMS picker, not as a separate channel. I made another file at home on a imac running 10.4.11 CS2 with PMS 307 chosen the same way. Both are RGB files, both have color management off. The colors did not match. Anyone know why?
    Thanks

    stephanie,
    >This was an RGB question that has been blow all out of proportion and I thank you for pointing that out. The CMYK only comes in because of the pantone picker, used to match a logo color.
    Please understand that the folks here are trying to understand what you are seeing and what you are trying to do. In your posts #3, #5 and #26, you clearly refer to commercial printing and unmanaged color.
    CMYK and Pantone are not Web color associations. And RGB, CMYK, and Pantone spot colors all have different color spaces/gamuts. You cannot get an exact color equivalents across the board in these color spaces. And there are gamut differences between sRGB, Adobe RGB and all the other RGB spaces you can access in Photoshop.
    So I'm confused as to what it is exactly that you want to do with the images, in other words, how they are going to be used and seen when all is done.
    We can't be sure you have your monitors properly calibrated (the most important first step to color management). And you seem to be assigning your (unique) monitor profiles to your work. I can't say for sure that I follow your workflow.
    So, let me ask a few questions:
    1. Are your monitors hardware calibrated to 6500°K with a 2.2 gamma?
    2. How are the images in question going to be used? Commercial offset, desktop printer, Website, etc.?
    3. What color space are you assigning or embedding or... with your images? Is it sRGB?
    4. Which Pantone color are you using (and is it for coated, uncoated, or matte paper)? And if you are going for Web, why are you working with Pantone colors instead of RGB or hexadecimal?
    5. Have you read G Ballard's excellent color management basics? Do you have any questions?
    6. Can you post a link to a screen shot of your color setup if you are preparing art for print?
    7. Can you post a link to a screenshot of the mismatched images and describe how you arrived at the colors?
    You can go to the free http://.www.pixentral.com to upload the images in question, and copy the link (per pixentral's instructions) back here.
    Thank you.
    Neil

  • Color question (Pantone to PDF)

    This is probably more of an Adobe Distiller question, but
    I'll ask
    anyways...
    I whipped up a logo design for a client and they love it. I
    just eyeballed
    on-screen colors and told them that they'll have to sit down
    with the
    Pantone Swatch book and pick the specific colors they want to
    use.
    They ended up matching the swatches to the on-screen colors I
    picked and
    that's what I used.
    I then created a PDF (press optimized) of said FH file. Now
    the colors look
    completely different on-screen (though, obviously, they are
    the correct
    pantone colors and as long as the printer isn't an idiot,
    they'll look fine
    on the t-shirts).
    The question I have is why do on-screen matched pantone
    colors not actually
    match on screen when used?
    -Darrel

    As you requested Darrel, here is my best answer to this
    question. (I
    didn't answer before because I'm not 100% able to back up my
    answer with
    facts and typically leave it up people who are.)
    The colors are not matching simply because all applications
    render
    colors differently. I can open up the same PDF in Acrobat 4
    and 8 as
    well as Preview and get three different color schemes. Each
    program has
    it's own method of rendering colors on screen. Now you
    transfer that
    same PDF to someone else's computer with a different monitor,
    different
    video card and different operating system and you've got a
    real mess.
    There is not guaranteed way to deliver color on screen. If
    you spend
    some money and a lot of time you may be able to get FreeHand,
    Photoshop
    and your desktop printer to agree (more or less) but you can
    forget
    about much else.
    Moral of the story? Never buy clothes online that you haven't
    seen in
    person.
    Rich
    P.S. Even on press, Pantone or process, you are going to get
    color
    variations. If you are printing a t-shirt it better be white,
    because
    the colors will vary just by virtue of the color they are
    printed on and
    even just LOOK different because of the color next to it.
    darrel wrote:
    > This is probably more of an Adobe Distiller question,
    but I'll ask
    > anyways...
    >
    > I whipped up a logo design for a client and they love
    it. I just eyeballed
    > on-screen colors and told them that they'll have to sit
    down with the
    > Pantone Swatch book and pick the specific colors they
    want to use.
    >
    > They ended up matching the swatches to the on-screen
    colors I picked and
    > that's what I used.
    >
    > I then created a PDF (press optimized) of said FH file.
    Now the colors look
    > completely different on-screen (though, obviously, they
    are the correct
    > pantone colors and as long as the printer isn't an
    idiot, they'll look fine
    > on the t-shirts).
    >
    > The question I have is why do on-screen matched pantone
    colors not actually
    > match on screen when used?
    >
    > -Darrel
    >
    >

  • Select color question.

    Hello everyone, I am a new member. My question is, is it possible to create an action in the action palette which chooses a specific color I want , instead of doing it manually with the magic wand?
    For example something like "Set selection all blacks"?
    Thank you in advance for your answers.

    It might be possible to automate some color selections using Select>Color Range.

  • Really easy, but confusing question about SW installation.....

    Hello:
    I have a pc desktop (Win XP Home SP 2) and a new HP wireless laptop I want to connect with my new WRT54GS.
    Question.....When I open the box, it says "STOP - LOAD THE CD FIRST".
    Ok, fine. Load the cd where????? Desktop (wired to router), laptop, or both?????
    Thanks for answering a silly question.
    William Hollingsworth

    Is your PC going to be wired or wireless? Anyway, set-up CD usually does not work properly. Connect a PC directly to the modem and go to www.linksys.com/easy and run the EasyLink Connect Tool.

  • JLabel Color

    Can anyone tell me how to display the string in the statement below in a different color?
    addComponent(entryPanel, new JLabel("(Must at least contain one character)"), layout, constraints, 1,y,1,1);

    I'm going to guess that it would be:
    JLabel label = new JLabel("(Must at least contain one character)");
    label.setForeground(someColor); // where someColor is a java.awt.Color
    addComponent(entryPanel, label, layout, constraints,1,y,1,1);

  • Konsole shell color question?

    Hello, All
    First, I am new here with Arch, actually I have only installed it twice two different computer. My problem,question persists on both of them.  I have look though the forum
    till my eyes bug out, I just haven't seen the neon sign that has my answer on it, so I thought I would ask. By the way, I 'm very impress with the way Arch runs.. hats off to devs.
    My question, When I click on the icon (or menu) for Konsole  it launches and works as it should but, the colors are always reset to shell's colors  witch is white background with green text. It acts like another program or file is controlling the color part, cause if I change to a linux console new session the colors I want for konsole are remembered.  Thanks for being so patient with us arch newbies, gypsy

    locate konsolerc
    /home/*******/.kde/share/config/konsolerc
    /opt/kde/share/config/kdemod/konsolerc
    /root/.kde/share/apps/RecentDocuments/konsolerc.desktop
    /root/.kde/share/config/konsolerc
    I don't know? Where do I need to put it, or where's should it be ? I also notice kdmtheme(manager) doesn't work right either, maybe that's a clue. Thanks,gypsy

  • Inverting my Mac's colors -- question

    Is there any way to invert my Mac's colors (CTRL + OPT + COMMAND + 8) only on my desktop and not in any of my applications?
    Thanks!

    Hi,
    Recently i also got this flashing question mark error. The apple told me that its an Internal HD error.
    Well how common is that with the macbook ?
    The apple did changed my Internal HD ( for free). New one - Hitachi. I also have backup on my External HDD where the latest backup was 2 weeks before my Intenal HD crashed.
    Is it safe to do the system restore completely on my new internal HD without causing any new problems ? As i have heard that the complete system restore can give lot of trouble.
    And one more question, after getting repair, am I eligible to apply for Apple Care protection Plan ?
    My warranty expires on 26th January 2010.
    Thank you
    Milan

  • Browser background color question

    Hello,
    I have read in some article, that not all Browser background colors are readable by all computers.
    So I am wondering: when I am choosing the right color for my website's Browser Background, can I pick any color from color picker?
    Or should I only use certain "universal" color, which is guaranteed to be readable on any viewer's computer.
    Thank you .

    Just as there are web-safe fonts, there are also web-safe colors. Your color window has all the information you need. See.....
    http://www.iwebformusicians.com/WebMusic/FontsandColors.html
    "I may receive some form of compensation, financial or otherwise, from my recommendation or link."

Maybe you are looking for

  • "Can't Lock IPOD" message

    Okay. Here's the story: After downloading latest itunes and IPOD update, my IPOD slipped into DATA mode and is completely locked up. I tried to reset the IPOD, but it cycles through and ultimately shows a folder and exclamation point on the screen. I

  • Lightroom4 prints are too light

    I have documented the lighter print output from LR 4 a while back and have been waiting for someone at Adobe to notice and offer some solution to this problem. I use a robust printing workflow and have done the experiments under very carefully contro

  • HT5787 How do I unlock my apple IPOD touch phone? I have lost the passcode

    How do I unlock my apple IPOD touch phone? I have lost the passcode

  • Does restoring your iPod solve the problem with the updater?

    I have a fourth generation iPod and I downloaded the 10-12-2005 updater. Since then my click wheel will not work, but all the buttons on my iPod still work. I have looked through the discussions and many other people have this same problem, but i hav

  • How to find the parts list for an existing server.

    I need to know what kind of integrated controller is in my DL 385 G7 server. The website is unable to tell me anything - or at least I've only invested 45 minutes in trying to find the actual data. I have the Serial number, the Product number, the Pr