private boolean accept(Component aComponent) { if (!(aComponent.isVisible() && aComponent.isDisplayable() && aComponent.isFocusable() && aComponent.isEnabled())) { return false; } // Verify that the Component is recursively enabled. Disabling a // heavyweight Container disables its children, whereas disabling // a lightweight Container does not. if (!(aComponent instanceof Window)) { for (Container enableTest = aComponent.getParent(); enableTest != null; enableTest = enableTest.getParent()) { if (!(enableTest.isEnabled() || enableTest.isLightweight())) { return false; } if (enableTest instanceof Window) { break; } } } return true; }
private void paintFocusBorders(boolean clean) { if (myCurrent != null) { Graphics currentFocusGraphics = myCurrent.getGraphics(); if (currentFocusGraphics != null) { if (clean) { if (myCurrent.isDisplayable()) { myCurrent.repaint(); } } else { currentFocusGraphics.setColor(myTemporary ? JBColor.ORANGE : JBColor.GREEN); UIUtil.drawDottedRectangle( currentFocusGraphics, 1, 1, myCurrent.getSize().width - 2, myCurrent.getSize().height - 2); } } } if (myPrevious != null) { Graphics previousFocusGraphics = myPrevious.getGraphics(); if (previousFocusGraphics != null) { if (clean) { if (myPrevious.isDisplayable()) { myPrevious.repaint(); } } else { previousFocusGraphics.setColor(JBColor.RED); UIUtil.drawDottedRectangle( previousFocusGraphics, 1, 1, myPrevious.getSize().width - 2, myPrevious.getSize().height - 2); } } } }
private void paintBorder() { final int row = FocusTracesDialog.this.myRequestsTable.getSelectedRow(); if (row != -1) { final FocusRequestInfo info = FocusTracesDialog.this.myRequests.get(row); if (prev != null && prev != info.getComponent()) { prev.repaint(); } prev = info.getComponent(); if (prev != null && prev.isDisplayable()) { final Graphics g = prev.getGraphics(); g.setColor(Color.RED); final Dimension sz = prev.getSize(); UIUtil.drawDottedRectangle(g, 1, 1, sz.width - 2, sz.height - 2); } } }
public static boolean isFocusable(Component component) { return component.isFocusable() && component.isDisplayable() && component.isVisible() && component.isEnabled(); }