Skip to content

feat(FeaturePanel): modernize UI with responsive layout, progress bar, and keyboard shortcuts#117

Open
AmlanDalai wants to merge 2 commits intosumit3203:masterfrom
AmlanDalai:feat/featurepanel-ui-modernization
Open

feat(FeaturePanel): modernize UI with responsive layout, progress bar, and keyboard shortcuts#117
AmlanDalai wants to merge 2 commits intosumit3203:masterfrom
AmlanDalai:feat/featurepanel-ui-modernization

Conversation

@AmlanDalai
Copy link
Copy Markdown
Contributor

@AmlanDalai AmlanDalai commented Mar 16, 2026

Summary

Comprehensive UI modernization of FeaturePanel.java, the main annotation/marking panel. Replaces the fragile null layout with proper Swing layout managers, adds training progress feedback, button tooltips, keyboard shortcuts, and fixes 4 string comparison bugs.

Addresses #60 (training state indicator), partially addresses #103 (== comparison bugs)

Changes

1. Responsive Layout (replaces null layout)

Replaced panel.setLayout(null) with a JSplitPane + BoxLayout hierarchy:

  • Removed setResizable(false) — window is now fully resizable
  • Removed all hardcoded setBounds() positioning
  • Divider is draggable with one-touch expand buttons

2. Training Progress Bar (addresses #60)

Added JProgressBar that appears during training and shows completion:

  • Shows animated "Training in progress..." during training
  • Shows "Training complete!" for 2 seconds after finishing
  • Graceful error handling with user-friendly dialog if training fails

3. Asynchronous Training (SwingWorker)

Wrapped featureManager.compute() in SwingWorker for both classification and segmentation modes:

  • UI no longer freezes during training
  • Progress bar updates on the EDT

4. Tooltips on All Buttons

Button Tooltip
<< Previous image (← key)
>> Next image (→ key)
Train Train the classifier (Ctrl+T)
Save Save regions of interest (Ctrl+S)
Overlay Toggle result overlay (Ctrl+O)
Masks Show classification masks
Snap Take a screenshot of the canvas

5. Keyboard Shortcuts

  • / — Navigate between images
  • Ctrl+T — Train the classifier
  • Ctrl+S — Save regions of interest
  • Ctrl+O — Toggle result overlay

6. Bug Fixes (relates to #103)

Fixed 4 unsafe == string comparisons in doAction():

- if(event.getActionCommand()== "ColorButton"){
+ if("ColorButton".equals(event.getActionCommand())){

Applied the same fix to AddButton, UploadButton, and DownloadButton.

7. Code Cleanup

  • Window title: "Marking""Active Segmentation - Feature Marking"
  • Removed unused frameList variable
  • Removed 18 lines of dead commented-out MouseWheelListener
  • Removed duplicate frame.add(features) call

Screenshots

Before

before-change-featurepanel

After

training-progress-featurepanel tooltip-featurepanel full-window-feature panel

Testing

  • Verified all buttons function correctly
  • Verified ROI add/delete operations work
  • Verified image navigation via buttons and arrow keys
  • Verified training progress bar appears and hides
  • Verified window is resizable and split pane divider works
  • Verified tooltips appear on hover

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant