refactor(GuiPanel): replace absolute layout with GridBagLayout for responsive UI#98
Open
AmlanDalai wants to merge 3 commits intosumit3203:masterfrom
Open
refactor(GuiPanel): replace absolute layout with GridBagLayout for responsive UI#98AmlanDalai wants to merge 3 commits intosumit3203:masterfrom
AmlanDalai wants to merge 3 commits intosumit3203:masterfrom
Conversation
… patterns to .gitignore
- Replace setLayout(null) + setBounds() with BorderLayout/GridBagLayout - Makes UI responsive to window resizing - Fixes WindowBuilder parsing: all 9 buttons now visible in Design view - Extract createButton() helper; remove coordinate parameters - Remove System.out.println debug statements - Add full Javadoc to all methods
…uilder compatibility
Contributor
Author
Note on diff sizeThe large diff in this PR is due to two structural changes that affected most lines:
The actual logic changes are minimal:
All button actions and functionality are identical to the original. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
GuiPanel served as the main navigation dashboard of the Active Segmentation plugin but relied on null layout management with hardcoded pixel coordinates for all nine navigation controls. This approach introduced two significant maintainability concerns that this PR addresses.
Problems Identified
1. Non-responsive layout
Absolute positioning via
setLayout(null)andsetBounds(x, y, w, h)caused the UI to break on different screen resolutions and prevented the panel from adapting to window resizing.2. Visual designer incompatibility
Eclipse WindowBuilder could only parse 2 of the 9 components in Design view due to the use of a generic
addButton()factory method. This made visual inspection and future UI modifications impractical.Changes
setLayout(null)withBorderLayoutat the panel level andGridBagLayoutfor the button gridbtnSelectFilters,btnFilterVisualization, etc.)GridBagConstraintsinstance per buttonaddButton()withstyleButton()— separating layout concerns from visual stylingSystem.out.printlndebug statements from constructorOutcome
Before vs After — Eclipse WindowBuilder Design View
Before (absolute layout — only 2/9 components parsed):

After (GridBagLayout — all 9 components visible):