mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 23:08:42 +03:00
Demo: moved leading/trailing icons (on text field) code from end of initComponents() to constructor (so that it easier to find)
This commit is contained in:
@@ -43,6 +43,17 @@ class BasicComponentsPanel
|
||||
// UIManager.put( "PasswordField.showRevealButton", true );
|
||||
passwordField1.putClientProperty( FlatClientProperties.STYLE, "showRevealButton: true" );
|
||||
|
||||
// add leading/trailing icons to text fields
|
||||
leadingIconTextField.putClientProperty( FlatClientProperties.PLACEHOLDER_TEXT, "Search" );
|
||||
leadingIconTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_LEADING_ICON,
|
||||
new FlatSearchIcon() );
|
||||
trailingIconTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_TRAILING_ICON,
|
||||
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/DataTables.svg" ) );
|
||||
iconsTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_LEADING_ICON,
|
||||
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/user.svg" ) );
|
||||
iconsTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_TRAILING_ICON,
|
||||
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/bookmarkGroup.svg" ) );
|
||||
|
||||
// search history button
|
||||
JButton searchHistoryButton = new JButton( new FlatSearchWithHistoryIcon( true ) );
|
||||
searchHistoryButton.setToolTipText( "Search History" );
|
||||
@@ -177,9 +188,9 @@ class BasicComponentsPanel
|
||||
JComboBox<String> warningHintsComboBox = new JComboBox<>();
|
||||
JSpinner warningHintsSpinner = new JSpinner();
|
||||
JLabel iconsLabel = new JLabel();
|
||||
JTextField leadingIconTextField = new JTextField();
|
||||
JTextField trailingIconTextField = new JTextField();
|
||||
JTextField iconsTextField = new JTextField();
|
||||
leadingIconTextField = new JTextField();
|
||||
trailingIconTextField = new JTextField();
|
||||
iconsTextField = new JTextField();
|
||||
JLabel compsLabel = new JLabel();
|
||||
compsTextField = new JTextField();
|
||||
clearTextField = new JTextField();
|
||||
@@ -851,17 +862,6 @@ class BasicComponentsPanel
|
||||
copyMenuItem.addActionListener( new DefaultEditorKit.CopyAction() );
|
||||
pasteMenuItem.addActionListener( new DefaultEditorKit.PasteAction() );
|
||||
|
||||
// add leading/trailing icons to text fields
|
||||
leadingIconTextField.putClientProperty( FlatClientProperties.PLACEHOLDER_TEXT, "Search" );
|
||||
leadingIconTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_LEADING_ICON,
|
||||
new FlatSearchIcon() );
|
||||
trailingIconTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_TRAILING_ICON,
|
||||
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/DataTables.svg" ) );
|
||||
iconsTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_LEADING_ICON,
|
||||
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/user.svg" ) );
|
||||
iconsTextField.putClientProperty( FlatClientProperties.TEXT_FIELD_TRAILING_ICON,
|
||||
new FlatSVGIcon( "com/formdev/flatlaf/demo/icons/bookmarkGroup.svg" ) );
|
||||
|
||||
if( FlatLafDemo.screenshotsMode ) {
|
||||
// hide some components
|
||||
Component[] hiddenComponents = {
|
||||
@@ -919,6 +919,9 @@ class BasicComponentsPanel
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JPasswordField passwordField1;
|
||||
private JTextField leadingIconTextField;
|
||||
private JTextField trailingIconTextField;
|
||||
private JTextField iconsTextField;
|
||||
private JTextField compsTextField;
|
||||
private JTextField clearTextField;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
@@ -659,18 +659,27 @@ new FormModel {
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
name: "leadingIconTextField"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 14,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
name: "trailingIconTextField"
|
||||
"text": "text"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 14,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
name: "iconsTextField"
|
||||
"text": "text"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 14,growx"
|
||||
} )
|
||||
|
||||
Reference in New Issue
Block a user