From 3a8b30ca8e7e8423aa2717b41ca50fa901b72755 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Fri, 11 Dec 2020 13:00:20 +0100 Subject: [PATCH] Extras: removed extension interfaces and moved methods to components classes because: - Javadoc for components that implement extension interfaces are useless because they do not include default methods from the extension interface - GUI builders do not recognize default methods from the extension interface and it is not possible to edit extension properties in GUI builder - the idea of adding the extension interface to own components can be also achieved by changing superclass of own component (issue #117) --- flatlaf-extras/build.gradle.kts | 1 + .../extras/components/FlatComboBox.java | 20 ++++- .../FlatComponentExtension.java | 2 +- .../components/FlatFormattedTextField.java | 39 +++++++++- .../extras/components/FlatPasswordField.java | 39 +++++++++- .../extras/components/FlatScrollBar.java | 20 ++++- .../extras/components/FlatScrollPane.java | 35 ++++++++- .../extras/components/FlatTextField.java | 39 +++++++++- .../extensions/FlatComboBoxExtension.java | 48 ------------ .../extensions/FlatScrollBarExtension.java | 49 ------------- .../extensions/FlatScrollPaneExtension.java | 64 ---------------- .../extensions/FlatTextFieldExtension.java | 73 ------------------- 12 files changed, 170 insertions(+), 259 deletions(-) rename flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/{extensions => }/FlatComponentExtension.java (97%) delete mode 100644 flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatComboBoxExtension.java delete mode 100644 flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatScrollBarExtension.java delete mode 100644 flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatScrollPaneExtension.java delete mode 100644 flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatTextFieldExtension.java diff --git a/flatlaf-extras/build.gradle.kts b/flatlaf-extras/build.gradle.kts index 8be930dc..3fe98c75 100644 --- a/flatlaf-extras/build.gradle.kts +++ b/flatlaf-extras/build.gradle.kts @@ -40,6 +40,7 @@ tasks { this as StandardJavadocDocletOptions use( true ) tags = listOf( "uiDefault", "clientProperty" ) + addStringOption( "Xdoclint:all,-missing", "-Xdoclint:all,-missing" ) } isFailOnError = false } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatComboBox.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatComboBox.java index 1e90718d..22312042 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatComboBox.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatComboBox.java @@ -16,17 +16,29 @@ package com.formdev.flatlaf.extras.components; +import static com.formdev.flatlaf.FlatClientProperties.*; import javax.swing.JComboBox; -import com.formdev.flatlaf.extras.components.extensions.FlatComboBoxExtension; /** - * Subclass of {@link JComboBox} that implements {@link FlatComboBoxExtension} - * to provide easy access to FlatLaf specific client properties. + * Subclass of {@link JComboBox} that provides easy access to FlatLaf specific client properties. * * @author Karl Tauber */ public class FlatComboBox extends JComboBox - implements FlatComboBoxExtension + implements FlatComponentExtension { + /** + * Returns the placeholder text that is only painted if the editable combo box is empty. + */ + public String getPlaceholderText() { + return (String) getClientProperty( PLACEHOLDER_TEXT ); + } + + /** + * Sets the placeholder text that is only painted if the editable combo box is empty. + */ + public void setPlaceholderText( String placeholderText ) { + putClientProperty( PLACEHOLDER_TEXT, placeholderText ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatComponentExtension.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatComponentExtension.java similarity index 97% rename from flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatComponentExtension.java rename to flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatComponentExtension.java index f3744282..5df828a0 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatComponentExtension.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatComponentExtension.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.formdev.flatlaf.extras.components.extensions; +package com.formdev.flatlaf.extras.components; import javax.swing.JComponent; import javax.swing.UIManager; diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatFormattedTextField.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatFormattedTextField.java index b2c11342..db7cd5cd 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatFormattedTextField.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatFormattedTextField.java @@ -16,17 +16,48 @@ package com.formdev.flatlaf.extras.components; +import static com.formdev.flatlaf.FlatClientProperties.*; import javax.swing.JFormattedTextField; -import com.formdev.flatlaf.extras.components.extensions.FlatTextFieldExtension; /** - * Subclass of {@link JFormattedTextField} that implements {@link FlatTextFieldExtension} - * to provide easy access to FlatLaf specific client properties. + * Subclass of {@link JFormattedTextField} that provides easy access to FlatLaf specific client properties. * * @author Karl Tauber */ public class FlatFormattedTextField extends JFormattedTextField - implements FlatTextFieldExtension + implements FlatComponentExtension { + /** + * Returns the placeholder text that is only painted if the text field is empty. + */ + public String getPlaceholderText() { + return (String) getClientProperty( PLACEHOLDER_TEXT ); + } + + /** + * Sets the placeholder text that is only painted if the text field is empty. + */ + public void setPlaceholderText( String placeholderText ) { + putClientProperty( PLACEHOLDER_TEXT, placeholderText ); + } + + + // NOTE: enum names must be equal to allowed strings + enum SelectAllOnFocusPolicy { never, once, always }; + + /** + * Returns whether all text is selected when the text component gains focus. + */ + public SelectAllOnFocusPolicy getSelectAllOnFocusPolicy() { + return getClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, SelectAllOnFocusPolicy.class, + "TextComponent.selectAllOnFocusPolicy", SelectAllOnFocusPolicy.once ); + } + + /** + * Specifies whether all text is selected when the text component gains focus. + */ + public void setSelectAllOnFocusPolicy( SelectAllOnFocusPolicy selectAllOnFocusPolicy ) { + putClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, selectAllOnFocusPolicy ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatPasswordField.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatPasswordField.java index 6c172e68..fd0cd289 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatPasswordField.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatPasswordField.java @@ -16,17 +16,48 @@ package com.formdev.flatlaf.extras.components; +import static com.formdev.flatlaf.FlatClientProperties.*; import javax.swing.JPasswordField; -import com.formdev.flatlaf.extras.components.extensions.FlatTextFieldExtension; /** - * Subclass of {@link JPasswordField} that implements {@link FlatTextFieldExtension} - * to provide easy access to FlatLaf specific client properties. + * Subclass of {@link JPasswordField} that provides easy access to FlatLaf specific client properties. * * @author Karl Tauber */ public class FlatPasswordField extends JPasswordField - implements FlatTextFieldExtension + implements FlatComponentExtension { + /** + * Returns the placeholder text that is only painted if the text field is empty. + */ + public String getPlaceholderText() { + return (String) getClientProperty( PLACEHOLDER_TEXT ); + } + + /** + * Sets the placeholder text that is only painted if the text field is empty. + */ + public void setPlaceholderText( String placeholderText ) { + putClientProperty( PLACEHOLDER_TEXT, placeholderText ); + } + + + // NOTE: enum names must be equal to allowed strings + enum SelectAllOnFocusPolicy { never, once, always }; + + /** + * Returns whether all text is selected when the text component gains focus. + */ + public SelectAllOnFocusPolicy getSelectAllOnFocusPolicy() { + return getClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, SelectAllOnFocusPolicy.class, + "TextComponent.selectAllOnFocusPolicy", SelectAllOnFocusPolicy.once ); + } + + /** + * Specifies whether all text is selected when the text component gains focus. + */ + public void setSelectAllOnFocusPolicy( SelectAllOnFocusPolicy selectAllOnFocusPolicy ) { + putClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, selectAllOnFocusPolicy ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollBar.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollBar.java index cba09974..eba79afe 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollBar.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollBar.java @@ -16,17 +16,29 @@ package com.formdev.flatlaf.extras.components; +import static com.formdev.flatlaf.FlatClientProperties.*; import javax.swing.JScrollBar; -import com.formdev.flatlaf.extras.components.extensions.FlatScrollBarExtension; /** - * Subclass of {@link JScrollBar} that implements {@link FlatScrollBarExtension} - * to provide easy access to FlatLaf specific client properties. + * Subclass of {@link JScrollBar} that provides easy access to FlatLaf specific client properties. * * @author Karl Tauber */ public class FlatScrollBar extends JScrollBar - implements FlatScrollBarExtension + implements FlatComponentExtension { + /** + * Returns whether the decrease/increase arrow buttons of a scrollbar are shown. + */ + public boolean isShowButtons() { + return getClientPropertyBoolean( SCROLL_BAR_SHOW_BUTTONS, "ScrollBar.showButtons" ); + } + + /** + * Specifies whether the decrease/increase arrow buttons of a scrollbar are shown. + */ + public void setShowButtons( boolean showButtons ) { + putClientProperty( SCROLL_BAR_SHOW_BUTTONS, showButtons ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollPane.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollPane.java index 07f70db5..ed0ef473 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollPane.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollPane.java @@ -16,17 +16,44 @@ package com.formdev.flatlaf.extras.components; +import static com.formdev.flatlaf.FlatClientProperties.*; import javax.swing.JScrollPane; -import com.formdev.flatlaf.extras.components.extensions.FlatScrollPaneExtension; /** - * Subclass of {@link JScrollPane} that implements {@link FlatScrollPaneExtension} - * to provide easy access to FlatLaf specific client properties. + * Subclass of {@link JScrollPane} that provides easy access to FlatLaf specific client properties. * * @author Karl Tauber */ public class FlatScrollPane extends JScrollPane - implements FlatScrollPaneExtension + implements FlatComponentExtension { + /** + * Returns whether the decrease/increase arrow buttons of a scrollbar are shown. + */ + public boolean isShowButtons() { + return getClientPropertyBoolean( SCROLL_BAR_SHOW_BUTTONS, "ScrollBar.showButtons" ); + } + + /** + * Specifies whether the decrease/increase arrow buttons of a scrollbar are shown. + */ + public void setShowButtons( boolean showButtons ) { + putClientProperty( SCROLL_BAR_SHOW_BUTTONS, showButtons ); + } + + + /** + * Returns whether the scroll pane uses smooth scrolling. + */ + public boolean isSmoothScrolling() { + return getClientPropertyBoolean( SCROLL_PANE_SMOOTH_SCROLLING, "ScrollPane.smoothScrolling" ); + } + + /** + * Specifies whether the scroll pane uses smooth scrolling. + */ + public void setSmoothScrolling( boolean smoothScrolling ) { + putClientProperty( SCROLL_PANE_SMOOTH_SCROLLING, smoothScrolling ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatTextField.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatTextField.java index 45c49e5b..fe3755ef 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatTextField.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatTextField.java @@ -16,17 +16,48 @@ package com.formdev.flatlaf.extras.components; +import static com.formdev.flatlaf.FlatClientProperties.*; import javax.swing.JTextField; -import com.formdev.flatlaf.extras.components.extensions.FlatTextFieldExtension; /** - * Subclass of {@link JTextField} that implements {@link FlatTextFieldExtension} - * to provide easy access to FlatLaf specific client properties. + * Subclass of {@link JTextField} that provides easy access to FlatLaf specific client properties. * * @author Karl Tauber */ public class FlatTextField extends JTextField - implements FlatTextFieldExtension + implements FlatComponentExtension { + /** + * Returns the placeholder text that is only painted if the text field is empty. + */ + public String getPlaceholderText() { + return (String) getClientProperty( PLACEHOLDER_TEXT ); + } + + /** + * Sets the placeholder text that is only painted if the text field is empty. + */ + public void setPlaceholderText( String placeholderText ) { + putClientProperty( PLACEHOLDER_TEXT, placeholderText ); + } + + + // NOTE: enum names must be equal to allowed strings + enum SelectAllOnFocusPolicy { never, once, always }; + + /** + * Returns whether all text is selected when the text component gains focus. + */ + public SelectAllOnFocusPolicy getSelectAllOnFocusPolicy() { + return getClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, SelectAllOnFocusPolicy.class, + "TextComponent.selectAllOnFocusPolicy", SelectAllOnFocusPolicy.once ); + } + + /** + * Specifies whether all text is selected when the text component gains focus. + */ + public void setSelectAllOnFocusPolicy( SelectAllOnFocusPolicy selectAllOnFocusPolicy ) { + putClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, selectAllOnFocusPolicy ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatComboBoxExtension.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatComboBoxExtension.java deleted file mode 100644 index b259ce81..00000000 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatComboBoxExtension.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2020 FormDev Software GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.formdev.flatlaf.extras.components.extensions; - -import static com.formdev.flatlaf.FlatClientProperties.*; -import javax.swing.JComboBox; - -/** - * Extension interface for {@link JComboBox} that provides - * easy access to FlatLaf specific client properties. - *

- * Use this interface if you already have a subclass of {@link JComboBox} - * in your project and want add access to FlatLaf features to your class. - * Otherwise use {@link FlatComboBox}. - * - * @author Karl Tauber - */ -public interface FlatComboBoxExtension - extends FlatComponentExtension -{ - /** - * Returns the placeholder text that is only painted if the editable combo box is empty. - */ - default String getPlaceholderText() { - return (String) getClientProperty( PLACEHOLDER_TEXT ); - } - - /** - * Sets the placeholder text that is only painted if the editable combo box is empty. - */ - default void setPlaceholderText( String placeholderText ) { - putClientProperty( PLACEHOLDER_TEXT, placeholderText ); - } -} diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatScrollBarExtension.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatScrollBarExtension.java deleted file mode 100644 index 007216f7..00000000 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatScrollBarExtension.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2020 FormDev Software GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.formdev.flatlaf.extras.components.extensions; - -import static com.formdev.flatlaf.FlatClientProperties.*; -import javax.swing.JScrollBar; -import com.formdev.flatlaf.extras.components.FlatScrollBar; - -/** - * Extension interface for {@link JScrollBar} that provides - * easy access to FlatLaf specific client properties. - *

- * Use this interface if you already have a subclass of {@link JScrollBar} - * in your project and want add access to FlatLaf features to your class. - * Otherwise use {@link FlatScrollBar}. - * - * @author Karl Tauber - */ -public interface FlatScrollBarExtension - extends FlatComponentExtension -{ - /** - * Returns whether the decrease/increase arrow buttons of a scrollbar are shown. - */ - default boolean isShowButtons() { - return getClientPropertyBoolean( SCROLL_BAR_SHOW_BUTTONS, "ScrollBar.showButtons" ); - } - - /** - * Specifies whether the decrease/increase arrow buttons of a scrollbar are shown. - */ - default void setShowButtons( boolean showButtons ) { - putClientProperty( SCROLL_BAR_SHOW_BUTTONS, showButtons ); - } -} diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatScrollPaneExtension.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatScrollPaneExtension.java deleted file mode 100644 index 52439157..00000000 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatScrollPaneExtension.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2020 FormDev Software GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.formdev.flatlaf.extras.components.extensions; - -import static com.formdev.flatlaf.FlatClientProperties.*; -import javax.swing.JScrollPane; -import com.formdev.flatlaf.extras.components.FlatScrollPane; - -/** - * Extension interface for {@link JScrollPane} that provides - * easy access to FlatLaf specific client properties. - *

- * Use this interface if you already have a subclass of {@link JScrollPane} - * in your project and want add access to FlatLaf features to your class. - * Otherwise use {@link FlatScrollPane}. - * - * @author Karl Tauber - */ -public interface FlatScrollPaneExtension - extends FlatComponentExtension -{ - /** - * Returns whether the decrease/increase arrow buttons of a scrollbar are shown. - */ - default boolean isShowButtons() { - return getClientPropertyBoolean( SCROLL_BAR_SHOW_BUTTONS, "ScrollBar.showButtons" ); - } - - /** - * Specifies whether the decrease/increase arrow buttons of a scrollbar are shown. - */ - default void setShowButtons( boolean showButtons ) { - putClientProperty( SCROLL_BAR_SHOW_BUTTONS, showButtons ); - } - - - /** - * Returns whether the scroll pane uses smooth scrolling. - */ - default boolean isSmoothScrolling() { - return getClientPropertyBoolean( SCROLL_PANE_SMOOTH_SCROLLING, "ScrollPane.smoothScrolling" ); - } - - /** - * Specifies whether the scroll pane uses smooth scrolling. - */ - default void setSmoothScrolling( boolean smoothScrolling ) { - putClientProperty( SCROLL_PANE_SMOOTH_SCROLLING, smoothScrolling ); - } -} diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatTextFieldExtension.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatTextFieldExtension.java deleted file mode 100644 index d317a68e..00000000 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/extensions/FlatTextFieldExtension.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2020 FormDev Software GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.formdev.flatlaf.extras.components.extensions; - -import static com.formdev.flatlaf.FlatClientProperties.*; -import javax.swing.JFormattedTextField; -import javax.swing.JPasswordField; -import javax.swing.JTextField; -import com.formdev.flatlaf.extras.components.FlatFormattedTextField; -import com.formdev.flatlaf.extras.components.FlatPasswordField; -import com.formdev.flatlaf.extras.components.FlatTextField; - -/** - * Extension interface for {@link JTextField} (and subclasses) that provides - * easy access to FlatLaf specific client properties. - *

- * Use this interface if you already have a subclass of {@link JTextField}, - * {@link JFormattedTextField} or {@link JPasswordField} - * in your project and want add access to FlatLaf features to your class. - * Otherwise use {@link FlatTextField}, {@link FlatFormattedTextField} or {@link FlatPasswordField}. - * - * @author Karl Tauber - */ -public interface FlatTextFieldExtension - extends FlatComponentExtension -{ - /** - * Returns the placeholder text that is only painted if the text field is empty. - */ - default String getPlaceholderText() { - return (String) getClientProperty( PLACEHOLDER_TEXT ); - } - - /** - * Sets the placeholder text that is only painted if the text field is empty. - */ - default void setPlaceholderText( String placeholderText ) { - putClientProperty( PLACEHOLDER_TEXT, placeholderText ); - } - - - // NOTE: enum names must be equal to allowed strings - enum SelectAllOnFocusPolicy { never, once, always }; - - /** - * Returns whether all text is selected when the text component gains focus. - */ - default SelectAllOnFocusPolicy getSelectAllOnFocusPolicy() { - return getClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, SelectAllOnFocusPolicy.class, - "TextComponent.selectAllOnFocusPolicy", SelectAllOnFocusPolicy.once ); - } - - /** - * Specifies whether all text is selected when the text component gains focus. - */ - default void setSelectAllOnFocusPolicy( SelectAllOnFocusPolicy selectAllOnFocusPolicy ) { - putClientPropertyEnumString( SELECT_ALL_ON_FOCUS_POLICY, selectAllOnFocusPolicy ); - } -}