Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!newsfeed.pionier.net.pl!feed.xsnews.nl!border03.ams.xsnews.nl!feeder03.ams.xsnews.nl!frontend-F09-12.ams.news.kpn.nl From: Cecil Westerhof Newsgroups: comp.lang.java.programmer Subject: Disabling generated buttons Organization: Decebal Computing X-Face: "(y8cC@tg_12{">GF'UXTW]FHI2wMiZNrnf'1EFQ&O#$m:f#O7+7}kR,v+Pti8=Vi/Z"g^?b"E X-Homepage: http://www.decebal.nl/ Date: Mon, 02 Feb 2015 13:24:50 +0100 Message-ID: <874mr41ox9.fsf@Equus.decebal.nl> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) Cancel-Lock: sha1:xLSg/Sk/cZjOe6IFXVWVB0URlAE= MIME-Version: 1.0 Content-Type: text/plain Lines: 51 NNTP-Posting-Host: 77.171.42.144 X-Trace: 1422880135 news.kpn.nl 18621 77.171.42.144@kpn/77.171.42.144:36907 Xref: csiph.com comp.lang.java.programmer:31002 I defined the following class: private enum Colours { Blue(Color.BLUE), Red(Color.RED), Orange(Color.ORANGE), Yellow(Color.YELLOW), Green(Color.GREEN), Cyan(Color.CYAN), Magenta(Color.MAGENTA), Brown(new Color(0x9C, 0x5D, 0x52)), ; private final Color value; Colours(Color value) { this.value = value; } public Color value() { return value; } } I use it to add some (Swing) buttons: for(int i = 0; i < Colours.values().length; ++i) { final Colours colour = Colours.values()[i]; JButton jButton = new JButton("" + colour); add(jButton, gbc); jButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { checkColour(colour); } }); gbc.gridx++; if( gbc.gridx == 3 ) { gbc.gridy++; gbc.gridx = 0; } } Those buttons are used to select a colour. But when the wrong colour is selected I want to disable all the buttons for half a second. (Otherwise people could just click very fast at random.) How would I do this? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof