@Override public void showFeedback() { createFeedback(); myBounds = myContext.getTransformedRectangle( myComponent.getBounds(myContext.getArea().getFeedbackLayer())); myBounds.width = Math.max(myBounds.width, 0); myBounds.height = Math.max(myBounds.height, 0); int direction = myContext.getResizeDirection(); if ((direction & Position.EAST) != 0) { if (!snapToWidth(myBounds, myWrapSize, SNAP_DELTA)) { snapToWidth(myBounds, myFillSize, SNAP_DELTA); } } if ((direction & Position.SOUTH) != 0) { if (!snapToHeight(myBounds, myWrapSize, SNAP_DELTA)) { snapToHeight(myBounds, myFillSize, SNAP_DELTA); } } myFeedback.setBounds(myBounds); myTextFeedback.clear(); addTextSize(myStaticWidth, myBounds.width, myWrapSize.width, myFillSize.width); myTextFeedback.append(" x ", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES); addTextSize(myStaticHeight, myBounds.height, myWrapSize.height, myFillSize.height); myTextFeedback.locationTo(myContext.getLocation(), 15); }
private void createStaticFeedback(Rectangle bounds, String width, String height) { int direction = myContext.getResizeDirection(); Rectangle wrapBounds; Rectangle fillBounds; if (direction == Position.EAST) { myStaticHeight = height; wrapBounds = new Rectangle(bounds.x, bounds.y, myWrapSize.width, bounds.height); fillBounds = new Rectangle(bounds.x, bounds.y, myFillSize.width, bounds.height); } else if (direction == Position.SOUTH) { myStaticWidth = width; wrapBounds = new Rectangle(bounds.x, bounds.y, bounds.width, myWrapSize.height); fillBounds = new Rectangle(bounds.x, bounds.y, bounds.width, myFillSize.height); } else { wrapBounds = new Rectangle(bounds.getLocation(), myWrapSize); fillBounds = new Rectangle(bounds.getLocation(), myFillSize); } myWrapFeedback = new RectangleFeedback(Color.green, 1); myWrapFeedback.setBounds(wrapBounds); myFillFeedback = new RectangleFeedback(Color.green, 1); myFillFeedback.setBounds(fillBounds); }