protected void paintComponent(Graphics g) { if (isFlipped) { Graphics2D g2 = (Graphics2D) g; g2.translate(0, getHeight()); g2.scale(1.0, -1.0); } KEYFRAME_ICON.paintIcon(this, g, 0, SELECTION_ICON.getIconHeight()); // Draw as selected. // Display selection above control so it is visible when multiple overlap. if (this == selectedControl) SELECTION_ICON.paintIcon(this, g, (getWidth() - SELECTION_ICON.getIconHeight()) / 2, 0); }
public KeyframeControl(Keyframe keyframe, boolean isMoveable) { this.keyframe = keyframe; setSize( KEYFRAME_ICON.getIconWidth(), KEYFRAME_ICON.getIconHeight() + SELECTION_ICON.getIconHeight()); if (isMoveable) enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK); enableEvents(AWTEvent.MOUSE_EVENT_MASK); ToolTipManager.sharedInstance().registerComponent(this); }