JIDE: JidePopupMenu:

- added test to FlatJideOssTest
- updated README.md and CHANGELOG.md

(PR #246)
This commit is contained in:
Karl Tauber
2021-01-21 00:14:42 +01:00
parent 51f22bfe75
commit 63193feebe
4 changed files with 54 additions and 15 deletions

View File

@@ -3,6 +3,10 @@ FlatLaf Change Log
## 1.0-rc2-SNAPSHOT ## 1.0-rc2-SNAPSHOT
#### New features and improvements
- JIDE Common Layer: Support `JidePopupMenu`.
#### Fixed bugs #### Fixed bugs
- CheckBox and RadioButton: Fill component background as soon as background - CheckBox and RadioButton: Fill component background as soon as background

View File

@@ -6,6 +6,7 @@ This addon for FlatLaf adds support for **some**
Following JIDE Common Layer components are currently supported by this addon: Following JIDE Common Layer components are currently supported by this addon:
- `JidePopupMenu`
- `JideTabbedPane` - `JideTabbedPane`
- `RangeSlider` - `RangeSlider`
- `TristateCheckBox` - `TristateCheckBox`

View File

@@ -84,18 +84,27 @@ public class FlatJideOssTest
} }
} }
private void showJidePopupButtonActionPerformed( ActionEvent e ) { private void showJidePopup( ActionEvent e ) {
Component invoker = (Component) e.getSource(); Component invoker = (Component) e.getSource();
JPanel panel = new JPanel( new MigLayout() ); JPanel panel = new JPanel( new MigLayout() );
panel.add( new JLabel( "Name:") ); panel.add( new JLabel( "Name:") );
panel.add( new JTextField( 20 ) ); panel.add( new JTextField( 20 ) );
JidePopup popupMenu = new JidePopup(); JidePopup popup = new JidePopup();
popupMenu.add( panel ); popup.add( panel );
popupMenu.setDetached( true ); popup.setDetached( true );
popupMenu.setOwner( invoker ); popup.setOwner( invoker );
popupMenu.showPopup(); popup.showPopup();
}
private void showJidePopupMenu( ActionEvent e ) {
Component invoker = (Component) e.getSource();
JidePopupMenu popupMenu = new JidePopupMenu();
for( int i = 1; i <= 100; i++ )
popupMenu.add( "menu item " + i );
popupMenu.show( invoker, 0, invoker.getHeight() );
} }
private void tristateCheckBox1Changed() { private void tristateCheckBox1Changed() {
@@ -139,6 +148,8 @@ public class FlatJideOssTest
JPanel panel10 = new JPanel(); JPanel panel10 = new JPanel();
JLabel jidePopupLabel = new JLabel(); JLabel jidePopupLabel = new JLabel();
JButton showJidePopupButton = new JButton(); JButton showJidePopupButton = new JButton();
JLabel jidePopupMenuLabel = new JLabel();
JButton showJidePopupMenuButton = new JButton();
JLabel label9 = new JLabel(); JLabel label9 = new JLabel();
tristateCheckBox1 = new TristateCheckBox(); tristateCheckBox1 = new TristateCheckBox();
triStateLabel1 = new JLabel(); triStateLabel1 = new JLabel();
@@ -314,6 +325,7 @@ public class FlatJideOssTest
"[fill]", "[fill]",
// rows // rows
"[]" + "[]" +
"[]" +
"[]")); "[]"));
//---- jidePopupLabel ---- //---- jidePopupLabel ----
@@ -322,22 +334,31 @@ public class FlatJideOssTest
//---- showJidePopupButton ---- //---- showJidePopupButton ----
showJidePopupButton.setText("show JidePopup"); showJidePopupButton.setText("show JidePopup");
showJidePopupButton.addActionListener(e -> showJidePopupButtonActionPerformed(e)); showJidePopupButton.addActionListener(e -> showJidePopup(e));
panel10.add(showJidePopupButton, "cell 1 0"); panel10.add(showJidePopupButton, "cell 1 0");
//---- jidePopupMenuLabel ----
jidePopupMenuLabel.setText("JidePopupMenu:");
panel10.add(jidePopupMenuLabel, "cell 0 1");
//---- showJidePopupMenuButton ----
showJidePopupMenuButton.setText("show JidePopupMenu");
showJidePopupMenuButton.addActionListener(e -> showJidePopupMenu(e));
panel10.add(showJidePopupMenuButton, "cell 1 1");
//---- label9 ---- //---- label9 ----
label9.setText("TristateCheckBox:"); label9.setText("TristateCheckBox:");
panel10.add(label9, "cell 0 1"); panel10.add(label9, "cell 0 2");
//---- tristateCheckBox1 ---- //---- tristateCheckBox1 ----
tristateCheckBox1.setText("three states"); tristateCheckBox1.setText("three states");
tristateCheckBox1.addActionListener(e -> tristateCheckBox1Changed()); tristateCheckBox1.addActionListener(e -> tristateCheckBox1Changed());
panel10.add(tristateCheckBox1, "cell 1 1"); panel10.add(tristateCheckBox1, "cell 1 2");
//---- triStateLabel1 ---- //---- triStateLabel1 ----
triStateLabel1.setText("text"); triStateLabel1.setText("text");
triStateLabel1.setEnabled(false); triStateLabel1.setEnabled(false);
panel10.add(triStateLabel1, "cell 2 1"); panel10.add(triStateLabel1, "cell 2 2");
} }
panel9.add(panel10, cc.xy(1, 9)); panel9.add(panel10, cc.xy(1, 9));
} }

View File

@@ -195,7 +195,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 3 0 3 3,hidemode 3" "$layoutConstraints": "insets 3 0 3 3,hidemode 3"
"$columnConstraints": "[fill][fill][fill]" "$columnConstraints": "[fill][fill][fill]"
"$rowConstraints": "[][]" "$rowConstraints": "[][][]"
} ) { } ) {
name: "panel10" name: "panel10"
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
@@ -207,15 +207,28 @@ new FormModel {
add( new FormComponent( "javax.swing.JButton" ) { add( new FormComponent( "javax.swing.JButton" ) {
name: "showJidePopupButton" name: "showJidePopupButton"
"text": "show JidePopup" "text": "show JidePopup"
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showJidePopupButtonActionPerformed", true ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showJidePopup", true ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0" "value": "cell 1 0"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "jidePopupMenuLabel"
"text": "JidePopupMenu:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "showJidePopupMenuButton"
"text": "show JidePopupMenu"
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showJidePopupMenu", true ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "label9" name: "label9"
"text": "TristateCheckBox:" "text": "TristateCheckBox:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1" "value": "cell 0 2"
} ) } )
add( new FormComponent( "com.jidesoft.swing.TristateCheckBox" ) { add( new FormComponent( "com.jidesoft.swing.TristateCheckBox" ) {
name: "tristateCheckBox1" name: "tristateCheckBox1"
@@ -225,7 +238,7 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tristateCheckBox1Changed", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tristateCheckBox1Changed", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1" "value": "cell 1 2"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "triStateLabel1" name: "triStateLabel1"
@@ -235,7 +248,7 @@ new FormModel {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1" "value": "cell 2 2"
} ) } )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) { }, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridY": 9 "gridY": 9