codice:
gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
gridBagLayout.columnWeights = new double[]{1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
gridBagLayout.rowWeights = new double[]{0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
getContentPane().setLayout(gridBagLayout);
JLabel lblNewLabel = new JLabel("New label");
GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
gbc_lblNewLabel.gridx = 0;
gbc_lblNewLabel.gridy = 0;
getContentPane().add(lblNewLabel, gbc_lblNewLabel);
JComboBox comboBox = new JComboBox();
GridBagConstraints gbc_comboBox = new GridBagConstraints();
gbc_comboBox.gridwidth = 5;
gbc_comboBox.insets = new Insets(0, 0, 5, 5);
gbc_comboBox.fill = GridBagConstraints.HORIZONTAL;
gbc_comboBox.gridx = 4;
gbc_comboBox.gridy = 0;
getContentPane().add(comboBox, gbc_comboBox);
JButton btnNewButton = new JButton("New button");
GridBagConstraints gbc_btnNewButton = new GridBagConstraints();
gbc_btnNewButton.insets = new Insets(0, 0, 5, 0);
gbc_btnNewButton.gridx = 11;
gbc_btnNewButton.gridy = 0;
getContentPane().add(btnNewButton, gbc_btnNewButton);
JList list = new JList();
GridBagConstraints gbc_list = new GridBagConstraints();
gbc_list.gridwidth = 2;
gbc_list.gridheight = 5;
gbc_list.insets = new Insets(0, 0, 5, 5);
gbc_list.fill = GridBagConstraints.BOTH;
gbc_list.gridx = 0;
gbc_list.gridy = 2;
getContentPane().add(list, gbc_list);
JTextArea textArea = new JTextArea();
GridBagConstraints gbc_textArea = new GridBagConstraints();
gbc_textArea.gridwidth = 9;
gbc_textArea.gridheight = 5;
gbc_textArea.insets = new Insets(0, 0, 5, 0);
gbc_textArea.fill = GridBagConstraints.BOTH;
gbc_textArea.gridx = 3;
gbc_textArea.gridy = 2;
getContentPane().add(textArea, gbc_textArea);
JSeparator separator = new JSeparator();
GridBagConstraints gbc_separator = new GridBagConstraints();
gbc_separator.insets = new Insets(0, 0, 5, 5);
gbc_separator.gridx = 2;
gbc_separator.gridy = 3;
getContentPane().add(separator, gbc_separator);
/*GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
gbc_lblNewLabel_1.insets = new Insets(0, 0, 0, 5);
gbc_lblNewLabel_1.gridx = 0;
gbc_lblNewLabel_1.gridy = 8;
getContentPane().add(controlsComponent, gbc_lblNewLabel_1);*/
private class EventHandler implements ControllerListener {
public void controllerUpdate( ControllerEvent e ) {
if ( e instanceof RealizeCompleteEvent ) {
Container c = getContentPane();
// load Visual and Control components if they exist
visualComponent = player.getVisualComponent();
if ( visualComponent != null )
c.add( visualComponent);
controlsComponent = player.getControlPanelComponent();
if ( controlsComponent != null )
c.add( controlsComponent, GridBagConstraints.HORIZONTAL);
c.doLayout();
}
allora vorrei aggiungere "controlsComponent" alla fine del frame!!!! cioè al posto dell'ultimo label...come faccio??