/** * Determines whether this component is enabled. An enabled component * can respond to user input and generate events. Components are * enabled initially by default. A component may be enabled or disabled by * calling its <code>setEnabled</code> method. * @return <code>true</code> if the component is enabled, * <code>false</code> otherwise * @see #setEnabled setEnabled */ public boolean isEnabled(){ return btOui_.isEnabled(); }
public void actionPerformed(ActionEvent e) { if ( ((AbstractButton)e.getSource()).isEnabled() ) { setSelectedBean( beanpanel ) ; } } }
@Override public void propertyChange(PropertyChangeEvent evt) { setEnabled(button.isEnabled()); } });
@Override public void actionPerformed(final ActionEvent event) { if (button.isEnabled()) { button.doClick(); } } }
@Override public void actionPerformed(ActionEvent e) { if (button.isEnabled()) { button.doClick(); } } },
static void paintBackground(final Graphics g, final AbstractButton btn) { final Graphics2D g2 = (Graphics2D) g.create(); final Paint p; if (btn.isEnabled()) p = new GradientPaint(new Point(0, 0), BG_COLOR_1, new Point(0, btn.getHeight()), BG_COLOR_2); else p = BG_DISABLED_COLOR; g2.setPaint(p); g2.fillRect(0, 0, btn.getWidth(), btn.getHeight()); g2.dispose(); } }
@Override public void keyReleased(final KeyEvent e) { final String srch = search.getText(); if(!oldSearch.equals(srch)) { if(regex.isEnabled() && search.getText().matches("^.*(?<!\\\\)\\\\n.*")) { multi.setSelected(true); } oldSearch = srch; search(); } } });
@Override public void actionPerformed(final ActionEvent e) { // call your a method that contains your action code if (btn.isVisible() && btn.isEnabled()) { btn.doClick(); } } });
/** * Invoked when the mouse enters a component. */ @Override public void mouseEntered(MouseEvent e) { if (!button.isBorderPainted() && button.isEnabled()) { button.setBorderPainted(true); } mouseIsOver = true; }
@Override public void keyReleased(final KeyEvent e) { final String srch = search.getText(); if(!oldSearch.equals(srch)) { if(regex.isEnabled() && search.getText().matches("^.*(?<!\\\\)\\\\n.*")) { multi.setSelected(true); } oldSearch = srch; search(); } } });
/** Invoked when the mouse enters a component. * */ @Override public void mouseEntered(MouseEvent e) { if (!button.isBorderPainted() && button.isEnabled()) { button.setBorderPainted(true); } mouseIsOver = true; }
private void setRolloverStateState(AbstractButton b) { if (b.isEnabled()) { b.setBorderPainted(true); b.setBackground(ROLLOVER_BACKGROUND_COLOR); } }
protected boolean canExecuteAction(ActionEvent e) { AbstractButton editor = getEditor(); Objects.requireNonNull(editor); if (!editor.isVisible() || !editor.isEnabled()) { return false; } if (editor instanceof JMenuItem) { return ((JMenuItem) editor).isArmed(); } return editor.isShowing(); }
private void setSelectedState(AbstractButton b) { if (b.isEnabled()) { b.setBorderPainted(true); b.setBackground(SELECTED_BACKGROUND_COLOR); } else { b.setBorderPainted(false); b.setBackground(getDefaultBackground().darker()); } }
private void paintBackground (Graphics2D g, AbstractButton b, Rectangle r) { if (!b.isEnabled()) { } else if (b.getModel().isPressed()) { compositeColor (g, r, Color.BLUE, 0.3f); } else if (b.getModel().isSelected()) { compositeColor (g, r, new Color (0, 120, 255), 0.2f);; } }
public void click() { AssertAdapter.assertTrue("The button is not enabled, it cannot be activated", abstractButton.isEnabled()); AssertAdapter.assertTrue("The button is not visible, it cannot be activated", abstractButton.isVisible()); if (SwingUtilities.isEventDispatchThread()) { doClick(abstractButton); } else { TriggerRunner.runInSwingThread(triggerClick()); } }
@Override public void keyReleased(final KeyEvent e) { final boolean exec = gui.editor.go.isEnabled(); if(EXEC1.is(e)) { if(exec) release(Action.EXECUTE); } else if(UNIT.is(e)) { if(exec) release(Action.TEST); } else if((!e.isActionKey() || MOVEDOWN.is(e) || MOVEUP.is(e)) && !modifier(e)) { release(Action.CHECK); } }
@Override public void keyReleased(final KeyEvent e) { final boolean exec = gui.editor.go.isEnabled(); if(EXEC1.is(e)) { if(exec) release(Action.EXECUTE); } else if(UNIT.is(e)) { if(exec) release(Action.TEST); } else if((!e.isActionKey() || MOVEDOWN.is(e) || MOVEUP.is(e)) && !modifier(e)) { release(Action.CHECK); } }
@Test public void testEnabledStateOfUIComponentsAfterInitializing() { assertFalse(roiMaskSelector.useRoiMaskCheckBox.isEnabled()); assertFalse(roiMaskSelector.roiMaskComboBox.isEnabled()); assertTrue(roiMaskSelector.showMaskManagerButton.isEnabled()); }
@Test public void testEnabledStateWhenProductContainsNoMasks() { roiMaskSelector.updateMaskSource(createProduct()); assertFalse(roiMaskSelector.useRoiMaskCheckBox.isEnabled()); assertFalse(roiMaskSelector.roiMaskComboBox.isEnabled()); assertTrue(roiMaskSelector.showMaskManagerButton.isEnabled()); }