FlatSmoothScrollingTest:

- added small vertical line to indicate data points in chart
- added split pane to allow changing height of components
- Alt+C clears chart without moving focus to "Clear" button
- separate chart lines for smooth and non-smooth scrolling
This commit is contained in:
Karl Tauber
2023-06-05 23:48:17 +02:00
parent cf70cfb50c
commit e2e3fd31e9
2 changed files with 379 additions and 260 deletions

View File

@@ -70,6 +70,14 @@ public class FlatSmoothScrollingTest
KeyStroke.getKeyStroke( "alt " + (char) smoothScrollingCheckBox.getMnemonic() ), KeyStroke.getKeyStroke( "alt " + (char) smoothScrollingCheckBox.getMnemonic() ),
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ); JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
// allow clearing chart with Alt+C without moving focus to button
registerKeyboardAction(
e -> {
clearChart();
},
KeyStroke.getKeyStroke( "alt " + (char) clearChartButton.getMnemonic() ),
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
listLabel.setIcon( new ColorIcon( Color.red.darker() ) ); listLabel.setIcon( new ColorIcon( Color.red.darker() ) );
treeLabel.setIcon( new ColorIcon( Color.blue.darker() ) ); treeLabel.setIcon( new ColorIcon( Color.blue.darker() ) );
tableLabel.setIcon( new ColorIcon( Color.green.darker() ) ); tableLabel.setIcon( new ColorIcon( Color.green.darker() ) );
@@ -205,6 +213,9 @@ public class FlatSmoothScrollingTest
private void initComponents() { private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
smoothScrollingCheckBox = new JCheckBox(); smoothScrollingCheckBox = new JCheckBox();
splitPane1 = new JSplitPane();
splitPane2 = new JSplitPane();
panel1 = new JPanel();
listLabel = new JLabel(); listLabel = new JLabel();
treeLabel = new JLabel(); treeLabel = new JLabel();
tableLabel = new JLabel(); tableLabel = new JLabel();
@@ -216,6 +227,7 @@ public class FlatSmoothScrollingTest
tree = new JTree(); tree = new JTree();
tableScrollPane = new FlatSmoothScrollingTest.DebugScrollPane(); tableScrollPane = new FlatSmoothScrollingTest.DebugScrollPane();
table = new JTable(); table = new JTable();
panel2 = new JPanel();
textAreaLabel = new JLabel(); textAreaLabel = new JLabel();
textPaneLabel = new JLabel(); textPaneLabel = new JLabel();
editorPaneLabel = new JLabel(); editorPaneLabel = new JLabel();
@@ -228,7 +240,8 @@ public class FlatSmoothScrollingTest
editorPane = new JEditorPane(); editorPane = new JEditorPane();
customScrollPane = new FlatSmoothScrollingTest.DebugScrollPane(); customScrollPane = new FlatSmoothScrollingTest.DebugScrollPane();
button1 = new JButton(); button1 = new JButton();
scrollPane1 = new JScrollPane(); panel3 = new JPanel();
chartScrollPane = new JScrollPane();
lineChartPanel = new FlatSmoothScrollingTest.LineChartPanel(); lineChartPanel = new FlatSmoothScrollingTest.LineChartPanel();
label1 = new JLabel(); label1 = new JLabel();
updateChartDelayedCheckBox = new JCheckBox(); updateChartDelayedCheckBox = new JCheckBox();
@@ -238,17 +251,10 @@ public class FlatSmoothScrollingTest
setLayout(new MigLayout( setLayout(new MigLayout(
"ltr,insets dialog,hidemode 3", "ltr,insets dialog,hidemode 3",
// columns // columns
"[200,fill]" + "[200,grow,fill]",
"[200,fill]" +
"[200,fill]" +
"[200,fill]",
// rows // rows
"[]" + "[]" +
"[]" + "[grow,fill]" +
"[200,grow,fill]" +
"[]" +
"[200,grow,fill]" +
"[300,grow,fill]" +
"[]")); "[]"));
//---- smoothScrollingCheckBox ---- //---- smoothScrollingCheckBox ----
@@ -258,128 +264,186 @@ public class FlatSmoothScrollingTest
smoothScrollingCheckBox.addActionListener(e -> smoothScrollingChanged()); smoothScrollingCheckBox.addActionListener(e -> smoothScrollingChanged());
add(smoothScrollingCheckBox, "cell 0 0,alignx left,growx 0"); add(smoothScrollingCheckBox, "cell 0 0,alignx left,growx 0");
//---- listLabel ---- //======== splitPane1 ========
listLabel.setText("JList:");
listLabel.setHorizontalTextPosition(SwingConstants.LEADING);
add(listLabel, "cell 0 1,aligny top,growy 0");
//---- treeLabel ----
treeLabel.setText("JTree:");
treeLabel.setHorizontalTextPosition(SwingConstants.LEADING);
add(treeLabel, "cell 1 1");
//---- tableLabel ----
tableLabel.setText("JTable:");
tableLabel.setHorizontalTextPosition(SwingConstants.LEADING);
add(tableLabel, "cell 2 1 2 1");
//---- showTableGridCheckBox ----
showTableGridCheckBox.setText("Show table grid");
showTableGridCheckBox.setMnemonic('G');
showTableGridCheckBox.addActionListener(e -> showTableGridChanged());
add(showTableGridCheckBox, "cell 2 1 2 1,alignx right,growx 0");
//---- autoResizeModeCheckBox ----
autoResizeModeCheckBox.setText("Auto-resize mode");
autoResizeModeCheckBox.setSelected(true);
autoResizeModeCheckBox.addActionListener(e -> autoResizeModeChanged());
add(autoResizeModeCheckBox, "cell 2 1 2 1,alignx right,growx 0");
//======== listScrollPane ========
{ {
listScrollPane.setViewportView(list); splitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
splitPane1.setResizeWeight(1.0);
//======== splitPane2 ========
{
splitPane2.setOrientation(JSplitPane.VERTICAL_SPLIT);
splitPane2.setResizeWeight(0.5);
//======== panel1 ========
{
panel1.setLayout(new MigLayout(
"ltr,insets 3,hidemode 3",
// columns
"[200,grow,fill]" +
"[200,grow,fill]" +
"[200,grow,fill]" +
"[200,grow,fill]",
// rows
"[]0" +
"[200,grow,fill]"));
//---- listLabel ----
listLabel.setText("JList:");
listLabel.setHorizontalTextPosition(SwingConstants.LEADING);
panel1.add(listLabel, "cell 0 0,aligny top,growy 0");
//---- treeLabel ----
treeLabel.setText("JTree:");
treeLabel.setHorizontalTextPosition(SwingConstants.LEADING);
panel1.add(treeLabel, "cell 1 0");
//---- tableLabel ----
tableLabel.setText("JTable:");
tableLabel.setHorizontalTextPosition(SwingConstants.LEADING);
panel1.add(tableLabel, "cell 2 0 2 1");
//---- showTableGridCheckBox ----
showTableGridCheckBox.setText("Show table grid");
showTableGridCheckBox.setMnemonic('G');
showTableGridCheckBox.addActionListener(e -> showTableGridChanged());
panel1.add(showTableGridCheckBox, "cell 2 0 2 1,alignx right,growx 0");
//---- autoResizeModeCheckBox ----
autoResizeModeCheckBox.setText("Auto-resize mode");
autoResizeModeCheckBox.setSelected(true);
autoResizeModeCheckBox.addActionListener(e -> autoResizeModeChanged());
panel1.add(autoResizeModeCheckBox, "cell 2 0 2 1,alignx right,growx 0");
//======== listScrollPane ========
{
listScrollPane.setViewportView(list);
}
panel1.add(listScrollPane, "cell 0 1,growx");
//======== treeScrollPane ========
{
treeScrollPane.setViewportView(tree);
}
panel1.add(treeScrollPane, "cell 1 1");
//======== tableScrollPane ========
{
tableScrollPane.setViewportView(table);
}
panel1.add(tableScrollPane, "cell 2 1 2 1,width 100,height 100");
}
splitPane2.setTopComponent(panel1);
//======== panel2 ========
{
panel2.setLayout(new MigLayout(
"ltr,insets 3,hidemode 3",
// columns
"[200,grow,fill]" +
"[200,grow,fill]" +
"[200,grow,fill]" +
"[200,grow,fill]",
// rows
"[]0" +
"[200,grow,fill]"));
//---- textAreaLabel ----
textAreaLabel.setText("JTextArea:");
textAreaLabel.setHorizontalTextPosition(SwingConstants.LEADING);
panel2.add(textAreaLabel, "cell 0 0");
//---- textPaneLabel ----
textPaneLabel.setText("JTextPane:");
textPaneLabel.setHorizontalTextPosition(SwingConstants.LEADING);
panel2.add(textPaneLabel, "cell 1 0");
//---- editorPaneLabel ----
editorPaneLabel.setText("JEditorPane:");
editorPaneLabel.setHorizontalTextPosition(SwingConstants.LEADING);
panel2.add(editorPaneLabel, "cell 2 0");
//---- customLabel ----
customLabel.setText("Custom:");
panel2.add(customLabel, "cell 3 0");
//======== textAreaScrollPane ========
{
textAreaScrollPane.setViewportView(textArea);
}
panel2.add(textAreaScrollPane, "cell 0 1");
//======== textPaneScrollPane ========
{
textPaneScrollPane.setViewportView(textPane);
}
panel2.add(textPaneScrollPane, "cell 1 1");
//======== editorPaneScrollPane ========
{
editorPaneScrollPane.setViewportView(editorPane);
}
panel2.add(editorPaneScrollPane, "cell 2 1");
//======== customScrollPane ========
{
//---- button1 ----
button1.setText("I'm a large button, but do not implement Scrollable interface");
button1.setPreferredSize(new Dimension(800, 800));
button1.setHorizontalAlignment(SwingConstants.LEADING);
button1.setVerticalAlignment(SwingConstants.TOP);
customScrollPane.setViewportView(button1);
}
panel2.add(customScrollPane, "cell 3 1");
}
splitPane2.setBottomComponent(panel2);
}
splitPane1.setTopComponent(splitPane2);
//======== panel3 ========
{
panel3.setLayout(new MigLayout(
"insets 3,hidemode 3",
// columns
"[grow,fill]",
// rows
"[300,grow,fill]"));
//======== chartScrollPane ========
{
chartScrollPane.putClientProperty("JScrollPane.smoothScrolling", false);
chartScrollPane.setViewportView(lineChartPanel);
}
panel3.add(chartScrollPane, "cell 0 0");
}
splitPane1.setBottomComponent(panel3);
} }
add(listScrollPane, "cell 0 2,growx"); add(splitPane1, "cell 0 1");
//======== treeScrollPane ========
{
treeScrollPane.setViewportView(tree);
}
add(treeScrollPane, "cell 1 2");
//======== tableScrollPane ========
{
tableScrollPane.setViewportView(table);
}
add(tableScrollPane, "cell 2 2 2 1,width 100,height 100");
//---- textAreaLabel ----
textAreaLabel.setText("JTextArea:");
textAreaLabel.setHorizontalTextPosition(SwingConstants.LEADING);
add(textAreaLabel, "cell 0 3");
//---- textPaneLabel ----
textPaneLabel.setText("JTextPane:");
textPaneLabel.setHorizontalTextPosition(SwingConstants.LEADING);
add(textPaneLabel, "cell 1 3");
//---- editorPaneLabel ----
editorPaneLabel.setText("JEditorPane:");
editorPaneLabel.setHorizontalTextPosition(SwingConstants.LEADING);
add(editorPaneLabel, "cell 2 3");
//---- customLabel ----
customLabel.setText("Custom:");
add(customLabel, "cell 3 3");
//======== textAreaScrollPane ========
{
textAreaScrollPane.setViewportView(textArea);
}
add(textAreaScrollPane, "cell 0 4");
//======== textPaneScrollPane ========
{
textPaneScrollPane.setViewportView(textPane);
}
add(textPaneScrollPane, "cell 1 4");
//======== editorPaneScrollPane ========
{
editorPaneScrollPane.setViewportView(editorPane);
}
add(editorPaneScrollPane, "cell 2 4");
//======== customScrollPane ========
{
//---- button1 ----
button1.setText("I'm a large button, but do not implement Scrollable interface");
button1.setPreferredSize(new Dimension(800, 800));
button1.setHorizontalAlignment(SwingConstants.LEADING);
button1.setVerticalAlignment(SwingConstants.TOP);
customScrollPane.setViewportView(button1);
}
add(customScrollPane, "cell 3 4");
//======== scrollPane1 ========
{
scrollPane1.putClientProperty("JScrollPane.smoothScrolling", false);
scrollPane1.setViewportView(lineChartPanel);
}
add(scrollPane1, "cell 0 5 4 1,width 100");
//---- label1 ---- //---- label1 ----
label1.setText("X: time (200ms per line) / Y: scroll bar value (10% per line)"); label1.setText("X: time (200ms per line) / Y: scroll bar value (10% per line)");
add(label1, "cell 0 6 4 1"); add(label1, "cell 0 2");
//---- updateChartDelayedCheckBox ---- //---- updateChartDelayedCheckBox ----
updateChartDelayedCheckBox.setText("Update chart delayed"); updateChartDelayedCheckBox.setText("Update chart delayed");
updateChartDelayedCheckBox.setMnemonic('U'); updateChartDelayedCheckBox.setMnemonic('U');
updateChartDelayedCheckBox.setSelected(true); updateChartDelayedCheckBox.setSelected(true);
updateChartDelayedCheckBox.addActionListener(e -> updateChartDelayedChanged()); updateChartDelayedCheckBox.addActionListener(e -> updateChartDelayedChanged());
add(updateChartDelayedCheckBox, "cell 0 6 4 1,alignx right,growx 0"); add(updateChartDelayedCheckBox, "cell 0 2,alignx right,growx 0");
//---- clearChartButton ---- //---- clearChartButton ----
clearChartButton.setText("Clear Chart"); clearChartButton.setText("Clear Chart");
clearChartButton.setMnemonic('C'); clearChartButton.setMnemonic('C');
clearChartButton.addActionListener(e -> clearChart()); clearChartButton.addActionListener(e -> clearChart());
add(clearChartButton, "cell 0 6 4 1,alignx right,growx 0"); add(clearChartButton, "cell 0 2,alignx right,growx 0");
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
} }
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JCheckBox smoothScrollingCheckBox; private JCheckBox smoothScrollingCheckBox;
private JSplitPane splitPane1;
private JSplitPane splitPane2;
private JPanel panel1;
private JLabel listLabel; private JLabel listLabel;
private JLabel treeLabel; private JLabel treeLabel;
private JLabel tableLabel; private JLabel tableLabel;
@@ -391,6 +455,7 @@ public class FlatSmoothScrollingTest
private JTree tree; private JTree tree;
private FlatSmoothScrollingTest.DebugScrollPane tableScrollPane; private FlatSmoothScrollingTest.DebugScrollPane tableScrollPane;
private JTable table; private JTable table;
private JPanel panel2;
private JLabel textAreaLabel; private JLabel textAreaLabel;
private JLabel textPaneLabel; private JLabel textPaneLabel;
private JLabel editorPaneLabel; private JLabel editorPaneLabel;
@@ -403,7 +468,8 @@ public class FlatSmoothScrollingTest
private JEditorPane editorPane; private JEditorPane editorPane;
private FlatSmoothScrollingTest.DebugScrollPane customScrollPane; private FlatSmoothScrollingTest.DebugScrollPane customScrollPane;
private JButton button1; private JButton button1;
private JScrollPane scrollPane1; private JPanel panel3;
private JScrollPane chartScrollPane;
private FlatSmoothScrollingTest.LineChartPanel lineChartPanel; private FlatSmoothScrollingTest.LineChartPanel lineChartPanel;
private JLabel label1; private JLabel label1;
private JCheckBox updateChartDelayedCheckBox; private JCheckBox updateChartDelayedCheckBox;
@@ -416,13 +482,15 @@ public class FlatSmoothScrollingTest
implements ChangeListener implements ChangeListener
{ {
private final String name; private final String name;
private final Color chartColor; private final Color chartColor; // for smooth scrolling
private final Color chartColor2; // for non-smooth scrolling
private int count; private int count;
private long lastTime; private long lastTime;
ScrollBarChangeHandler( DebugScrollPane scrollPane, boolean vertical, String name, Color chartColor ) { ScrollBarChangeHandler( DebugScrollPane scrollPane, boolean vertical, String name, Color chartColor ) {
this.name = name; this.name = name;
this.chartColor = chartColor; this.chartColor = chartColor;
this.chartColor2 = chartColor.brighter();
// add change listener to viewport that is invoked from JViewport.setViewPosition() // add change listener to viewport that is invoked from JViewport.setViewPosition()
scrollPane.getViewport().addChangeListener( e -> { scrollPane.getViewport().addChangeListener( e -> {
@@ -439,8 +507,9 @@ public class FlatSmoothScrollingTest
@Override @Override
public void stateChanged( ChangeEvent e ) { public void stateChanged( ChangeEvent e ) {
DefaultBoundedRangeModel m = (DefaultBoundedRangeModel) e.getSource(); DefaultBoundedRangeModel m = (DefaultBoundedRangeModel) e.getSource();
boolean smoothScrolling = smoothScrollingCheckBox.isSelected();
lineChartPanel.addValue( getChartValue( m ), chartColor ); lineChartPanel.addValue( getChartValue( m ), smoothScrolling ? chartColor : chartColor2 );
long t = System.nanoTime() / 1000000; long t = System.nanoTime() / 1000000;
@@ -643,6 +712,8 @@ public class FlatSmoothScrollingTest
int px = 0; int px = 0;
int py = 0; int py = 0;
int pcount = 0; int pcount = 0;
int s1 = UIScale.scale( 1 );
int s3 = UIScale.scale( 3 );
g.setColor( chartColor ); g.setColor( chartColor );
@@ -656,16 +727,18 @@ public class FlatSmoothScrollingTest
int dotx = px; int dotx = px;
if( i > 0 && data.time > ptime + NEW_SEQUENCE_TIME_LAG ) if( i > 0 && data.time > ptime + NEW_SEQUENCE_TIME_LAG )
dotx += seqGapWidth; dotx += seqGapWidth;
int o = UIScale.scale( 1 ); g.fillRect( dotx - s1, dy - s1, s3, s3 );
int s = UIScale.scale( 3 );
g.fillRect( dotx - o, dy - o, s, s );
continue; continue;
} }
if( data.time > ptime + NEW_SEQUENCE_TIME_LAG ) { if( data.time > ptime + NEW_SEQUENCE_TIME_LAG ) {
if( !first && pcount == 0 ) if( !first && pcount == 0 ) {
g.drawLine( px, py, px + (int) (4 * scaleFactor), py ); g.drawLine( px, py, px + (int) (4 * scaleFactor), py );
// small vertical line to indicate data point
g.drawLine( px, py - s1, px, py + s1 );
}
// start new sequence // start new sequence
seqTime = data.time; seqTime = data.time;
seqX = !first ? px + seqGapWidth : 0; seqX = !first ? px + seqGapWidth : 0;
@@ -680,11 +753,16 @@ public class FlatSmoothScrollingTest
// line in sequence // line in sequence
int dx = (int) (seqX + (((data.time - seqTime) / 1000.) * secondWidth)); int dx = (int) (seqX + (((data.time - seqTime) / 1000.) * secondWidth));
g.drawLine( px, py, dx, dy ); g.drawLine( px, py, dx, dy );
px = dx;
pcount++;
if( isTemporaryValue ) if( isTemporaryValue )
g.setColor( chartColor ); g.setColor( chartColor );
// small vertical lines to indicate data point
g.drawLine( px, py - s1, px, py + s1 );
g.drawLine( dx, dy - s1, dx, dy + s1 );
px = dx;
pcount++;
} }
py = dy; py = dy;

View File

@@ -5,8 +5,8 @@ new FormModel {
root: new FormRoot { root: new FormRoot {
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "ltr,insets dialog,hidemode 3" "$layoutConstraints": "ltr,insets dialog,hidemode 3"
"$columnConstraints": "[200,fill][200,fill][200,fill][200,fill]" "$columnConstraints": "[200,grow,fill]"
"$rowConstraints": "[][][200,grow,fill][][200,grow,fill][300,grow,fill][]" "$rowConstraints": "[][grow,fill][]"
} ) { } ) {
name: "this" name: "this"
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
@@ -18,148 +18,189 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0,alignx left,growx 0" "value": "cell 0 0,alignx left,growx 0"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormContainer( "javax.swing.JSplitPane", new FormLayoutManager( class javax.swing.JSplitPane ) ) {
name: "listLabel" name: "splitPane1"
"text": "JList:" "orientation": 0
"horizontalTextPosition": 10 "resizeWeight": 1.0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { add( new FormContainer( "javax.swing.JSplitPane", new FormLayoutManager( class javax.swing.JSplitPane ) ) {
"value": "cell 0 1,aligny top,growy 0" name: "splitPane2"
} ) "orientation": 0
add( new FormComponent( "javax.swing.JLabel" ) { "resizeWeight": 0.5
name: "treeLabel" add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"text": "JTree:" "$columnConstraints": "[200,grow,fill][200,grow,fill][200,grow,fill][200,grow,fill]"
"horizontalTextPosition": 10 "$rowConstraints": "[]0[200,grow,fill]"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "$layoutConstraints": "ltr,insets 3,hidemode 3"
"value": "cell 1 1" } ) {
} ) name: "panel1"
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "tableLabel" name: "listLabel"
"text": "JTable:" "text": "JList:"
"horizontalTextPosition": 10 "horizontalTextPosition": 10
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1 2 1" "value": "cell 0 0,aligny top,growy 0"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "showTableGridCheckBox" name: "treeLabel"
"text": "Show table grid" "text": "JTree:"
"mnemonic": 71 "horizontalTextPosition": 10
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTableGridChanged", false ) ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 0"
"value": "cell 2 1 2 1,alignx right,growx 0" } )
} ) add( new FormComponent( "javax.swing.JLabel" ) {
add( new FormComponent( "javax.swing.JCheckBox" ) { name: "tableLabel"
name: "autoResizeModeCheckBox" "text": "JTable:"
"text": "Auto-resize mode" "horizontalTextPosition": 10
"selected": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "autoResizeModeChanged", false ) ) "value": "cell 2 0 2 1"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { } )
"value": "cell 2 1 2 1,alignx right,growx 0" add( new FormComponent( "javax.swing.JCheckBox" ) {
} ) name: "showTableGridCheckBox"
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { "text": "Show table grid"
name: "listScrollPane" "mnemonic": 71
add( new FormComponent( "javax.swing.JList" ) { addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTableGridChanged", false ) )
name: "list" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
auxiliary() { "value": "cell 2 0 2 1,alignx right,growx 0"
"JavaCodeGenerator.typeParameters": "String" } )
"JavaCodeGenerator.variableLocal": false add( new FormComponent( "javax.swing.JCheckBox" ) {
} name: "autoResizeModeCheckBox"
"text": "Auto-resize mode"
"selected": true
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "autoResizeModeChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0 2 1,alignx right,growx 0"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "listScrollPane"
add( new FormComponent( "javax.swing.JList" ) {
name: "list"
auxiliary() {
"JavaCodeGenerator.typeParameters": "String"
"JavaCodeGenerator.variableLocal": false
}
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1,growx"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "treeScrollPane"
add( new FormComponent( "javax.swing.JTree" ) {
name: "tree"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "tableScrollPane"
add( new FormComponent( "javax.swing.JTable" ) {
name: "table"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1 2 1,width 100,height 100"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "left"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$columnConstraints": "[200,grow,fill][200,grow,fill][200,grow,fill][200,grow,fill]"
"$rowConstraints": "[]0[200,grow,fill]"
"$layoutConstraints": "ltr,insets 3,hidemode 3"
} ) {
name: "panel2"
add( new FormComponent( "javax.swing.JLabel" ) {
name: "textAreaLabel"
"text": "JTextArea:"
"horizontalTextPosition": 10
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "textPaneLabel"
"text": "JTextPane:"
"horizontalTextPosition": 10
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "editorPaneLabel"
"text": "JEditorPane:"
"horizontalTextPosition": 10
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "customLabel"
"text": "Custom:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 0"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "textAreaScrollPane"
add( new FormComponent( "javax.swing.JTextArea" ) {
name: "textArea"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "textPaneScrollPane"
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "editorPaneScrollPane"
add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "customScrollPane"
add( new FormComponent( "javax.swing.JButton" ) {
name: "button1"
"text": "I'm a large button, but do not implement Scrollable interface"
"preferredSize": new java.awt.Dimension( 800, 800 )
"horizontalAlignment": 10
"verticalAlignment": 1
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 1"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "right"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "left"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 3,hidemode 3"
"$columnConstraints": "[grow,fill]"
"$rowConstraints": "[300,grow,fill]"
} ) {
name: "panel3"
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "chartScrollPane"
"$client.JScrollPane.smoothScrolling": false
add( new FormComponent( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$LineChartPanel" ) {
name: "lineChartPanel"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "right"
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2,growx" "value": "cell 0 1"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "treeScrollPane"
add( new FormComponent( "javax.swing.JTree" ) {
name: "tree"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "tableScrollPane"
add( new FormComponent( "javax.swing.JTable" ) {
name: "table"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2 2 1,width 100,height 100"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "textAreaLabel"
"text": "JTextArea:"
"horizontalTextPosition": 10
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "textPaneLabel"
"text": "JTextPane:"
"horizontalTextPosition": 10
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "editorPaneLabel"
"text": "JEditorPane:"
"horizontalTextPosition": 10
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 3"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "customLabel"
"text": "Custom:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 3"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "textAreaScrollPane"
add( new FormComponent( "javax.swing.JTextArea" ) {
name: "textArea"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "textPaneScrollPane"
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "editorPaneScrollPane"
add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 4"
} )
add( new FormContainer( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$DebugScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "customScrollPane"
add( new FormComponent( "javax.swing.JButton" ) {
name: "button1"
"text": "I'm a large button, but do not implement Scrollable interface"
"preferredSize": new java.awt.Dimension( 800, 800 )
"horizontalAlignment": 10
"verticalAlignment": 1
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 4"
} )
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane1"
"$client.JScrollPane.smoothScrolling": false
add( new FormComponent( "com.formdev.flatlaf.testing.FlatSmoothScrollingTest$LineChartPanel" ) {
name: "lineChartPanel"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 5 4 1,width 100"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "label1" name: "label1"
"text": "X: time (200ms per line) / Y: scroll bar value (10% per line)" "text": "X: time (200ms per line) / Y: scroll bar value (10% per line)"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 6 4 1" "value": "cell 0 2"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "updateChartDelayedCheckBox" name: "updateChartDelayedCheckBox"
@@ -168,7 +209,7 @@ new FormModel {
"selected": true "selected": true
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "updateChartDelayedChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "updateChartDelayedChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 6 4 1,alignx right,growx 0" "value": "cell 0 2,alignx right,growx 0"
} ) } )
add( new FormComponent( "javax.swing.JButton" ) { add( new FormComponent( "javax.swing.JButton" ) {
name: "clearChartButton" name: "clearChartButton"
@@ -176,11 +217,11 @@ new FormModel {
"mnemonic": 67 "mnemonic": 67
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "clearChart", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "clearChart", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 6 4 1,alignx right,growx 0" "value": "cell 0 2,alignx right,growx 0"
} ) } )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 790, 715 ) "size": new java.awt.Dimension( 875, 715 )
} ) } )
} }
} }