Skip to content

Fixed how the community buttons look on macos#171

Merged
matthew-SG merged 1 commit intomainfrom
170-fix-button-style-error-on-mac-for-community
Dec 2, 2025
Merged

Fixed how the community buttons look on macos#171
matthew-SG merged 1 commit intomainfrom
170-fix-button-style-error-on-mac-for-community

Conversation

@Adish-Singh
Copy link
Copy Markdown
Collaborator

@Adish-Singh Adish-Singh commented Dec 2, 2025

Summary
This pull request updates the styling of several Swing JButton components within the CommunityView to ensure consistent appearance across operating systems, particularly macOS, where Swing's default button rendering differs from Windows. By explicitly configuring button opacity, border painting, focus painting, and preferred sizing, the UI now displays reliably and uniformly on both platforms.

Motivation
Swing buttons on macOS often render with default Aqua-style gradients, borders, and focus indicators even when background colors or sizes are applied. This caused discrepancies in the UI compared to Windows, including:

  • Custom background colors not appearing unless setOpaque(true) is set.
  • Default macOS borders overriding button styling unless setBorderPainted(false) is used.
  • macOS focus ring appearing unless disabled with setFocusPainted(false).
  • Platform differences in button sizing unless an explicit PreferredSize is defined.

These changes were introduced to ensure that the community view buttons maintain a consistent visual style across all development environments.

Changes Included

  1. Post Review Button
  • Configured to override macOS default rendering and match Windows appearance:
    postReviewButton.setPreferredSize(new Dimension(150, 40));
    postReviewButton.setBackground(new Color(70, 130, 180));
    postReviewButton.setForeground(Color.WHITE);
    postReviewButton.setOpaque(true);
    postReviewButton.setBorderPainted(false);
    postReviewButton.setFocusPainted(false);
  1. Refresh Review Button
  • Applied the same styling changes to maintain uniformity:
    refreshReviewButton.setPreferredSize(new Dimension(150, 40));
    refreshReviewButton.setBackground(new Color(70, 130, 180));
    refreshReviewButton.setForeground(Color.WHITE);
    refreshReviewButton.setOpaque(true);
    refreshReviewButton.setBorderPainted(false);
    refreshReviewButton.setFocusPainted(false);
  1. Add to Liked Button
  • Standardized visual presentation, including explicit opacity and border settings:
    addButton.setBackground(new Color(60, 179, 113));
    addButton.setOpaque(true);
    addButton.setBorderPainted(false);
    addButton.setForeground(Color.WHITE);
    addButton.setPreferredSize(new Dimension(140, 35));
    addButton.setFocusPainted(false);

Impact
Improves cross-platform visual consistency of the GUI.
Eliminates reliance on OS-specific default UI rendering.
Provides a uniform, modern, flat-style button appearance across all supported platforms.
No impact on application logic; this PR only modifies presentation properties.

Testing
Changes were verified on both macOS and Windows to confirm that:

  • Background colors apply correctly on macOS.
  • No Aqua border or focus ring appears.
  • Button dimensions render identically across platforms.
  • Styling is consistent throughout the community view.

Files Modified
CommunityView.java

@Adish-Singh Adish-Singh linked an issue Dec 2, 2025 that may be closed by this pull request
@matthew-SG
Copy link
Copy Markdown
Owner

Thank you for fixing the button transparency issue for Mac users.

@matthew-SG matthew-SG merged commit 0f76a2a into main Dec 2, 2025
1 check passed
@Adish-Singh Adish-Singh changed the title Fixed how the buttons look on macos by adding the setOpaque and the b… Fixed how the community buttons look on macos Dec 3, 2025
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.

Fix button style error on mac for community

2 participants