X-Received: by 2002:a37:dd4:: with SMTP id 203mr3068545qkn.326.1560411410805; Thu, 13 Jun 2019 00:36:50 -0700 (PDT) X-Received: by 2002:a81:1090:: with SMTP id 138mr46507395ywq.422.1560411410501; Thu, 13 Jun 2019 00:36:50 -0700 (PDT) Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!j96no939172qte.0!news-out.google.com!33ni213qtt.0!nntp.google.com!j96no939169qte.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.gui Date: Thu, 13 Jun 2019 00:36:50 -0700 (PDT) In-Reply-To: <928e2762-1449-489d-92b6-dd50f5789b72@z28g2000prd.googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=103.119.254.234; posting-account=_V-uxwoAAAB5doJJ_IUqPkUcKrLhw_tD NNTP-Posting-Host: 103.119.254.234 References: <928e2762-1449-489d-92b6-dd50f5789b72@z28g2000prd.googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <338d2c60-100e-4058-836b-93f251ec5df9@googlegroups.com> Subject: Re: Enable/disable JOptionPane button From: sajeer@retailcloud.com Injection-Date: Thu, 13 Jun 2019 07:36:50 +0000 Content-Type: text/plain; charset="UTF-8" Lines: 21 Xref: csiph.com comp.lang.java.gui:5537 On Saturday, January 31, 2009 at 1:11:28 AM UTC+5:30, FredK wrote: > I create a dialog using a JOptionPane: > > Object options[] = {"OK", "Apply", "Cancel"}; > wOptionPane = new JOptionPane( child, messageType, > JOptionPane.DEFAULT_OPTION, > null, options, null ); > > When I make the dialog visible, I sometimes want to > disable one or more of the option buttons until the > user has input valid data that makes the action of > that button meaningful. > > How can I retrieve the buttons that the JOptionPane > creates for the options? Or is my only choice to create > all the buttons myself instead of letting the JOptionPane > create them? > > -- > Fred K. You can create buttons and add to options instead only adding button text, so that you can do anything to your buttons