The main JPanel provided by JSynthLib's PatchEditorFrame is named scrollPane . It is by default set to GridBagLayout, but you can also set it to use GridLayout using the setLayout method.
scrollPane.setLayout(new GridLayout(0,1));To decide what layout to use, read the chapters about GridLayout and GridbagLayout.
To add a JPanel to the scrollPane JPanel with a GridbagLayout, use a line like this:
scrollPane.add(yourPane,gbc);
where yourPane is the JPanel you created and gbc is a GridBagConstraints object (see GridBagConstraints below).
You can also add Sysex Widgets directly onto scrollPane. In that case you don't use a GridbagConstraints object because the gridx, gridy, gridheight and gridwidth values are given with the addWidget method.
If scrollPane uses GridLayout, the line would look like this:
scrollPane.add(yourPane);
Now the JPanel is added following the previous JPanel, using the number of rows/columns speciefied by the GridLayout's constructor.
To group certain widgets together, put an etched border around their JPanel like this:
yourPane.setBorder(
new TitledBorder(
new EtchedBorder(
EtchedBorder.RAISED
),
"Your Title Here ",
TitledBorder.LEFT, // horizontal alignment
TitledBorder.CENTER // vertical alignment
)
);
The GridbagConstraints object gbc is used to define where an object should be placed.
The following will put an object in the left column at the second and third row.
gbc.gridx=0; // first column from the left gbc.gridy=1; // second row from top gbc.gridwidth=1; // one block wide gbc.gridheight=2; // two blocks high
There has been error in communication with booki server. Not sure right now where is the problem.
You should refresh this page.