JButton disable issue

I have a small swing app, which have couple of buttons. One of the button involves a five minute processing. During this time, I have disabled the button and removed the action Listener. Even though the button remains faded during the process, If the user clicks on the button ( while remaining faded) , the proces starts all over again, after the end of the current process.
button.removeActionListerner(listener)
button.setEnabled(false)
paint(getGraphics())
processData()
button.setEnabled(true)
button.addActionListener(listener)
paint(getGraphics())
Any ideas ? Thanks

Thought this would be a good time to learn and try to use a background thread in Swing. Never done this before, but the code works. If no one else finds fault with it (not unlikely given my novice status), you might want to try to use something like this in your program.
Please anyone, let me know if this is messed up or if it is ok. Thanks!
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class SwingBckGround extends JFrame implements ActionListener
    private JPanel mainPanel = new JPanel();
    private JPanel buttonPanel = new JPanel();
    private JButton noThreadButton = new JButton("No Background Thread");
    private JButton yesThreadButton = new JButton("With Background Thread");
    private JPanel redPanel = new JPanel();
    private JLabel redPanelLabel = new JLabel("Press Buttons to turn panel red");
    private Color redPanelBkGrndColor;
    public SwingBckGround()
        super("Brief Swing App");
        createWidgets();
        getContentPane().add(mainPanel);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        pack();
        setVisible(true);
    private void createWidgets()
        // create buttonPanel
        int edgeSize = 10;
        FlowLayout fLayO = new FlowLayout();
        fLayO.setHgap(2* edgeSize);
        buttonPanel.setLayout(fLayO);
        buttonPanel.add(noThreadButton);
        buttonPanel.add(yesThreadButton);
        buttonPanel.setBorder(BorderFactory.createEmptyBorder(edgeSize, edgeSize, edgeSize, edgeSize));
        noThreadButton.addActionListener(this);
        yesThreadButton.addActionListener(this);
        // create redPanel
        redPanel.setPreferredSize(new Dimension(40, 80));
        redPanel.add(redPanelLabel);
        // create mainPanel
        mainPanel.setLayout(new BorderLayout());
        mainPanel.add(buttonPanel, BorderLayout.NORTH);
        mainPanel.add(redPanel, BorderLayout.SOUTH);
    // any method that will take some time to finish
    private void busyWork()
        int loopSize = 1000;
        for (int i = 0; i < loopSize; i++)
            for (int j = 0; j < loopSize; j++)
                for (int k = 0; k < loopSize; k++)
                    int foo = i + j + k;
    public void actionPerformed(ActionEvent e)
        JButton myBtn = (JButton)e.getSource();
        if (myBtn.equals(noThreadButton))
            yesThreadButton.setEnabled(false);
            redPanelBkGrndColor = redPanel.getBackground();
            redPanel.setBackground(Color.red);
            busyWork();
            yesThreadButton.setEnabled(true);
            redPanel.setBackground(redPanelBkGrndColor);
        else if (myBtn.equals(yesThreadButton))  // the if not needed but here for clarity
            noThreadButton.setEnabled(false);  // disable the other button
            redPanelBkGrndColor = redPanel.getBackground();  // store original panel color
            redPanel.setBackground(Color.red); // set redpanel to red
            // create our background thread.  Needs Java 6 to work
            SwingWorker<Void, Void> mySW = new SwingWorker<Void, Void>()
                @Override  // do our busy work here in the background
                protected Void doInBackground() throws Exception
                    busyWork();
                    return null;
                @Override
                public void done()
                    // when done reset button to enabled, and 
                    // change redPanel color back to original color
                    // I'm not sure if tricky GUI calls here would require a
                    // call through the Swing event thread with
                    // SwingUtilities.invokeLater(new Runnable()....?
                    noThreadButton.setEnabled(true);
                    redPanel.setBackground(redPanelBkGrndColor);
            mySW.execute();  // lets call our SwingWorker object here
    private static void createAndShowGUI()
        SwingBckGround swngBckGrnd = new SwingBckGround();
    public static void main(String[] args)
        javax.swing.SwingUtilities.invokeLater(new Runnable()
        { public void run() { createAndShowGUI();}});
}

Similar Messages

  • HT1212 iPhone4 6.1.3 Disabled issues

    Last week , I purchased an iPhone4 6.1.3. I HAVE NOT synced it with iTunes yet. I originally had is set for Setting, General , Passcode Lock 'ON' and used that passcode for one day. After that day, I didn't like the passcode as it was hard to type , a 4 digit code. I went back into settings, general, passcode lock and went to change my passcode.. as I was doing this , I noticed there was a way to make it alphanumeric.. started typing then thought this was not going to be user friendly, then went back to a 4 digit code and set a new password. After that, I got the passcode lock screen, then tried the original, then the new one I set it to.. neither one worked. I tried 0000 and 1111.. It locked the screen and had me try back in minutes, then 60 minutes.. etc.. until it DISABLED the phone. After it was disabled, I read online about how to recover the phone correctly from apple ( see link http://support.apple.com/kb/HT1212 ), . After following the directions to the T, and running the restore on my phone, it is STILL DISABLED , and I am not able to use my less than 1 week old phone. I am getting upset that after waiting for the restore in iTunes to run ( which , due to my slow connection, took 8-12 hours) - this was supposed to be the final answer for me. I am still not able to use my new phone. Please help! I am computer literate and have tried everything that is recommended. I noticed that there is another user with a similar issue ( see https://discussions.apple.com/thread/5156012?tstart=0 ). Is there another procedue to run? My wife has purchased and iPhone4 the same day and has had no issues. She has synced her phone on her side of our PC. Is there a way I can use her synced iPhone file to restore mine? I don't care if I wipe all my information off my phone as I have mo previous files, photos, etc.. even if it wipes my contacts.. I am good with that as well, my phone has the following information on the box - MD127LL/A iPhone 4 , Black , 8G - Model A1332 UPC 885909499458 m (1P) Oart No. MD127LL/A , (S) Serial No. DX*******P0N , Carrier Part No. 65488. My phone provider is AT&T. I purchased the phone about 8PM MST on July 3rd 2013. I used the phone that day, then locked it July 4th at about 9:30 pm, just in time for fireworks and haven't used it since. PLEASE HELP!! I noticed another comment not addressed on this as well - see https://discussions.apple.com/message/15901781#15901781.
    IF THIS IS POSTED FOR PUBLIC VIEW - PLEASE REMOVE MY PHONE SER# AND OTHER VITAL iPhone4 INFO... THANK YOU!
    <Personal Information Edited by Host>

    Last week , I purchased an iPhone4 6.1.3. I HAVE NOT synced it with iTunes yet. I originally had is set for Setting, General , Passcode Lock 'ON' and used that passcode for one day. After that day, I didn't like the passcode as it was hard to type , a 4 digit code. I went back into settings, general, passcode lock and went to change my passcode.. as I was doing this , I noticed there was a way to make it alphanumeric.. started typing then thought this was not going to be user friendly, then went back to a 4 digit code and set a new password. After that, I got the passcode lock screen, then tried the original, then the new one I set it to.. neither one worked. I tried 0000 and 1111.. It locked the screen and had me try back in minutes, then 60 minutes.. etc.. until it DISABLED the phone. After it was disabled, I read online about how to recover the phone correctly from apple ( see link http://support.apple.com/kb/HT1212 ), . After following the directions to the T, and running the restore on my phone, it is STILL DISABLED , and I am not able to use my less than 1 week old phone. I am getting upset that after waiting for the restore in iTunes to run ( which , due to my slow connection, took 8-12 hours) - this was supposed to be the final answer for me. I am still not able to use my new phone. Please help! I am computer literate and have tried everything that is recommended. I noticed that there is another user with a similar issue ( see https://discussions.apple.com/thread/5156012?tstart=0 ). Is there another procedue to run? My wife has purchased and iPhone4 the same day and has had no issues. She has synced her phone on her side of our PC. Is there a way I can use her synced iPhone file to restore mine? I don't care if I wipe all my information off my phone as I have mo previous files, photos, etc.. even if it wipes my contacts.. I am good with that as well, my phone has the following information on the box - MD127LL/A iPhone 4 , Black , 8G - Model A1332 UPC 885909499458 m (1P) Oart No. MD127LL/A , (S) Serial No. DX*******P0N , Carrier Part No. 65488. My phone provider is AT&T. I purchased the phone about 8PM MST on July 3rd 2013. I used the phone that day, then locked it July 4th at about 9:30 pm, just in time for fireworks and haven't used it since. PLEASE HELP!! I noticed another comment not addressed on this as well - see https://discussions.apple.com/message/15901781#15901781.
    IF THIS IS POSTED FOR PUBLIC VIEW - PLEASE REMOVE MY PHONE SER# AND OTHER VITAL iPhone4 INFO... THANK YOU!
    <Personal Information Edited by Host>

  • Java 1.6.0_19  MD2withRSA is disabled issue

    Some of our clients have been upgraded to the latest jre 1.6.0_19. They get the following exception:
    javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: algorithm check failed: MD2withRSA is disabled.
    SEND TLSv1 ALERT: fatal, description = certificate_unknown
    Data Processor, WRITE: TLSv1 Alert, length = 2
    This is the certificate in question:
    Version: V1
    Subject: OU=Class 3 Public Primary Certification Authority, O="VeriSign, Inc.", C=US
    Signature Algorithm: MD2withRSA, OID = 1.2.840.113549.1.1.2
    Key: Sun RSA public key, 1024 bits
    modulus: 14140032204...Omitted for brevity...36711
    public exponent: 65537
    Validity: [From: Sun Jan 28 19:00:00 EST 1996,
                   To: Tue Aug 01 19:59:59 EDT 2028]
    Issuer: OU=Class 3 Public Primary Certification Authority, O="VeriSign, Inc.", C=US
    SerialNumber: [    70bae41d 10d92934 b638ca7b 03ccbabf]
    Algorithm: [MD2withRSA]
    Signature:
    0000: BB 4C ...Omitted for brevity
    0070: C0 7D B7 72 9C C9 36 3A 6B 9F 4E A8 FF 64 0D 64 ...r..6:k.N..d.d
    Now I tested this with 1.6.0_18, and there are no problems with this certificate. No exceptions are thrown and logging in is successful. Why would this be if MD*withRSA has been disabled starting with 1.6.0_17 and upwards?
    Upon looking at the 1.6.0_19 release notes, I noticed that several root certificates have been replaced in that release, including the one which we are currently using which uses MD2withRSA encryption.
    Can anyone confirm that the reason why this is working in 0_18 is because the root cert in question was removed in 0_19?
    Thanks in advance

    Just confirmed that with 1.6.0_18 there is no issue with a root certificate which uses the MD2withRSA algoritm. In there it says that it found a trusted certificate. Is the reason this no longer wrks in 1.6.0_19 that this verisign class 3 ca cert was removed from the jre?
    chain [2] = [
    Version: V1
    Subject: OU=Class 3 Public Primary Certification Authority, O="VeriSign, Inc.", C=US
    Signature Algorithm: MD2withRSA, OID = 1.2.840.113549.1.1.2
    Key: Sun RSA public key, 1024 bits
    modulus: 1414003220445505168651...Omitted for brevity...6711
    public exponent: 65537
    Validity: [From: Sun Jan 28 19:00:00 EST 1996,
                   To: Tue Aug 01 19:59:59 EDT 2028]
    Issuer: OU=Class 3 Public Primary Certification Authority, O="VeriSign, Inc.", C=US
    SerialNumber: [    70bae41d 10d92934 b638ca7b 03ccbabf]
    Algorithm: [MD2withRSA]
    Signature:
    0000: BB 4C 12 2B CF 2C 26 00 ...Omitted for brevity
    0070: C0 7D B7 72 9C C9 36 3A 6B 9F 4E A8 FF 64 0D 64 ...r..6:k.N..d.d
    Found trusted certificate:
    Version: V1
    Subject: OU=Class 3 Public Primary Certification Authority, O="VeriSign, Inc.", C=US
    Signature Algorithm: MD2withRSA, OID = 1.2.840.113549.1.1.2
    Key: Sun RSA public key, 1024 bits
    modulus: 141400322044...Omitted for brevity...6711
    public exponent: 65537
    Validity: [From: Sun Jan 28 19:00:00 EST 1996,
                   To: Tue Aug 01 19:59:59 EDT 2028]
    Issuer: OU=Class 3 Public Primary Certification Authority, O="VeriSign, Inc.", C=US
    SerialNumber: [    70bae41d 10d92934 b638ca7b 03ccbabf]
    Algorithm: [MD2withRSA]
    Signature:
    0000: BB 4C 12 2B CF 2C 26 00 4F 14 13 DD A6 FB ...Omitted for brevity...
    0070: C0 7D B7 72 9C C9 36 3A 6B 9F 4E A8 FF 64 0D 64 ...r..6:k.N..d.d
    Edited by: javadev157 on Apr 8, 2010 11:30 AM
    Edited by: javadev157 on Apr 8, 2010 11:30 AM

  • Disable 'Issue Output To' in VF02

    Dear Expert,
    I have question on how to disable an Billing Invoice from issueing to output for printing in VF02, by checking whether the invoice has been marked cancel or not. If the invoice has been marked as cancel, it should not be able to print.
    I have been thinking of using USEREXIT_PRINT_HEAD for enhancement, but is this the correct userexit to use?
    How am I going to enhance by using this userexit if this is the correct one?

    Hi all,
    Thanks for replying.
    V05N0001 is a customer exit right? Is there any different between a user exit & a customer exit?
    I would like to disable printing 'issue output to' in VF02. Below is the scenario.
    Cancellation is applied on document header, once there is cancellation, all the item in the original invoice will be cancel. Thus, when user go to VF02 with the original invoice number, and click on u2018billing document > issue output tou2019 on title bar, system should disallow user to use the print button to print out the invoice.
    Regards, Jeff
    Edited by: Jeff Khoo on Dec 23, 2010 4:01 AM

  • Jbutton disabling

    how to stop the action of a jbutton while executing the process
    i had a problem the button action was performed and continuing the process
    i want to disable the button when the process is executing
    plz help me

    Goyyaala
    I'm blocking your posts and user account for violating Section 1.4 of the Code of Conduct that you agreed to when you signed up to this site.
    1.4 You agree not to post messages that are clearly outside of the stated topic of any forums nor disrupt a forum by deliberately posting repeated irrelevant messages or copies of identical messages (also known as "flooding").
    You agree not to post or store on Sun.com or any of its affiliated sites any Content that is intentionally off-topic, repetitive, inaccurate, or irrelevant.
    db

  • Publishing site and webpart disable issue

    I have installed SharePoint 2013 server and did the following.
    1. Created a web application
    2. Create a Site Collection
    3. Selected "Publishing" template
    4. Assigned "Site Collection Administrator"
    5. I then tried accessing root site through client browser http://portal.mydomain.com
    6. I went into the settings and selected "EDIT" to change the layout and changed into Two Columns layout and deleted default webparts except "Documents"
    Now when I want to add a webpart like i used to do in SharePoint 2010 nothing happens and it seems like the webpart button is disabled.  Here is the snapshot ..Please guide how to add webparts and what to do to bring the webparts dialogue like in 2010
    version.

    It seems there are issues with Internet Explorer default viewing compatibility. For those who are banging their heads with IE 9/10 ...here is the solution
    1. Access your site in Internet Explorer....
    2. Press F12 key (developer tools)
    3. do settings as below.
    Cheers!

  • Ideapad u430p adaptive brightness disable issue

    Hello,
    I have an issue with turning adaptive brightness(brightness changes depending on what the screen is showing) off for u430p(both plugged and unplugged). I have tried it multiple ways:
    From intel control pannel,
    From services (disabled sensor)
    In power management I even have adaptive brightness off (both plugged and unplugged)
    If anyone found a fix for this particular model, please let me know. It drives me insane and don't know why they haven't made this option to be easily disabled.
    Thanks in advance.
    Solved!
    Go to Solution.

    Hi,
    I had the same issue, it was present on both linux and windows. The laptop came with BIOS 7CCN34WW and even though it is not mentioned in the changelog, upgrading to 7CCN61WW fixes the problem.

  • EID3.0 Endeca Server SSL disable issue

    Hi,
    I have installed EID3.0 on our server and the SSL was enabled. I built page based on this Endeca Server and it worked well.
    For testing the Java Client call, I need to disable the SSL.
    Today I updated the config file "EndecaServer.properties" under path "MW_HOME/user_projects/domains/endeca_domain/config" as below:
    endeca-require-https=false
    endeca-webserver-port=7001
    endeca-secure-mode=false
    And remove the SSL setting in "MW_HOME/user_projects/domains/endeca_domain/config/config.xml"
    But when I restart the weblogic and run "./endeca-cmd list-dd", it throws error as below:
    endeca-cmd encountered a problem.
    caused by:
    Error contacting the Endeca Server localhost:7001: javax.xml.soap.SOAPException: javax.xml.soap.SOAPException: Bad response: 503 Service Unavailable from url http://localhost:7001/endeca-server/ws/manage
    caused by:
    javax.xml.soap.SOAPException: javax.xml.soap.SOAPException: Bad response: 503 Service Unavailable from url http://localhost:7001/endeca-server/ws/manage
    caused by:
    javax.xml.soap.SOAPException: Bad response: 503 Service Unavailable from url http://localhost:7001/endeca-server/ws/manage
    caused by:
    Bad response: 503 Service Unavailable from url http://localhost:7001/endeca-server/ws/manage
    Anyone know how to disable SSL for EID3.0? Must I reinstall it again?

    Try also clearing the following two EndecaServer.properties:
    endeca-ds-cert-file=
    endeca-ds-ca-file=
    Also don't forget to review your EndecaCmd.properties settings.

  • Jbutton Table Issue

    Hi...
    I have a constructor like below whose class extends JFrame. The problem is that my for loop is printing only the last string.( I am using this information ultimately to build a JButton table).
    Can somebody tell me whats wrong with this and howto make it happen the way I want it to be ?
    Below is the code:-
    public MyclassConstructor() {
        super("JButton Table builder");
        DefaultTableModel dm = new DefaultTableModel();
        String[] Fields1={"String1","String2","String3","String4","String5"};
        for(int i=0; i<Fields1.length;i++){
        dm.setDataVector(new Object[][] { {new String(Fields1)} },
    new Object[] { "Fields", "Answers" });
    JTable table = new JTable(dm);
    String[] answer = { "A", "B", "C", "D", "E", "F" };
    table.getColumn("My Answers").setCellRenderer(
    new RadioButtonRenderer(answer));
    table.getColumn("My Answers").setCellEditor(
    new RadioButtonEditor(new JCheckBox(), new RadioButtonPanel(
    answer)));
    JScrollPane scroll = new JScrollPane(table);
    getContentPane().add(scroll);
    }Normally I do it like this and get all the strings correctly:public JRadioButtonTableExample2() {
    super("JButton Table builder");
    DefaultTableModel dm = new DefaultTableModel();
    dm.setDataVector(new Object[][] { {new String("String1") },
    {{new String("String2") }, { {new String("String3") },
    { {new String("String4") }, { {new String("String5") } },
    new Object[] { "Fields", "Answers" });
    JTable table = new JTable(dm);
    String[] answer = { "A", "B", "C", "D", "E", "F" };
    table.getColumn("My Buttons").setCellRenderer(
    new RadioButtonRenderer(answer));
    table.getColumn("My Buttons").setCellEditor(
    new RadioButtonEditor(new JCheckBox(), new RadioButtonPanel(
    answer)));
    JScrollPane scroll = new JScrollPane(table);
    getContentPane().add(scroll);
    Thanks in advance
    Edited by: Java_Surfer on Oct 24, 2009 7:03 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Please go through [http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html]
    Your code is so badly formatted that it's next to impossible to see what it's doing / meant to do.
    db

  • Keeping text intact in disabled checkbox

    hi all,
    If I disable a checkbox, I want to keep it's name/text not disabled
    (normal) would it be possible?
    Thanks

    You could probably get into overriding paint methods or creating a new UI delegate for the checkbox, but both of those are going to be fairly daunting. One solution would be to just create a label and place it next to a 'blank' checkbox. Change the foreground color to the same color you would expect the checkbox to use (I did it the sloppy way, I hardcoded it) and your set. If you run this little app you'll notice that the label doesn't quite line up like it would with a real checkbox, but it won't be noticeable as long as you don't have any other checkboxes nearby.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class CheckBoxTestFrame extends JFrame
       private JCheckBox _chkDummy;
       private JCheckBox _chkDisablingCheckbox;
       public CheckBoxTestFrame()
          super("Checkbox test frame");
          Container content = getContentPane();
          content.add(getCheckboxComponent(), BorderLayout.NORTH);
          content.add(getButtonPanel(), BorderLayout.SOUTH);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          pack();     
          setVisible(true);
       private Component getCheckboxComponent()
          JPanel panel = new JPanel(new GridBagLayout());
          GridBagConstraints gbc = new GridBagConstraints();
          _chkDisablingCheckbox = new JCheckBox();
          _chkDisablingCheckbox.setMnemonic('n');
          gbc.anchor = gbc.WEST;
          panel.add(_chkDisablingCheckbox, gbc);
          JLabel lblNonDisablingLabel = new JLabel("Non disabling label");
          lblNonDisablingLabel.setForeground(Color.black);
          lblNonDisablingLabel.setLabelFor(_chkDisablingCheckbox);
          lblNonDisablingLabel.setDisplayedMnemonic(_chkDisablingCheckbox.getMnemonic());
          gbc.gridx = 1;
          gbc.weightx = 1.0;
          gbc.weighty = 1.0;
          panel.add(lblNonDisablingLabel, gbc);
          _chkDummy = new JCheckBox("Dummy checkbox for comparison");
          gbc.gridy = 1;
          gbc.gridx = 0;
          gbc.gridwidth = 2;
          gbc.weightx = 0.0;
          gbc.weighty = 0.0;
          panel.add(_chkDummy, gbc);
          return panel;     
       private Component getButtonPanel()
          JPanel panel = new JPanel();
          final JButton btnDisableEnable = new JButton("Disable");
          btnDisableEnable.setMnemonic('a');
          btnDisableEnable.addActionListener(new ActionListener()
             public void actionPerformed(ActionEvent e)
                boolean isDisable = btnDisableEnable.getText().startsWith("Dis");
                _chkDisablingCheckbox.setEnabled(!isDisable);
                _chkDummy.setEnabled(!isDisable);
                btnDisableEnable.setText(isDisable ? "Enable" : "Disable");
          panel.add(btnDisableEnable);
          return panel;
       public static void main(String[] args)
          new CheckBoxTestFrame();
    }

  • Java Script Disable/Enable Items Problem

    Hi,
    I followed the directions to disable/enable items from http://www.oracle.com/technology/products/database/htmldb/howtos/htmldb_javascript_howto2.html#disable.
    And I'm getting an error.
    I have fields like :
    Issue Summary
    Issue Description
    Identified By
    Identified Date
    Status (Values: Open, On-Hold, In-Process, Closed)
    Priority
    Target Resolution Date
    Whenever the Status changes to 'In-Process' I would like to disable 'Issue Summary and Issue Description'.
    Both the fields (Issue Summary and Issue Description) are being disabled when the Status changed to 'In-Process'
    but when I click the 'Apply Changes' button I'm getting the error: 'Issue summary cannot be null.'
    I do have a Not Null validation on Issue Summary field, but I'm only updating the Status field.
    Following is the JavaScript:
    In the Page Attribute (HTML Header)
    <script language="JavaScript" type="text/javascript">
    <!--
    //htmldb_delete_message='"DELETE_CONFIRM_MSG"';
    //-->
    // This function takes in:
    // 1. A string expression to evaluate. For example:
    // 'document.getElementById(\'P125_STATUS\').value=InProcess'
    // Notice the quotes are escaped using a "\"
    // 2. One or more arguments which are item ID's as strings. For example:
    // ...,'P1_ENAME','P1_SAL'...);
    // Notice the ID's are the item names, NOT item labels
    function disFormItems(testString,P125_ISSUE_SUMMARY,P125_ISSUE_DESCRIPTION){
    theTest = eval(testString);
    if(theTest){
    for(var i=1;i<4;i++){
    if (arguments){
    disItem = document.getElementById(arguments[i]);
    // disItem.style.background = '#cccccc';
    disItem.disabled = true;
    else{
    for(var i=1;i<4;i++){
    if (arguments[i]){
    disItem = document.getElementById(arguments[i]);
    disItem.disabled = false;
    // disItem.style.background = '#ffffff';
    //-->
    </script>
    In the Footer:
    <script language="JavaScript1.1" type="text/javascript">
    disFormItems('document.getElementById(\'P125_STATUS\').value==\'In-Process\'','P125_ISSUE_SUMMARY','P125_ISSUE_DESCRIPTION');
    </script>
    In the Status field HTML Form Element Attributes:
    onChange="javascript:disFormItems('document.getElementById(\'P125_STATUS\').value == \'In-Process\'','P125_ISSUE_SUMMARY','P125_ISSUE_DESCRIPTION');"
    Can somebody let me know what's wrong?
    Any help is greatly appreciated.
    Thanks in advance

    FYI: I used the following JavaScript to make it work:
    In the Header Text
    function SetReadOnly()
    var status = document.forms[0].p_t09.value;
    if(status == 'In-Process')
    document.forms[0].p_t02.readOnly = true;
    document.forms[0].p_t03.readOnly = true;
    //-->
    In the Footer
    <script language="JavaScript1.1" type="text/javascript">
    SetReadOnly();
    </script>
    In the HTML Form Element Attributes
    onChange="javascript:SetReadOnly();"
    Thank you very much for your suggestion

  • How to change the location of JButton

    b1 = new JButton("Disable middle button");
    b1.setVerticalTextPosition(AbstractButton.CENTER);
    b1.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
    b1.setMnemonic(KeyEvent.VK_D);
    b1.setActionCommand("disable");
    b1.setPreferredSize(new Dimension(300, 30));
    I have got this far and now i want to change the physical location of the the 'b1' button any idea ?

    now i want to change the physical location of the the 'b1' button use the appropriate layout manager (or nested managers)
    (it is rarely a good idea to use a null layout)
    http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html

  • Disabled foreground color in JComboBox

    what's the correct way to set the disabled foreground color of a jcombobox? i don't want to set the disabled color for the entire ui to the same color, but for one jcombobox specifically. i searched the web and found many posts with the same question, but no real solution. this one has been giving me nightmares and i thought i'd share what i've found. the solution seems to be quite simple: wrap the combobox label in a panel. that way the panel gets the disabled colors, but the coloring of the label of the combobox remains. here's the solution in short in case others need it:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.DefaultListCellRenderer;
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.ListCellRenderer;
    public class MyComboBox extends JComboBox {
      public MyComboBox() {
        super();
        setRenderer( new ColorCellRenderer());
      public static void main(String s[]) {
        JFrame frame = new JFrame("ComboBox Example");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        final JComboBox cb = new MyComboBox();
        cb.addItem( "ComboBox Item 1");
        cb.addItem( "ComboBox Item 2");
        cb.addItem( "ComboBox Item 3");
        cb.setForeground( Color.blue);
        final JButton bt = new JButton ("disable");
        bt.addActionListener( new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            cb.setEnabled( !cb.isEnabled());
            if( !cb.isEnabled()) {
              cb.setForeground( Color.red);
              bt.setText( "enable");
            } else {
              cb.setForeground( Color.blue);
              bt.setText( "disable");
        frame.getContentPane().setLayout( new FlowLayout());
        frame.getContentPane().add( bt);
        frame.getContentPane().add( cb);
        frame.pack();
        frame.setVisible(true);
      class ColorCellRenderer implements ListCellRenderer {
        protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
        public Component getListCellRendererComponent(JList list, Object value,
            int index, boolean isSelected, boolean cellHasFocus) {
          JLabel label = (JLabel) defaultRenderer
              .getListCellRendererComponent(list, value, index,
                  isSelected, cellHasFocus);
          JPanel wrapper = new JPanel();
          wrapper.setLayout( new BorderLayout());
          wrapper.add( label, BorderLayout.CENTER);
          return wrapper;
    }if anyone knows a way to remove the dropdown button of a disabled combobox without leaving a blank space when you simply hide the button, feel free to extend this :-)
    Edited by: Lofi on Mar 20, 2010 10:46 PM

    i thought i'd share what i've found. the solution seems to be quite simple: wrap the combobox label in a panel.Brilliant! I'm sure this will be useful to others who find this solution here.
    Your code does have some unnecessary overheads though, like constructing a new JPanel in every call to getListCellRendererComponent, and holding a separate renderer as a field. I've attempted to clean it up for brevity and efficiency.import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.DefaultListCellRenderer;
    import javax.swing.JCheckBox;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    public class DisabledForegroundListCellRenderer extends DefaultListCellRenderer {
      private final JPanel wrapper = new JPanel(new BorderLayout());
      public DisabledForegroundListCellRenderer() {
        wrapper.add(this);
      @Override
      public Component getListCellRendererComponent(JList list, Object value,
              int index, boolean isSelected, boolean cellHasFocus) {
        super.getListCellRendererComponent(list, value,
                index, isSelected, cellHasFocus);
        return wrapper;
      // Test rig
      public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            new DisabledForegroundListCellRenderer().makeUI();
      public void makeUI() {
        String[] data = {"One", "Two", "Three"};
        final JComboBox combo = new JComboBox(data);
        combo.setRenderer(new DisabledForegroundListCellRenderer());
        final JCheckBox check = new JCheckBox("Combo enabled");
        check.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            boolean selected = check.isSelected();
            combo.setForeground(selected ? Color.BLUE : Color.RED);
            combo.setEnabled(selected);
        check.doClick();
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.add(check, BorderLayout.NORTH);
        frame.add(combo, BorderLayout.SOUTH);
        frame.pack();
        frame.setVisible(true);
    }I've also changed the class name, as to me "ColorCellRenderer" would rather imply something that renders either the foreground or the background (or both) on the basis of the value parameter.
    if anyone knows a way to remove the dropdown button of a disabled combobox without leaving a blank space when you simply hide the buttonThat would require a custom UI delegate, not a custom renderer. And really, I wouldn't bother -- I would just use a JComboBox and a disabled (or maybe uneditable) JTextField, held in a CardLayout, and swap them instead of disabling the combo.
    Shall take a look at how the combo UIs reserve space for the button though :)
    luck, db
    Edited by: DarrylBurke -- changed wrapper to private final, it shouldn't be static

  • Incompatability Issues  MAC OS 10.4.10 With USB headphones

    I bought iListen so I could type more quickly as I have some disability issues and type very slowly. I had a lot of trouble training iListen. I bought a package which included a Platronics USB headset and USB Mic fromthe Apple online store. After many issues I was able to find out from Plantronics that MAC OS 10.4.10 has some compatability issues with USB Microphones. After making sure the System Preferences are correctly chosen in Sound and Speech Panes you can follow the steps below, I hope this helps some others to avoid this frustration.
    The following applies only to Macintosh computers running Mac OS X 10.4.10.
    If you experience no transmit (i.e. the mic doesn't seem to work), please try the following:
    1) Make sure your Plantronics microphone is plugged into an open USB port on your computer.
    2) Launch "Audio MIDI Setup.app." (You will find this application in Applications> Utilities.)
    3). In System Settings, select "Plantronics Headset" as the default input.
    4). In "Properties For:" select "Plantronics Headset."
    5). In the bottom right area of the window, uncheck "Mute."

    I have had communication from MacSpeech which indicated they actually gave the solution to Plantronics and were aware of the issues. I did not realize that there was an issue that was not with me because it only happened some of the time that my computer muted the microphone and resorted to the built in mic! Hope this helps someone else

  • "orcladmin" access has been disabled & some FTP problems & user IDs

    Hi,
    I was working on a problem with OCS 10g (10.1.2) where we can only upload/ftp successfully file types (with extensions: BMP, JPG, WAV, MP3 & LOG). Txt, Doc and XLS files get an access denied error.
    So I try to logon to "http://myocsserver.com:7778/content/" as orcladmin to change any applicable settings to allow all file types to be uploaded to my library in Content Services. When orcladmin access gets an error message "Error
    Your access has been disabled. Contact your system administrator for more information."
    I've tried looking at the product documentations, OTN and even MetaLink. Unfortunately I couldn't find anything. Can anyone tell me how to get my orcladmin account to work again on "http://myocsserver.com:7778/content/" ?
    When i goto "http://myocsserver.com:7777/oiddas/" and even "http://myocsserver.com:1810", orcladmin works just fine. When I examince orcladmin account in OID I see that it is not locked and is enabled. So I can't seem to understand/figure out why I get the error "Your access has been disabled. Contact your system administrator for more information."
    BTW, we also tried to create another super user account. We created it in OID granted it with all the privileges available and assigned it a domain admin role. However when it is able to logon to "http://myocsserver.com:7778/content/" it is not able to access the administration mode.
    Hopefully someone can point me in the right direction.
    Thanks in advance.
    Regards,
    -Ken

    Hi user544366,
    Thank you for the suggestion, I appreciate it.
    Hi all,
    Got a fix from Metalink support personnel on the orcladmin user access disabled issue. Apparrently you have to de-provision Content for orcladmin and re-provision again. After doing that we were able to login to Content services again ("Http://ourOCSserver:7778/content/").
    My remaining issue now is that even after I log on as orcladmin to Content Services I cannot find any settings that will fix my original problems. Using any user id (orcladmin etc) I can only successfully upload files w/ extensions (WAV, MP3, BMP, JPG & LOG) to Content services. I cannot upload -fails - (DOC, TXT, PDF, PPT & PDF) files to Content services. If I use FTP I get "Access Denied" error. If I use the web interface to upload I get an error "Error An Item must be selected etc."
    TIA.
    :)

Maybe you are looking for