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

Similar Messages

  • Is This A Possible Work Around for Lack of Firewire Syncing?

    I just learned that Apple discontinued firewire syncing on the newer iPods. Oh well, so much for using my sexy Cube as an iTunes server any more since it's non-expandable...
    I just came across this firewire hard drive enclosure from OWC.
    http://eshop.macsales.com/shop/ministack-usb
    It sports a built in USB2 jack. Does anyone out there own this enclosure AND a 5G iPod? I, and a whole lot of other people, would be grateful if you could plug your Pod into the USB2 jack of this device and report on whether or not it works...
    Thanks in advance.

    Whoops, wrong link:
    http://eshop.macsales.com/shop/ministack/
    So my exact idea is this:
    I want to get a 5G iPod, but don't want to deal with the slow transfer rate of USB 1.1.
    Now lets say I buy this enclosure and tell iTunes to use it as my iTunes library destination.
    If I connect a 5G iPod to the USB 2 port on the enclosure, the million dollar question is will the transfer rate from the iPod to the iTunes library on that enclosure happen at USB 2 speeds.
    Does that make sense? I wouldn't be transferring any data between the computer and the iPod, so technically I wouldn't need USB 2 on the mac. Right?
    Now that I think of it, I guess I'm also assuming you can daisy chain USB 2 devices like firewire devices.
    Thanks for all of your posts!
    -Phil
    PB 1.5ghz G4, Dual 1ghz G4, 450mhz Cube etc....   Mac OS X (10.3.8)  

  • Got error message with web based application that it would only work on MS Explorer 6.0 or newer. Any work around for this?

    When accessing a web based program I got a message that it could only be accessed using MS Explorer 6.0 or newer. Is there a work around for this?

    There is a way to do this.
    But it works or not, I have no idea.
    Enable  "Develop menu".
    Safari > Preference > Advanced
    Checkmark the box for "Show Develop menu in menu bar".
    Develop menu will appear in the Safari menu bar.
    Click the Develop menu and select "User Agent"
    There are choices. Do not forget to make Safari default again afterwards.

  • In OBIEE mobile apps designer there is no option for multi select prompts?The navigation page gives option only for single select?Is there a work around for this?

    In OBIEE mobile apps designer there is no option for multi select prompts?The navigation page gives option only for single select?Is there a work around for this?

    Nic, for me the iTunes window looks like this, when I connect my iPad 3:
    I select the iPad in the "devices" section of the Sidebar (use: "View > Show Sidebar" if the sidebar is hidden).
    Click the "Apps" tab in the "Devices" pane.
    Scroll all the way down in the Devices pane to "File Sharing" "Apps" section.
    Then do I click "GarageBand" to select the documents in the right panel.
    Which part is different for you? Perhaps you could post a screenshot?
    Regards
    Léonie

  • Work Around for a Panasonic AJ-D750 deck

    I recently upgraded to FCP 5 from 4.5. Since the upgrade I can not digitize from my Panasonic AJ-D750 DVC Pro deck, RS422 connection. Does anyone know a work around for this? Any information would be great!

    Hi, I had the exact problem with a Panasonic AJD950 deck. This is the response I got from Brian Conner
    " I wonder if this is caused by the deck polling problem that FCP5 brought about. FCP5 doubled the amount of deck polling it does during pre-roll and Panasonic decks don't like that.
    A couple of my support clients use a plug-in that Aja tech support passed on to me. The plug returns polling to pre-FCP5 levels. I think the plug was written by Panasonic.
    Try contacting Panasonic tech support to see if that's the case. "
    and thankfully he saved me from another two months of capturing films in 3min segements.
    I managed to find the disable polling file from someone on another forum and I haven't had the problem since. Maybe you could try to google it, or contact Aja, otherwise, if you still can't find it, I can email it to you (as far as I am aware it works with all capture cards, we have Blackmagic).
    Dual 2GHz PowerPC G5   Mac OS X (10.4.5)   XRaid Final Cut Studio

  • Work around for shared calendars

    Has anyone found a work around for shared calendars yet? This has to be one of the biggest downfalls of the iPhone, along with the fact it can't search in the mail app.
    If anyone ahs found a work around I'd be very keen to here it.

    I have not used this product but it sounds like it may be able to do what you want.
    http://www.busymac.com/index.html

  • Work around for radio tuner service not working

    A work around for the lack of radio tuner service that has appearently hit Itunes versions lower than 11.
    We all hope that Apple will restore Radio Tuner Service for us legacy products users soon, but I've been thrown under the bus more than once by Apple in the last 25 yrs to put much hope in that (I started with an Apple III w/a Z80 card running C/PM, yeah I'm that old)
    Have your iTunes and your favorite browser open.
    In your browser go to http://vtuner.com/setupapp/guide/asp/BrowseStations/startpage.asp
    This will give you a list of Genre's, etc of streaming internet stations.
    When you select a genre you'll get a list of stations that shows station ID, what type of feed codec and data rate.
    Select any of the AAC or MP3 feeds.
    Select play.
    This will send a small download file to your computer containing the selected feeds URL.
    Your computer will ask what app to use to open the file, select iTunes.
    This will automatically open a file called Internet Songs at the end of Playlists in iTunes (if you don't already have one), and will install the URL there. 
    All the stations you selected will now be permanently stored in Internet Songs.
    Viola, your very own custom personal internet radio playlist!
    GT
    Dual Core 2Ghz G5, 9.22/10.4.11/10.5.8

    Apperently iTunes 11 is not affected (Apple stil makes iTunes11 for the 14 yr old Microsoft XP OS, but not for anything PPCs can run. Go figure)
    "Next door" to Steve was metaphoric, he lived in Los Altos, about 15 miles away, but he cast a big shadow!
    On 9.2.1/10.4.11 differences, some time in the past someone selected 'save file' and checked the box 'don't ask again' on your computers dialog box. That's why you're not given a choice wih the file downloads. I would think that selection should be able to be reversed.
    iTunes 9.2.1/OS10.4.11 puts those downloaded URLs into the Music Libary of iTunes, no matter if it's opened directly, or you click on the file on your desktop. You can create a new playlist, highlight the selection in the Music Libary, and drag it to your new playlist to keep alll the steaming URLs together. NOTE, this only creates an alias, the URL copied by iTunes must remain in the Music Libary. You can then delete the the files on the desktop, if you want. I did multiple stations this way in 9.2.1, they all show in either the new playlist created, or in the Music Libary, and remain after the desktop files are deleted and trash emptied.
    You can switch sations by double clicking them. Another note, all the URLs were all from vtune.
    I hope this helps.
    PS, I forgot how clunky Tiger is compared to Leopard...

  • Work Around For Numbers Crashing

    Work Around For Numbers Users:
    For those of us who have numbers and have had problems with it crashing when scrolling across sheets that have checkboxes try this:  Double select a cell, and use the expanding group to navigate the sheet.  It seems to be stable when doing this.
    3 weeks after the os8 release and still no fix for this?  Pathetic.

    If anyone has been having trouble with upgrading the domain file and iWeb crashes, here is the fix that worked for me:
    http://discussions.apple.com/message.jspa?messageID=5100025#5100025
    *MAKE SURE YOU BACKUP YOUR DOMAIN FILES FIRST!*

  • Work around for User ID 32 character limitation in CCX Agent?

    Are there any kind of creative work arounds for getting past the ridiculous 32 character limit when logging into the CCX Agent?
    We are moving toward using the User Principal Name (UPN) in CUCM LDAP which means that the domain is now tacked onto the end of their existing User IDs.  We are doing this so that users from multiple domains can authenticate to various Cisco tools and apps.  It works very well, except when firing up the Agent!
    I've already been playing around with UPN suffixes, and while I can get them to show up in CUCM (and subsequently), I can't seem to get them to authenticate.
    I shouldn't even have to get this creative, just remove the 32 character limit, Cisco!
    We are running CCX 8.5 and CUCM 8.6

    Hi ,
    I am not aware about any such workarounds.
    After referring to the below guide,
    http://www.cisco.com/en/US/docs/voice_ip_comm/cust_contact/contact_center/crs/express_8_5/configuration/guide/uccx851ag.pdf
    On page 78, it is mentioned as,
    Caution : When logging into Cisco Agent Desktop, agents use the Unified CM user ID and password. While the Unified CM limits agent IDs to 128 alphanumeric characters, the Unified CCX limits agent IDs to 31 alphanumeric characters. Be sure to abide by the 31 character-limit when configuring agents in Unified CM.
    I am sure even if it works by some workarounds also, you may see some issues specially from the CAD\CSD\CDA side, which Cisco will not support it quoting the same above reason.
    Hope it helps,
    Anand
    Please Rate helpful posts !!

  • Work around for 60 column limitation

    All,
    Does anyone know of a work around for the 60 column table limitation?
    Will this be changed in a future release?
    Thank you.

    I also need a workaround for this. I have users that want to download data as excel files, and the built in export to csv was working great until the dynamic sql statement pushed itself to more then 60 columns. Is there some other way to provide a link to the data as csv? Can I hook into the csv functionality of HTML DB? Can I create a page template that modifies the Content-Disposition and/or Content-Type so the browser thinks the page is csv/excel so that I could dump out a clob of data I put together? Should I just have a button that provides a link to something outside HTML DB to query and dump data from the database?
    As it is, the users really don't need to see the data on the screen. I just need a way to dump 60+ columns of data to the user as csv.

  • Work around for Excel's array formulae?

    I have an Excel spreadsheet which I have built over many years to manage maintenance tasks of my boat. I would like to convert this to run on Numbers. Unfortunately I can't find a work-around for Excel's "Array Formulas".
    The column headers of my spreadsheet contain maintenance tasks (plus data on how frequently by days or engine hours these jobs need to done). When I complete a maintenance task, I log the date and engine hours in a new row with an "x" to signify that the job is done. Excel then looks up the date/engine hours when each job was last done (ie the lowest "x") and then uses conditional formatting to highlight the column headers of which jobs are overdue. Is there a work around for this in Numbers?
    I attach an image shot of my Excel spreadsheet which may help:

    Hi Rich,
    Some made-up dates.
    If you have multiple x's in a column, change all but the most recent to "Done" or something other than x This approach looks for the date in Column A that matches a single x in a task column.
    This example works on years. I hope you change your oil and filter more often .
    One Header Row and four Footer Rows. Enter Years between services (D9) from the keyboard.
    To find the date of the last service (the only x in Column D)
    D10 contains this formula:
    =INDEX($A,MATCH("x",D,0))
    You can Fill Right to other columns.
    "Years since" (D11) contains this formula:
    =YEAR(TODAY())-YEAR(D10)
    "Alert" (D12) contains this formula:
    =IF(D11>D9,"Hey, You!", "OK")
    Conditional Formatting in D12 sets the text to red if it equals "Hey, You!"
    It would be best to combine these steps into one complex formula. Numbers is slowed down with each Header or Footer in a Table.
    Regards,
    Ian.

  • Work around for Excel "Array Formula" in Numbers?

    I have an Excel spreadsheet which I have built over many years to manage maintenance tasks of my boat. I would like to convert this to run on Numbers. Unfortunately I can't find a work-around for Excel's "Array Formulas".
    The column headers of my spreadsheet contain maintenance tasks (plus data on how frequently by days or engine hours these jobs need to done). When I complete a maintenance task, I log the date and engine hours in a new row with an "x" to signify that the job is done. Excel then looks up the date/engine hours when each job was last done (ie the lowest "x") and then uses conditional formatting to highlight the column headers of which jobs are overdue. Is there a work around for this in Numbers?

    It not clear from your post, but I get the impression you are inquiring about Numbers for OSX. This is the iOS iWork forum. You may want to repost here: https://discussions.apple.com/community/iwork/numbers
    If I'm wrong, and you are asking about Numbers for iOS, these links may help: http://help.apple.com/numbers/ipad/2.2/#/tan5ca02385
    http://help.apple.com/functions/mac/5.0/
    But Numbers for iOS does not fully support conditional text.

  • Work around for unsupported OS?

    I'm rcving a message that InDesign does not support the OS that I'm using, therefore I can't download or use it. Is there a work-around for this problem?

    Hi Rachel,
    Unfortunately there are no workarounds for the product which isn't supported for an OS.
    Check the System requirements here: http://helpx.adobe.com/x-productkb/policy-pricing/system-requirements-indesign.html
    Thanks!
    Ankit

  • Work around for kindle on ipad 1

    Restored my ipad 1 and lost kindle access due to update.  Is there a work around for this?

    Not sure that you fully searched the Amazon Kindle site. They tell you how to download a 5.1.1-compatible version of the Kindle App if you have not previously done so:
    Important: iPad, iPhone and iPod touch devices with iOS 6.0 or later are able to download the latest version of the Kindle reading app. If your device is running iOS 5.0 and you previously downloaded the Kindle application using the Apple account that is associated with your device, you will have the option of downloading a version of the Kindle application that is compatible with iOS 5.0. If you've never downloaded the Kindle application using the Apple account that is associated with your device and you want to download a version that is compatible with iOS 5.0, you'll need to first get the latest available version of the application on your Apple account, using the iTunes Store from your computer.
    So, download the current Kindle version to iTunes, then, according to this paragraph, you will then have the option of downloading the 5.x compatible version. I would imagine that if you have issues getting the 5.x version after downloading the current version, you can contact Amazon support to get help. They have always been helpful for me.
    Cheers,
    GB

  • Work around for JSF lack of XHMTL standards

    Has anyone come up with a work around for the fact that JSF cannot produce XHTML documents? Anyone know why they went this route?
    Thanks,
    David

    BTW, one more thing: the JSF RI uses the HTML/XHTML
    hybrid output strategy (output that works for both),
    but the JSF APIs are sufficient to let a single
    RenderKit output pure HTML and pure XHTML depending
    on (for example) the client's browser, without
    changing a single line of Renderer code!I don't quite understand how this "magic method" will help me get around the RI's insistence upon generating non-XHTML-compliant markup. UISelectBoolean rendered as a checkbox is an example:
    <input id="_id74:_id75:0:selected" type="checkbox" name="_id74:_id75:0:selected" checked />The offending code is found in HtmlResponseWriter, which renderes Boolean value attributes in a way incompatible with XML.
    I'd love to write my own XHTMLResponseWriter, but how do I plug it in? In order to overrwride createResponseWriter(), I have to create my own render kit. I can do that, but that doesn't help the existing RI CheckboxRenderer, which is already defined in another render kit.
    It seems a shame to have to write a completely new renderer when the existing RI CheckboxRenderer is logically sound---it just uses a faulty (as far as XHTML is concerned) response writer.
    Garret

Maybe you are looking for

  • Calling different Applications w/o having to enter login info again.How ?

    Hello, we have created several apex applications that are in different workspaces. Each application has it's own custom authentication process and a login form. Now we want to have a central login form, from which user can login and be able to visit

  • Photos not visible in iPhoto 6

    I'm a Mac newbie, and haven't been able to figure out the following situation. I transfered all of my .JPG files from my PC to the 'iPhoto Library' using my home network. Problem: I can't seem to see any of my pictures using iPhoto or other applicati

  • Wireless Internet works but Macs can't see each other on same network.

    First: Ahh! Second: I have an iMac & and MacBook connected to the same Wifi connection at home. I'm using the Belkin F5D8235-4 v2000 with Firmware 2.01.08. The most up to date firmware and Mac compatible. Both have IP addresses within this range 192.

  • Can't install Photoshop CS4 I'm a new user can you help me?

    I have download the CS4 Photoshop and when I try to run the set up almost finishing it sends me a message that says it can't finish because Adobe upgrade is in use. I've tried closing all the programs, even disconnect from wireless, what can I do?

  • Need Help Calculating Business Days AND omitting Holidays...

    Post Author: dkotenoglou CA Forum: Formula Thanks to the people here I was able to get a nice formula to help me calculate the amount of business days between two days.//Crystal syntax Local DateTimeVar d1 := ; Local DateTimeVar d2 := ; DateDiff ("d"