JPanel middlePanel = new JPanel();
middlePanel.setAlignmentX(1);
GridBagLayout layout = new GridBagLayout();
middlePanel.setLayout(layout);
Method method = null;
try {
method = list.getClass().getMethod("getSelectedValue", null);
}
catch (NoSuchMethodException
nsme) {
}
data.registerDataLookup("Plugin.ID", new DefaultDataLookup(list, method, null));
list.addListSelectionListener(this );
list.setSelectedIndex(0);
JScrollPane scrollPane = new JScrollPane(list);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
// scrollPane.setPreferredSize( new Dimension(200,200) );
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.NORTHWEST;
c.gridx = 0;
c.fill = GridBagConstraints.BOTH;
c.weightx = 0.4;
// c.gridwidth = GridBagConstraints.RELATIVE;
c.weighty = 1.0;
layout.setConstraints(scrollPane, c);
middlePanel.add(scrollPane);
c.gridwidth = GridBagConstraints.REMAINDER;
c.weightx = 0.6;
c.gridx = 1;
c.anchor = GridBagConstraints.NORTHWEST;
c.insets = new Insets(0, 10, 0, 0);
JScrollPane scrollPane2 = new JScrollPane(descriptionLabel);
scrollPane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
layout.setConstraints(scrollPane2, c);
middlePanel.add(scrollPane2);
component.add(middlePanel);
return component;
|