ToolBar and ToolBarSeparator implementation

This commit is contained in:
Karl Tauber
2019-09-04 19:10:48 +02:00
parent a15e21b6c1
commit 6512ede8b1
9 changed files with 546 additions and 16 deletions

View File

@@ -126,6 +126,11 @@ public class FlatComponentsTest
JScrollPane scrollPane14 = new JScrollPane();
progressBar3 = new JProgressBar();
progressBar4 = new JProgressBar();
JToolBar toolBar2 = new JToolBar();
JButton button9 = new JButton();
JButton button10 = new JButton();
JButton button11 = new JButton();
JToggleButton toggleButton7 = new JToggleButton();
JLabel scrollBarLabel = new JLabel();
JScrollBar scrollBar1 = new JScrollBar();
JScrollBar scrollBar4 = new JScrollBar();
@@ -142,6 +147,13 @@ public class FlatComponentsTest
indeterminateCheckBox = new JCheckBox();
JLabel toolTipLabel = new JLabel();
JToolTip toolTip1 = new JToolTip();
JLabel toolBarLabel = new JLabel();
JToolBar toolBar1 = new JToolBar();
JButton button4 = new JButton();
JButton button6 = new JButton();
JButton button7 = new JButton();
JButton button8 = new JButton();
JToggleButton toggleButton6 = new JToggleButton();
//======== this ========
setLayout(new MigLayout(
@@ -173,6 +185,7 @@ public class FlatComponentsTest
"[]" +
"[]" +
"[]" +
"[]" +
"[]"));
//---- labelLabel ----
@@ -613,6 +626,29 @@ public class FlatComponentsTest
progressBar4.setStringPainted(true);
add(progressBar4, "cell 4 12 1 4,growy");
//======== toolBar2 ========
{
toolBar2.setOrientation(SwingConstants.VERTICAL);
//---- button9 ----
button9.setIcon(UIManager.getIcon("Tree.closedIcon"));
toolBar2.add(button9);
//---- button10 ----
button10.setIcon(UIManager.getIcon("Tree.openIcon"));
toolBar2.add(button10);
toolBar2.addSeparator();
//---- button11 ----
button11.setIcon(UIManager.getIcon("Tree.leafIcon"));
toolBar2.add(button11);
//---- toggleButton7 ----
toggleButton7.setIcon(UIManager.getIcon("Tree.closedIcon"));
toolBar2.add(toggleButton7);
}
add(toolBar2, "cell 4 12 1 4,growy");
//---- scrollBarLabel ----
scrollBarLabel.setText("JScrollBar:");
add(scrollBarLabel, "cell 0 13");
@@ -686,6 +722,39 @@ public class FlatComponentsTest
//---- toolTip1 ----
toolTip1.setTipText("Some text in tool tip.");
add(toolTip1, "cell 1 19 3 1");
//---- toolBarLabel ----
toolBarLabel.setText("JToolBar:");
add(toolBarLabel, "cell 0 20");
//======== toolBar1 ========
{
//---- button4 ----
button4.setIcon(UIManager.getIcon("Tree.closedIcon"));
toolBar1.add(button4);
//---- button6 ----
button6.setIcon(UIManager.getIcon("Tree.openIcon"));
toolBar1.add(button6);
toolBar1.addSeparator();
//---- button7 ----
button7.setIcon(UIManager.getIcon("Tree.leafIcon"));
toolBar1.add(button7);
toolBar1.addSeparator();
//---- button8 ----
button8.setText("Text");
button8.setIcon(UIManager.getIcon("Tree.expandedIcon"));
toolBar1.add(button8);
//---- toggleButton6 ----
toggleButton6.setText("Toggle");
toggleButton6.setIcon(UIManager.getIcon("Tree.leafIcon"));
toolBar1.add(toggleButton6);
}
add(toolBar1, "cell 1 20 3 1,growx");
// 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 ) {
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
"$columnConstraints": "[][][][][][]"
"$rowConstraints": "[][][][][][][][][][][][][][][][][][][][]"
"$rowConstraints": "[][][][][][][][][][][][][][][][][][][][][]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
@@ -573,6 +573,31 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 12 1 4,growy"
} )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "toolBar2"
"orientation": 1
add( new FormComponent( "javax.swing.JButton" ) {
name: "button9"
"icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button10"
"icon": &SwingIcon1 new com.jformdesigner.model.SwingIcon( 2, "Tree.openIcon" )
} )
add( new FormComponent( "javax.swing.JToolBar$Separator" ) {
name: "separator5"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button11"
"icon": &SwingIcon2 new com.jformdesigner.model.SwingIcon( 2, "Tree.leafIcon" )
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton7"
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 12 1 4,growy"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "scrollBarLabel"
"text": "JScrollBar:"
@@ -690,6 +715,45 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 19 3 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "toolBarLabel"
"text": "JToolBar:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 20"
} )
add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) {
name: "toolBar1"
add( new FormComponent( "javax.swing.JButton" ) {
name: "button4"
"icon": #SwingIcon0
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button6"
"icon": #SwingIcon1
} )
add( new FormComponent( "javax.swing.JToolBar$Separator" ) {
name: "separator3"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button7"
"icon": #SwingIcon2
} )
add( new FormComponent( "javax.swing.JToolBar$Separator" ) {
name: "separator4"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button8"
"text": "Text"
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.expandedIcon" )
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton6"
"text": "Toggle"
"icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.leafIcon" )
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 20 3 1,growx"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 790, 715 )