File tree Expand file tree Collapse file tree
sierra/src/main/java/org/httprpc/sierra Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -113,15 +113,13 @@ private void paint(Graphics2D graphics) {
113113 var scaledImageHeight = scale * imageHeight ;
114114
115115 var x = switch (horizontalAlignment ) {
116- case LEFT -> 0 ;
117- case RIGHT -> width - scaledImageWidth ;
118- case LEADING , TRAILING -> {
119- if (getComponentOrientation ().isLeftToRight () ^ horizontalAlignment == HorizontalAlignment .TRAILING ) {
116+ case LEFT , RIGHT , LEADING , TRAILING -> {
117+ if (horizontalAlignment == HorizontalAlignment .LEFT
118+ || getComponentOrientation ().isLeftToRight () ^ horizontalAlignment == HorizontalAlignment .TRAILING ) {
120119 yield 0 ;
121120 } else {
122121 yield width - scaledImageWidth ;
123122 }
124-
125123 }
126124 case CENTER -> (width - scaledImageWidth ) / 2 ;
127125 };
Original file line number Diff line number Diff line change @@ -87,10 +87,9 @@ public void setPressed(boolean pressed) {
8787 var popupMenuSize = popupMenu .getPreferredSize ();
8888
8989 var x = switch (popupHorizontalAlignment ) {
90- case LEFT -> 0 ;
91- case RIGHT -> size .width - popupMenuSize .width ;
92- case LEADING , TRAILING -> {
93- if (getComponentOrientation ().isLeftToRight () ^ popupHorizontalAlignment == HorizontalAlignment .TRAILING ) {
90+ case LEFT , RIGHT , LEADING , TRAILING -> {
91+ if (popupHorizontalAlignment == HorizontalAlignment .LEFT
92+ || getComponentOrientation ().isLeftToRight () ^ popupHorizontalAlignment == HorizontalAlignment .TRAILING ) {
9493 yield 0 ;
9594 } else {
9695 yield size .width - popupMenuSize .width ;
Original file line number Diff line number Diff line change @@ -205,10 +205,9 @@ protected void showPopup() {
205205 var popupSize = popupComponent .getPreferredSize ();
206206
207207 var x = switch (popupHorizontalAlignment ) {
208- case LEFT -> 0 ;
209- case RIGHT -> size .width - popupSize .width ;
210- case LEADING , TRAILING -> {
211- if (getComponentOrientation ().isLeftToRight () ^ popupHorizontalAlignment == HorizontalAlignment .TRAILING ) {
208+ case LEFT , RIGHT , LEADING , TRAILING -> {
209+ if (popupHorizontalAlignment == HorizontalAlignment .LEFT
210+ || getComponentOrientation ().isLeftToRight () ^ popupHorizontalAlignment == HorizontalAlignment .TRAILING ) {
212211 yield 0 ;
213212 } else {
214213 yield size .width - popupSize .width ;
Original file line number Diff line number Diff line change @@ -154,10 +154,9 @@ private void paint(Graphics2D graphics) {
154154 var lineWidth = textBounds .getWidth ();
155155
156156 var x = switch (horizontalAlignment ) {
157- case LEFT -> insets .left ;
158- case RIGHT -> size .width - (lineWidth + insets .right );
159- case LEADING , TRAILING -> {
160- if (getComponentOrientation ().isLeftToRight () ^ horizontalAlignment == HorizontalAlignment .TRAILING ) {
157+ case LEFT , RIGHT , LEADING , TRAILING -> {
158+ if (horizontalAlignment == HorizontalAlignment .LEFT
159+ || getComponentOrientation ().isLeftToRight () ^ horizontalAlignment == HorizontalAlignment .TRAILING ) {
161160 yield insets .left ;
162161 } else {
163162 yield size .width - (lineWidth + insets .right );
You can’t perform that action at this time.
0 commit comments