mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 23:07:15 -06:00
Styling: use FlatLightLaf in unit tests and get UI delegates from components
This commit is contained in:
@@ -60,6 +60,7 @@ tasks {
|
|||||||
|
|
||||||
test {
|
test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
|
testLogging.exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -309,6 +309,9 @@ class LinuxFontPolicy
|
|||||||
* - running on JetBrains Runtime 11 or later and scaling is enabled in system Settings
|
* - running on JetBrains Runtime 11 or later and scaling is enabled in system Settings
|
||||||
*/
|
*/
|
||||||
private static boolean isSystemScaling() {
|
private static boolean isSystemScaling() {
|
||||||
|
if( GraphicsEnvironment.isHeadless() )
|
||||||
|
return true;
|
||||||
|
|
||||||
GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
|
GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
|
||||||
.getDefaultScreenDevice().getDefaultConfiguration();
|
.getDefaultScreenDevice().getDefaultConfiguration();
|
||||||
return UIScale.getSystemScaleFactor( gc ) > 1;
|
return UIScale.getSystemScaleFactor( gc ) > 1;
|
||||||
|
|||||||
@@ -24,7 +24,10 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.table.JTableHeader;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import com.formdev.flatlaf.FlatLightLaf;
|
||||||
import com.formdev.flatlaf.icons.*;
|
import com.formdev.flatlaf.icons.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,6 +35,11 @@ import com.formdev.flatlaf.icons.*;
|
|||||||
*/
|
*/
|
||||||
public class FlatStylingTests
|
public class FlatStylingTests
|
||||||
{
|
{
|
||||||
|
@BeforeAll
|
||||||
|
static void setup() {
|
||||||
|
FlatLightLaf.setup();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void parse() {
|
void parse() {
|
||||||
assertEquals( null, FlatStyleSupport.parse( null ) );
|
assertEquals( null, FlatStyleSupport.parse( null ) );
|
||||||
@@ -62,12 +70,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void button() {
|
void button() {
|
||||||
FlatButtonUI ui = new FlatButtonUI( false );
|
|
||||||
|
|
||||||
// create border
|
|
||||||
UIManager.put( "Button.border", new FlatButtonBorder() );
|
|
||||||
JButton b = new JButton();
|
JButton b = new JButton();
|
||||||
ui.installUI( b );
|
FlatButtonUI ui = (FlatButtonUI) b.getUI();
|
||||||
|
|
||||||
button( b, ui );
|
button( b, ui );
|
||||||
|
|
||||||
@@ -126,11 +130,9 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void checkBox() {
|
void checkBox() {
|
||||||
FlatCheckBoxUI ui = new FlatCheckBoxUI( false );
|
JCheckBox c = new JCheckBox();
|
||||||
|
FlatCheckBoxUI ui = (FlatCheckBoxUI) c.getUI();
|
||||||
|
|
||||||
// assign icon
|
|
||||||
UIManager.put( "CheckBox.icon", new FlatCheckBoxIcon() );
|
|
||||||
ui.installDefaults( new JCheckBox() );
|
|
||||||
assertTrue( ui.getDefaultIcon() instanceof FlatCheckBoxIcon );
|
assertTrue( ui.getDefaultIcon() instanceof FlatCheckBoxIcon );
|
||||||
|
|
||||||
// FlatCheckBoxUI extends FlatRadioButtonUI
|
// FlatCheckBoxUI extends FlatRadioButtonUI
|
||||||
@@ -139,11 +141,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void comboBox() {
|
void comboBox() {
|
||||||
FlatComboBoxUI ui = new FlatComboBoxUI();
|
JComboBox<Object> c = new JComboBox<>();
|
||||||
|
FlatComboBoxUI ui = (FlatComboBoxUI) c.getUI();
|
||||||
// create border and arrow button
|
|
||||||
UIManager.put( "ComboBox.border", new FlatRoundBorder() );
|
|
||||||
ui.installUI( new JComboBox<>() );
|
|
||||||
|
|
||||||
ui.applyStyle( "minimumWidth: 100" );
|
ui.applyStyle( "minimumWidth: 100" );
|
||||||
ui.applyStyle( "editorColumns: 10" );
|
ui.applyStyle( "editorColumns: 10" );
|
||||||
@@ -173,10 +172,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void editorPane() {
|
void editorPane() {
|
||||||
FlatEditorPaneUI ui = new FlatEditorPaneUI();
|
JEditorPane c = new JEditorPane();
|
||||||
|
FlatEditorPaneUI ui = (FlatEditorPaneUI) c.getUI();
|
||||||
// for FlatEditorPaneUI.updateBackground()
|
|
||||||
ui.installUI( new JEditorPane() );
|
|
||||||
|
|
||||||
ui.applyStyle( "minimumWidth: 100" );
|
ui.applyStyle( "minimumWidth: 100" );
|
||||||
ui.applyStyle( "disabledBackground: #fff" );
|
ui.applyStyle( "disabledBackground: #fff" );
|
||||||
@@ -186,11 +183,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void formattedTextField() {
|
void formattedTextField() {
|
||||||
FlatFormattedTextFieldUI ui = new FlatFormattedTextFieldUI();
|
JFormattedTextField c = new JFormattedTextField();
|
||||||
|
FlatFormattedTextFieldUI ui = (FlatFormattedTextFieldUI) c.getUI();
|
||||||
// create border
|
|
||||||
UIManager.put( "FormattedTextField.border", new FlatTextBorder() );
|
|
||||||
ui.installUI( new JFormattedTextField() );
|
|
||||||
|
|
||||||
// FlatFormattedTextFieldUI extends FlatTextFieldUI
|
// FlatFormattedTextFieldUI extends FlatTextFieldUI
|
||||||
textField( ui );
|
textField( ui );
|
||||||
@@ -198,15 +192,16 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void label() {
|
void label() {
|
||||||
FlatLabelUI ui = new FlatLabelUI( false );
|
JLabel c = new JLabel();
|
||||||
|
FlatLabelUI ui = (FlatLabelUI) c.getUI();
|
||||||
|
|
||||||
ui.applyStyle( "disabledForeground: #fff" );
|
ui.applyStyle( "disabledForeground: #fff" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void list() {
|
void list() {
|
||||||
FlatListUI ui = new FlatListUI();
|
JList<Object> c = new JList<>();
|
||||||
ui.installUI( new JList<>() );
|
FlatListUI ui = (FlatListUI) c.getUI();
|
||||||
|
|
||||||
ui.applyStyle( "selectionBackground: #fff" );
|
ui.applyStyle( "selectionBackground: #fff" );
|
||||||
ui.applyStyle( "selectionForeground: #fff" );
|
ui.applyStyle( "selectionForeground: #fff" );
|
||||||
@@ -221,10 +216,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void menu() {
|
void menu() {
|
||||||
UIManager.put( "Menu.arrowIcon", new FlatMenuArrowIcon() );
|
JMenu c = new JMenu();
|
||||||
UIManager.put( "Menu.checkIcon", null );
|
FlatMenuUI ui = (FlatMenuUI) c.getUI();
|
||||||
FlatMenuUI ui = new FlatMenuUI();
|
|
||||||
ui.installUI( new JMenu() );
|
|
||||||
|
|
||||||
Consumer<String> applyStyle = style -> ui.applyStyle( style );
|
Consumer<String> applyStyle = style -> ui.applyStyle( style );
|
||||||
menuItem( applyStyle );
|
menuItem( applyStyle );
|
||||||
@@ -233,10 +226,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void menuItem() {
|
void menuItem() {
|
||||||
UIManager.put( "MenuItem.arrowIcon", new FlatMenuItemArrowIcon() );
|
JMenuItem c = new JMenuItem();
|
||||||
UIManager.put( "MenuItem.checkIcon", null );
|
FlatMenuItemUI ui = (FlatMenuItemUI) c.getUI();
|
||||||
FlatMenuItemUI ui = new FlatMenuItemUI();
|
|
||||||
ui.installUI( new JMenuItem() );
|
|
||||||
|
|
||||||
Consumer<String> applyStyle = style -> ui.applyStyle( style );
|
Consumer<String> applyStyle = style -> ui.applyStyle( style );
|
||||||
menuItem( applyStyle );
|
menuItem( applyStyle );
|
||||||
@@ -245,10 +236,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void checkBoxMenuItem() {
|
void checkBoxMenuItem() {
|
||||||
UIManager.put( "CheckBoxMenuItem.arrowIcon", new FlatMenuItemArrowIcon() );
|
JCheckBoxMenuItem c = new JCheckBoxMenuItem();
|
||||||
UIManager.put( "CheckBoxMenuItem.checkIcon", new FlatCheckBoxMenuItemIcon() );
|
FlatCheckBoxMenuItemUI ui = (FlatCheckBoxMenuItemUI) c.getUI();
|
||||||
FlatCheckBoxMenuItemUI ui = new FlatCheckBoxMenuItemUI();
|
|
||||||
ui.installUI( new JCheckBoxMenuItem() );
|
|
||||||
|
|
||||||
Consumer<String> applyStyle = style -> ui.applyStyle( style );
|
Consumer<String> applyStyle = style -> ui.applyStyle( style );
|
||||||
menuItem( applyStyle );
|
menuItem( applyStyle );
|
||||||
@@ -258,10 +247,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void radioButtonMenuItem() {
|
void radioButtonMenuItem() {
|
||||||
UIManager.put( "RadioButtonMenuItem.arrowIcon", new FlatMenuItemArrowIcon() );
|
JRadioButtonMenuItem c = new JRadioButtonMenuItem();
|
||||||
UIManager.put( "RadioButtonMenuItem.checkIcon", new FlatRadioButtonMenuItemIcon() );
|
FlatRadioButtonMenuItemUI ui = (FlatRadioButtonMenuItemUI) c.getUI();
|
||||||
FlatRadioButtonMenuItemUI ui = new FlatRadioButtonMenuItemUI();
|
|
||||||
ui.installUI( new JRadioButtonMenuItem() );
|
|
||||||
|
|
||||||
Consumer<String> applyStyle = style -> ui.applyStyle( style );
|
Consumer<String> applyStyle = style -> ui.applyStyle( style );
|
||||||
menuItem( applyStyle );
|
menuItem( applyStyle );
|
||||||
@@ -310,12 +297,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void passwordField() {
|
void passwordField() {
|
||||||
FlatPasswordFieldUI ui = new FlatPasswordFieldUI();
|
JPasswordField c = new JPasswordField();
|
||||||
|
FlatPasswordFieldUI ui = (FlatPasswordFieldUI) c.getUI();
|
||||||
// create border and capsLockIcon
|
|
||||||
UIManager.put( "PasswordField.border", new FlatTextBorder() );
|
|
||||||
UIManager.put( "PasswordField.capsLockIcon", new FlatCapsLockIcon() );
|
|
||||||
ui.installUI( new JPasswordField() );
|
|
||||||
|
|
||||||
ui.applyStyle( "minimumWidth: 100" );
|
ui.applyStyle( "minimumWidth: 100" );
|
||||||
ui.applyStyle( "disabledBackground: #fff" );
|
ui.applyStyle( "disabledBackground: #fff" );
|
||||||
@@ -333,7 +316,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void popupMenuSeparator() {
|
void popupMenuSeparator() {
|
||||||
FlatPopupMenuSeparatorUI ui = new FlatPopupMenuSeparatorUI( false );
|
JPopupMenu.Separator c = new JPopupMenu.Separator();
|
||||||
|
FlatPopupMenuSeparatorUI ui = (FlatPopupMenuSeparatorUI) c.getUI();
|
||||||
|
|
||||||
// FlatPopupMenuSeparatorUI extends FlatSeparatorUI
|
// FlatPopupMenuSeparatorUI extends FlatSeparatorUI
|
||||||
separator( ui );
|
separator( ui );
|
||||||
@@ -341,7 +325,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void progressBar() {
|
void progressBar() {
|
||||||
FlatProgressBarUI ui = new FlatProgressBarUI();
|
JProgressBar c = new JProgressBar();
|
||||||
|
FlatProgressBarUI ui = (FlatProgressBarUI) c.getUI();
|
||||||
|
|
||||||
ui.applyStyle( "arc: 5" );
|
ui.applyStyle( "arc: 5" );
|
||||||
ui.applyStyle( "horizontalSize: 100,12" );
|
ui.applyStyle( "horizontalSize: 100,12" );
|
||||||
@@ -350,11 +335,9 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void radioButton() {
|
void radioButton() {
|
||||||
FlatRadioButtonUI ui = new FlatRadioButtonUI( false );
|
JRadioButton c = new JRadioButton();
|
||||||
|
FlatRadioButtonUI ui = (FlatRadioButtonUI) c.getUI();
|
||||||
|
|
||||||
// assign icon
|
|
||||||
UIManager.put( "RadioButton.icon", new FlatRadioButtonIcon() );
|
|
||||||
ui.installDefaults( new JRadioButton() ); // assign icon
|
|
||||||
assertTrue( ui.getDefaultIcon() instanceof FlatRadioButtonIcon );
|
assertTrue( ui.getDefaultIcon() instanceof FlatRadioButtonIcon );
|
||||||
|
|
||||||
radioButton( ui );
|
radioButton( ui );
|
||||||
@@ -402,7 +385,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void scrollBar() {
|
void scrollBar() {
|
||||||
FlatScrollBarUI ui = new FlatScrollBarUI();
|
JScrollBar c = new JScrollBar();
|
||||||
|
FlatScrollBarUI ui = (FlatScrollBarUI) c.getUI();
|
||||||
|
|
||||||
ui.applyStyle( "track: #fff" );
|
ui.applyStyle( "track: #fff" );
|
||||||
ui.applyStyle( "thumb: #fff" );
|
ui.applyStyle( "thumb: #fff" );
|
||||||
@@ -432,11 +416,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void scrollPane() {
|
void scrollPane() {
|
||||||
FlatScrollPaneUI ui = new FlatScrollPaneUI();
|
JScrollPane c = new JScrollPane();
|
||||||
|
FlatScrollPaneUI ui = (FlatScrollPaneUI) c.getUI();
|
||||||
// create border
|
|
||||||
UIManager.put( "ScrollPane.border", new FlatBorder() );
|
|
||||||
ui.installUI( new JScrollPane() );
|
|
||||||
|
|
||||||
// border
|
// border
|
||||||
flatBorder( style -> ui.applyStyle( style ) );
|
flatBorder( style -> ui.applyStyle( style ) );
|
||||||
@@ -444,7 +425,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void separator() {
|
void separator() {
|
||||||
FlatSeparatorUI ui = new FlatSeparatorUI( false );
|
JSeparator c = new JSeparator();
|
||||||
|
FlatSeparatorUI ui = (FlatSeparatorUI) c.getUI();
|
||||||
|
|
||||||
separator( ui );
|
separator( ui );
|
||||||
}
|
}
|
||||||
@@ -457,7 +439,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void slider() {
|
void slider() {
|
||||||
FlatSliderUI ui = new FlatSliderUI();
|
JSlider c = new JSlider();
|
||||||
|
FlatSliderUI ui = (FlatSliderUI) c.getUI();
|
||||||
|
|
||||||
ui.applyStyle( "trackWidth: 2" );
|
ui.applyStyle( "trackWidth: 2" );
|
||||||
ui.applyStyle( "thumbSize: 12,12" );
|
ui.applyStyle( "thumbSize: 12,12" );
|
||||||
@@ -479,11 +462,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void spinner() {
|
void spinner() {
|
||||||
FlatSpinnerUI ui = new FlatSpinnerUI();
|
JSpinner c = new JSpinner();
|
||||||
|
FlatSpinnerUI ui = (FlatSpinnerUI) c.getUI();
|
||||||
// create border and arrow buttons
|
|
||||||
UIManager.put( "Spinner.border", new FlatRoundBorder() );
|
|
||||||
ui.installUI( new JSpinner() );
|
|
||||||
|
|
||||||
ui.applyStyle( "minimumWidth: 100" );
|
ui.applyStyle( "minimumWidth: 100" );
|
||||||
ui.applyStyle( "buttonStyle: button" );
|
ui.applyStyle( "buttonStyle: button" );
|
||||||
@@ -506,10 +486,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void splitPane() {
|
void splitPane() {
|
||||||
FlatSplitPaneUI ui = new FlatSplitPaneUI();
|
JSplitPane c = new JSplitPane();
|
||||||
|
FlatSplitPaneUI ui = (FlatSplitPaneUI) c.getUI();
|
||||||
// create divider and one-touch buttons
|
|
||||||
ui.installUI( new JSplitPane() );
|
|
||||||
|
|
||||||
ui.applyStyle( "arrowType: chevron" );
|
ui.applyStyle( "arrowType: chevron" );
|
||||||
ui.applyStyle( "oneTouchArrowColor: #fff" );
|
ui.applyStyle( "oneTouchArrowColor: #fff" );
|
||||||
@@ -525,10 +503,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void tabbedPane() {
|
void tabbedPane() {
|
||||||
FlatTabbedPaneUI ui = new FlatTabbedPaneUI();
|
JTabbedPane c = new JTabbedPane();
|
||||||
|
FlatTabbedPaneUI ui = (FlatTabbedPaneUI) c.getUI();
|
||||||
UIManager.put( "TabbedPane.closeIcon", new FlatTabbedPaneCloseIcon() );
|
|
||||||
ui.installUI( new JTabbedPane() );
|
|
||||||
|
|
||||||
ui.applyStyle( "tabInsets: 1,2,3,4" );
|
ui.applyStyle( "tabInsets: 1,2,3,4" );
|
||||||
ui.applyStyle( "tabAreaInsets: 1,2,3,4" );
|
ui.applyStyle( "tabAreaInsets: 1,2,3,4" );
|
||||||
@@ -587,8 +563,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void table() {
|
void table() {
|
||||||
FlatTableUI ui = new FlatTableUI();
|
JTable c = new JTable();
|
||||||
ui.installUI( new JTable() );
|
FlatTableUI ui = (FlatTableUI) c.getUI();
|
||||||
|
|
||||||
ui.applyStyle( "selectionBackground: #fff" );
|
ui.applyStyle( "selectionBackground: #fff" );
|
||||||
ui.applyStyle( "selectionForeground: #fff" );
|
ui.applyStyle( "selectionForeground: #fff" );
|
||||||
@@ -603,7 +579,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void tableHeader() {
|
void tableHeader() {
|
||||||
FlatTableHeaderUI ui = new FlatTableHeaderUI();
|
JTableHeader c = new JTableHeader();
|
||||||
|
FlatTableHeaderUI ui = (FlatTableHeaderUI) c.getUI();
|
||||||
|
|
||||||
ui.applyStyle( "bottomSeparatorColor: #fff" );
|
ui.applyStyle( "bottomSeparatorColor: #fff" );
|
||||||
ui.applyStyle( "height: 20" );
|
ui.applyStyle( "height: 20" );
|
||||||
@@ -620,10 +597,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void textArea() {
|
void textArea() {
|
||||||
FlatTextAreaUI ui = new FlatTextAreaUI();
|
JTextArea c = new JTextArea();
|
||||||
|
FlatTextAreaUI ui = (FlatTextAreaUI) c.getUI();
|
||||||
// for FlatEditorPaneUI.updateBackground()
|
|
||||||
ui.installUI( new JTextArea() );
|
|
||||||
|
|
||||||
ui.applyStyle( "minimumWidth: 100" );
|
ui.applyStyle( "minimumWidth: 100" );
|
||||||
ui.applyStyle( "disabledBackground: #fff" );
|
ui.applyStyle( "disabledBackground: #fff" );
|
||||||
@@ -633,11 +608,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void textField() {
|
void textField() {
|
||||||
FlatTextFieldUI ui = new FlatTextFieldUI();
|
JTextField c = new JTextField();
|
||||||
|
FlatTextFieldUI ui = (FlatTextFieldUI) c.getUI();
|
||||||
// create border
|
|
||||||
UIManager.put( "TextField.border", new FlatTextBorder() );
|
|
||||||
ui.installUI( new JTextField() );
|
|
||||||
|
|
||||||
textField( ui );
|
textField( ui );
|
||||||
}
|
}
|
||||||
@@ -655,10 +627,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void textPane() {
|
void textPane() {
|
||||||
FlatTextPaneUI ui = new FlatTextPaneUI();
|
JTextPane c = new JTextPane();
|
||||||
|
FlatTextPaneUI ui = (FlatTextPaneUI) c.getUI();
|
||||||
// for FlatEditorPaneUI.updateBackground()
|
|
||||||
ui.installUI( new JTextPane() );
|
|
||||||
|
|
||||||
ui.applyStyle( "minimumWidth: 100" );
|
ui.applyStyle( "minimumWidth: 100" );
|
||||||
ui.applyStyle( "disabledBackground: #fff" );
|
ui.applyStyle( "disabledBackground: #fff" );
|
||||||
@@ -668,12 +638,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toggleButton() {
|
void toggleButton() {
|
||||||
FlatToggleButtonUI ui = new FlatToggleButtonUI( false );
|
|
||||||
|
|
||||||
// create border
|
|
||||||
UIManager.put( "ToggleButton.border", new FlatButtonBorder() );
|
|
||||||
JToggleButton b = new JToggleButton();
|
JToggleButton b = new JToggleButton();
|
||||||
ui.installUI( b );
|
FlatToggleButtonUI ui = (FlatToggleButtonUI) b.getUI();
|
||||||
|
|
||||||
// FlatToggleButtonUI extends FlatButtonUI
|
// FlatToggleButtonUI extends FlatButtonUI
|
||||||
button( b, ui );
|
button( b, ui );
|
||||||
@@ -688,7 +654,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toolBar() {
|
void toolBar() {
|
||||||
FlatToolBarUI ui = new FlatToolBarUI();
|
JToolBar c = new JToolBar();
|
||||||
|
FlatToolBarUI ui = (FlatToolBarUI) c.getUI();
|
||||||
|
|
||||||
ui.applyStyle( "borderMargins: 1,2,3,4" );
|
ui.applyStyle( "borderMargins: 1,2,3,4" );
|
||||||
ui.applyStyle( "gripColor: #fff" );
|
ui.applyStyle( "gripColor: #fff" );
|
||||||
@@ -696,7 +663,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void toolBarSeparator() {
|
void toolBarSeparator() {
|
||||||
FlatToolBarSeparatorUI ui = new FlatToolBarSeparatorUI( false );
|
JToolBar.Separator c = new JToolBar.Separator();
|
||||||
|
FlatToolBarSeparatorUI ui = (FlatToolBarSeparatorUI) c.getUI();
|
||||||
|
|
||||||
ui.applyStyle( "separatorWidth: 6" );
|
ui.applyStyle( "separatorWidth: 6" );
|
||||||
ui.applyStyle( "separatorColor: #fff" );
|
ui.applyStyle( "separatorColor: #fff" );
|
||||||
@@ -704,8 +672,8 @@ public class FlatStylingTests
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void tree() {
|
void tree() {
|
||||||
FlatTreeUI ui = new FlatTreeUI();
|
JTree c = new JTree();
|
||||||
ui.installUI( new JTree() );
|
FlatTreeUI ui = (FlatTreeUI) c.getUI();
|
||||||
|
|
||||||
ui.applyStyle( "selectionBackground: #fff" );
|
ui.applyStyle( "selectionBackground: #fff" );
|
||||||
ui.applyStyle( "selectionForeground: #fff" );
|
ui.applyStyle( "selectionForeground: #fff" );
|
||||||
|
|||||||
Reference in New Issue
Block a user