mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 22:40:53 +03:00
JIDE: support TristateCheckBox
This commit is contained in:
@@ -15,6 +15,7 @@ FlatLaf Change Log
|
||||
to `com.formdev.flatlaf.extras.FlatSVGUtils`.
|
||||
- IntelliJ Themes: Added flag whether a theme is dark to
|
||||
`FlatAllIJThemes.INFOS`. (issue #221)
|
||||
- JIDE Common Layer: Support `TristateCheckBox`.
|
||||
|
||||
|
||||
#### Fixed bugs
|
||||
|
||||
@@ -8,6 +8,7 @@ Following JIDE Common Layer components are currently supported by this addon:
|
||||
|
||||
- `JideTabbedPane`
|
||||
- `RangeSlider`
|
||||
- `TristateCheckBox`
|
||||
|
||||
|
||||
**Note**: We have currently no plans to support additional components. If you're
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.formdev.flatlaf.jideoss;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.UIDefaults;
|
||||
import com.formdev.flatlaf.FlatDefaultsAddon;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
@@ -46,6 +47,14 @@ public class FlatJideOssDefaultsAddon
|
||||
return super.getDefaults( lafClass );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterDefaultsLoading( LookAndFeel laf, UIDefaults defaults ) {
|
||||
// TristateCheckBox
|
||||
defaults.put( "TristateCheckBox.icon", null );
|
||||
defaults.put( "TristateCheckBox.setMixed.clientProperty", new Object[] { "JButton.selectedState", "indeterminate" } );
|
||||
defaults.put( "TristateCheckBox.clearMixed.clientProperty", new Object[] { "JButton.selectedState", null } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return 11;
|
||||
@@ -71,6 +80,7 @@ public class FlatJideOssDefaultsAddon
|
||||
Object key = e.getKey();
|
||||
if( key instanceof String &&
|
||||
(((String)key).startsWith( "Jide" ) ||
|
||||
((String)key).startsWith( "TristateCheckBox." ) ||
|
||||
key.equals( "RangeSliderUI" ) ||
|
||||
key.equals( "Resizable.resizeBorder" )) )
|
||||
{
|
||||
@@ -85,6 +95,9 @@ public class FlatJideOssDefaultsAddon
|
||||
defaults.putAll( jideDefaults );
|
||||
jideDefaults = null;
|
||||
}
|
||||
|
||||
// TristateCheckBox
|
||||
defaults.put( "TristateCheckBox.icon", null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@ public class FlatJideOssTest
|
||||
|
||||
FlatJideOssTest() {
|
||||
initComponents();
|
||||
|
||||
tristateCheckBox1Changed();
|
||||
}
|
||||
|
||||
private void tabScrollChanged() {
|
||||
@@ -104,6 +106,16 @@ public class FlatJideOssTest
|
||||
popupMenu.showPopup();
|
||||
}
|
||||
|
||||
private void tristateCheckBox1Changed() {
|
||||
String text = null;
|
||||
switch( tristateCheckBox1.getState() ) {
|
||||
case TristateCheckBox.STATE_UNSELECTED: text = "UNSELECTED"; break;
|
||||
case TristateCheckBox.STATE_SELECTED: text = "SELECTED"; break;
|
||||
case TristateCheckBox.STATE_MIXED: text = "MIXED"; break;
|
||||
}
|
||||
triStateLabel1.setText( text );
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
JPanel panel9 = new JPanel();
|
||||
@@ -135,6 +147,9 @@ public class FlatJideOssTest
|
||||
JPanel panel10 = new JPanel();
|
||||
JLabel jidePopupLabel = new JLabel();
|
||||
JButton showJidePopupButton = new JButton();
|
||||
JLabel label9 = new JLabel();
|
||||
tristateCheckBox1 = new TristateCheckBox();
|
||||
triStateLabel1 = new JLabel();
|
||||
CellConstraints cc = new CellConstraints();
|
||||
|
||||
//======== this ========
|
||||
@@ -303,8 +318,10 @@ public class FlatJideOssTest
|
||||
"insets 3 0 3 3,hidemode 3",
|
||||
// columns
|
||||
"[fill]" +
|
||||
"[fill]" +
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- jidePopupLabel ----
|
||||
@@ -315,6 +332,20 @@ public class FlatJideOssTest
|
||||
showJidePopupButton.setText("show JidePopup");
|
||||
showJidePopupButton.addActionListener(e -> showJidePopupButtonActionPerformed(e));
|
||||
panel10.add(showJidePopupButton, "cell 1 0");
|
||||
|
||||
//---- label9 ----
|
||||
label9.setText("TristateCheckBox:");
|
||||
panel10.add(label9, "cell 0 1");
|
||||
|
||||
//---- tristateCheckBox1 ----
|
||||
tristateCheckBox1.setText("three states");
|
||||
tristateCheckBox1.addActionListener(e -> tristateCheckBox1Changed());
|
||||
panel10.add(tristateCheckBox1, "cell 1 1");
|
||||
|
||||
//---- triStateLabel1 ----
|
||||
triStateLabel1.setText("text");
|
||||
triStateLabel1.setEnabled(false);
|
||||
panel10.add(triStateLabel1, "cell 2 1");
|
||||
}
|
||||
panel9.add(panel10, cc.xy(1, 9));
|
||||
}
|
||||
@@ -330,5 +361,7 @@ public class FlatJideOssTest
|
||||
private JCheckBox moreTabsCheckBox;
|
||||
private JCheckBox tabScrollCheckBox;
|
||||
private JCheckBox hasFullBorderCheckBox;
|
||||
private TristateCheckBox tristateCheckBox1;
|
||||
private JLabel triStateLabel1;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -194,8 +194,8 @@ new FormModel {
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 3 0 3 3,hidemode 3"
|
||||
"$columnConstraints": "[fill][fill]"
|
||||
"$rowConstraints": "[]"
|
||||
"$columnConstraints": "[fill][fill][fill]"
|
||||
"$rowConstraints": "[][]"
|
||||
} ) {
|
||||
name: "panel10"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
@@ -211,6 +211,32 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label9"
|
||||
"text": "TristateCheckBox:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormComponent( "com.jidesoft.swing.TristateCheckBox" ) {
|
||||
name: "tristateCheckBox1"
|
||||
"text": "three states"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tristateCheckBox1Changed", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "triStateLabel1"
|
||||
"text": "text"
|
||||
"enabled": false
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridY": 9
|
||||
} )
|
||||
|
||||
Reference in New Issue
Block a user