void update() { for (int i = 0; i < getComponentCount(); ++i) { Component component = getComponent(i); if (component instanceof JButton) { final JButton button = (JButton) component; button.setEnabled(!isSearchInProgress()); } } }
public void addButtonRunnable(int index, final Runnable runnable, String text) { if (getBorder() == null) setBorder(IdeBorderFactory.createBorder(SideBorder.TOP)); final JButton button = new JButton(UIUtil.replaceMnemonicAmpersand(text)); DialogUtil.registerMnemonic(button); button.setFocusable(false); button.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { runnable.run(); } }); add(button, index); invalidate(); if (getParent() != null) { getParent().validate(); } }