Changing FG color for disabled TextField
Is there any way to change the foreground color of a disabled textfield?
Use this method
JTextField.setDisabledTextColor(Color);
Eg:
JTextField txf = new JTextField("123");
txf.setDisabledTextColor(Color.blue);
Similar Messages
-
Is this a valid work around for disabled TextField Font colors?
We would like to change the font color in disabled TextFields.
Since the AWT calls some native code that apparently overrides
any call to setForeground(), so that the Foreground is always a
light gray color in disabled TextFields I decided to override
the paint() method. This works fine as listed below. The formula
for setting the initial position for the drawString() method has
worked for every Font/Size that I have tested, but I don't like
the added literals (2 and +1) that I am needing to pass to have
the string line up exactly as is displayed automatically.
Is there another way to get these (x,y) values from method calls
to the component, container or FontMetrics that I am missing?
Also, does anyone see anything wrong with this to override the
default implementation?
Even though I do not call super.paint() in the event that
the [enabled] field is true, the TextField still paints itself
correctly with the appopriate Background and Foreground.
If anyone knows why that is please let me know.
Thanks
public void setEnabled(boolean en) {
enabled = en;
super.setEnabled(enabled);
if(enabled) {
setBackground(defaultBackground);
setForeground(defaultForeground);
else {
setBackground(disabledBackground);
setForeground(disabledForeground);
public void paint(Graphics g) {
FontMetrics fm = this.getFontMetrics(this.getFont());
// [enabled] is a private field that is set in the constructor
// by calling this.isEnabled(), and by any call to the setEnabled()
// method
if(!enabled) {
// clear the old string representation
g.clearRect(0, 0, getSize().width, getSize().height);
// set the font color to the defined [disabledForeground] Color
g.setColor(disabledForeground);
// draw the string in the desired Color instead of the default
// disabled color of light gray
g.drawString(getText(), 2, fm.getAscent()+1);
}Walt, I tried that first, but due to the native call to draw
the disabled TextField the setForeground() is useless.
"The solution is platform dependent. A TextField might be painted entierly by native code. And then calls you make to the Graphics object will then have no effect at all. If you run your textfield in an applet in IE you will not see anything but the native TextField painting. The g.drawString, g.setColor or g.clearRect you call seems to be totaly ignored..."
From the tests that I have done I was able to manipulate the
the Graphics object in the paint() method to override the default
representation of the TextField (I also tried this with a Button
and it worked as well). I did run this in IE 5.0 and was able to
get my modifications to work. Since the TextField that I am modifying
must extend another class to inherit some default behavior
I can not create a new TextField that implements a Panel, I thought
about that until I was told that the TextField needs to extend an
already existing class.
I think that my solution should be fine. I was hoping to find out
if anyone knows of a better way to determine the starting
point for the drawString() method besides adding literals for the (x,y)
attributes. If anyone knows a better way than my method please
let me know.
Thanks for the responses -
How to change a color for a row in ALV grid display
Hi,
how to change a color for a row in ALV grid display based on a condition.Any sample code plzHello Ramya,
Did you check in [SCN|How to color a row of alv grid]
Thanks! -
How to change the color for HTML words in JEditorPane?
Hi Sir,
In the JTextPane , we could change the word's color by using:
Style style = doc.addStyle("test",null);
StyleConstants.setForeground(style, Color.red);
doc.setCharacterAttributes(10,20,syle,true);
we can change the text into red color,which range is from 10 to 30.
But how to change the color for HTML words in JEditorPane?Hi,
you can use an AttributeSet to apply the foreground color. Let's say, doc is a HTMLDocument, then SimpleAttributeSet set = new SimpleAttributeSet();
doc.getStyleSheet().addCSSAttribute(set, CSS.Attribute.COLOR, "#0D0D0D"); would apply a color to a given AttributeSet. The AttributeSet with your color then can be applied to a selected range of text in a JEditorPane by /**
* set the attributes for a given editor. If a range of
* text is selected, the attributes are applied to the selection.
* If nothing is selected, the input attributes of the given
* editor are set thus applying the given attributes to future
* inputs.
* @param editor the editor pane to apply the attributes to
* @param a the set of attributes to apply
public void applyAttributes(JEditorPane editor, AttributeSet a) {
((HTMLDocument) editor.getDocument()).getStyleSheet().addCSSAttribute(set, CSS.Attribute.COLOR, "#0D0D0D");
editor.requestFocus();
int start = editor.getSelectionStart();
int end = editor.getSelectionEnd();
if(end != start) {
doc.setCharacterAttributes(start, end - start, a, false);
else {
MutableAttributeSet inputAttributes =
((SHTMLEditorKit) editor.getEditorKit()).getInputAttributes();
inputAttributes.addAttributes(a);
} Ulrich -
How to change the color for the af:messages by skins ?
Hello All
How i can change the text color for the af:messages by skins,i want change the color for the messages paragraph not for message header
Because i know how to change the message header color text by
.AFErrorTextForeground:alias
color: Red;
Error:
1. You Must Select etc...
2. Hello All
i want to change the color nor for the header (Error) ,i want change it for the messages 1 and 2 and its text.
Regards
Mohammad Weshah
)Hi Frank
Unfortunately it dose not work.
Any another options for this issue .
Regards
Mohd.Weshah -
Change of colors for actual day in ical
Is there any possibilty to change the color for the day into another one - the light blue looks nice but pale.
OK... got it... I use Microsoft Exchange set up by a 3rd party so i guess that is what the e-mail one is. I still use Outlook but eventually want to simplify. Right now i go back and forth between Outlook and iCal because Outlook still seems better to me. But hoping to have an open mind and find out how to use iCal more effectively. But i wonder if the local calenders are synced with the e-mail account. Is there anyway to move and/or combine the local calendars with my e-mail one so i have it all under "one roof" which means i can access all of it on my iphone, ipad, and computer and not have them appear as if thy are seperate?
Thanks. -
Transfer footage iMovie 08 to iMovie 06 HD & change outline color for text
I have a completed video that is basically all stills. I would like to transfer the stills in their current sequence and if possible with their current crop styles ie Ken Burns without having to start ALL over. Is this possible? Just downloaded 06 HD because I wanted more editing options that iMovie 08 seems to be lacking.
Also, how do you change the outline color for text in titles? At one point it switched from black to white but I have no idea how it happened... now its back to black.
Lastly, are we only allowed to place music exactly at the head of a clip or is there a setting I am unable to find that unlocks that "snap to" function?
Thank you.
Message was edited by: boogieon
Message was edited by: boogieonThanks....I was thinking that was probably it. Will be a little time consuming, but I'll feel better in the end knowing a vacation and bunch of summer stuff is back on tape for archiving.
-
How to change the colors for individual bubbles in a bubble chart?
I have a report where in a bubble chart needs to be shown with different colors for bubbles available in the chart. I cant find any option to select individual bubbles and format the color options.
Any guidance or suggestions solving this would be much appreciated.
Thanks,
VinayThanks JB for your reply, I see in format chart data there is are two sections:
1. Positional
2. Conditional
In Positional - I have the type and color changes for the bubbles but if I change any color in that all the bubbles are simultaneously getting the same color code.
Not sure if there is any other setting. Please share me your thoughts on this.
Thanks again -
Changing hover color for TabNavigator tabs
I was able to change the background color of selected tab to
Navy and the others to Medium Blue. The foreground color is set to
White. The default color for the hover seems to be black, so when I
pass over the selected tab you can not read the text.
How do you change the hover color?Try setting the textRollOverColor of your selected tab style.
-
Changing hyperlink colors for the navigation bar
hello all i am trying to figure out how to change the color of the links that are the top of my page in the navigation bar. i know how to do it with the ones in my text- but i cannot figure out how to do so for the ones at the top of each page in the navigation bar.
any help would be much appreciated!Welcome to the Apple Discussions. Here's a link to a post by Cyclosaurus, the resident java script expert, about changing the font, etc. in the navbar with java script and a HTML snippet.. Don't know if includes color also.
http://discussions.apple.com/thread.jspa?messageID=8600361#8600361
OT -
Changing a color for the whole Application
Hi,
Is there a way to change the color, default purple of swing to some other color(say green) for the whole application without using themes? Is it possible through UIManager.put()?
Regards
SridharThanks Michael,
I just modified your code to fit my needs.
import java.awt.*;
import javax.swing.*;
import java.util.Enumeration;
class ApplicationColor
public ApplicationColor()
setApplicationColor(new Color(88, 140, 165));
JFrame frame = new JFrame();
frame.setLocation(400,300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel jp = new JPanel(new BorderLayout());
String[] temp = {"abc","123"};
JComboBox cbo = new JComboBox(temp);
JButton btn = new JButton("I'm a button");
jp.add(new JLabel("I'm a label"),BorderLayout.NORTH);
jp.add(cbo,BorderLayout.CENTER);
jp.add(btn,BorderLayout.SOUTH);
frame.getContentPane().add(jp);
frame.pack();
frame.setVisible(true);
public void setApplicationColor(Color color)
Enumeration enum = UIManager.getDefaults().keys();
while(enum.hasMoreElements())
Object key = enum.nextElement();
Object value = UIManager.get(key);
Color jfcBlue = new Color(204, 204, 255);
Color jfcBlue1 = new Color(153, 153, 204);
if (value instanceof Color)
if(value.equals(jfcBlue) || value.equals(jfcBlue1)){
UIManager.put(key, color);
public static void main(String[] args){new ApplicationColor();}
}Sridhar -
How to change highlight color for menus?
What controls the highlight color used for Firefox menus? ... like Find, Print and About ... the main menus.
I used the Stratiform Plug-in to change my font color to blue and now it's exactly the same as the highlight color ... so highlighting makes the entry's text invisible.
I want my highlight color to be YELLOW only, regardless of any theme I might use.Good idea ... but (in XP) the color for Selected Items only affects Windows menu entries. It looks like some other setting affects the Firefox ones. I've attached a couple of captures to show what I'm seeing.
Thanks for trying. -
Cannot change multiple colors for the life of me
Hi there-
I am VERY new to photoshop and have been trying to change just two colors in this stupid picture now for about five days. I realize this is rudimentary probably for most users.
I have searched extensively online and experimented using the color replacement tool and the "replace color" adjustment under image. I will attempt to attach the before image and the after image I have been able to come up with.
Essentially, I just want to replace the red and green with orange and black. The orange I have is a very specific pantone (I have both RGB and CMYK numbers that I'd like to use). If possible, I'd like to keep the shading....I think this is the biggest problem. Colors are not uniform.
Anyways, if this is going to take me a long time that is fine, I just don't know how to do it and have all the edges and shading look correct. I cannot find a tutorial anywhere online that even shows how to clean up an image after you have changed its color so it looks professional. I am going nuts. This is for a job application and if you know how to do this and can help me - please! Help!The orange I have is a very specific pantone (I have both RGB and CMYK numbers that I'd like to use).
Doesn't mean anything in relation to spot colors. That's the part you seriously must understand - either you want to print it prodfessionally and a spot color is mandatory or it isn't. Process color CMYK is also used in professional print, but requires to work with color management. RGB is just for on-screen, web or printing on your home printer. Each of the methods will require a different way of shifting/ remapping the colors. For RGB and process CMYK, a gradient map adjustment layer might work, including of course converting to CMYK for the latter and dealing with color management. If it's just for home printing on unmanged printers like your personal inkjet, anything from hue shifting to selectiove color corrections will do. For spot colors you can forget these "dumb" methods and will have to learn how to create selections, manage channels and work with Dutone/ tritone/ multichannel modes.
Mylenium -
Change highlight color for content assist
Hello. The highlight color for current selection in Content Assist (Code .. Hinting) in FB3 IDE is too light for me to distinguish. How it can be changed?
Try with this
Windows -> Prefrences -> General -> Editors -> Text Editors -> Annotations -> Right side there is list from which select -> Actionscript occurance. -
How can I set the color for a textfield
Hi all,
I use a textfield and I want to set the color for characters which are typed in the textfield. I didn't find anywhere a solution for this. Do you know how I should implement this?
ThanksNot possible. If you want this, you'll need to make a custonItem that implements this.
Maybe you are looking for
-
I have tried to burn a smart playlist to a DVD to listen to my music at work. The DVD does burn, but all the music that I have purchased from iTunes is missing. It is selected in the playlist but it doesn't burn to the DVD. Any suggestions?
-
Exporting to multiple clips to compressor3.5 from final Cut 7
Hi have a timeline split into 20 or so individual clips that i want to export as DV fies using compressor. I set the in and out points for each clip in the sequence timeline, then use the "send to compressor" menu option. Each time it sends the clip
-
Aperture not seeing referenced masters on Samba share
Hello all, I have moved my referenced masters from my laptop to a Samba-mounted RAID server. I go to mount the Samba share and for some reason, Aperture won't see my referenced masters. It also shows the volume as being offline, when I know for a fac
-
ODBC Vs Net Manager connections
Please can anyone help me? I am using Oracle 11 release 2 and I installed Instant Client (using OUI) on a machine. I also installed Net Manager on the Client and created a service name in order to connect to a server. When I press the test buton, the
-
WLC 5508 : session disconnected when one lag-port is down.
Hello, I have a WLC 5508 ( version 6.0.182). When the port1 and port2 are connected ( The switch is configured with a etherchannel in forced mode) everything works fine: There is traffic on the 2 ports. When I disconnect one of the 2 ports, I can sti