001: /*
002: * Sun Public License Notice
003: *
004: * The contents of this file are subject to the Sun Public License
005: * Version 1.0 (the "License"). You may not use this file except in
006: * compliance with the License. A copy of the License is available at
007: * http://www.sun.com/
008: *
009: * The Original Code is NetBeans. The Initial Developer of the Original
010: * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
011: * Microsystems, Inc. All Rights Reserved.
012: */
013:
014: package org.netbeans.editor.ext.java;
015:
016: import java.awt.Dimension;
017:
018: import org.netbeans.editor.LocaleSupport;
019:
020: /**
021: * The panel for opening java classes.
022: *
023: * @author Miloslav Metelka
024: * @version 1.0
025: */
026: class JavaFastImportPanel extends javax.swing.JPanel {
027:
028: private JavaFastImport jfi;
029:
030: /** Creates new form SaveMacroPanel */
031: public JavaFastImportPanel(JavaFastImport jfi) {
032: this .jfi = jfi;
033:
034: initComponents();
035:
036: getAccessibleContext().setAccessibleDescription(
037: LocaleSupport.getString("ACSD_JFI")); // NOI18N
038: listLabel.setDisplayedMnemonic(LocaleSupport.getString(
039: "JFI_listLabelMnemonic", "M").charAt(0)); // NOI18N
040: javax.swing.JList jl = jfi.getResultList();
041: listScrollPane.setViewportView(jl);
042: listLabel.setLabelFor(jl);
043: jl.getAccessibleContext().setAccessibleDescription(
044: LocaleSupport.getString("ACSD_JFI_listLabel")); // NOI18N
045:
046: setMaximumSize(new Dimension(400, 200));
047:
048: }
049:
050: public Dimension getPreferredSize() {
051: Dimension pref = super .getPreferredSize();
052: Dimension max = getMaximumSize();
053: if (pref.width > max.width)
054: pref.width = max.width;
055: if (pref.height > max.height)
056: pref.height = max.height;
057: return pref;
058: }
059:
060: void popupNotify() {
061: listScrollPane.requestFocus();
062: }
063:
064: private void initComponents() {// GEN-BEGIN:initComponents
065: java.awt.GridBagConstraints gridBagConstraints;
066:
067: listLabel = new javax.swing.JLabel();
068: listPanel = new javax.swing.JPanel();
069: listScrollPane = new javax.swing.JScrollPane();
070:
071: setLayout(new java.awt.BorderLayout(0, 2));
072:
073: setBorder(new javax.swing.border.EmptyBorder(
074: new java.awt.Insets(12, 12, 11, 11)));
075: listLabel.setText(LocaleSupport.getString("JFI_listLabel",
076: "Matching Classes:"));
077: add(listLabel, java.awt.BorderLayout.NORTH);
078:
079: listPanel.setLayout(new java.awt.GridBagLayout());
080:
081: listScrollPane
082: .setPreferredSize(new java.awt.Dimension(200, 100));
083: gridBagConstraints = new java.awt.GridBagConstraints();
084: gridBagConstraints.gridheight = 3;
085: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
086: gridBagConstraints.weightx = 1.0;
087: gridBagConstraints.weighty = 1.0;
088: listPanel.add(listScrollPane, gridBagConstraints);
089:
090: add(listPanel, java.awt.BorderLayout.CENTER);
091:
092: }// GEN-END:initComponents
093:
094: // Variables declaration - do not modify//GEN-BEGIN:variables
095: private javax.swing.JPanel listPanel;
096: private javax.swing.JLabel listLabel;
097: private javax.swing.JScrollPane listScrollPane;
098: // End of variables declaration//GEN-END:variables
099:
100: }
|