|
|
@ -298,15 +298,16 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { |
|
|
|
Background borderImage = style.getBorderImage(); |
|
|
|
Background borderImage = style.getBorderImage(); |
|
|
|
if (borderImage instanceof ImageBackground) { |
|
|
|
if (borderImage instanceof ImageBackground) { |
|
|
|
// 图片类型边框
|
|
|
|
// 图片类型边框
|
|
|
|
Image image = ((ImageBackground) borderImage).getImage(); |
|
|
|
ImageBackground imageBackground = (ImageBackground) borderImage; |
|
|
|
int[] ninePoint = ((ImageBackground) borderImage).getNinePoint(); |
|
|
|
Image image = imageBackground.getImage(); |
|
|
|
|
|
|
|
|
|
|
|
if (image != null) { |
|
|
|
if (image != null) { |
|
|
|
this.borderLineCombo.selectBorderImage(); |
|
|
|
this.borderLineCombo.selectBorderImage(); |
|
|
|
this.imagePreviewPane.setImageWithSuffix(((ImageBackground) borderImage).getImageWithSuffix()); |
|
|
|
this.imagePreviewPane.setImageWithSuffix(((ImageBackground) borderImage).getImageWithSuffix()); |
|
|
|
this.tweakNinePointButton.setEnabled(true); |
|
|
|
this.tweakNinePointButton.setEnabled(true); |
|
|
|
this.borderImageOpacityPane.populateBean(style.getBorderImageOpacity()); |
|
|
|
this.borderImageOpacityPane.populateBean(style.getBorderImageOpacity()); |
|
|
|
if (ninePoint != null && ninePoint.length == 4 && ninePoint[0] > 0 && ninePoint[1] > 0 && ninePoint[2] > 0 && ninePoint[3] > 0) { |
|
|
|
int[] ninePoint = ((ImageBackground) borderImage).getNinePoint(); |
|
|
|
|
|
|
|
if (ninePoint != null && ninePoint.length == 4 && ninePoint[0] >= 0 && ninePoint[1] >= 0 && ninePoint[2] >= 0 && ninePoint[3] >= 0) { |
|
|
|
this.ninePoint = Arrays.copyOf(ninePoint, 4); |
|
|
|
this.ninePoint = Arrays.copyOf(ninePoint, 4); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.ninePoint = new int[4]; |
|
|
|
this.ninePoint = new int[4]; |
|
|
@ -503,6 +504,7 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { |
|
|
|
private int ninePointBottom = -1; |
|
|
|
private int ninePointBottom = -1; |
|
|
|
|
|
|
|
|
|
|
|
private static final int MIN_NINE_POINT = 0; |
|
|
|
private static final int MIN_NINE_POINT = 0; |
|
|
|
|
|
|
|
private static final int MIN_GAP_PARALLEL_LINES = 1; |
|
|
|
|
|
|
|
|
|
|
|
private int imgWidth; |
|
|
|
private int imgWidth; |
|
|
|
private int imgHeight; |
|
|
|
private int imgHeight; |
|
|
@ -773,8 +775,8 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { |
|
|
|
private void onNinePointTopChanged(int value) { |
|
|
|
private void onNinePointTopChanged(int value) { |
|
|
|
if (value < MIN_NINE_POINT) { |
|
|
|
if (value < MIN_NINE_POINT) { |
|
|
|
value = MIN_NINE_POINT; |
|
|
|
value = MIN_NINE_POINT; |
|
|
|
} else if (value >= imgHeight - ninePointBottom) { |
|
|
|
} else if (value >= imgHeight - ninePointBottom - MIN_GAP_PARALLEL_LINES) { |
|
|
|
value = imgHeight - ninePointBottom - MIN_NINE_POINT; |
|
|
|
value = imgHeight - ninePointBottom - MIN_GAP_PARALLEL_LINES; |
|
|
|
} |
|
|
|
} |
|
|
|
this.ninePointTop = value; |
|
|
|
this.ninePointTop = value; |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
@ -783,8 +785,8 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { |
|
|
|
private void onNinePointBottomChanged(int value) { |
|
|
|
private void onNinePointBottomChanged(int value) { |
|
|
|
if (value < MIN_NINE_POINT) { |
|
|
|
if (value < MIN_NINE_POINT) { |
|
|
|
value = MIN_NINE_POINT; |
|
|
|
value = MIN_NINE_POINT; |
|
|
|
} else if (value >= imgHeight - ninePointTop) { |
|
|
|
} else if (value >= imgHeight - ninePointTop - MIN_GAP_PARALLEL_LINES) { |
|
|
|
value = imgHeight - ninePointTop - MIN_NINE_POINT; |
|
|
|
value = imgHeight - ninePointTop - MIN_GAP_PARALLEL_LINES; |
|
|
|
} |
|
|
|
} |
|
|
|
this.ninePointBottom = value; |
|
|
|
this.ninePointBottom = value; |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
@ -793,8 +795,8 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { |
|
|
|
private void onNinePointLeftChanged(int value) { |
|
|
|
private void onNinePointLeftChanged(int value) { |
|
|
|
if (value < MIN_NINE_POINT) { |
|
|
|
if (value < MIN_NINE_POINT) { |
|
|
|
value = MIN_NINE_POINT; |
|
|
|
value = MIN_NINE_POINT; |
|
|
|
} else if (value >= imgWidth - ninePointRight) { |
|
|
|
} else if (value >= imgWidth - ninePointRight - MIN_GAP_PARALLEL_LINES) { |
|
|
|
value = imgWidth - ninePointRight - MIN_NINE_POINT; |
|
|
|
value = imgWidth - ninePointRight - MIN_GAP_PARALLEL_LINES; |
|
|
|
} |
|
|
|
} |
|
|
|
this.ninePointLeft = value; |
|
|
|
this.ninePointLeft = value; |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
@ -803,8 +805,8 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver { |
|
|
|
private void onNinePointRightChanged(int value) { |
|
|
|
private void onNinePointRightChanged(int value) { |
|
|
|
if (value < MIN_NINE_POINT) { |
|
|
|
if (value < MIN_NINE_POINT) { |
|
|
|
value = MIN_NINE_POINT; |
|
|
|
value = MIN_NINE_POINT; |
|
|
|
} else if (value >= imgWidth - ninePointLeft) { |
|
|
|
} else if (value >= imgWidth - ninePointLeft - MIN_GAP_PARALLEL_LINES) { |
|
|
|
value = imgWidth - ninePointLeft - MIN_NINE_POINT; |
|
|
|
value = imgWidth - ninePointLeft - MIN_GAP_PARALLEL_LINES; |
|
|
|
} |
|
|
|
} |
|
|
|
this.ninePointRight = value; |
|
|
|
this.ninePointRight = value; |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
|