Can i change the color of the text of a JButton, when it is disabled?

Hi,
I want to keep the black foreground of my JButton even after I disable it. I have tried using:
.setForeground(Color.black);
but it remains gray. Is there anyway to do this?
thanks!

just a thought...
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Testing extends JFrame
  public Testing()
    setLocation(400,300);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    JPanel jp = new JPanel(new GridLayout(2,1));
    final JButton btn = new JButton("Enabled");
    btn.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae){
        JOptionPane.showMessageDialog(getContentPane(),"Hello World");}});
    JCheckBox cbx = new JCheckBox("Enable/Disable",true);
    cbx.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae){
        btn.setEnabled(!btn.isEnabled());
        //btn.setText(btn.isEnabled()? "Enabled":"Disabled");}});//toggle these lines
        btn.setText(btn.isEnabled()? "Enabled":"<html><font color=black>Disabled</font></html>");}});
    jp.add(btn);
    jp.add(cbx);
    getContentPane().add(jp);
    pack();
  public static void main(String[] args){new Testing().setVisible(true);}
}

Similar Messages

  • How can I change the text   color in pages

    Hi , how can I change the text color in pages app

    Select the text you want to change.
    Tap the i in the top bar.
    Tap Style in the top bar.
    Tap the Font name/size
    Tap Color then choose the color you want the text.

  • Can i change the text colors in the app store

    Can i change the text colors in the App Store as i find it very difficult to read the grey text on a black background?

    No, you cannot change.
    The only thing you can change as a whole:
    SETTINGS/GENERAL/ACCESSIBILTY/ turn on WHITE ON BLACK.
    You can test to see if this one fits you.  If not change it back.

  • Can i change the text of submit button on a login box of a secure zone?

    Can i change the text of the submit button in the login box of a secure zone?
    Or, maybe, i can replace the button with the image?
    So, can this be done, and how to achieve this?
    Any suggestions are welcome.

    Ok, this is the description:
    http://helpx.adobe.com/business-catalyst/partner/add-secure-area-your-site.html
    "You can replace the form submit button with an image by clicking the Use Image Form Button."
    Can please anyone tell me where can i find this "Use Image Form Button"?
    Message was edited by: ChefEng

  • How can I change the text in an iPhoto book from Spanish to English?

    How can I change the text in an Iphoto book I'm trying to create from Spanish to English??

    In the Creative Cloud Application you can change in Preferences the App language. Then you can download and install additional the other language.
    With Photoshop you can now go to Preferences > User Interface and switch between all installed and available languages.

  • How can I change the text in F1 Help?

    I made a General Text  in T-code SE61, the name is 'ZTEST'.
    And at the SE80, in the local program,
    I used functions like these:
    HELP_OBJECT_SHOW
    HELP_OBJECT_SHOW_FOR_FIELD
    DSYS_SHOW_FOR_F1HELP
    These functions can display F1 HELP.
    But I want to send a text using functions,
    and display F1 HELP.
    Example)
    'Hello! This is your program.'
    Sending this to F1 HELP by functions, and display.
    If you know, please help me.
    Thank you.
    Edited by: Jaime White 999 on Apr 19, 2011 9:20 AM

    My source is like this:
    REPORT  z_test008.
    DATA: lt_links TYPE TABLE OF tline.
    SELECTION-SCREEN: PUSHBUTTON 2(6) s_button USER-COMMAND click.
    INITIALIZATION.
      s_button = 'uB3C4uC6C0uB9D0'.
    AT SELECTION-SCREEN.
      CASE sy-ucomm.
        WHEN 'CLICK'.
          CALL FUNCTION 'HELP_OBJECT_SHOW'
            EXPORTING
              dokclass                            = 'TX'
              doklangu                            = sy-langu
              dokname                             = 'Z_TEST'
              doktitle                            = 'Description'
    *          CALLED_BY_PROGRAM                   = ' '
    *          CALLED_BY_DYNP                      = ' '
    *          CALLED_FOR_TAB                      = ' '
    *          CALLED_FOR_FIELD                    = ' '
    *          CALLED_FOR_TAB_FLD_BTCH_INPUT       = ' '
    *          msg_var_1                           = ' '
    *          MSG_VAR_2                           = ' '
    *          MSG_VAR_3                           = ' '
    *          MSG_VAR_4                           = ' '
    *          CALLED_BY_CUAPROG                   = ' '
    *          CALLED_BY_CUASTAT                   =
    *          SHORT_TEXT                          = 'X'
    *          CLASSIC_SAPSCRIPT                   = ' '
            TABLES
              links                               = lt_links
           EXCEPTIONS
             object_not_found                    = 1
             sapscript_error                     = 2
             OTHERS                              = 3.
          IF sy-subrc NE 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
      ENDCASE.
    I just want to know that how can I change the text in F1 HELP, do not use SE61.
    In the source, I want to send the text by functions, and display that.
    Thank you.

  • How can I change the proggrams my Mac opens when I start my laptop?

    How can I change the proggrams my Mac opens when I start my laptop? My mac book Air opens Word and Skype automatically and I can´t seem to make not to do this. Help!

    Your Mac will also open anything that was open when it was shut down unless you uncheck this option in the restart and shutdown dialog.

  • How can I change the country on my account when I still have 11cents on it?

    How can I change the country on my account when I still have 11cents on my account? I lived in the US for 2 years, now that I'm back in France I wanna change it. Please help me.

    Contact itunes support and ask them to remove the balance

  • Can I change the defualt folder that opens when I press 'save' in answers?

    Hi
    like in the question above: can I change the default folder that opens when I press 'save' in answers?
    it shows the path but in order to see the content of the folder where I wanna save sth i need to navigate through folders to get to that destination folder
    can i change the set up so that by default directly the content of the folder displays where the report is saved?

    I am on a webiste and wish to upload a photo.
    I click on select file on the website
    You are attempting to download the picture to your computer not uploading photo to the website if I am understanding you correctly.
    To change the download direction, you must do so through your browser's Preferences.  If you are using Safari, hopefully, someone who uses Safari will help you and/or post over in their forums.  I do not use Safari.
    If using Firefox>Preferences>General>Save Files to:

  • How can I change the text in toolbars ("Forward" to "Fwd", etc)

    I want to shorten the text for items in my toolbar because the address box is way too short. I know how to change the items for items on the second row toolbar (right-click>properties), but I want to change the text for items in the top row. Right click does not show a property option for the items in the top row. For example, I want to change "Back" to "Bk", "Forward" to "Fwd". Two of the items are way too long ("Google Shortcuts v" and "Downloads"). I want to change these to "Gogl extr" and "DnLds". I want both text and the icons.
    By any chance, if the above can not be done, can I create custom icons? I'd take the current icon (where are they stored?) and add my own text into the icon, then tell firefox to show the icon.
    I'm using Firefox 22.0

    Have you considered using Icons ''(only)'' instead of Text and Icons in the Customize Toolbars dialog box?

  • Preview issue: can't change the text of annotation taken in PDFs.

    With Preview you can annotate PDFs (highlight or underline text, taking notes). It is a nice feature, and I use it a lot.
    I've notice that after saving the changes made on a PDf, I can no longer modify the text in the notes (I can change the text, but these changes are not saved). To me it is a terrible limitation, I would say it is a BUG.
    The workaround is to delete the note, and create a new one with the new text, but it's time consuming.
    I hope this behavior will be changed soon.
    Bye,
    Giorgio

    PDF documents were really never meant to be editable, especially not with a program named "Preview". Use a different format or some specialized software such as PDF Clerk Pro or Full Acrobat.
    Message was edited by: etresoft

  • How can i change the text of inbox?

    Hello SRM friends
    I use SRM Server5.5. (Classic scenario)
    I want to change the text of inbox.
    We have the following process for GR.
    1.     Vendor request confirmation (GR) in SRM.
    2.     Approver approves the confirmation on approval menu.
    As you know that standard text is “Approve Confirmation no. 1000000166 from Local vendor test “ in approval list. 
    “Approve confirmation no. <Confirmation number> from <vendor name>.”
    I think that confirmation number and vendor name are variable.
    I want to change this text such like “Approve GR for PO no. <PO number> from <vendor name>”
    How can I change this text of inbox?
    Is there any BADI or function?
    Thank you
    Best regards,
    SH

    Hi Andy
    2) Enter Worklfow: WS10400020 ( check whether this wokflow is active for GR )
    --> Yes.
    3) Go to the Task TS10407924 and double click
    or 1) Go to pftc_dis - > give task TS10407924
    --> Yes. I changed text "Approve GR For PO number &PROCCONFIRMATION.PURCHASEORDER&from&DOCUMENTCREATOR&
    But Approver can see the text " Approve GR For PO number"
    But i go to BBP_PD, I can see the worlflow text " Approval GR for PO number  from VENDOR2"
    Is there additioanl step to activate the changed text?

  • Javascript confirm alert Can we change the text ok

    can we change the ok and cancel text in the javascript confirm alert. pls respond, its very ungent
    Edited by: Bini John on Jun 10, 2009 9:19 AM

    Hi,
    Yes if client want new description for the PS Group, you have to create new only and assign the wage types to them and so on..... you have to do all the configurations regarding the PS Group. Here the main point is be careful with the start date of the PS Group for newly created records and assignments.
    Best Regards.

  • How can I change the text from impossible to read blue to black

    Unlike Chrome, which has an ad-on that changes the text to black, I have so far been unable to find a way to change Firefox's terrible light blue text to black, despite having made many attempts through Tools, Option, Colors, etc. Help will be appreciated. I am using version 30 on an HP Laptop running Win7

    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    Use a compressed image type like PNG or JPG to save the screenshot.
    Make sure that you haven't enabled a High Contrast theme in the Windows/Mac Accessibility settings.
    Make sure that you allow pages to choose their own colors and check the default colors.
    *Tools > Options > Content Fonts & Colors > Colors [X] "Allow pages to choose their own colors, instead of my selections above"
    Note that these settings affect background images.
    See also:
    *http://kb.mozillazine.org/Website_colors_are_wrong

  • Can we change the text in PanelCollection --   default toolbarItemDisplay ?

    Hi ,
    In the Panel Collection, we have a table inside. The panel collection provides the default icons like a search button and a Detach button.
    By default the text in Detach button is appearing as "Maximise" always. Even when the screen is maximised the text is the same.
    I want to change the text to "Minimise" when the screen is maximised. Is this possible?
    Thanks
    Dinesh
    Edited by: 845905 on May 4, 2011 12:13 AM

    E-mails generated with that function module are created in plain text format.  The font that would appear when reading the e-mail would be dependt on the user's setting for the e-mail application (e.g. Outlook).
    To my knowledge, the font cannot be affected during it's creation.
    Hope this sheds some light on your issue.
    -Mark

Maybe you are looking for

  • PDFMaker Server cannot be loaded

    Acrobat 7.0.1 Word 2003 XP SP2 PDFMaker is unavailable from Word, PowerPoint, Excel, and Publisher. I get the error message "PDFMaker Server cannot be loaded." Running the Intaller in repair mode has no effect. PDFMaker is NOT listed as disabled (Abo

  • Redolog in standby

    Hi Chaps I know that the redologs are not being used in physical standby database. So why do I see "CLEARING_CURRENT" or "CLEARING" in their status? and their status changes. Does that mean that they are used?

  • Adding a new link to workcenter group

    Hi I have to add a link of 'competitors' to the UI in the accounts workcenter group. I have created a component for the competitors but am not able to make out how do i link it to the 'Accounts' workcenter group. Can anyone help me out please. Thanks

  • Essential System Software...what is this

    How do I reinstall 'Printer Support' only from Snow Leopard disk...it seems to have 'Essential System Software' that I can't uncheck so I cancelled the reinstall. I don't think I want to reinstall this, as my system is set up the way I want it to be,

  • TS4009 My 3 apple devices share the same icloud storage sate them now?

    My 3 apple devices share the same Icloud storage space and I am running out of free space. How do separate them and get individual accounts for each device?