mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06: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 );
|
// UIManager.put( "PasswordField.showRevealButton", true );
|
||||||
passwordField1.putClientProperty( FlatClientProperties.STYLE, "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
|
// search history button
|
||||||
JButton searchHistoryButton = new JButton( new FlatSearchWithHistoryIcon( true ) );
|
JButton searchHistoryButton = new JButton( new FlatSearchWithHistoryIcon( true ) );
|
||||||
searchHistoryButton.setToolTipText( "Search History" );
|
searchHistoryButton.setToolTipText( "Search History" );
|
||||||
@@ -177,9 +188,9 @@ class BasicComponentsPanel
|
|||||||
JComboBox<String> warningHintsComboBox = new JComboBox<>();
|
JComboBox<String> warningHintsComboBox = new JComboBox<>();
|
||||||
JSpinner warningHintsSpinner = new JSpinner();
|
JSpinner warningHintsSpinner = new JSpinner();
|
||||||
JLabel iconsLabel = new JLabel();
|
JLabel iconsLabel = new JLabel();
|
||||||
JTextField leadingIconTextField = new JTextField();
|
leadingIconTextField = new JTextField();
|
||||||
JTextField trailingIconTextField = new JTextField();
|
trailingIconTextField = new JTextField();
|
||||||
JTextField iconsTextField = new JTextField();
|
iconsTextField = new JTextField();
|
||||||
JLabel compsLabel = new JLabel();
|
JLabel compsLabel = new JLabel();
|
||||||
compsTextField = new JTextField();
|
compsTextField = new JTextField();
|
||||||
clearTextField = new JTextField();
|
clearTextField = new JTextField();
|
||||||
@@ -851,17 +862,6 @@ class BasicComponentsPanel
|
|||||||
copyMenuItem.addActionListener( new DefaultEditorKit.CopyAction() );
|
copyMenuItem.addActionListener( new DefaultEditorKit.CopyAction() );
|
||||||
pasteMenuItem.addActionListener( new DefaultEditorKit.PasteAction() );
|
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 ) {
|
if( FlatLafDemo.screenshotsMode ) {
|
||||||
// hide some components
|
// hide some components
|
||||||
Component[] hiddenComponents = {
|
Component[] hiddenComponents = {
|
||||||
@@ -919,6 +919,9 @@ class BasicComponentsPanel
|
|||||||
|
|
||||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||||
private JPasswordField passwordField1;
|
private JPasswordField passwordField1;
|
||||||
|
private JTextField leadingIconTextField;
|
||||||
|
private JTextField trailingIconTextField;
|
||||||
|
private JTextField iconsTextField;
|
||||||
private JTextField compsTextField;
|
private JTextField compsTextField;
|
||||||
private JTextField clearTextField;
|
private JTextField clearTextField;
|
||||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||||
|
|||||||
@@ -659,18 +659,27 @@ new FormModel {
|
|||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
name: "leadingIconTextField"
|
name: "leadingIconTextField"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 14,growx"
|
"value": "cell 1 14,growx"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
name: "trailingIconTextField"
|
name: "trailingIconTextField"
|
||||||
"text": "text"
|
"text": "text"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 2 14,growx"
|
"value": "cell 2 14,growx"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||||
name: "iconsTextField"
|
name: "iconsTextField"
|
||||||
"text": "text"
|
"text": "text"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 3 14,growx"
|
"value": "cell 3 14,growx"
|
||||||
} )
|
} )
|
||||||
|
|||||||
Reference in New Issue
Block a user