mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
ScrollPane with Table: The border of buttons that are added to one of the four scroll pane corners are now removed if the center component is a table. Also, these corner buttons are made not focusable.
This commit is contained in:
@@ -21,6 +21,7 @@ import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
import com.formdev.flatlaf.icons.FlatMenuArrowIcon;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
/**
|
||||
@@ -70,6 +71,18 @@ public class FlatComponents2Test
|
||||
}
|
||||
}
|
||||
|
||||
private void tableHeaderButtonChanged() {
|
||||
boolean show = tableHeaderButtonCheckBox.isSelected();
|
||||
JButton button = null;
|
||||
if( show ) {
|
||||
button = new JButton( new FlatMenuArrowIcon() );
|
||||
button.addActionListener( e -> {
|
||||
JOptionPane.showMessageDialog( this, "hello" );
|
||||
} );
|
||||
}
|
||||
scrollPane5.setCorner( JScrollPane.UPPER_TRAILING_CORNER, button );
|
||||
}
|
||||
|
||||
@SuppressWarnings( { "unchecked", "rawtypes" } )
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
@@ -87,9 +100,10 @@ public class FlatComponents2Test
|
||||
JScrollPane scrollPane4 = new JScrollPane();
|
||||
tree2 = new JTree();
|
||||
JLabel tableLabel = new JLabel();
|
||||
JScrollPane scrollPane5 = new JScrollPane();
|
||||
scrollPane5 = new JScrollPane();
|
||||
table1 = new JTable();
|
||||
dndCheckBox = new JCheckBox();
|
||||
tableHeaderButtonCheckBox = new JCheckBox();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
@@ -102,7 +116,7 @@ public class FlatComponents2Test
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[::200]" +
|
||||
"[::150]" +
|
||||
"[150,grow]" +
|
||||
"[]"));
|
||||
|
||||
//---- textFieldLabel ----
|
||||
@@ -293,6 +307,11 @@ public class FlatComponents2Test
|
||||
dndCheckBox.setMnemonic('D');
|
||||
dndCheckBox.addActionListener(e -> dndChanged());
|
||||
add(dndCheckBox, "cell 0 4 3 1");
|
||||
|
||||
//---- tableHeaderButtonCheckBox ----
|
||||
tableHeaderButtonCheckBox.setText("show button in table header");
|
||||
tableHeaderButtonCheckBox.addActionListener(e -> tableHeaderButtonChanged());
|
||||
add(tableHeaderButtonCheckBox, "cell 0 4 3 1");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
|
||||
((JComboBox)((DefaultCellEditor)table1.getColumnModel().getColumn( 3 ).getCellEditor()).getComponent()).setEditable( true );
|
||||
@@ -303,8 +322,10 @@ public class FlatComponents2Test
|
||||
private JList<String> list2;
|
||||
private JTree tree1;
|
||||
private JTree tree2;
|
||||
private JScrollPane scrollPane5;
|
||||
private JTable table1;
|
||||
private JCheckBox dndCheckBox;
|
||||
private JCheckBox tableHeaderButtonCheckBox;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
//---- class DummyTransferHandler -----------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -9,7 +9,7 @@ new FormModel {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
|
||||
"$columnConstraints": "[][200][200]"
|
||||
"$rowConstraints": "[][][::200][::150][]"
|
||||
"$rowConstraints": "[][][::200][150,grow][]"
|
||||
} ) {
|
||||
name: "this"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
@@ -135,6 +135,9 @@ new FormModel {
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane5"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
add( new FormComponent( "javax.swing.JTable" ) {
|
||||
name: "table1"
|
||||
"model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector {
|
||||
@@ -282,6 +285,16 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4 3 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "tableHeaderButtonCheckBox"
|
||||
"text": "show button in table header"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tableHeaderButtonChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4 3 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 790, 715 )
|
||||
|
||||
Reference in New Issue
Block a user