void (ActionEvent e) { long timePassed = System.currentTimeMillis() - startTime; if (timePassed >= mySwipeTime) { Component currentFocusComponent = IdeFocusManager.getGlobalInstance().getFocusedDescendantFor(parent); show(parent, name); if (currentFocusComponent != null) currentFocusComponent.requestFocusInWindow(); if (onDone != null) { onDone.run(); } return; } linearProgress[0] = MathUtil.clamp((float)timePassed / mySwipeTime, 0, 1); double naturalProgress = (1 - Math.cos(Math.PI * linearProgress[0])) / 2; Rectangle bounds = new Rectangle(parent.getWidth(), parent.getHeight()); JBInsets.removeFrom(bounds, parent.getInsets()); Rectangle r = new Rectangle(bounds); int x = (int)((naturalProgress * r.width)); r.translate(isForward ? -x : x, 0); mySwipeFrom.setBounds(r); Rectangle r2 = new Rectangle(bounds); r2.translate(isForward ? r2.width - x : x - r2.width, 0); mySwipeTo.setVisible(true); mySwipeTo.setBounds(r2); parent.repaint(); }