ScrollBar: show decrease/increase arrow buttons if client property "JScrollBar.showButtons" is set to true on JScrollPane or JScrollBar (issue #25)

This commit is contained in:
Karl Tauber
2019-12-03 10:53:39 +01:00
parent 2cc8327a08
commit 48e38b2855
10 changed files with 341 additions and 115 deletions

View File

@@ -3,6 +3,9 @@ FlatLaf Change Log
## Unreleased ## Unreleased
- ScrollBar: Show decrease/increase arrow buttons if client property
"JScrollBar.showButtons" is set to `true` on `JScrollPane` or `JScrollBar`.
(issue #25)
- `FlatLaf.isNativeLookAndFeel()` now returns `false`. - `FlatLaf.isNativeLookAndFeel()` now returns `false`.
- Button: Optionally support gradient borders, gradient backgrounds and shadows - Button: Optionally support gradient borders, gradient backgrounds and shadows
for improved compatibility with IntelliJ platform themes (e.g. for Vuesion, for improved compatibility with IntelliJ platform themes (e.g. for Vuesion,

View File

@@ -30,6 +30,14 @@ public interface FlatClientProperties
String SELECTED_STATE = "JButton.selectedState"; String SELECTED_STATE = "JButton.selectedState";
String SELECTED_STATE_INDETERMINATE = "indeterminate"; String SELECTED_STATE_INDETERMINATE = "indeterminate";
/**
* Specifies whether the decrease/increase arrow buttons of a scrollbar are shown.
* <p>
* <strong>Component</strong> {@link javax.swing.JScrollBar} or {@link javax.swing.JScrollPane}<br>
* <strong>Value type</strong> {@link java.lang.Boolean}
*/
String SCROLL_BAR_SHOW_BUTTONS = "JScrollBar.showButtons";
String TABBED_PANE_HAS_FULL_BORDER = "JTabbedPane.hasFullBorder"; String TABBED_PANE_HAS_FULL_BORDER = "JTabbedPane.hasFullBorder";
/** /**

View File

@@ -38,12 +38,15 @@ public class FlatArrowButton
extends BasicArrowButton extends BasicArrowButton
implements UIResource implements UIResource
{ {
public static final int DEFAULT_ARROW_WIDTH = 8;
private final boolean chevron; private final boolean chevron;
private final Color foreground; private final Color foreground;
private final Color disabledForeground; private final Color disabledForeground;
private final Color hoverForeground; private final Color hoverForeground;
private final Color hoverBackground; private final Color hoverBackground;
private int arrowWidth = DEFAULT_ARROW_WIDTH;
private int xOffset = 0; private int xOffset = 0;
private int yOffset = 0; private int yOffset = 0;
@@ -80,6 +83,14 @@ public class FlatArrowButton
} }
} }
public int getArrowWidth() {
return arrowWidth;
}
public void setArrowWidth( int arrowWidth ) {
this.arrowWidth = arrowWidth;
}
protected boolean isHover() { protected boolean isHover() {
return hover; return hover;
} }
@@ -128,8 +139,8 @@ public class FlatArrowButton
int direction = getDirection(); int direction = getDirection();
boolean vert = (direction == NORTH || direction == SOUTH); boolean vert = (direction == NORTH || direction == SOUTH);
int w = scale( chevron ? 8 : 9 ); int w = scale( arrowWidth + (chevron ? 0 : 1) );
int h = scale( chevron ? 4 : 5 ); int h = scale( (arrowWidth / 2) + (chevron ? 0 : 1) );
int rw = vert ? w : h; int rw = vert ? w : h;
int rh = vert ? h : w; int rh = vert ? h : w;
int x = Math.round( (width - rw) / 2f + scale( (float) xOffset ) ); int x = Math.round( (width - rw) / 2f + scale( (float) xOffset ) );

View File

@@ -22,11 +22,16 @@ import java.awt.Graphics;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Objects;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicScrollBarUI; import javax.swing.plaf.basic.BasicScrollBarUI;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.util.UIScale; import com.formdev.flatlaf.util.UIScale;
/** /**
@@ -38,13 +43,20 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault ScrollBar.foreground Color * @uiDefault ScrollBar.foreground Color
* @uiDefault ScrollBar.track Color * @uiDefault ScrollBar.track Color
* @uiDefault ScrollBar.thumb Color * @uiDefault ScrollBar.thumb Color
* @uiDefault ScrollBar.hoverTrackColor Color
* @uiDefault ScrollBar.hoverThumbColor Color
* @uiDefault ScrollBar.width int * @uiDefault ScrollBar.width int
* @uiDefault ScrollBar.minimumThumbSize Dimension * @uiDefault ScrollBar.minimumThumbSize Dimension
* @uiDefault ScrollBar.maximumThumbSize Dimension * @uiDefault ScrollBar.maximumThumbSize Dimension
* @uiDefault ScrollBar.allowsAbsolutePositioning boolean * @uiDefault ScrollBar.allowsAbsolutePositioning boolean
* *
* <!-- FlatScrollBarUI -->
*
* @uiDefault ScrollBar.hoverTrackColor Color
* @uiDefault ScrollBar.hoverThumbColor Color
* @uiDefault Component.arrowType String triangle (default) or chevron
* @uiDefault ScrollBar.showButtons boolean
* @uiDefault ScrollBar.buttonArrowColor Color
* @uiDefault ScrollBar.buttonDisabledArrowColor Color
*
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatScrollBarUI public class FlatScrollBarUI
@@ -53,6 +65,11 @@ public class FlatScrollBarUI
protected Color hoverTrackColor; protected Color hoverTrackColor;
protected Color hoverThumbColor; protected Color hoverThumbColor;
protected boolean showButtons;
protected String arrowType;
protected Color buttonArrowColor;
protected Color buttonDisabledArrowColor;
private MouseAdapter hoverListener; private MouseAdapter hoverListener;
private boolean hoverTrack; private boolean hoverTrack;
private boolean hoverThumb; private boolean hoverThumb;
@@ -85,6 +102,11 @@ public class FlatScrollBarUI
hoverTrackColor = UIManager.getColor( "ScrollBar.hoverTrackColor" ); hoverTrackColor = UIManager.getColor( "ScrollBar.hoverTrackColor" );
hoverThumbColor = UIManager.getColor( "ScrollBar.hoverThumbColor" ); hoverThumbColor = UIManager.getColor( "ScrollBar.hoverThumbColor" );
showButtons = UIManager.getBoolean( "ScrollBar.showButtons" );
arrowType = UIManager.getString( "Component.arrowType" );
buttonArrowColor = UIManager.getColor( "ScrollBar.buttonArrowColor" );
buttonDisabledArrowColor = UIManager.getColor( "ScrollBar.buttonDisabledArrowColor" );
} }
@Override @Override
@@ -93,6 +115,24 @@ public class FlatScrollBarUI
hoverTrackColor = null; hoverTrackColor = null;
hoverThumbColor = null; hoverThumbColor = null;
buttonArrowColor = null;
buttonDisabledArrowColor = null;
}
@Override
protected PropertyChangeListener createPropertyChangeListener() {
return new BasicScrollBarUI.PropertyChangeHandler() {
@Override
public void propertyChange( PropertyChangeEvent e ) {
super.propertyChange( e );
if( FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS.equals( e.getPropertyName() ) ) {
scrollbar.revalidate();
scrollbar.repaint();
}
}
};
} }
@Override @Override
@@ -102,24 +142,50 @@ public class FlatScrollBarUI
@Override @Override
protected JButton createDecreaseButton( int orientation ) { protected JButton createDecreaseButton( int orientation ) {
return createInvisibleButton(); return createArrowButton( orientation );
} }
@Override @Override
protected JButton createIncreaseButton( int orientation ) { protected JButton createIncreaseButton( int orientation ) {
return createInvisibleButton(); return createArrowButton( orientation );
} }
private JButton createInvisibleButton() { private JButton createArrowButton( int orientation ) {
JButton button = new JButton(); FlatArrowButton button = new FlatArrowButton( orientation,
button.setMinimumSize( new Dimension() ); arrowType, buttonArrowColor, buttonDisabledArrowColor, null, hoverTrackColor )
button.setMaximumSize( new Dimension() ); {
button.setPreferredSize( new Dimension() ); @Override
public Dimension getPreferredSize() {
if( isShowButtons() ) {
int w = UIScale.scale( scrollBarWidth );
return new Dimension( w, w );
} else
return new Dimension();
}
@Override
public Dimension getMinimumSize() {
return isShowButtons() ? super.getMinimumSize() : new Dimension();
}
@Override
public Dimension getMaximumSize() {
return isShowButtons() ? super.getMaximumSize() : new Dimension();
}
};
button.setArrowWidth( FlatArrowButton.DEFAULT_ARROW_WIDTH - 2 );
button.setFocusable( false ); button.setFocusable( false );
button.setRequestFocusEnabled( false ); button.setRequestFocusEnabled( false );
return button; return button;
} }
private boolean isShowButtons() {
Object showButtons = scrollbar.getClientProperty( FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS );
if( showButtons == null && scrollbar.getParent() instanceof JScrollPane )
showButtons = ((JScrollPane)scrollbar.getParent()).getClientProperty( FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS );
return (showButtons != null) ? Objects.equals( showButtons, true ) : this.showButtons;
}
@Override @Override
protected void paintDecreaseHighlight( Graphics g ) { protected void paintDecreaseHighlight( Graphics g ) {
// do not paint // do not paint

View File

@@ -24,13 +24,16 @@ import java.awt.event.ContainerListener;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.FocusListener; import java.awt.event.FocusListener;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JViewport; import javax.swing.JViewport;
import javax.swing.LookAndFeel; import javax.swing.LookAndFeel;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicScrollPaneUI; import javax.swing.plaf.basic.BasicScrollPaneUI;
import com.formdev.flatlaf.FlatClientProperties;
/** /**
* Provides the Flat LaF UI delegate for {@link javax.swing.JScrollPane}. * Provides the Flat LaF UI delegate for {@link javax.swing.JScrollPane}.
@@ -87,6 +90,29 @@ public class FlatScrollPaneUI
handler = null; handler = null;
} }
@Override
protected PropertyChangeListener createPropertyChangeListener() {
return new BasicScrollPaneUI.PropertyChangeHandler() {
@Override
public void propertyChange( PropertyChangeEvent e ) {
super.propertyChange( e );
if( FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS.equals( e.getPropertyName() ) ) {
JScrollBar vsb = scrollpane.getVerticalScrollBar();
JScrollBar hsb = scrollpane.getHorizontalScrollBar();
if( vsb != null ) {
vsb.revalidate();
vsb.repaint();
}
if( hsb != null ) {
hsb.revalidate();
hsb.repaint();
}
}
}
};
}
public Handler getHandler() { public Handler getHandler() {
if( handler == null ) if( handler == null )
handler = new Handler(); handler = new Handler();

View File

@@ -262,6 +262,10 @@ RadioButtonMenuItem.margin=2,2,2,2
#---- ScrollBar ---- #---- ScrollBar ----
ScrollBar.width=10 ScrollBar.width=10
ScrollBar.showButtons=false
ScrollBar.squareButtons=false
ScrollBar.buttonArrowColor=@@ComboBox.buttonArrowColor
ScrollBar.buttonDisabledArrowColor=@@ComboBox.buttonDisabledArrowColor
#---- ScrollPane ---- #---- ScrollPane ----

View File

@@ -46,6 +46,8 @@ class MoreComponentsPanel
JPanel panel1 = new JPanel(); JPanel panel1 = new JPanel();
JScrollBar scrollBar2 = new JScrollBar(); JScrollBar scrollBar2 = new JScrollBar();
JScrollBar scrollBar3 = new JScrollBar(); JScrollBar scrollBar3 = new JScrollBar();
JScrollBar scrollBar7 = new JScrollBar();
JScrollBar scrollBar8 = new JScrollBar();
JSeparator separator2 = new JSeparator(); JSeparator separator2 = new JSeparator();
JSlider slider2 = new JSlider(); JSlider slider2 = new JSlider();
JSlider slider4 = new JSlider(); JSlider slider4 = new JSlider();
@@ -60,6 +62,8 @@ class MoreComponentsPanel
JLabel scrollBarLabel = new JLabel(); JLabel scrollBarLabel = new JLabel();
JScrollBar scrollBar1 = new JScrollBar(); JScrollBar scrollBar1 = new JScrollBar();
JScrollBar scrollBar4 = new JScrollBar(); JScrollBar scrollBar4 = new JScrollBar();
JScrollBar scrollBar5 = new JScrollBar();
JScrollBar scrollBar6 = new JScrollBar();
JLabel separatorLabel = new JLabel(); JLabel separatorLabel = new JLabel();
JSeparator separator1 = new JSeparator(); JSeparator separator1 = new JSeparator();
JPanel panel2 = new JPanel(); JPanel panel2 = new JPanel();
@@ -102,6 +106,8 @@ class MoreComponentsPanel
"[]" + "[]" +
"[]" + "[]" +
"[]" + "[]" +
"[]" +
"[]" +
"[]")); "[]"));
//---- scrollPaneLabel ---- //---- scrollPaneLabel ----
@@ -121,20 +127,29 @@ class MoreComponentsPanel
scrollPane13.setViewportView(panel1); scrollPane13.setViewportView(panel1);
} }
add(scrollPane13, "cell 1 0,grow,width 70,height 70"); add(scrollPane13, "cell 1 0,grow,width 70,height 70");
add(scrollBar2, "cell 2 0 1 4,growy"); add(scrollBar2, "cell 2 0 1 6,growy");
//---- scrollBar3 ---- //---- scrollBar3 ----
scrollBar3.setEnabled(false); scrollBar3.setEnabled(false);
add(scrollBar3, "cell 2 0 1 4,growy"); add(scrollBar3, "cell 2 0 1 6,growy");
//---- scrollBar7 ----
scrollBar7.putClientProperty("JScrollBar.showButtons", true);
add(scrollBar7, "cell 2 0 1 6,growy");
//---- scrollBar8 ----
scrollBar8.setEnabled(false);
scrollBar8.putClientProperty("JScrollBar.showButtons", true);
add(scrollBar8, "cell 2 0 1 6,growy");
//---- separator2 ---- //---- separator2 ----
separator2.setOrientation(SwingConstants.VERTICAL); separator2.setOrientation(SwingConstants.VERTICAL);
add(separator2, "cell 2 0 1 4,growy"); add(separator2, "cell 2 0 1 6,growy");
//---- slider2 ---- //---- slider2 ----
slider2.setOrientation(SwingConstants.VERTICAL); slider2.setOrientation(SwingConstants.VERTICAL);
slider2.setValue(30); slider2.setValue(30);
add(slider2, "cell 2 0 1 4,growy"); add(slider2, "cell 2 0 1 6,growy");
//---- slider4 ---- //---- slider4 ----
slider4.setMinorTickSpacing(10); slider4.setMinorTickSpacing(10);
@@ -143,19 +158,19 @@ class MoreComponentsPanel
slider4.setPaintLabels(true); slider4.setPaintLabels(true);
slider4.setOrientation(SwingConstants.VERTICAL); slider4.setOrientation(SwingConstants.VERTICAL);
slider4.setValue(30); slider4.setValue(30);
add(slider4, "cell 2 0 1 4,growy"); add(slider4, "cell 2 0 1 6,growy");
add(scrollPane14, "cell 3 0,grow"); add(scrollPane14, "cell 3 0,grow");
//---- progressBar3 ---- //---- progressBar3 ----
progressBar3.setOrientation(SwingConstants.VERTICAL); progressBar3.setOrientation(SwingConstants.VERTICAL);
progressBar3.setValue(50); progressBar3.setValue(50);
add(progressBar3, "cell 4 0 1 4,growy"); add(progressBar3, "cell 4 0 1 6,growy");
//---- progressBar4 ---- //---- progressBar4 ----
progressBar4.setOrientation(SwingConstants.VERTICAL); progressBar4.setOrientation(SwingConstants.VERTICAL);
progressBar4.setValue(55); progressBar4.setValue(55);
progressBar4.setStringPainted(true); progressBar4.setStringPainted(true);
add(progressBar4, "cell 4 0 1 4,growy"); add(progressBar4, "cell 4 0 1 6,growy");
//======== toolBar2 ======== //======== toolBar2 ========
{ {
@@ -178,7 +193,7 @@ class MoreComponentsPanel
toggleButton7.setIcon(UIManager.getIcon("Tree.closedIcon")); toggleButton7.setIcon(UIManager.getIcon("Tree.closedIcon"));
toolBar2.add(toggleButton7); toolBar2.add(toggleButton7);
} }
add(toolBar2, "cell 4 0 1 4,growy"); add(toolBar2, "cell 4 0 1 6,growy");
//---- scrollBarLabel ---- //---- scrollBarLabel ----
scrollBarLabel.setText("JScrollBar:"); scrollBarLabel.setText("JScrollBar:");
@@ -193,30 +208,41 @@ class MoreComponentsPanel
scrollBar4.setEnabled(false); scrollBar4.setEnabled(false);
add(scrollBar4, "cell 1 2,growx"); add(scrollBar4, "cell 1 2,growx");
//---- scrollBar5 ----
scrollBar5.setOrientation(Adjustable.HORIZONTAL);
scrollBar5.putClientProperty("JScrollBar.showButtons", true);
add(scrollBar5, "cell 1 3,growx");
//---- scrollBar6 ----
scrollBar6.setOrientation(Adjustable.HORIZONTAL);
scrollBar6.setEnabled(false);
scrollBar6.putClientProperty("JScrollBar.showButtons", true);
add(scrollBar6, "cell 1 4,growx");
//---- separatorLabel ---- //---- separatorLabel ----
separatorLabel.setText("JSeparator:"); separatorLabel.setText("JSeparator:");
add(separatorLabel, "cell 0 3"); add(separatorLabel, "cell 0 5");
add(separator1, "cell 1 3,growx"); add(separator1, "cell 1 5,growx");
//======== panel2 ======== //======== panel2 ========
{ {
panel2.setBorder(new TitledBorder("TitledBorder")); panel2.setBorder(new TitledBorder("TitledBorder"));
panel2.setLayout(new FlowLayout()); panel2.setLayout(new FlowLayout());
} }
add(panel2, "cell 3 3,grow"); add(panel2, "cell 3 5,grow");
//---- sliderLabel ---- //---- sliderLabel ----
sliderLabel.setText("JSlider:"); sliderLabel.setText("JSlider:");
add(sliderLabel, "cell 0 4"); add(sliderLabel, "cell 0 6");
//---- slider1 ---- //---- slider1 ----
slider1.setValue(30); slider1.setValue(30);
add(slider1, "cell 1 4 3 1,aligny top,grow 100 0"); add(slider1, "cell 1 6 3 1,aligny top,grow 100 0");
//---- slider6 ---- //---- slider6 ----
slider6.setEnabled(false); slider6.setEnabled(false);
slider6.setValue(30); slider6.setValue(30);
add(slider6, "cell 1 4 3 1,aligny top,growy 0"); add(slider6, "cell 1 6 3 1,aligny top,growy 0");
//---- slider3 ---- //---- slider3 ----
slider3.setMinorTickSpacing(10); slider3.setMinorTickSpacing(10);
@@ -224,7 +250,7 @@ class MoreComponentsPanel
slider3.setMajorTickSpacing(50); slider3.setMajorTickSpacing(50);
slider3.setPaintLabels(true); slider3.setPaintLabels(true);
slider3.setValue(30); slider3.setValue(30);
add(slider3, "cell 1 5 3 1,aligny top,grow 100 0"); add(slider3, "cell 1 7 3 1,aligny top,grow 100 0");
//---- slider5 ---- //---- slider5 ----
slider5.setMinorTickSpacing(10); slider5.setMinorTickSpacing(10);
@@ -233,41 +259,41 @@ class MoreComponentsPanel
slider5.setPaintLabels(true); slider5.setPaintLabels(true);
slider5.setEnabled(false); slider5.setEnabled(false);
slider5.setValue(30); slider5.setValue(30);
add(slider5, "cell 1 5 3 1,aligny top,growy 0"); add(slider5, "cell 1 7 3 1,aligny top,growy 0");
//---- progressBarLabel ---- //---- progressBarLabel ----
progressBarLabel.setText("JProgressBar:"); progressBarLabel.setText("JProgressBar:");
add(progressBarLabel, "cell 0 6"); add(progressBarLabel, "cell 0 8");
//---- progressBar1 ---- //---- progressBar1 ----
progressBar1.setValue(50); progressBar1.setValue(50);
add(progressBar1, "cell 1 6 3 1,growx"); add(progressBar1, "cell 1 8 3 1,growx");
//---- progressBar2 ---- //---- progressBar2 ----
progressBar2.setStringPainted(true); progressBar2.setStringPainted(true);
progressBar2.setValue(55); progressBar2.setValue(55);
add(progressBar2, "cell 1 6 3 1,growx"); add(progressBar2, "cell 1 8 3 1,growx");
//---- indeterminateCheckBox ---- //---- indeterminateCheckBox ----
indeterminateCheckBox.setText("indeterminate"); indeterminateCheckBox.setText("indeterminate");
indeterminateCheckBox.addActionListener(e -> indeterminateCheckBoxActionPerformed()); indeterminateCheckBox.addActionListener(e -> indeterminateCheckBoxActionPerformed());
add(indeterminateCheckBox, "cell 4 6"); add(indeterminateCheckBox, "cell 4 8");
//---- toolTipLabel ---- //---- toolTipLabel ----
toolTipLabel.setText("JToolTip:"); toolTipLabel.setText("JToolTip:");
add(toolTipLabel, "cell 0 7"); add(toolTipLabel, "cell 0 9");
//---- toolTip1 ---- //---- toolTip1 ----
toolTip1.setTipText("Some text in tool tip."); toolTip1.setTipText("Some text in tool tip.");
add(toolTip1, "cell 1 7 3 1"); add(toolTip1, "cell 1 9 3 1");
//---- toolTip2 ---- //---- toolTip2 ----
toolTip2.setTipText("Tool tip with\nmultiple\nlines."); toolTip2.setTipText("Tool tip with\nmultiple\nlines.");
add(toolTip2, "cell 1 7 3 1"); add(toolTip2, "cell 1 9 3 1");
//---- toolBarLabel ---- //---- toolBarLabel ----
toolBarLabel.setText("JToolBar:"); toolBarLabel.setText("JToolBar:");
add(toolBarLabel, "cell 0 8"); add(toolBarLabel, "cell 0 10");
//======== toolBar1 ======== //======== toolBar1 ========
{ {
@@ -297,7 +323,7 @@ class MoreComponentsPanel
toggleButton6.setSelected(true); toggleButton6.setSelected(true);
toolBar1.add(toggleButton6); toolBar1.add(toggleButton6);
} }
add(toolBar1, "cell 1 8 3 1,growx"); add(toolBar1, "cell 1 10 3 1,growx");
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
} }

View File

@@ -9,7 +9,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": "hidemode 3" "$layoutConstraints": "hidemode 3"
"$columnConstraints": "[][][][][][]" "$columnConstraints": "[][][][][][]"
"$rowConstraints": "[][][][][][][][][]" "$rowConstraints": "[][][][][][][][][][][]"
} ) { } ) {
name: "this" name: "this"
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
@@ -32,26 +32,39 @@ new FormModel {
add( new FormComponent( "javax.swing.JScrollBar" ) { add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar2" name: "scrollBar2"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0 1 4,growy" "value": "cell 2 0 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JScrollBar" ) { add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar3" name: "scrollBar3"
"enabled": false "enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0 1 4,growy" "value": "cell 2 0 1 6,growy"
} )
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar7"
"$client.JScrollBar.showButtons": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0 1 6,growy"
} )
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar8"
"enabled": false
"$client.JScrollBar.showButtons": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JSeparator" ) { add( new FormComponent( "javax.swing.JSeparator" ) {
name: "separator2" name: "separator2"
"orientation": 1 "orientation": 1
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0 1 4,growy" "value": "cell 2 0 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider2" name: "slider2"
"orientation": 1 "orientation": 1
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0 1 4,growy" "value": "cell 2 0 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider4" name: "slider4"
@@ -62,7 +75,7 @@ new FormModel {
"orientation": 1 "orientation": 1
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0 1 4,growy" "value": "cell 2 0 1 6,growy"
} ) } )
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane14" name: "scrollPane14"
@@ -77,7 +90,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 4 0 1 4,growy" "value": "cell 4 0 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JProgressBar" ) { add( new FormComponent( "javax.swing.JProgressBar" ) {
name: "progressBar4" name: "progressBar4"
@@ -88,7 +101,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 4 0 1 4,growy" "value": "cell 4 0 1 6,growy"
} ) } )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "toolBar2" name: "toolBar2"
@@ -113,7 +126,7 @@ new FormModel {
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" ) "icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 0 1 4,growy" "value": "cell 4 0 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "scrollBarLabel" name: "scrollBarLabel"
@@ -134,41 +147,56 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2,growx" "value": "cell 1 2,growx"
} ) } )
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar5"
"orientation": 0
"$client.JScrollBar.showButtons": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3,growx"
} )
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar6"
"orientation": 0
"enabled": false
"$client.JScrollBar.showButtons": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4,growx"
} )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "separatorLabel" name: "separatorLabel"
"text": "JSeparator:" "text": "JSeparator:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3" "value": "cell 0 5"
} ) } )
add( new FormComponent( "javax.swing.JSeparator" ) { add( new FormComponent( "javax.swing.JSeparator" ) {
name: "separator1" name: "separator1"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3,growx" "value": "cell 1 5,growx"
} ) } )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
name: "panel2" name: "panel2"
"border": new javax.swing.border.TitledBorder( "TitledBorder" ) "border": new javax.swing.border.TitledBorder( "TitledBorder" )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 3,grow" "value": "cell 3 5,grow"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "sliderLabel" name: "sliderLabel"
"text": "JSlider:" "text": "JSlider:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4" "value": "cell 0 6"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider1" name: "slider1"
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4 3 1,aligny top,grow 100 0" "value": "cell 1 6 3 1,aligny top,grow 100 0"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider6" name: "slider6"
"enabled": false "enabled": false
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4 3 1,aligny top,growy 0" "value": "cell 1 6 3 1,aligny top,growy 0"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider3" name: "slider3"
@@ -178,7 +206,7 @@ new FormModel {
"paintLabels": true "paintLabels": true
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5 3 1,aligny top,grow 100 0" "value": "cell 1 7 3 1,aligny top,grow 100 0"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider5" name: "slider5"
@@ -189,13 +217,13 @@ new FormModel {
"enabled": false "enabled": false
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5 3 1,aligny top,growy 0" "value": "cell 1 7 3 1,aligny top,growy 0"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "progressBarLabel" name: "progressBarLabel"
"text": "JProgressBar:" "text": "JProgressBar:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 6" "value": "cell 0 8"
} ) } )
add( new FormComponent( "javax.swing.JProgressBar" ) { add( new FormComponent( "javax.swing.JProgressBar" ) {
name: "progressBar1" name: "progressBar1"
@@ -204,7 +232,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 1 6 3 1,growx" "value": "cell 1 8 3 1,growx"
} ) } )
add( new FormComponent( "javax.swing.JProgressBar" ) { add( new FormComponent( "javax.swing.JProgressBar" ) {
name: "progressBar2" name: "progressBar2"
@@ -214,7 +242,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 1 6 3 1,growx" "value": "cell 1 8 3 1,growx"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "indeterminateCheckBox" name: "indeterminateCheckBox"
@@ -224,31 +252,31 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "indeterminateCheckBoxActionPerformed", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "indeterminateCheckBoxActionPerformed", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 6" "value": "cell 4 8"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "toolTipLabel" name: "toolTipLabel"
"text": "JToolTip:" "text": "JToolTip:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 7" "value": "cell 0 9"
} ) } )
add( new FormComponent( "javax.swing.JToolTip" ) { add( new FormComponent( "javax.swing.JToolTip" ) {
name: "toolTip1" name: "toolTip1"
"tipText": "Some text in tool tip." "tipText": "Some text in tool tip."
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 7 3 1" "value": "cell 1 9 3 1"
} ) } )
add( new FormComponent( "javax.swing.JToolTip" ) { add( new FormComponent( "javax.swing.JToolTip" ) {
name: "toolTip2" name: "toolTip2"
"tipText": "Tool tip with\nmultiple\nlines." "tipText": "Tool tip with\nmultiple\nlines."
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 7 3 1" "value": "cell 1 9 3 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "toolBarLabel" name: "toolBarLabel"
"text": "JToolBar:" "text": "JToolBar:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 8" "value": "cell 0 10"
} ) } )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "toolBar1" name: "toolBar1"
@@ -282,7 +310,7 @@ new FormModel {
"selected": true "selected": true
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 8 3 1,growx" "value": "cell 1 10 3 1,growx"
} ) } )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )

View File

@@ -135,6 +135,8 @@ public class FlatComponentsTest
JPanel panel1 = new JPanel(); JPanel panel1 = new JPanel();
JScrollBar scrollBar2 = new JScrollBar(); JScrollBar scrollBar2 = new JScrollBar();
JScrollBar scrollBar3 = new JScrollBar(); JScrollBar scrollBar3 = new JScrollBar();
JScrollBar scrollBar7 = new JScrollBar();
JScrollBar scrollBar8 = new JScrollBar();
JSeparator separator2 = new JSeparator(); JSeparator separator2 = new JSeparator();
JSlider slider2 = new JSlider(); JSlider slider2 = new JSlider();
JSlider slider4 = new JSlider(); JSlider slider4 = new JSlider();
@@ -156,6 +158,8 @@ public class FlatComponentsTest
JEditorPane editorPane6 = new JEditorPane(); JEditorPane editorPane6 = new JEditorPane();
JScrollPane scrollPane16 = new JScrollPane(); JScrollPane scrollPane16 = new JScrollPane();
JTextPane textPane6 = new JTextPane(); JTextPane textPane6 = new JTextPane();
JScrollBar scrollBar5 = new JScrollBar();
JScrollBar scrollBar6 = new JScrollBar();
JLabel separatorLabel = new JLabel(); JLabel separatorLabel = new JLabel();
JSeparator separator1 = new JSeparator(); JSeparator separator1 = new JSeparator();
JPanel panel2 = new JPanel(); JPanel panel2 = new JPanel();
@@ -211,6 +215,8 @@ public class FlatComponentsTest
"[]" + "[]" +
"[]" + "[]" +
"[]" + "[]" +
"[]" +
"[]" +
"[]")); "[]"));
//---- labelLabel ---- //---- labelLabel ----
@@ -695,20 +701,29 @@ public class FlatComponentsTest
scrollPane13.setViewportView(panel1); scrollPane13.setViewportView(panel1);
} }
add(scrollPane13, "cell 1 13,grow,width 70,height 70"); add(scrollPane13, "cell 1 13,grow,width 70,height 70");
add(scrollBar2, "cell 2 13 1 4,growy"); add(scrollBar2, "cell 2 13 1 6,growy");
//---- scrollBar3 ---- //---- scrollBar3 ----
scrollBar3.setEnabled(false); scrollBar3.setEnabled(false);
add(scrollBar3, "cell 2 13 1 4,growy"); add(scrollBar3, "cell 2 13 1 6,growy");
//---- scrollBar7 ----
scrollBar7.putClientProperty("JScrollBar.showButtons", true);
add(scrollBar7, "cell 2 13 1 6,growy");
//---- scrollBar8 ----
scrollBar8.setEnabled(false);
scrollBar8.putClientProperty("JScrollBar.showButtons", true);
add(scrollBar8, "cell 2 13 1 6,growy");
//---- separator2 ---- //---- separator2 ----
separator2.setOrientation(SwingConstants.VERTICAL); separator2.setOrientation(SwingConstants.VERTICAL);
add(separator2, "cell 2 13 1 4,growy"); add(separator2, "cell 2 13 1 6,growy");
//---- slider2 ---- //---- slider2 ----
slider2.setOrientation(SwingConstants.VERTICAL); slider2.setOrientation(SwingConstants.VERTICAL);
slider2.setValue(30); slider2.setValue(30);
add(slider2, "cell 2 13 1 4,growy"); add(slider2, "cell 2 13 1 6,growy");
//---- slider4 ---- //---- slider4 ----
slider4.setMinorTickSpacing(10); slider4.setMinorTickSpacing(10);
@@ -717,19 +732,19 @@ public class FlatComponentsTest
slider4.setPaintLabels(true); slider4.setPaintLabels(true);
slider4.setOrientation(SwingConstants.VERTICAL); slider4.setOrientation(SwingConstants.VERTICAL);
slider4.setValue(30); slider4.setValue(30);
add(slider4, "cell 2 13 1 4,growy"); add(slider4, "cell 2 13 1 6,growy");
add(scrollPane14, "cell 3 13,grow"); add(scrollPane14, "cell 3 13,grow");
//---- progressBar3 ---- //---- progressBar3 ----
progressBar3.setOrientation(SwingConstants.VERTICAL); progressBar3.setOrientation(SwingConstants.VERTICAL);
progressBar3.setValue(50); progressBar3.setValue(50);
add(progressBar3, "cell 4 13 1 4,growy"); add(progressBar3, "cell 4 13 1 6,growy");
//---- progressBar4 ---- //---- progressBar4 ----
progressBar4.setOrientation(SwingConstants.VERTICAL); progressBar4.setOrientation(SwingConstants.VERTICAL);
progressBar4.setValue(55); progressBar4.setValue(55);
progressBar4.setStringPainted(true); progressBar4.setStringPainted(true);
add(progressBar4, "cell 4 13 1 4,growy"); add(progressBar4, "cell 4 13 1 6,growy");
//======== toolBar2 ======== //======== toolBar2 ========
{ {
@@ -752,7 +767,7 @@ public class FlatComponentsTest
toggleButton7.setIcon(UIManager.getIcon("Tree.closedIcon")); toggleButton7.setIcon(UIManager.getIcon("Tree.closedIcon"));
toolBar2.add(toggleButton7); toolBar2.add(toggleButton7);
} }
add(toolBar2, "cell 4 13 1 4,growy"); add(toolBar2, "cell 4 13 1 6,growy");
//---- scrollBarLabel ---- //---- scrollBarLabel ----
scrollBarLabel.setText("JScrollBar:"); scrollBarLabel.setText("JScrollBar:");
@@ -807,12 +822,23 @@ public class FlatComponentsTest
} }
panel3.add(scrollPane16, "cell 0 2,grow"); panel3.add(scrollPane16, "cell 0 2,grow");
} }
add(panel3, "cell 5 15 1 7,aligny top,grow 100 0"); add(panel3, "cell 5 15 1 9,aligny top,grow 100 0");
//---- scrollBar5 ----
scrollBar5.setOrientation(Adjustable.HORIZONTAL);
scrollBar5.putClientProperty("JScrollBar.showButtons", true);
add(scrollBar5, "cell 1 16,growx");
//---- scrollBar6 ----
scrollBar6.setOrientation(Adjustable.HORIZONTAL);
scrollBar6.setEnabled(false);
scrollBar6.putClientProperty("JScrollBar.showButtons", true);
add(scrollBar6, "cell 1 17,growx");
//---- separatorLabel ---- //---- separatorLabel ----
separatorLabel.setText("JSeparator:"); separatorLabel.setText("JSeparator:");
add(separatorLabel, "cell 0 16"); add(separatorLabel, "cell 0 18");
add(separator1, "cell 1 16,growx"); add(separator1, "cell 1 18,growx");
//======== panel2 ======== //======== panel2 ========
{ {
@@ -820,20 +846,20 @@ public class FlatComponentsTest
panel2.setOpaque(false); panel2.setOpaque(false);
panel2.setLayout(new FlowLayout()); panel2.setLayout(new FlowLayout());
} }
add(panel2, "cell 3 16,grow"); add(panel2, "cell 3 18,grow");
//---- sliderLabel ---- //---- sliderLabel ----
sliderLabel.setText("JSlider:"); sliderLabel.setText("JSlider:");
add(sliderLabel, "cell 0 17"); add(sliderLabel, "cell 0 19");
//---- slider1 ---- //---- slider1 ----
slider1.setValue(30); slider1.setValue(30);
add(slider1, "cell 1 17 3 1,aligny top,grow 100 0"); add(slider1, "cell 1 19 3 1,aligny top,grow 100 0");
//---- slider6 ---- //---- slider6 ----
slider6.setEnabled(false); slider6.setEnabled(false);
slider6.setValue(30); slider6.setValue(30);
add(slider6, "cell 1 17 3 1,aligny top,growy 0"); add(slider6, "cell 1 19 3 1,aligny top,growy 0");
//---- slider3 ---- //---- slider3 ----
slider3.setMinorTickSpacing(10); slider3.setMinorTickSpacing(10);
@@ -841,7 +867,7 @@ public class FlatComponentsTest
slider3.setMajorTickSpacing(50); slider3.setMajorTickSpacing(50);
slider3.setPaintLabels(true); slider3.setPaintLabels(true);
slider3.setValue(30); slider3.setValue(30);
add(slider3, "cell 1 18 3 1,aligny top,grow 100 0"); add(slider3, "cell 1 20 3 1,aligny top,grow 100 0");
//---- slider5 ---- //---- slider5 ----
slider5.setMinorTickSpacing(10); slider5.setMinorTickSpacing(10);
@@ -850,41 +876,41 @@ public class FlatComponentsTest
slider5.setPaintLabels(true); slider5.setPaintLabels(true);
slider5.setEnabled(false); slider5.setEnabled(false);
slider5.setValue(30); slider5.setValue(30);
add(slider5, "cell 1 18 3 1,aligny top,growy 0"); add(slider5, "cell 1 20 3 1,aligny top,growy 0");
//---- progressBarLabel ---- //---- progressBarLabel ----
progressBarLabel.setText("JProgressBar:"); progressBarLabel.setText("JProgressBar:");
add(progressBarLabel, "cell 0 19"); add(progressBarLabel, "cell 0 21");
//---- progressBar1 ---- //---- progressBar1 ----
progressBar1.setValue(50); progressBar1.setValue(50);
add(progressBar1, "cell 1 19 3 1,growx"); add(progressBar1, "cell 1 21 3 1,growx");
//---- progressBar2 ---- //---- progressBar2 ----
progressBar2.setStringPainted(true); progressBar2.setStringPainted(true);
progressBar2.setValue(55); progressBar2.setValue(55);
add(progressBar2, "cell 1 19 3 1,growx"); add(progressBar2, "cell 1 21 3 1,growx");
//---- indeterminateCheckBox ---- //---- indeterminateCheckBox ----
indeterminateCheckBox.setText("indeterminate"); indeterminateCheckBox.setText("indeterminate");
indeterminateCheckBox.addActionListener(e -> indeterminateCheckBoxActionPerformed()); indeterminateCheckBox.addActionListener(e -> indeterminateCheckBoxActionPerformed());
add(indeterminateCheckBox, "cell 4 19"); add(indeterminateCheckBox, "cell 4 21");
//---- toolTipLabel ---- //---- toolTipLabel ----
toolTipLabel.setText("JToolTip:"); toolTipLabel.setText("JToolTip:");
add(toolTipLabel, "cell 0 20"); add(toolTipLabel, "cell 0 22");
//---- toolTip1 ---- //---- toolTip1 ----
toolTip1.setTipText("Some text in tool tip."); toolTip1.setTipText("Some text in tool tip.");
add(toolTip1, "cell 1 20 3 1"); add(toolTip1, "cell 1 22 3 1");
//---- toolTip2 ---- //---- toolTip2 ----
toolTip2.setTipText("Tool tip with\nmultiple\nlines."); toolTip2.setTipText("Tool tip with\nmultiple\nlines.");
add(toolTip2, "cell 1 20 3 1"); add(toolTip2, "cell 1 22 3 1");
//---- toolBarLabel ---- //---- toolBarLabel ----
toolBarLabel.setText("JToolBar:"); toolBarLabel.setText("JToolBar:");
add(toolBarLabel, "cell 0 21"); add(toolBarLabel, "cell 0 23");
//======== toolBar1 ======== //======== toolBar1 ========
{ {
@@ -914,7 +940,7 @@ public class FlatComponentsTest
toggleButton6.setSelected(true); toggleButton6.setSelected(true);
toolBar1.add(toggleButton6); toolBar1.add(toggleButton6);
} }
add(toolBar1, "cell 1 21 3 1,growx"); add(toolBar1, "cell 1 23 3 1,growx");
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
// BasicComboBoxRenderer customaRenderer = new BasicComboBoxRenderer(); // BasicComboBoxRenderer customaRenderer = new BasicComboBoxRenderer();

View File

@@ -9,7 +9,7 @@ new FormModel {
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": "[][][][][][]" "$columnConstraints": "[][][][][][]"
"$rowConstraints": "[][][][][][][][][][][][][][][][][][][][][][]" "$rowConstraints": "[][][][][][][][][][][][][][][][][][][][][][][][]"
} ) { } ) {
name: "this" name: "this"
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
@@ -620,26 +620,39 @@ new FormModel {
add( new FormComponent( "javax.swing.JScrollBar" ) { add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar2" name: "scrollBar2"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 13 1 4,growy" "value": "cell 2 13 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JScrollBar" ) { add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar3" name: "scrollBar3"
"enabled": false "enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 13 1 4,growy" "value": "cell 2 13 1 6,growy"
} )
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar7"
"$client.JScrollBar.showButtons": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 13 1 6,growy"
} )
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar8"
"enabled": false
"$client.JScrollBar.showButtons": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 13 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JSeparator" ) { add( new FormComponent( "javax.swing.JSeparator" ) {
name: "separator2" name: "separator2"
"orientation": 1 "orientation": 1
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 13 1 4,growy" "value": "cell 2 13 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider2" name: "slider2"
"orientation": 1 "orientation": 1
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 13 1 4,growy" "value": "cell 2 13 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider4" name: "slider4"
@@ -650,7 +663,7 @@ new FormModel {
"orientation": 1 "orientation": 1
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 13 1 4,growy" "value": "cell 2 13 1 6,growy"
} ) } )
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane14" name: "scrollPane14"
@@ -665,7 +678,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 4 13 1 4,growy" "value": "cell 4 13 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JProgressBar" ) { add( new FormComponent( "javax.swing.JProgressBar" ) {
name: "progressBar4" name: "progressBar4"
@@ -676,7 +689,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 4 13 1 4,growy" "value": "cell 4 13 1 6,growy"
} ) } )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "toolBar2" name: "toolBar2"
@@ -701,7 +714,7 @@ new FormModel {
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" ) "icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 13 1 4,growy" "value": "cell 4 13 1 6,growy"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "scrollBarLabel" name: "scrollBarLabel"
@@ -762,44 +775,59 @@ new FormModel {
"value": "cell 0 2,grow" "value": "cell 0 2,grow"
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 15 1 7,aligny top,grow 100 0" "value": "cell 5 15 1 9,aligny top,grow 100 0"
} )
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar5"
"orientation": 0
"$client.JScrollBar.showButtons": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 16,growx"
} )
add( new FormComponent( "javax.swing.JScrollBar" ) {
name: "scrollBar6"
"orientation": 0
"enabled": false
"$client.JScrollBar.showButtons": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 17,growx"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "separatorLabel" name: "separatorLabel"
"text": "JSeparator:" "text": "JSeparator:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 16" "value": "cell 0 18"
} ) } )
add( new FormComponent( "javax.swing.JSeparator" ) { add( new FormComponent( "javax.swing.JSeparator" ) {
name: "separator1" name: "separator1"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 16,growx" "value": "cell 1 18,growx"
} ) } )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
name: "panel2" name: "panel2"
"border": new javax.swing.border.TitledBorder( "TitledBorder" ) "border": new javax.swing.border.TitledBorder( "TitledBorder" )
"opaque": false "opaque": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 16,grow" "value": "cell 3 18,grow"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "sliderLabel" name: "sliderLabel"
"text": "JSlider:" "text": "JSlider:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 17" "value": "cell 0 19"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider1" name: "slider1"
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 17 3 1,aligny top,grow 100 0" "value": "cell 1 19 3 1,aligny top,grow 100 0"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider6" name: "slider6"
"enabled": false "enabled": false
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 17 3 1,aligny top,growy 0" "value": "cell 1 19 3 1,aligny top,growy 0"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider3" name: "slider3"
@@ -809,7 +837,7 @@ new FormModel {
"paintLabels": true "paintLabels": true
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 18 3 1,aligny top,grow 100 0" "value": "cell 1 20 3 1,aligny top,grow 100 0"
} ) } )
add( new FormComponent( "javax.swing.JSlider" ) { add( new FormComponent( "javax.swing.JSlider" ) {
name: "slider5" name: "slider5"
@@ -820,13 +848,13 @@ new FormModel {
"enabled": false "enabled": false
"value": 30 "value": 30
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 18 3 1,aligny top,growy 0" "value": "cell 1 20 3 1,aligny top,growy 0"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "progressBarLabel" name: "progressBarLabel"
"text": "JProgressBar:" "text": "JProgressBar:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 19" "value": "cell 0 21"
} ) } )
add( new FormComponent( "javax.swing.JProgressBar" ) { add( new FormComponent( "javax.swing.JProgressBar" ) {
name: "progressBar1" name: "progressBar1"
@@ -835,7 +863,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 1 19 3 1,growx" "value": "cell 1 21 3 1,growx"
} ) } )
add( new FormComponent( "javax.swing.JProgressBar" ) { add( new FormComponent( "javax.swing.JProgressBar" ) {
name: "progressBar2" name: "progressBar2"
@@ -845,7 +873,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 1 19 3 1,growx" "value": "cell 1 21 3 1,growx"
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "indeterminateCheckBox" name: "indeterminateCheckBox"
@@ -855,31 +883,31 @@ new FormModel {
} }
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "indeterminateCheckBoxActionPerformed", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "indeterminateCheckBoxActionPerformed", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 19" "value": "cell 4 21"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "toolTipLabel" name: "toolTipLabel"
"text": "JToolTip:" "text": "JToolTip:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 20" "value": "cell 0 22"
} ) } )
add( new FormComponent( "javax.swing.JToolTip" ) { add( new FormComponent( "javax.swing.JToolTip" ) {
name: "toolTip1" name: "toolTip1"
"tipText": "Some text in tool tip." "tipText": "Some text in tool tip."
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 20 3 1" "value": "cell 1 22 3 1"
} ) } )
add( new FormComponent( "javax.swing.JToolTip" ) { add( new FormComponent( "javax.swing.JToolTip" ) {
name: "toolTip2" name: "toolTip2"
"tipText": "Tool tip with\nmultiple\nlines." "tipText": "Tool tip with\nmultiple\nlines."
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 20 3 1" "value": "cell 1 22 3 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "toolBarLabel" name: "toolBarLabel"
"text": "JToolBar:" "text": "JToolBar:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 21" "value": "cell 0 23"
} ) } )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "toolBar1" name: "toolBar1"
@@ -913,7 +941,7 @@ new FormModel {
"selected": true "selected": true
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 21 3 1,growx" "value": "cell 1 23 3 1,growx"
} ) } )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )