Skip to content

Commit

Permalink
Improve layout closes #104
Browse files Browse the repository at this point in the history
  • Loading branch information
RetGal committed Feb 22, 2024
1 parent 2bac709 commit 8b95ad4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/main/java/mpo/dayon/assistant/gui/AssistantFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ private JTabbedPane createTabbedPane() {
tabbedPane.addTab(translate("connection"), connectionPanel);
tabbedPane.addTab(translate("session"), sessionPanel);
tabbedPane.addTab(translate("settings"), settingsPanel);
tabbedPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
// must not be focusable or the key listener won't work
tabbedPane.setFocusable(false);
tabbedPane.setBorder(null);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/mpo/dayon/assisted/gui/AssistedFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class AssistedFrame extends BaseFrame {

private ToolBar createToolBar() {
ToolBar toolbar = new ToolBar();
// i'd prefer to use the DEFAULT_SPACER but...
toolbar.add(Box.createHorizontalStrut(10));
toolbar.add(startButton);
toolbar.add(stopButton);
if (ScreenUtilities.getNumberOfScreens() > 1 || File.separatorChar == '\\') {
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/mpo/dayon/common/gui/common/BaseFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ protected void setFrameType(FrameType frameType) {

protected void setupToolBar(ToolBar toolBar) {
float alignmentY = frameType.equals(FrameType.ASSISTANT) ? Component.BOTTOM_ALIGNMENT : Component.CENTER_ALIGNMENT;
toolBar.add(DEFAULT_SPACER);
if (FrameType.ASSISTANT.equals(frameType)) {
// poor man's vertical align top
fingerprints.setBorder(BorderFactory.createEmptyBorder(0, 10, 35, 0));
Expand All @@ -95,9 +94,11 @@ protected void setupToolBar(ToolBar toolBar) {
toolBar.addAction(createShowInfoAction(), alignmentY);
toolBar.addAction(createShowHelpAction(), alignmentY);
toolBar.addAction(createExitAction(), alignmentY);
toolBar.add(DEFAULT_SPACER);
if (FrameType.ASSISTANT.equals(frameType)) {
toolBar.add(DEFAULT_SPACER);
}
add(toolBar, BorderLayout.NORTH);
toolBar.setBorder(null);
toolBar.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
this.toolBar = toolBar;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/mpo/dayon/common/gui/toolbar/ToolBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ public class ToolBar extends JToolBar {

public static final Font DEFAULT_FONT = new Font("Sans Serif", Font.PLAIN, 16);

public static final Component DEFAULT_SPACER = Box.createHorizontalStrut(10);
public static final Component DEFAULT_SPACER = Box.createHorizontalStrut(8);

public ToolBar() {
setFloatable(false);
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
setBorder(null);
setBorder(BorderFactory.createEmptyBorder());
}

public void addAction(Action action) {
Expand Down

0 comments on commit 8b95ad4

Please sign in to comment.