mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-14 07:47:12 -06:00
Styling: Extras: add style getters and setters to component classes
This commit is contained in:
@@ -127,12 +127,21 @@ public interface FlatClientProperties
|
|||||||
//---- JComponent ---------------------------------------------------------
|
//---- JComponent ---------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the style of a component in CSS syntax ("key1: value1; key2: value2; ...").
|
* Specifies the style of a component as String in CSS syntax ("key1: value1; key2: value2; ...")
|
||||||
|
* or 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 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).
|
||||||
|
* When using a map, the values are not parsed from a string. They must be binary.
|
||||||
* <p>
|
* <p>
|
||||||
* <strong>Components</strong> {@link javax.swing.JComponent}<br>
|
* <strong>Components</strong> {@link javax.swing.JComponent}<br>
|
||||||
* <strong>Value type</strong> {@link java.lang.String} or {@link java.util.Map}<String, Object><br>
|
* <strong>Value type</strong> {@link java.lang.String} or {@link java.util.Map}<String, Object><br>
|
||||||
*
|
*
|
||||||
* @since TODO
|
* @since 2
|
||||||
*/
|
*/
|
||||||
String STYLE = "FlatLaf.style";
|
String STYLE = "FlatLaf.style";
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import javax.swing.JButton;
|
|||||||
*/
|
*/
|
||||||
public class FlatButton
|
public class FlatButton
|
||||||
extends JButton
|
extends JButton
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
// NOTE: enum names must be equal to allowed strings
|
// NOTE: enum names must be equal to allowed strings
|
||||||
public enum ButtonType { none, square, roundRect, tab, help, toolBarButton, borderless }
|
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>
|
public class FlatComboBox<E>
|
||||||
extends JComboBox<E>
|
extends JComboBox<E>
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns the placeholder text that is only painted if the editable combo box is empty.
|
* 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
|
public class FlatEditorPane
|
||||||
extends JEditorPane
|
extends JEditorPane
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns minimum width of a component.
|
* Returns minimum width of a component.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolic
|
|||||||
*/
|
*/
|
||||||
public class FlatFormattedTextField
|
public class FlatFormattedTextField
|
||||||
extends JFormattedTextField
|
extends JFormattedTextField
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns the placeholder text that is only painted if the text field is empty.
|
* 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
|
public class FlatPasswordField
|
||||||
extends JPasswordField
|
extends JPasswordField
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns the placeholder text that is only painted if the text field is empty.
|
* 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
|
public class FlatProgressBar
|
||||||
extends JProgressBar
|
extends JProgressBar
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns whether the progress bar has always the larger height even if no string is painted.
|
* 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
|
public class FlatScrollBar
|
||||||
extends JScrollBar
|
extends JScrollBar
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns whether the decrease/increase arrow buttons of a scrollbar are shown.
|
* Returns whether the decrease/increase arrow buttons of a scrollbar are shown.
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import javax.swing.JScrollPane;
|
|||||||
*/
|
*/
|
||||||
public class FlatScrollPane
|
public class FlatScrollPane
|
||||||
extends JScrollPane
|
extends JScrollPane
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns whether the decrease/increase arrow buttons of a scrollbar are shown.
|
* 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
|
public class FlatSpinner
|
||||||
extends JSpinner
|
extends JSpinner
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns minimum width of a component.
|
* 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
|
public class FlatTabbedPane
|
||||||
extends JTabbedPane
|
extends JTabbedPane
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns whether separators are shown between tabs.
|
* 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
|
public class FlatTextArea
|
||||||
extends JTextArea
|
extends JTextArea
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns minimum width of a component.
|
* Returns minimum width of a component.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import javax.swing.JTextField;
|
|||||||
*/
|
*/
|
||||||
public class FlatTextField
|
public class FlatTextField
|
||||||
extends JTextField
|
extends JTextField
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns the placeholder text that is only painted if the text field is empty.
|
* 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
|
public class FlatTextPane
|
||||||
extends JTextPane
|
extends JTextPane
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns minimum width of a component.
|
* Returns minimum width of a component.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import com.formdev.flatlaf.extras.components.FlatButton.ButtonType;
|
|||||||
*/
|
*/
|
||||||
public class FlatToggleButton
|
public class FlatToggleButton
|
||||||
extends JToggleButton
|
extends JToggleButton
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns type of a button.
|
* 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.
|
* Subclass of {@link JTree} that provides easy access to FlatLaf specific client properties.
|
||||||
*
|
*
|
||||||
|
* @author Karl Tauber
|
||||||
*/
|
*/
|
||||||
public class FlatTree
|
public class FlatTree
|
||||||
extends JTree
|
extends JTree
|
||||||
implements FlatComponentExtension
|
implements FlatComponentExtension, FlatStyleableComponent
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns if the tree shows a wide selection
|
* Returns if the tree shows a wide selection
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ import java.util.prefs.Preferences;
|
|||||||
import javax.lang.model.SourceVersion;
|
import javax.lang.model.SourceVersion;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import net.miginfocom.swing.*;
|
import net.miginfocom.swing.*;
|
||||||
import com.formdev.flatlaf.FlatClientProperties;
|
|
||||||
import com.formdev.flatlaf.FlatDarculaLaf;
|
import com.formdev.flatlaf.FlatDarculaLaf;
|
||||||
import com.formdev.flatlaf.FlatDarkLaf;
|
import com.formdev.flatlaf.FlatDarkLaf;
|
||||||
import com.formdev.flatlaf.FlatIntelliJLaf;
|
import com.formdev.flatlaf.FlatIntelliJLaf;
|
||||||
@@ -132,8 +131,7 @@ class FlatThemeFileEditor
|
|||||||
darkLafMenuItem.setSelected( true );
|
darkLafMenuItem.setSelected( true );
|
||||||
|
|
||||||
// highlight selected tab
|
// highlight selected tab
|
||||||
tabbedPane.putClientProperty( FlatClientProperties.STYLE,
|
tabbedPane.setStyle( "[light]selectedBackground: #fff; [dark]selectedBackground: #303234" );
|
||||||
"[light]selectedBackground: #fff; [dark]selectedBackground: #303234" );
|
|
||||||
|
|
||||||
// add "+" button to tabbed pane
|
// add "+" button to tabbed pane
|
||||||
newButton = new JButton( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/add.svg" ) );
|
newButton = new JButton( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/add.svg" ) );
|
||||||
|
|||||||
Reference in New Issue
Block a user