Skip to content

Commit

Permalink
Merge pull request #211 into master
Browse files Browse the repository at this point in the history
TabbedPane: scroll buttons on both sides of the tab area
  • Loading branch information
DevCharly committed Nov 15, 2020
2 parents cbc1fe2 + f9e34cb commit 66a5f35
Show file tree
Hide file tree
Showing 17 changed files with 876 additions and 252 deletions.
25 changes: 15 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ FlatLaf Change Log

#### New features and improvements

- TabbedPane: Replaced forward/backward scrolling arrow buttons with "Show
Hidden Tabs" button. If pressed, it shows a popup menu that contains (partly)
hidden tabs and selecting one activates that tab. If you prefer
forward/backward buttons, use `UIManager.put(
"TabbedPane.hiddenTabsNavigation", "arrowButtons" )`. (PR #190; issue #40)
- TabbedPane: Support scrolling tabs with mouse wheel (if `tabLayoutPolicy` is
`SCROLL_TAB_LAYOUT`). (PR #187; issue #40)
- TabbedPane: Repeat scrolling as long as arrow buttons are pressed. (PR #187;
issue #40)
- TabbedPane: Support adding custom components to left and right sides of tabs
- TabbedPane: In scroll tab layout, added "Show Hidden Tabs" button to trailing
side of tab area. If pressed, it shows a popup menu that contains (partly)
hidden tabs and selecting one activates that tab. (PR #190; issue #40)
- TabbedPane: Support forward/backward scroll arrow buttons on both sides of tab
area. Backward button on left side, forward button on right side. Not
applicable scroll buttons are hidden. (PR #211; issue #40)
- TabbedPane: Support specifying default tab layout policy for all tabbed panes
in the application via UI value `TabbedPane.tabLayoutPolicy`. E.g. invoke
`UIManager.put( "TabbedPane.tabLayoutPolicy", "scroll" );` to use scroll
layout.
- TabbedPane: Support tab scrolling with mouse wheel (in scroll tab layout). (PR
#187; issue #40)
- TabbedPane: Repeat scrolling as long as scroll arrow buttons are pressed. (PR
#187; issue #40)
- TabbedPane: Support adding custom components to left and right sides of tab
area. (set client property `JTabbedPane.leadingComponent` or
`JTabbedPane.trailingComponent` to a `java.awt.Component`) (PR #192; issue
#40)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,28 +366,85 @@ public interface FlatClientProperties
String TABBED_PANE_TAB_CLOSE_CALLBACK = "JTabbedPane.tabCloseCallback";

/**
* Specifies how to navigate to hidden tabs.
* Specifies the display policy for the "more tabs" button,
* which shows a popup menu with the (partly) hidden tabs.
* <p>
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
* <strong>Value type</strong> {@link java.lang.String}<br>
* <strong>Allowed Values</strong> {@link #TABBED_PANE_HIDDEN_TABS_NAVIGATION_MORE_TABS_BUTTON}
* or {@link #TABBED_PANE_HIDDEN_TABS_NAVIGATION_ARROW_BUTTONS}
* <strong>Allowed Values</strong>
* {@link #TABBED_PANE_POLICY_NEVER} or
* {@link #TABBED_PANE_POLICY_AS_NEEDED}
*/
String TABBED_PANE_TABS_POPUP_POLICY = "JTabbedPane.tabsPopupPolicy";

/**
* Specifies the display policy for the forward/backward scroll arrow buttons.
* <p>
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
* <strong>Value type</strong> {@link java.lang.String}<br>
* <strong>Allowed Values</strong>
* {@link #TABBED_PANE_POLICY_NEVER},
* {@link #TABBED_PANE_POLICY_AS_NEEDED} or
* {@link #TABBED_PANE_POLICY_AS_NEEDED_SINGLE}
*/
String TABBED_PANE_SCROLL_BUTTONS_POLICY = "JTabbedPane.scrollButtonsPolicy";

/**
* Display never.
*
* @see #TABBED_PANE_TABS_POPUP_POLICY
* @see #TABBED_PANE_SCROLL_BUTTONS_POLICY
*/
String TABBED_PANE_POLICY_NEVER = "never";

/**
* Display only when needed.
* <p>
* If used for {@link #TABBED_PANE_SCROLL_BUTTONS_POLICY}, both scroll arrow buttons
* are either shown or hidden. Buttons are disabled if scrolling in that
* direction is not applicable.
*
* @see #TABBED_PANE_TABS_POPUP_POLICY
* @see #TABBED_PANE_SCROLL_BUTTONS_POLICY
*/
String TABBED_PANE_POLICY_AS_NEEDED = "asNeeded";

/**
* Display single button only when needed.
* <p>
* If scroll button placement is trailing, then this option is ignored
* and both buttons are shown or hidden as needed.
*
* @see #TABBED_PANE_SCROLL_BUTTONS_POLICY
*/
String TABBED_PANE_POLICY_AS_NEEDED_SINGLE = "asNeededSingle";

/**
* Specifies the placement of the forward/backward scroll arrow buttons.
* <p>
* <strong>Component</strong> {@link javax.swing.JTabbedPane}<br>
* <strong>Value type</strong> {@link java.lang.String}<br>
* <strong>Allowed Values</strong>
* {@link #TABBED_PANE_PLACEMENT_BOTH} or
* {@link #TABBED_PANE_PLACEMENT_TRAILING}
*/
String TABBED_PANE_HIDDEN_TABS_NAVIGATION = "JTabbedPane.hiddenTabsNavigation";
String TABBED_PANE_SCROLL_BUTTONS_PLACEMENT = "JTabbedPane.scrollButtonsPlacement";

/**
* Use "more tabs" button for navigation to hidden tabs.
* The forward/backward scroll arrow buttons are placed on both sides of the tab area.
* The backward scroll button at the left/top side.
* The forward scroll button at the right/bottom side.
*
* @see #TABBED_PANE_HIDDEN_TABS_NAVIGATION
* @see #TABBED_PANE_SCROLL_BUTTONS_PLACEMENT
*/
String TABBED_PANE_HIDDEN_TABS_NAVIGATION_MORE_TABS_BUTTON = "moreTabsButton";
String TABBED_PANE_PLACEMENT_BOTH = "both";

/**
* Use forward/backward buttons for navigation to hidden tabs.
* The forward/backward scroll arrow buttons are placed on the trailing side of the tab area.
*
* @see #TABBED_PANE_HIDDEN_TABS_NAVIGATION
* @see #TABBED_PANE_SCROLL_BUTTONS_PLACEMENT
*/
String TABBED_PANE_HIDDEN_TABS_NAVIGATION_ARROW_BUTTONS = "arrowButtons";
String TABBED_PANE_PLACEMENT_TRAILING = "trailing";

/**
* Specifies the alignment of the tab area.
Expand Down
Loading

0 comments on commit 66a5f35

Please sign in to comment.