private static Rectangle fitToScreen(
     @NotNull Dimension newDim, @NotNull RelativePoint popupPosition, JTable table) {
   Rectangle rectangle = new Rectangle(popupPosition.getScreenPoint(), newDim);
   ScreenUtil.fitToScreen(rectangle);
   if (rectangle.getHeight() != newDim.getHeight()) {
     int newHeight = (int) rectangle.getHeight();
     int roundedHeight = newHeight - newHeight % table.getRowHeight();
     rectangle.setSize((int) rectangle.getWidth(), Math.max(roundedHeight, table.getRowHeight()));
   }
   return rectangle;
 }
 private static void drawSelection(JTable table, int column, Graphics g, final int width) {
   int y = 0;
   final int[] rows = table.getSelectedRows();
   final int height = table.getRowHeight();
   for (int row : rows) {
     final TableCellRenderer renderer = table.getCellRenderer(row, column);
     final Component component =
         renderer.getTableCellRendererComponent(
             table, table.getValueAt(row, column), false, false, row, column);
     g.translate(0, y);
     component.setBounds(0, 0, width, height);
     boolean wasOpaque = false;
     if (component instanceof JComponent) {
       final JComponent j = (JComponent) component;
       if (j.isOpaque()) wasOpaque = true;
       j.setOpaque(false);
     }
     component.paint(g);
     if (wasOpaque) {
       ((JComponent) component).setOpaque(true);
     }
     y += height;
     g.translate(0, -y);
   }
 }
 @Override
 public Rectangle getCellRect(int row, int column, boolean includeSpacing) {
   Rectangle r = super.getCellRect(row, column, includeSpacing);
   int height = table.getRowHeight(row);
   if (getRowHeight(row) != height) setRowHeight(row, height);
   r.height = height;
   return r;
 }
  public TeacherManagePasswords() {
    super(new BorderLayout());
    setBackground(FWCConfigurator.bgColor);

    // Build title and north panel
    pnNorth = new JPanel(new FlowLayout(FlowLayout.CENTER));
    pnNorth.setBackground(FWCConfigurator.bgColor);
    lblTitle = new TitleLabel("Reset Passwords", FWCConfigurator.RESET_PASSW_TITLE_IMG);
    pnNorth.add(lblTitle);

    // Build center panel
    pnCenter = new JPanel(new BorderLayout());
    pnCenter.setBackground(FWCConfigurator.bgColor);

    // Build table of students
    tableModel = new DisabledTableModel();
    tableModel.setColumnIdentifiers(
        new String[] {"First Name", " Last " + "Name", "Username", "Class"});

    studentsTable = new JTable(tableModel);
    studentsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    studentsTable.setFillsViewportHeight(true);
    studentsTable.getTableHeader().setFont(new Font("Calibri", Font.PLAIN, 18));
    studentsTable.setFont(new Font("Calibri", Font.PLAIN, 18));
    studentsTable.setRowHeight(studentsTable.getRowHeight() + 12);

    // Populate the table only with students that need a password reset
    students = FWCConfigurator.getTeacher().getStudentsRequestedReset();
    populateTable();

    tableScroll =
        new JScrollPane(
            studentsTable,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tableScroll.setBackground(FWCConfigurator.bgColor);
    tableScroll.setBorder(
        BorderFactory.createCompoundBorder(
            new EmptyBorder(10, 100, 10, 100), new LineBorder(Color.black, 1)));

    pnCenter.add(tableScroll, BorderLayout.CENTER);

    // Build south panel
    pnButtons = new JPanel(new FlowLayout(FlowLayout.CENTER));
    pnButtons.setBackground(FWCConfigurator.bgColor);
    pnButtons.setBorder(BorderFactory.createEmptyBorder(0, 100, 20, 100));
    btnReset = new ImageButton("Reset Selected", FWCConfigurator.RESET_SELECTED_IMG, 150, 50);
    btnReset.addActionListener(new ResetListener());
    btnResetAll = new ImageButton("Reset All", FWCConfigurator.RESET_ALL_IMG, 150, 50);
    btnResetAll.addActionListener(new ResetListener());
    pnButtons.add(btnReset);
    pnButtons.add(btnResetAll);

    this.add(pnNorth, BorderLayout.NORTH);
    this.add(pnCenter, BorderLayout.CENTER);
    this.add(pnButtons, BorderLayout.SOUTH);
  }
예제 #5
0
 private void recomputeNumVisibleRows() {
   Rectangle rect = new Rectangle();
   getBounds(rect);
   int h = table.getRowHeight();
   numVisibleRows = (rect.height + (h - 1)) / h;
   numUsableRows = numVisibleRows - 2;
   scrollBar.setBlockIncrementHP(new BigInteger(Integer.toString(addressSize * (numUsableRows))));
   model.fireTableDataChanged();
   // FIXME: refresh selection
 }
예제 #6
0
  @Override
  public int getRowHeight(int row) {
    int rowHeight = main.getRowHeight(row);

    if (rowHeight != super.getRowHeight(row)) {
      super.setRowHeight(row, rowHeight);
    }

    return rowHeight;
  }
예제 #7
0
 private static int getTableBaseline(JTable table, int height) {
   if (TABLE_LABEL == null) {
     TABLE_LABEL = new JLabel("");
     TABLE_LABEL.setBorder(new EmptyBorder(1, 1, 1, 1));
   }
   JLabel label = TABLE_LABEL;
   label.setFont(table.getFont());
   int rowMargin = table.getRowMargin();
   int baseline = getLabelBaseline(label, table.getRowHeight() - rowMargin);
   return baseline += rowMargin / 2;
 }
  private void setSizeAndDimensions(
      @NotNull JTable table,
      @NotNull JBPopup popup,
      @NotNull RelativePoint popupPosition,
      @NotNull List<UsageNode> data) {
    JComponent content = popup.getContent();
    Window window = SwingUtilities.windowForComponent(content);
    Dimension d = window.getSize();

    int width = calcMaxWidth(table);
    width = (int) Math.max(d.getWidth(), width);
    Dimension headerSize = ((AbstractPopup) popup).getHeaderPreferredSize();
    width = Math.max((int) headerSize.getWidth(), width);
    width = Math.max(myWidth, width);

    if (myWidth == -1) myWidth = width;
    int newWidth = Math.max(width, d.width + width - myWidth);

    myWidth = newWidth;

    int rowsToShow = Math.min(30, data.size());
    Dimension dimension = new Dimension(newWidth, table.getRowHeight() * rowsToShow);
    Rectangle rectangle = fitToScreen(dimension, popupPosition, table);
    dimension = rectangle.getSize();
    Point location = window.getLocation();
    if (!location.equals(rectangle.getLocation())) {
      window.setLocation(rectangle.getLocation());
    }

    if (!data.isEmpty()) {
      TableScrollingUtil.ensureSelectionExists(table);
    }
    table.setSize(dimension);
    // table.setPreferredSize(dimension);
    // table.setMaximumSize(dimension);
    // table.setPreferredScrollableViewportSize(dimension);

    Dimension footerSize = ((AbstractPopup) popup).getFooterPreferredSize();

    int newHeight =
        (int) (dimension.height + headerSize.getHeight() + footerSize.getHeight())
            + 4 /* invisible borders, margins etc*/;
    Dimension newDim = new Dimension(dimension.width, newHeight);
    window.setSize(newDim);
    window.setMinimumSize(newDim);
    window.setMaximumSize(newDim);

    window.validate();
    window.repaint();
    table.revalidate();
    table.repaint();
  }
    public static Image createImage(final JTable table, int column) {
      final int height =
          Math.max(20, Math.min(100, table.getSelectedRowCount() * table.getRowHeight()));
      final int width = table.getColumnModel().getColumn(column).getWidth();

      final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
      Graphics2D g2 = (Graphics2D) image.getGraphics();

      g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f));

      drawSelection(table, column, g2, width);
      return image;
    }
  private void backBind() {
    status.setText(viewModel.getStatus());
    compute.setEnabled(viewModel.isButtonEnabled());

    monthlyPayment.setText(viewModel.getMonthlyPayment());
    overpaymentWithFees.setText(viewModel.getOverpaymentWithFees());
    overpayment.setText(viewModel.getOverpayment());

    DefaultTableModel model = viewModel.getGraphicOfPayments();
    graphicOfPayments.setModel(model);
    graphicOfPayments.setPreferredSize(
        new Dimension(
            graphicOfPayments.getWidth(), graphicOfPayments.getRowHeight() * model.getRowCount()));

    List<String> log = viewModel.getLog();
    String[] items = log.toArray(new String[log.size()]);
    logList.setListData(items);
  }
  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      e.printStackTrace();
    }

    Action action = new GloballyContextSensitiveAction("selectAll", "selectAll", "selectAll");
    JMenuBar menubar = new JMenuBar();
    JMenu menu = new JMenu("Actions");
    menu.add(action);
    menubar.add(menu);

    JToolBar toolbar = new JToolBar();
    toolbar.setRollover(true);
    toolbar.setFloatable(true);
    toolbar.add(action);

    JPanel contents = new JPanel();

    String[] listData = new String[] {"item1", "item2", "item3", "item4", "item5            "};
    JList list = new JList(listData);
    contents.add(new JScrollPane(list));

    JTree tree = new JTree();
    tree.setVisibleRowCount(10);
    contents.add(new JScrollPane(tree));

    JTable table = new JTable(new DefaultTableModel(new String[] {"Name", "Type", "Modified"}, 10));
    table.setPreferredScrollableViewportSize(new Dimension(100, 5 * table.getRowHeight()));
    contents.add(new JScrollPane(table));
    contents.add(new JPanel());

    JFrame frame = new JFrame("Globally Context Sensitive Actions - [email protected]");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setJMenuBar(menubar);
    frame.getContentPane().add(contents);
    frame.getContentPane().add(toolbar, BorderLayout.NORTH);

    frame.pack();
    frame.show();
  }
예제 #12
0
  public JunctionLinkDataFrame(final JunctionLink jl) {
    super(
        jl.getCurrName() + " properties",
        false, // resizable
        false, // closable
        false, // maximizable
        true); // iconifiable
    // PSRender.onHold();
    super.setBackground(back_color);
    super.addInternalFrameListener(
        new InternalFrameAdapter() {
          public void internalFrameActivated(InternalFrameEvent e) {
            reload();
            SelectedObject.setSelectedObject(jl);
          }
        });
    PSRender.moveToTop(jl.getBound(), 0.5);
    ml = jl;
    setLocation(50, 50);
    dataModelMain = new HeadTable(jl);
    tableMain = new JTable(dataModelMain);
    tableMain.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
    tableMain.setPreferredScrollableViewportSize(new Dimension(500, 20));
    //        tableMain.setBackground(back_color);

    // code
    TableColumn column_code = tableMain.getColumn("Code");
    DefaultTableCellRenderer rendererCode = new DefaultTableCellRenderer();
    rendererCode.setToolTipText("Enter new code for this path");
    column_code.setCellRenderer(rendererCode);
    column_code.setCellEditor(new TextFieldEditor());
    // name
    TableColumn column_name = tableMain.getColumn("Name");
    LanguageButtonRender render_name = new LanguageButtonRender();
    render_name.setToolTipText("Path name. Press for change name");
    column_name.setCellRenderer(render_name);
    LanguageButtonEditor editor_name = new LanguageButtonEditor(new JCheckBox());
    column_name.setCellEditor(editor_name);
    // junction 1
    TableColumn column_junc_1 = tableMain.getColumn("Junction 1");
    MLButtonRenderer rendererJunc_1 = new MLButtonRenderer();
    rendererJunc_1.setToolTipText("Code of first Junction, click for open properties");
    column_junc_1.setCellRenderer(rendererJunc_1);
    MLButtonEditor editorJunc = new MLButtonEditor(new JCheckBox());
    column_junc_1.setCellEditor(editorJunc);
    // junction 2
    TableColumn column_junc_2 = tableMain.getColumn("Junction 2");
    MLButtonRenderer rendererJunc_2 = new MLButtonRenderer();
    rendererJunc_2.setToolTipText("Code of second Junction, click for open properties");
    column_junc_2.setCellRenderer(rendererJunc_2);
    column_junc_2.setCellEditor(editorJunc);
    // type
    JComboBox comboBoxType = new JComboBox();
    String roadNames[] = jl.getTypeNames();
    for (int i = 0, len = roadNames.length; i < len; i++) {
      comboBoxType.addItem(roadNames[i]);
    }
    TableColumn column_type = tableMain.getColumn("Type");
    DefaultTableCellRenderer rendererType = new DefaultTableCellRenderer();
    rendererType.setToolTipText("To change road type click for combo box");
    column_type.setCellRenderer(rendererType);
    column_type.setCellEditor(new DefaultCellEditor(comboBoxType));
    // legth
    TableColumn column_length = tableMain.getColumn("Length");
    DefaultTableCellRenderer rendererLen = new DefaultTableCellRenderer();
    rendererLen.setToolTipText("The path length in meters");
    column_length.setCellRenderer(rendererLen);

    scrollpaneMain = new JScrollPane(tableMain);
    scrollpaneMain.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollpaneMain.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    scrollpaneMain.setPreferredSize(new Dimension(500, 50));

    Container contentPane = super.getContentPane();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    contentPane.setLayout(gridbag);

    c.ipady = 0; // make this component tall
    c.weightx = 0.5;
    c.gridwidth = 4;
    c.gridx = 0;
    c.gridy = 0;
    gridbag.setConstraints(scrollpaneMain, c);
    //        scrollpaneMain.setBackground(back_color);
    //        scrollpaneMain.setForeground(back_color);
    contentPane.add(scrollpaneMain);

    TableModel dataModelPoints = new PointTableModel(jl);
    tablePoints = new JTable(dataModelPoints);
    tablePoints.setPreferredScrollableViewportSize(
        new Dimension(200, dataModelPoints.getRowCount() * tablePoints.getRowHeight()));
    ListModel lm =
        new AbstractListModel() {
          public int getSize() {
            return 1000;
          }

          public Object getElementAt(int index) {
            return "" + index;
          }
        };
    JList rowHeader = new JList(lm);
    rowHeader.setFixedCellWidth(20);

    rowHeader.setFixedCellHeight(tablePoints.getRowHeight());
    // + tablePoints.getRowMargin());

    rowHeader.setCellRenderer(new RowHeaderRenderer(tablePoints));

    scrollPanePoints = new JScrollPane(tablePoints);
    scrollPanePoints.setWheelScrollingEnabled(true);
    scrollPanePoints.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPanePoints.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    int mh;
    if (dataModelPoints.getRowCount() * tablePoints.getRowHeight() > 100) {
      mh = 100;
    } else {
      mh = dataModelPoints.getRowCount() * tablePoints.getRowHeight();
    }
    scrollPanePoints.setPreferredSize(new Dimension(200, mh));
    scrollPanePoints.setRowHeaderView(rowHeader);

    c.ipadx = 200;
    c.weightx = 0.5;
    c.gridwidth = 3;
    c.gridx = 1;
    c.gridy = 1;
    gridbag.setConstraints(scrollPanePoints, c);
    //        scrollPanePoints.setBackground(back_color);
    contentPane.add(scrollPanePoints);

    button_ok = new JButton("Ok");
    button_ok.addActionListener(this);
    JPanel buttonPane = new JPanel(null);
    buttonPane.setPreferredSize(new Dimension(500, 100));
    button_ok.setBounds(205, 40, 90, 40);
    buttonPane.add(button_ok);
    c.ipady = 10; // make this component tall
    c.ipadx = 10;
    c.weightx = 0.5;
    c.gridwidth = 4;
    c.gridx = 2;
    c.gridy = 2;
    gridbag.setConstraints(buttonPane, c);
    buttonPane.setBackground(back_color);
    contentPane.add(buttonPane);

    super.pack();
    super.setVisible(true);

    // MapApplication.getDesktop().setSelectedFrame(this);

  }
예제 #13
0
  public InputPanel(
      final TreeSpaceFrame parent, final TreeSpaceDocument document, final Action addDataAction) {

    this.frame = parent;
    this.document = document;

    dataTableModel = new DataTableModel();
    dataTable = new JTable(dataTableModel);

    dataTable.getTableHeader().setReorderingAllowed(false);
    //        dataTable.getTableHeader().setDefaultRenderer(
    //                new HeaderRenderer(SwingConstants.LEFT, new Insets(0, 4, 0, 4)));

    TableColumn col = dataTable.getColumnModel().getColumn(0);
    col.setCellRenderer(new MultiLineTableCellRenderer());

    dataTable.setRowHeight(dataTable.getRowHeight() * 2);

    dataTable.setDragEnabled(false);
    dataTable.setTransferHandler(new FSTransfer());

    TableEditorStopper.ensureEditingStopWhenTableLosesFocus(dataTable);

    dataTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent evt) {
                selectionChanged();
              }
            });

    dataTable.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
              editSelection();
            }
          }
        });

    scrollPane =
        new JScrollPane(
            dataTable,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane.setOpaque(false);

    //        JToolBar toolBar1 = new JToolBar();
    //        toolBar1.setFloatable(false);
    //        toolBar1.setOpaque(false);
    //        toolBar1.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));

    //        JButton button = new JButton(unlinkModelsAction);
    //        unlinkModelsAction.setEnabled(false);
    //        PanelUtils.setupComponent(button);
    //        toolBar1.add(button);

    ActionPanel actionPanel1 = new ActionPanel(true);
    actionPanel1.setAddAction(addDataAction);
    actionPanel1.setRemoveAction(removeAction);

    removeAction.setEnabled(false);

    JPanel controlPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    controlPanel1.setOpaque(false);
    controlPanel1.add(actionPanel1);

    setOpaque(false);
    setBorder(new BorderUIResource.EmptyBorderUIResource(new Insets(12, 12, 12, 12)));
    setLayout(new BorderLayout(0, 0));
    //        add(toolBar1, BorderLayout.NORTH);
    add(scrollPane, BorderLayout.CENTER);
    add(controlPanel1, BorderLayout.SOUTH);

    document.addListener(
        new TreeSpaceDocument.Listener() {
          public void dataChanged() {
            dataTableModel.fireTableDataChanged();
          }

          public void settingsChanged() {}
        });
  }
예제 #14
0
  public IllListView(FormWindow frm) {

    setBackground(Color.darkGray);
    setLayout(new BorderLayout(0, 0));

    model = new IllTableModel();

    table = new JTable(model);
    table.setDefaultEditor(Date.class, new DateColumnEditor());
    table.setDefaultEditor(Emp.class, new EmpColumnEditor());
    table
        .getColumnModel()
        .getColumn(2)
        .setCellEditor(new DefaultCellEditor(new JComboBox(Ill.getTypes())));
    table.setRowHeight(table.getRowHeight() + 5);
    add(new JScrollPane(table), BorderLayout.CENTER);

    // КНОПКИ

    JButton btnNew = new JButton("Новый");
    JButton btnEdit = new JButton("Изменить");
    JButton btnDel = new JButton("Удалить");
    JButton btnSave = new JButton("Сохранить");
    JButton btnChanges = new JButton("Изменения");
    JButton btnRefresh = new JButton("Обновить");
    JButton btnExit = new JButton("Выход");
    JPanel panelButton = new JPanel();
    panelButton.add(btnNew);
    panelButton.add(btnEdit);
    panelButton.add(btnDel);
    panelButton.add(btnSave);
    panelButton.add(btnChanges);
    panelButton.add(btnRefresh);
    panelButton.add(btnExit);
    add(panelButton, BorderLayout.SOUTH);

    btnExit.addActionListener(frm);

    btnChanges.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            model.printChanges();
          }
        });

    btnNew.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            model.addRow();
          }
        });
    btnDel.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            model.removeRow(table.convertRowIndexToModel(table.getSelectedRow()));
          }
        });
    btnSave.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              model.saveChanges();
              Msg.info(IllListView.this, "Операция выполнена успешно.");
            } catch (Exception e1) {
              Msg.error(IllListView.this, "Не удалось сохранить данные!");
            }
          }
        });

    btnRefresh.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            model.refresh();
          }
        });
  }
예제 #15
0
  public void mousePressed(MouseEvent e) {
    Point p = e.getPoint();

    resizingRow = getResizingRow(p);
    mouseYOffset = p.y - table.getRowHeight(resizingRow);
  }
예제 #16
0
 /** Sets the number of visible rows. */
 public void setVisibleRows(int num) {
   int tableHeight = num * callStackTable.getRowHeight();
   scrollPane.setSize(getTableWidth(), tableHeight + 3);
   setPreferredSize(new Dimension(getTableWidth(), tableHeight + 30));
   setSize(getTableWidth(), tableHeight + 30);
 }
예제 #17
0
  // {{{ InstallPanel constructor
  InstallPanel(PluginManager window, boolean updates) {
    super(new BorderLayout(12, 12));

    this.window = window;
    this.updates = updates;

    setBorder(new EmptyBorder(12, 12, 12, 12));

    final JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    split.setResizeWeight(0.75);
    /* Setup the table */
    table = new JTable(pluginModel = new PluginTableModel());
    table.setShowGrid(false);
    table.setIntercellSpacing(new Dimension(0, 0));
    table.setRowHeight(table.getRowHeight() + 2);
    table.setPreferredScrollableViewportSize(new Dimension(500, 200));
    table.setDefaultRenderer(
        Object.class,
        new TextRenderer((DefaultTableCellRenderer) table.getDefaultRenderer(Object.class)));
    table.addFocusListener(new TableFocusHandler());
    InputMap tableInputMap = table.getInputMap(JComponent.WHEN_FOCUSED);
    ActionMap tableActionMap = table.getActionMap();
    tableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "tabOutForward");
    tableActionMap.put("tabOutForward", new KeyboardAction(KeyboardCommand.TAB_OUT_FORWARD));
    tableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK), "tabOutBack");
    tableActionMap.put("tabOutBack", new KeyboardAction(KeyboardCommand.TAB_OUT_BACK));
    tableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "editPlugin");
    tableActionMap.put("editPlugin", new KeyboardAction(KeyboardCommand.EDIT_PLUGIN));
    tableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "closePluginManager");
    tableActionMap.put(
        "closePluginManager", new KeyboardAction(KeyboardCommand.CLOSE_PLUGIN_MANAGER));

    TableColumn col1 = table.getColumnModel().getColumn(0);
    TableColumn col2 = table.getColumnModel().getColumn(1);
    TableColumn col3 = table.getColumnModel().getColumn(2);
    TableColumn col4 = table.getColumnModel().getColumn(3);
    TableColumn col5 = table.getColumnModel().getColumn(4);

    col1.setPreferredWidth(30);
    col1.setMinWidth(30);
    col1.setMaxWidth(30);
    col1.setResizable(false);

    col2.setPreferredWidth(180);
    col3.setPreferredWidth(130);
    col4.setPreferredWidth(70);
    col5.setPreferredWidth(70);

    JTableHeader header = table.getTableHeader();
    header.setReorderingAllowed(false);
    header.addMouseListener(new HeaderMouseHandler());
    header.setDefaultRenderer(
        new HeaderRenderer((DefaultTableCellRenderer) header.getDefaultRenderer()));

    scrollpane = new JScrollPane(table);
    scrollpane.getViewport().setBackground(table.getBackground());
    split.setTopComponent(scrollpane);

    /* Create description */
    JScrollPane infoPane = new JScrollPane(infoBox = new PluginInfoBox());
    infoPane.setPreferredSize(new Dimension(500, 100));
    split.setBottomComponent(infoPane);

    EventQueue.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            split.setDividerLocation(0.75);
          }
        });

    final JTextField searchField = new JTextField();
    searchField.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_UP) {
              table.dispatchEvent(e);
              table.requestFocus();
            }
          }
        });
    searchField
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              void update() {
                pluginModel.setFilterString(searchField.getText());
              }

              @Override
              public void changedUpdate(DocumentEvent e) {
                update();
              }

              @Override
              public void insertUpdate(DocumentEvent e) {
                update();
              }

              @Override
              public void removeUpdate(DocumentEvent e) {
                update();
              }
            });
    table.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            int i = table.getSelectedRow(), n = table.getModel().getRowCount();
            if (e.getKeyCode() == KeyEvent.VK_DOWN && i == (n - 1)
                || e.getKeyCode() == KeyEvent.VK_UP && i == 0) {
              searchField.requestFocus();
              searchField.selectAll();
            }
          }
        });
    Box filterBox = Box.createHorizontalBox();
    filterBox.add(new JLabel("Filter : "));
    filterBox.add(searchField);
    add(BorderLayout.NORTH, filterBox);
    add(BorderLayout.CENTER, split);

    /* Create buttons */
    Box buttons = new Box(BoxLayout.X_AXIS);

    buttons.add(new InstallButton());
    buttons.add(Box.createHorizontalStrut(12));
    buttons.add(new SelectallButton());
    buttons.add(chooseButton = new ChoosePluginSet());
    buttons.add(new ClearPluginSet());
    buttons.add(Box.createGlue());
    buttons.add(new SizeLabel());

    add(BorderLayout.SOUTH, buttons);
    String path = jEdit.getProperty(PluginManager.PROPERTY_PLUGINSET, "");
    if (!path.isEmpty()) {
      loadPluginSet(path);
    }
  } // }}}