mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-10 22:17:13 -06:00
Merge PR #341: Styling individual components
This commit is contained in:
@@ -27,7 +27,7 @@ import javax.swing.JButton;
|
||||
*/
|
||||
public class FlatButton
|
||||
extends JButton
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
// NOTE: enum names must be equal to allowed strings
|
||||
public enum ButtonType { none, square, roundRect, tab, help, toolBarButton, borderless }
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JCheckBox} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatCheckBox
|
||||
extends JCheckBox
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JCheckBoxMenuItem} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatCheckBoxMenuItem
|
||||
extends JCheckBoxMenuItem
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -27,7 +27,7 @@ import javax.swing.JComboBox;
|
||||
*/
|
||||
public class FlatComboBox<E>
|
||||
extends JComboBox<E>
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns the placeholder text that is only painted if the editable combo box is empty.
|
||||
|
||||
@@ -26,7 +26,7 @@ import javax.swing.JEditorPane;
|
||||
*/
|
||||
public class FlatEditorPane
|
||||
extends JEditorPane
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolic
|
||||
*/
|
||||
public class FlatFormattedTextField
|
||||
extends JFormattedTextField
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns the placeholder text that is only painted if the text field is empty.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JInternalFrame;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JInternalFrame} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatInternalFrame
|
||||
extends JInternalFrame
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JLabel} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatLabel
|
||||
extends JLabel
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JList;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JList} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatList<E>
|
||||
extends JList<E>
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JMenu;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JMenu} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatMenu
|
||||
extends JMenu
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JMenuBar;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JMenuBar} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatMenuBar
|
||||
extends JMenuBar
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JMenuItem} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatMenuItem
|
||||
extends JMenuItem
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -29,7 +29,7 @@ import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolic
|
||||
*/
|
||||
public class FlatPasswordField
|
||||
extends JPasswordField
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns the placeholder text that is only painted if the text field is empty.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JPopupMenu} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatPopupMenu
|
||||
extends JPopupMenu
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JPopupMenu;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JPopupMenu.Separator} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatPopupMenuSeparator
|
||||
extends JPopupMenu.Separator
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import javax.swing.JProgressBar;
|
||||
*/
|
||||
public class FlatProgressBar
|
||||
extends JProgressBar
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns whether the progress bar has always the larger height even if no string is painted.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JRadioButton;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JRadioButton} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatRadioButton
|
||||
extends JRadioButton
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JRadioButtonMenuItem;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JRadioButtonMenuItem} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatRadioButtonMenuItem
|
||||
extends JRadioButtonMenuItem
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import javax.swing.JScrollBar;
|
||||
*/
|
||||
public class FlatScrollBar
|
||||
extends JScrollBar
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns whether the decrease/increase arrow buttons of a scrollbar are shown.
|
||||
|
||||
@@ -27,7 +27,7 @@ import javax.swing.JScrollPane;
|
||||
*/
|
||||
public class FlatScrollPane
|
||||
extends JScrollPane
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns whether the decrease/increase arrow buttons of a scrollbar are shown.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JSeparator;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JSeparator} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatSeparator
|
||||
extends JSeparator
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JSlider;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JSlider} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatSlider
|
||||
extends JSlider
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -27,7 +27,7 @@ import javax.swing.JSpinner;
|
||||
*/
|
||||
public class FlatSpinner
|
||||
extends JSpinner
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JSplitPane;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JSplitPane} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatSplitPane
|
||||
extends JSplitPane
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.swing.JComponent;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
|
||||
/**
|
||||
* Interface for all styleable FlatLaf components.
|
||||
* <p>
|
||||
* If you already have custom subclasses of Swing components, you can add this interface
|
||||
* to your components to add styling getter and setter methods to them.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public interface FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns the style of a component as String in CSS syntax ("key1: value1; key2: value2; ...")
|
||||
* or {@code null} if no style has been assigned.
|
||||
*/
|
||||
default String getStyle() {
|
||||
return (String) getClientProperty( FlatClientProperties.STYLE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the style of a component as String in CSS syntax ("key1: value1; key2: value2; ...").
|
||||
* <p>
|
||||
* The keys are the same as used in UI defaults, but without component type prefix.
|
||||
* E.g. for UI default {@code Slider.thumbSize} use key {@code thumbSize}.
|
||||
* <p>
|
||||
* The syntax of the CSS values is the same as used in FlatLaf properties files
|
||||
* (<a href="https://www.formdev.com/flatlaf/properties-files/">https://www.formdev.com/flatlaf/properties-files/</a>),
|
||||
* but some features are not supported (e.g. variables).
|
||||
*/
|
||||
default void setStyle( String style ) {
|
||||
putClientProperty( FlatClientProperties.STYLE, style );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the style of a component as {@link java.util.Map}<String, Object>
|
||||
* or {@code null} if no style has been assigned.
|
||||
*/
|
||||
@SuppressWarnings( "unchecked" )
|
||||
default Map<String, Object> getStyleMap() {
|
||||
return (Map<String, Object>) getClientProperty( FlatClientProperties.STYLE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies the style of a component as {@link java.util.Map}<String, Object> with binary values.
|
||||
* <p>
|
||||
* The keys are the same as used in UI defaults, but without component type prefix.
|
||||
* E.g. for UI default {@code Slider.thumbSize} use key {@code thumbSize}.
|
||||
* <p>
|
||||
* The values are not parsed from a string. They must be binary.
|
||||
*/
|
||||
default void setStyleMap( Map<String, Object> styleMap ) {
|
||||
putClientProperty( FlatClientProperties.STYLE, styleMap );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Overrides {@link JComponent#getClientProperty(Object)}.
|
||||
*/
|
||||
Object getClientProperty( Object key );
|
||||
|
||||
/**
|
||||
* Overrides {@link JComponent#putClientProperty(Object, Object)}.
|
||||
*/
|
||||
void putClientProperty( Object key, Object value );
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import javax.swing.SwingConstants;
|
||||
*/
|
||||
public class FlatTabbedPane
|
||||
extends JTabbedPane
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns whether separators are shown between tabs.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JTable;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JTable} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatTable
|
||||
extends JTable
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.table.JTableHeader;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JTableHeader} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatTableHeader
|
||||
extends JTableHeader
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import javax.swing.JTextArea;
|
||||
*/
|
||||
public class FlatTextArea
|
||||
extends JTextArea
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
|
||||
@@ -28,7 +28,7 @@ import javax.swing.JTextField;
|
||||
*/
|
||||
public class FlatTextField
|
||||
extends JTextField
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns the placeholder text that is only painted if the text field is empty.
|
||||
|
||||
@@ -26,7 +26,7 @@ import javax.swing.JTextPane;
|
||||
*/
|
||||
public class FlatTextPane
|
||||
extends JTextPane
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns minimum width of a component.
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.formdev.flatlaf.extras.components.FlatButton.ButtonType;
|
||||
*/
|
||||
public class FlatToggleButton
|
||||
extends JToggleButton
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns type of a button.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JToolBar;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JToolBar} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatToolBar
|
||||
extends JToolBar
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2021 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;
|
||||
|
||||
import javax.swing.JToolBar;
|
||||
|
||||
/**
|
||||
* Subclass of {@link JToolBar.Separator} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
* @since 2
|
||||
*/
|
||||
public class FlatToolBarSeparator
|
||||
extends JToolBar.Separator
|
||||
implements FlatStyleableComponent
|
||||
{
|
||||
}
|
||||
@@ -22,10 +22,11 @@ import javax.swing.JTree;
|
||||
/**
|
||||
* Subclass of {@link JTree} that provides easy access to FlatLaf specific client properties.
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatTree
|
||||
extends JTree
|
||||
implements FlatComponentExtension
|
||||
implements FlatComponentExtension, FlatStyleableComponent
|
||||
{
|
||||
/**
|
||||
* Returns if the tree shows a wide selection
|
||||
|
||||
Reference in New Issue
Block a user