From fb19e737bfbe5a84156cc1e93ceafe275ebdbcd2 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Mon, 20 Oct 2014 16:16:34 +0400 Subject: [PATCH] Change the default position of the laid out component --- .../ui/components/panels/HorizontalLayout.java | 10 +++++----- .../intellij/ui/components/panels/VerticalLayout.java | 10 +++++----- .../com/intellij/openapi/options/newEditor/Banner.java | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ui/components/panels/HorizontalLayout.java b/platform/platform-api/src/com/intellij/ui/components/panels/HorizontalLayout.java index 9652562b6d2a..83ef4d9b0802 100644 --- a/platform/platform-api/src/com/intellij/ui/components/panels/HorizontalLayout.java +++ b/platform/platform-api/src/com/intellij/ui/components/panels/HorizontalLayout.java @@ -112,12 +112,12 @@ public final class HorizontalLayout implements LayoutManager2 { @Override public void addLayoutComponent(String name, Component component) { synchronized (component.getTreeLock()) { - if (name == null || CENTER.equalsIgnoreCase(name)) { - myCenter.add(component); - } - else if (LEFT.equalsIgnoreCase(name)) { + if (name == null || LEFT.equalsIgnoreCase(name)) { myLeft.add(component); } + else if (CENTER.equalsIgnoreCase(name)) { + myCenter.add(component); + } else if (RIGHT.equalsIgnoreCase(name)) { myRight.add(component); } @@ -242,7 +242,7 @@ public final class HorizontalLayout implements LayoutManager2 { if (result == null) { result = new Dimension(); } - else if (aligned) { + else if (aligned && center != null) { int leftWidth = left == null ? 0 : left.width; int rightWidth = right == null ? 0 : right.width; result.width += Math.abs(leftWidth - rightWidth); diff --git a/platform/platform-api/src/com/intellij/ui/components/panels/VerticalLayout.java b/platform/platform-api/src/com/intellij/ui/components/panels/VerticalLayout.java index 7b9fdd0242ba..6d27dc33d132 100644 --- a/platform/platform-api/src/com/intellij/ui/components/panels/VerticalLayout.java +++ b/platform/platform-api/src/com/intellij/ui/components/panels/VerticalLayout.java @@ -112,12 +112,12 @@ public final class VerticalLayout implements LayoutManager2 { @Override public void addLayoutComponent(String name, Component component) { synchronized (component.getTreeLock()) { - if (name == null || CENTER.equalsIgnoreCase(name)) { - myCenter.add(component); - } - else if (TOP.equalsIgnoreCase(name)) { + if (name == null || TOP.equalsIgnoreCase(name)) { myTop.add(component); } + else if (CENTER.equalsIgnoreCase(name)) { + myCenter.add(component); + } else if (BOTTOM.equalsIgnoreCase(name)) { myBottom.add(component); } @@ -242,7 +242,7 @@ public final class VerticalLayout implements LayoutManager2 { if (result == null) { result = new Dimension(); } - else if (aligned) { + else if (aligned && center != null) { int topHeight = top == null ? 0 : top.height; int bottomHeight = bottom == null ? 0 : bottom.height; result.width += Math.abs(topHeight - bottomHeight); diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/Banner.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/Banner.java index 465f16ddd42a..19d5820c6a37 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/Banner.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/Banner.java @@ -66,9 +66,9 @@ final class Banner extends JPanel { } else { if (i > 0) { - myLeftPanel.add(HorizontalLayout.LEFT, RelativeFont.HUGE.install(new JLabel("\u203A"))); + myLeftPanel.add(RelativeFont.HUGE.install(new JLabel("\u203A"))); } - myLeftPanel.add(HorizontalLayout.LEFT, RelativeFont.BOLD.install(new JLabel(name))); + myLeftPanel.add(RelativeFont.BOLD.install(new JLabel(name))); } i += 2; }