However, knowing how to get the libraries from the Library Manager is pretty useful in some cases. For example, in the Frameworks panel in the New Project wizard for web applications, you might want to show all the libraries (or a filtered list, meeting certain criteria), so that the user can choose one of them to be put on the classpath.
So, in the above scenario, you need to declare a dependency on "External Libraries". This is the code, called from the JPanel's constructor, as well as in the (optional) filter's keyPressed event:
private void initLibraries(){
Library libraries[] = LibraryManager.getDefault().getLibraries();
Vectoritems = new Vector();
ArrayListallLibraries = new ArrayList();
String filter = jTextField1.getText();
for (int i = 0; i < libraries.length; i++) {
if (libraries[i].getName().startsWith(filter)){ //NOI18N
String displayName = libraries[i].getDisplayName();
items.add(displayName);
allLibraries.add(libraries[i]);
}
}
jComboBox1.setModel(new DefaultComboBoxModel(items));
if (items.size() == 0){
jComboBox1.setEnabled(false);
} else {
jComboBox1.setEnabled(true);
}
repaint();
}
And how do you create the toolbar in the first place? See the Google Toolbar Module Tutorial for details.