Example usage for javax.swing.event ListSelectionListener ListSelectionListener

List of usage examples for javax.swing.event ListSelectionListener ListSelectionListener

Introduction

In this page you can find the example usage for javax.swing.event ListSelectionListener ListSelectionListener.

Prototype

ListSelectionListener

Source Link

Usage

From source file:pl.otros.logview.gui.LogViewPanel.java

public LogViewPanel(final LogDataTableModel dataTableModel, TableColumns[] visibleColumns,
        final OtrosApplication otrosApplication) {
    super();//from w w w . j a  va 2  s  .co m
    this.dataTableModel = dataTableModel;
    this.otrosApplication = otrosApplication;
    this.statusObserver = otrosApplication.getStatusObserver();
    configuration = otrosApplication.getConfiguration();

    AllPluginables allPluginable = AllPluginables.getInstance();
    markersContainer = allPluginable.getMarkersContainser();
    markersContainer.addListener(new MarkersMenuReloader());
    logFiltersContainer = allPluginable.getLogFiltersContainer();
    messageColorizersContainer = allPluginable.getMessageColorizers();
    messageFormattersContainer = allPluginable.getMessageFormatters();
    selectedMessageColorizersContainer = new PluginableElementsContainer<MessageColorizer>();
    selectedMessageFormattersContainer = new PluginableElementsContainer<MessageFormatter>();
    for (MessageColorizer messageColorizer : messageColorizersContainer.getElements()) {
        selectedMessageColorizersContainer.addElement(messageColorizer);
    }
    for (MessageFormatter messageFormatter : messageFormattersContainer.getElements()) {
        selectedMessageFormattersContainer.addElement(messageFormatter);
    }
    messageColorizersContainer.addListener(
            new SynchronizePluginableContainerListener<MessageColorizer>(selectedMessageColorizersContainer));
    messageFormattersContainer.addListener(
            new SynchronizePluginableContainerListener<MessageFormatter>(selectedMessageFormattersContainer));

    menuLabelFont = new JLabel().getFont().deriveFont(Font.BOLD);
    filtersPanel = new JPanel();
    logsTablePanel = new JPanel();
    logsMarkersPanel = new JPanel();
    leftPanel = new JPanel(new MigLayout());
    logDetailTextArea = new JTextPane();
    logDetailTextArea.setEditable(false);
    MouseAdapter locationInfo = new LocationClickMouseAdapter(otrosApplication, logDetailTextArea);
    logDetailTextArea.addMouseMotionListener(locationInfo);
    logDetailTextArea.addMouseListener(locationInfo);
    logDetailTextArea.setBorder(BorderFactory.createTitledBorder("Details"));
    logDetailWithRulerScrollPane = RulerBarHelper.wrapTextComponent(logDetailTextArea);
    table = new JTableWith2RowHighliting(dataTableModel);

    // Initialize default column visible before creating context menu
    table.setColumnControlVisible(true);
    final ColumnControlButton columnControlButton = new ColumnControlButton(table) {

        @Override
        public void togglePopup() {
            populatePopup();
            super.togglePopup();
        }

        @Override
        protected List<Action> getAdditionalActions() {
            final List<Action> additionalActions = super.getAdditionalActions();
            final AbstractAction saveLayout = new AbstractAction("Save current to new column layout",
                    Icons.DISK) {
                @Override
                public void actionPerformed(ActionEvent actionEvent) {
                    String newLayoutName = JOptionPane.showInputDialog(table, "New Layout name");
                    if (newLayoutName == null) {
                        return;
                    }
                    newLayoutName = newLayoutName.trim();
                    LOGGER.info(String.format("Saving New column layout '%s'", newLayoutName));
                    ArrayList<String> visibleColNames = new ArrayList<String>();
                    for (TableColumn tc : table.getColumns()) {
                        Object o = tc.getIdentifier();
                        if (!(o instanceof TableColumns)) {
                            LOGGER.severe("TableColumn identifier of unexpected type: "
                                    + tc.getIdentifier().getClass().getName());
                            LOGGER.warning("Throw up a pop-up");
                            return;
                        }
                        TableColumns tcs = (TableColumns) o;
                        visibleColNames.add(tcs.getName());
                    }
                    ColumnLayout columnLayout = new ColumnLayout(newLayoutName, visibleColNames);
                    final List<ColumnLayout> columnLayouts = LogTableFormatConfigView
                            .loadColumnLayouts(configuration);
                    columnLayouts.add(columnLayout);
                    LogTableFormatConfigView.saveColumnLayouts(columnLayouts, configuration);
                    populatePopup();
                }
            };
            additionalActions.add(saveLayout);

            final List<ColumnLayout> columnLayoutNames = LogTableFormatConfigView
                    .loadColumnLayouts(configuration);
            for (final ColumnLayout columnLayout : columnLayoutNames) {
                final String name = columnLayout.getName();
                final AbstractAction applyColumnLayout = new ApplyColumnLayoutAction(name, Icons.EDIT_COLUMNS,
                        columnLayout, table);
                additionalActions.add(applyColumnLayout);
            }
            return additionalActions;
        }
    };
    table.setColumnControl(columnControlButton);

    List<TableColumn> columns = table.getColumns(true);
    for (int i = 0; i < columns.size(); i++) {
        columns.get(i).setIdentifier(TableColumns.getColumnById(i));
    }
    for (TableColumn tableColumn : columns) {
        table.getColumnExt(tableColumn.getIdentifier()).setVisible(false);
    }
    for (TableColumns tableColumns : visibleColumns) {
        table.getColumnExt(tableColumns).setVisible(true);
    }

    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    updateColumnsSize();
    table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
    final Renderers renderers = Renderers.getInstance(otrosApplication);
    table.setDefaultRenderer(String.class, new TableMarkDecoratorRenderer(renderers.getStringRenderer()));
    table.setDefaultRenderer(Object.class,
            new TableMarkDecoratorRenderer(table.getDefaultRenderer(Object.class)));
    table.setDefaultRenderer(Integer.class,
            new TableMarkDecoratorRenderer(table.getDefaultRenderer(Object.class)));
    table.setDefaultRenderer(Level.class, new TableMarkDecoratorRenderer(renderers.getLevelRenderer()));
    table.setDefaultRenderer(Date.class, new TableMarkDecoratorRenderer(renderers.getDateRenderer()));
    final TimeDeltaRenderer timeDeltaRenderer = new TimeDeltaRenderer();
    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent listSelectionEvent) {
            final int[] selectedRows = table.getSelectedRows();
            if (selectedRows.length > 0) {
                final int selectedRow = selectedRows[selectedRows.length - 1];
                final Date selectedDate = dataTableModel.getLogData(table.convertRowIndexToModel(selectedRow))
                        .getDate();
                timeDeltaRenderer.setSelectedTimestamp(selectedDate);
                table.repaint();
            }
        }
    });
    table.setDefaultRenderer(TimeDelta.class, new TableMarkDecoratorRenderer(timeDeltaRenderer));

    ((EventSource) configuration.getConfiguration()).addConfigurationListener(new ConfigurationListener() {
        @Override
        public void configurationChanged(ConfigurationEvent ce) {
            if (ce.getType() == AbstractConfiguration.EVENT_SET_PROPERTY && !ce.isBeforeUpdate()) {
                if (ce.getPropertyName().equals(ConfKeys.LOG_TABLE_FORMAT_DATE_FORMAT)) {
                    table.setDefaultRenderer(Date.class, new TableMarkDecoratorRenderer(new DateRenderer(
                            configuration.getString(ConfKeys.LOG_TABLE_FORMAT_DATE_FORMAT, "HH:mm:ss.SSS"))));
                    updateTimeColumnSize();
                } else if (ce.getPropertyName().equals(ConfKeys.LOG_TABLE_FORMAT_LEVEL_RENDERER)) {
                    table.setDefaultRenderer(Level.class,
                            new TableMarkDecoratorRenderer(new LevelRenderer(configuration.get(
                                    LevelRenderer.Mode.class, ConfKeys.LOG_TABLE_FORMAT_LEVEL_RENDERER,
                                    LevelRenderer.Mode.IconsOnly))));
                    updateLevelColumnSize();
                }
            }
        }
    });

    table.setDefaultRenderer(Boolean.class,
            new TableMarkDecoratorRenderer(table.getDefaultRenderer(Boolean.class)));
    table.setDefaultRenderer(Note.class, new TableMarkDecoratorRenderer(new NoteRenderer()));
    table.setDefaultRenderer(MarkerColors.class, new TableMarkDecoratorRenderer(new MarkTableRenderer()));
    table.setDefaultEditor(Note.class, new NoteTableEditor());
    table.setDefaultEditor(MarkerColors.class, new MarkTableEditor(otrosApplication));
    table.setDefaultRenderer(ClassWrapper.class,
            new TableMarkDecoratorRenderer(renderers.getClassWrapperRenderer()));
    sorter = new TableRowSorter<LogDataTableModel>(dataTableModel);
    for (int i = 0; i < dataTableModel.getColumnCount(); i++) {
        sorter.setSortable(i, false);
    }
    sorter.setSortable(TableColumns.ID.getColumn(), true);
    sorter.setSortable(TableColumns.TIME.getColumn(), true);
    table.setRowSorter(sorter);

    messageDetailListener = new MessageDetailListener(this, dateFormat, selectedMessageFormattersContainer,
            selectedMessageColorizersContainer);
    table.getSelectionModel().addListSelectionListener(messageDetailListener);
    dataTableModel.addNoteObserver(messageDetailListener);

    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            boolean hasFocus = otrosApplication.getApplicationJFrame().isFocused();
            final boolean enabled = otrosApplication.getConfiguration()
                    .getBoolean(ConfKeys.JUMP_TO_CODE_AUTO_JUMP_ENABLED, false);
            if (hasFocus && enabled && !e.getValueIsAdjusting()) {
                try {
                    final LogData logData = dataTableModel
                            .getLogData(table.convertRowIndexToModel(e.getFirstIndex()));
                    LocationInfo li = new LocationInfo(logData.getClazz(), logData.getMethod(),
                            logData.getFile(), Integer.valueOf(logData.getLine()));
                    final JumpToCodeService jumpToCodeService = otrosApplication.getServices()
                            .getJumpToCodeService();
                    final boolean ideAvailable = jumpToCodeService.isIdeAvailable();
                    if (ideAvailable) {
                        LOGGER.fine("Jumping to " + li);
                        jumpToCodeService.jump(li);
                    }
                } catch (Exception e1) {
                    LOGGER.warning("Can't perform jump to code " + e1.getMessage());
                }

            }
        }
    });

    notes = new JTextArea();
    notes.setEditable(false);
    NoteObserver allNotesObserver = new AllNotesTextAreaObserver(notes);
    dataTableModel.addNoteObserver(allNotesObserver);

    addFiltersGUIsToPanel(filtersPanel);
    logsTablePanel.setLayout(new BorderLayout());
    logsTablePanel.add(new JScrollPane(table));
    JPanel messageDetailsPanel = new JPanel(new BorderLayout());
    messageDetailToolbar = new JToolBar("MessageDetail");
    messageDetailsPanel.add(messageDetailToolbar, BorderLayout.NORTH);
    messageDetailsPanel.add(logDetailWithRulerScrollPane);
    initMessageDetailsToolbar();

    jTabbedPane = new JTabbedPane();
    jTabbedPane.add("Message detail", messageDetailsPanel);
    jTabbedPane.add("All notes", new JScrollPane(notes));

    leftPanel.add(filtersPanel, "wrap, growx");
    leftPanel.add(new JSeparator(SwingConstants.HORIZONTAL), "wrap,growx");
    leftPanel.add(logsMarkersPanel, "wrap,growx");

    JSplitPane splitPaneLogsTableAndDetails = new JSplitPane(JSplitPane.VERTICAL_SPLIT, logsTablePanel,
            jTabbedPane);
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftPanel,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED),
            splitPaneLogsTableAndDetails);
    splitPane.setOneTouchExpandable(true);
    this.setLayout(new BorderLayout());
    this.add(splitPane);

    splitPaneLogsTableAndDetails.setDividerLocation(0.5d);
    splitPaneLogsTableAndDetails.setOneTouchExpandable(true);
    splitPane.setDividerLocation(leftPanel.getPreferredSize().width + 10);

    PopupListener popupListener = new PopupListener(new Callable<JPopupMenu>() {
        @Override
        public JPopupMenu call() throws Exception {
            return initTableContextMenu();
        }
    });
    table.addMouseListener(popupListener);
    table.addKeyListener(popupListener);

    PopupListener popupListenerMessageDetailMenu = new PopupListener(new Callable<JPopupMenu>() {
        @Override
        public JPopupMenu call() throws Exception {
            return initMessageDetailPopupMenu();
        }
    });
    logDetailTextArea.addMouseListener(popupListenerMessageDetailMenu);
    logDetailTextArea.addKeyListener(popupListenerMessageDetailMenu);

    dataTableModel.notifyAllNoteObservers(new NoteEvent(EventType.CLEAR, dataTableModel, null, 0));

    table.addKeyListener(new MarkRowBySpaceKeyListener(otrosApplication));
    initAcceptConditions();
}

From source file:pl.otros.logview.gui.message.editor.MessageColorizerBrowser.java

public MessageColorizerBrowser(OtrosApplication otrosApplication) {
    super(new BorderLayout());
    this.container = otrosApplication.getAllPluginables().getMessageColorizers();
    this.otrosApplication = otrosApplication;

    toolBar = new JToolBar();
    editor = new MessageColorizerEditor(container, otrosApplication.getStatusObserver());
    JLabel noEditable = new JLabel("Selected MessageColorizer is not editable.", SwingConstants.CENTER);
    JLabel nothingSelected = new JLabel("Nothing selected", SwingConstants.CENTER);

    listModel = new PluginableElementListModel<MessageColorizer>(container);
    jList = new JList(listModel);
    jList.setCellRenderer(new PluginableElementNameListRenderer());
    cardLayout = new CardLayout();
    contentPanel = new JPanel(cardLayout);
    contentPanel.add(editor, CARD_LAYOUT_EDITOR);
    contentPanel.add(noEditable, CARD_LAYOUT_NOT_EDITABLE);
    contentPanel.add(nothingSelected, CARD_LAYOUT_NO_SELECTED);
    cardLayout.show(contentPanel, CARD_LAYOUT_NOT_EDITABLE);
    JSplitPane mainSplitPane = new JSplitPane(SwingConstants.VERTICAL, new JScrollPane(jList), contentPanel);
    mainSplitPane.setDividerLocation(220);

    jList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override/*ww  w .  ja va2 s  .c  o m*/
        public void valueChanged(ListSelectionEvent e) {
            showSelected();
            enableDisableButtonsForSelectedColorizer();
        }

    });

    jList.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            int keyCode = e.getKeyCode();
            if (keyCode == KeyEvent.VK_DELETE) {
                ActionEvent actionEvent = new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, "");
                deleteAction.actionPerformed(actionEvent);
            }
        }
    });

    JButton createNew = new JButton("Create new", Icons.ADD);
    createNew.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            saveAsButton.setEnabled(false);
            createNew();
        }
    });

    saveButton = new JButton("Save and use", Icons.DISK);
    saveButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            try {
                PropertyPatternMessageColorizer mc = editor.createMessageColorizer();
                File selectedFile = null;
                String f = mc.getFile();
                if (StringUtils.isNotBlank(f)) {
                    selectedFile = new File(mc.getFile());
                } else {
                    int response = chooser.showSaveDialog(MessageColorizerBrowser.this);
                    if (response != JFileChooser.APPROVE_OPTION) {
                        return;
                    }
                    selectedFile = chooser.getSelectedFile();
                    if (!selectedFile.getName().endsWith(".pattern")) {
                        selectedFile = new File(selectedFile.getParentFile(),
                                selectedFile.getName() + ".pattern");
                    }
                }
                removeMessageColorizerWithNullFile();
                applyMessageColorizer(selectedFile);
                saveMessageColorizer(selectedFile);
                jList.setSelectedValue(mc, true);
            } catch (ConfigurationException e1) {
                String errorMessage = String.format("Can't save message colorizer: %s", e1.getMessage());
                LOGGER.severe(errorMessage);
                MessageColorizerBrowser.this.otrosApplication.getStatusObserver().updateStatus(errorMessage,
                        StatusObserver.LEVEL_ERROR);
            }
        }
    });

    saveAsButton = new JButton("Save as", Icons.DISK_PLUS);
    saveAsButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                int response = chooser.showSaveDialog(MessageColorizerBrowser.this);
                if (response != JFileChooser.APPROVE_OPTION) {
                    return;
                }
                File selectedFile = chooser.getSelectedFile();
                selectedFile = chooser.getSelectedFile();
                if (!selectedFile.getName().endsWith(".pattern")) {
                    selectedFile = new File(selectedFile.getParentFile(), selectedFile.getName() + ".pattern");
                }
                removeMessageColorizerWithNullFile();
                applyMessageColorizer(selectedFile);
                saveMessageColorizer(selectedFile);
                jList.setSelectedValue(editor.createMessageColorizer(), true);
            } catch (ConfigurationException e1) {
                String errorMessage = String.format("Can't save message colorizer: %s", e1.getMessage());
                LOGGER.severe(errorMessage);
                MessageColorizerBrowser.this.otrosApplication.getStatusObserver().updateStatus(errorMessage,
                        StatusObserver.LEVEL_ERROR);
            }
        }
    });

    useButton = new JButton("Use without saving");
    useButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            try {
                removeMessageColorizerWithNullFile();
                applyMessageColorizer(File.createTempFile("messageColorizer", "pattern"));
            } catch (Exception e) {
                LOGGER.severe("Cannot create message colorizer: " + e.getMessage());
            }

        }
    });

    deleteAction = new DeleteSelected(otrosApplication);
    deleteButton = new JButton(deleteAction);

    toolBar.setFloatable(false);
    toolBar.add(createNew);
    toolBar.add(saveButton);
    toolBar.add(saveAsButton);
    toolBar.add(useButton);
    toolBar.add(deleteButton);
    enableDisableButtonsForSelectedColorizer();
    initFileChooser();
    this.add(mainSplitPane);
    this.add(toolBar, BorderLayout.SOUTH);
}

From source file:pl.otros.vfs.browser.VfsBrowser.java

License:asdf

private void initGui(final String initialPath) {
    this.setLayout(new BorderLayout());
    JLabel pathLabel = new JLabel(Messages.getMessage("browser.location"));
    pathLabel.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3));
    pathField = new JTextField(80);
    pathField.setFont(pathLabel.getFont().deriveFont(pathLabel.getFont().getSize() * 1.2f));
    pathField.setToolTipText(Messages.getMessage("nav.pathTooltip"));
    GuiUtils.addBlinkOnFocusGain(pathField);
    pathLabel.setLabelFor(pathField);//from  ww w  .  j  a v  a  2s  .  c  o  m
    pathLabel.setDisplayedMnemonic(Messages.getMessage("browser.location.mnemonic").charAt(0));

    InputMap inputMapPath = pathField.getInputMap(JComponent.WHEN_FOCUSED);
    inputMapPath.put(KeyStroke.getKeyStroke("ENTER"), "OPEN_PATH");
    inputMapPath.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), ACTION_FOCUS_ON_TABLE);
    pathField.getActionMap().put("OPEN_PATH", new BaseNavigateAction(this) {

        @Override
        protected void performLongOperation(CheckBeforeActionResult actionResult) {
            try {
                FileObject resolveFile = VFSUtils.resolveFileObject(pathField.getText().trim());
                if (resolveFile != null && resolveFile.getType() == FileType.FILE) {
                    loadAndSelSingleFile(resolveFile);
                    pathField.setText(resolveFile.getURL().toString());
                    actionApproveDelegate.actionPerformed(
                            // TODO:  Does actionResult provide an ID for 2nd param here,
                            // or should use a Random number?
                            new ActionEvent(actionResult, (int) new java.util.Date().getTime(),
                                    "SELECTED_FILE"));
                    return;
                }
            } catch (FileSystemException fse) {
                // Intentionally empty
            }
            goToUrl(pathField.getText().trim());
        }

        @Override
        protected boolean canGoUrl() {
            return true;
        }

        @Override
        protected boolean canExecuteDefaultAction() {
            return false;
        }

    });
    actionFocusOnTable = new

    AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            tableFiles.requestFocusInWindow();
            if (tableFiles.getSelectedRow() < 0 && tableFiles.getRowCount() == 0) {
                tableFiles.getSelectionModel().setSelectionInterval(0, 0);
            }
        }
    };
    pathField.getActionMap().put(ACTION_FOCUS_ON_TABLE, actionFocusOnTable);

    BaseNavigateActionGoUp goUpAction = new BaseNavigateActionGoUp(this);
    goUpButton = new JButton(goUpAction);

    BaseNavigateActionRefresh refreshAction = new BaseNavigateActionRefresh(this);
    JButton refreshButton = new JButton(refreshAction);

    JToolBar upperPanel = new JToolBar(Messages.getMessage("nav.ToolBarName"));
    upperPanel.setRollover(true);
    upperPanel.add(pathLabel);
    upperPanel.add(pathField, "growx");
    upperPanel.add(goUpButton);
    upperPanel.add(refreshButton);

    AddCurrentLocationToFavoriteAction addCurrentLocationToFavoriteAction = new AddCurrentLocationToFavoriteAction(
            this);
    JButton addCurrentLocationToFavoriteButton = new JButton(addCurrentLocationToFavoriteAction);
    addCurrentLocationToFavoriteButton.setText("");
    upperPanel.add(addCurrentLocationToFavoriteButton);

    previewComponent = new PreviewComponent();

    vfsTableModel = new VfsTableModel();

    tableFiles = new JTable(vfsTableModel);
    tableFiles.setFillsViewportHeight(true);
    tableFiles.getColumnModel().getColumn(0).setMinWidth(140);
    tableFiles.getColumnModel().getColumn(1).setMaxWidth(80);
    tableFiles.getColumnModel().getColumn(2).setMaxWidth(80);
    tableFiles.getColumnModel().getColumn(3).setMaxWidth(180);
    tableFiles.getColumnModel().getColumn(3).setMinWidth(120);

    sorter = new TableRowSorter<VfsTableModel>(vfsTableModel);
    final FileNameWithTypeComparator fileNameWithTypeComparator = new FileNameWithTypeComparator();
    sorter.addRowSorterListener(new RowSorterListener() {
        @Override
        public void sorterChanged(RowSorterEvent e) {
            RowSorterEvent.Type type = e.getType();
            if (type.equals(RowSorterEvent.Type.SORT_ORDER_CHANGED)) {
                List<? extends RowSorter.SortKey> sortKeys = e.getSource().getSortKeys();
                for (RowSorter.SortKey sortKey : sortKeys) {
                    if (sortKey.getColumn() == VfsTableModel.COLUMN_NAME) {
                        fileNameWithTypeComparator.setSortOrder(sortKey.getSortOrder());
                    }
                }
            }
        }
    });
    sorter.setComparator(VfsTableModel.COLUMN_NAME, fileNameWithTypeComparator);

    tableFiles.setRowSorter(sorter);
    tableFiles.setShowGrid(false);
    tableFiles.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            try {
                selectionChanged();
            } catch (FileSystemException e1) {
                LOGGER.error("Error during update state", e);
            }
        }
    });
    tableFiles.setColumnSelectionAllowed(false);
    vfsTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            updateStatusText();
        }
    });

    tableFiles.setDefaultRenderer(FileSize.class, new FileSizeTableCellRenderer());
    tableFiles.setDefaultRenderer(FileNameWithType.class, new FileNameWithTypeTableCellRenderer());
    tableFiles.setDefaultRenderer(Date.class, new MixedDateTableCellRenderer());
    tableFiles.setDefaultRenderer(FileType.class, new FileTypeTableCellRenderer());

    tableFiles.getSelectionModel().addListSelectionListener(new PreviewListener(this, previewComponent));

    JPanel favoritesPanel = new JPanel(new MigLayout("wrap, fillx", "[grow]"));
    favoritesUserListModel = new MutableListModel<Favorite>();

    List<Favorite> favSystemLocations = FavoritesUtils.getSystemLocations();
    List<Favorite> favUser = FavoritesUtils.loadFromProperties(configuration);
    List<Favorite> favJVfsFileChooser = FavoritesUtils.getJvfsFileChooserBookmarks();
    for (Favorite favorite : favUser) {
        favoritesUserListModel.add(favorite);
    }
    favoritesUserListModel.addListDataListener(new ListDataListener() {
        @Override
        public void intervalAdded(ListDataEvent e) {
            saveFavorites();

        }

        @Override
        public void intervalRemoved(ListDataEvent e) {
            saveFavorites();
        }

        @Override
        public void contentsChanged(ListDataEvent e) {
            saveFavorites();
        }

        protected void saveFavorites() {
            FavoritesUtils.storeFavorites(configuration, favoritesUserListModel.getList());
        }
    });

    favoritesUserList = new JList(favoritesUserListModel);
    favoritesUserList.setTransferHandler(new MutableListDropHandler(favoritesUserList));
    new MutableListDragListener(favoritesUserList);
    favoritesUserList.setCellRenderer(new FavoriteListCellRenderer());
    favoritesUserList.addFocusListener(new SelectFirstElementFocusAdapter());

    addOpenActionToList(favoritesUserList);
    addEditActionToList(favoritesUserList, favoritesUserListModel);

    favoritesUserList.getActionMap().put(ACTION_DELETE, new AbstractAction(
            Messages.getMessage("favorites.deleteButtonText"), Icons.getInstance().getMinusButton()) {

        @Override
        public void actionPerformed(ActionEvent e) {
            Favorite favorite = favoritesUserListModel.getElementAt(favoritesUserList.getSelectedIndex());
            if (!Favorite.Type.USER.equals(favorite.getType())) {
                return;
            }
            int response = JOptionPane.showConfirmDialog(VfsBrowser.this,
                    Messages.getMessage("favorites.areYouSureToDeleteConnections"),
                    Messages.getMessage("favorites.confirm"), JOptionPane.YES_NO_OPTION);

            if (response == JOptionPane.YES_OPTION) {
                favoritesUserListModel.remove(favoritesUserList.getSelectedIndex());
            }
        }
    });
    InputMap favoritesListInputMap = favoritesUserList.getInputMap(JComponent.WHEN_FOCUSED);
    favoritesListInputMap.put(KeyStroke.getKeyStroke("DELETE"), ACTION_DELETE);

    ActionMap actionMap = tableFiles.getActionMap();
    actionMap.put(ACTION_OPEN, new BaseNavigateActionOpen(this));
    actionMap.put(ACTION_GO_UP, goUpAction);
    actionMap.put(ACTION_APPROVE, new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (actionApproveButton.isEnabled()) {
                actionApproveDelegate.actionPerformed(e);
            }
        }
    });

    InputMap inputMap = tableFiles.getInputMap(JComponent.WHEN_FOCUSED);
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), ACTION_OPEN);
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_MASK), ACTION_APPROVE);

    inputMap.put(KeyStroke.getKeyStroke("BACK_SPACE"), ACTION_GO_UP);
    inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), ACTION_GO_UP);
    addPopupMenu(favoritesUserList, ACTION_OPEN, ACTION_EDIT, ACTION_DELETE);

    JList favoriteSystemList = new JList(new Vector<Object>(favSystemLocations));
    favoriteSystemList.setCellRenderer(new FavoriteListCellRenderer());
    addOpenActionToList(favoriteSystemList);
    addPopupMenu(favoriteSystemList, ACTION_OPEN);
    favoriteSystemList.addFocusListener(new SelectFirstElementFocusAdapter());

    JList favoriteJVfsList = new JList(new Vector<Object>(favJVfsFileChooser));
    addOpenActionToList(favoriteJVfsList);
    favoriteJVfsList.setCellRenderer(new FavoriteListCellRenderer());
    addPopupMenu(favoriteJVfsList, ACTION_OPEN);
    favoriteJVfsList.addFocusListener(new SelectFirstElementFocusAdapter());

    JLabel favoritesSystemLocationsLabel = getTitleListLabel(Messages.getMessage("favorites.systemLocations"),
            COMPUTER_ICON);
    favoritesSystemLocationsLabel.setLabelFor(favoriteSystemList);
    favoritesSystemLocationsLabel
            .setDisplayedMnemonic(Messages.getMessage("favorites.systemLocations.mnemonic").charAt(0));
    favoritesPanel.add(favoritesSystemLocationsLabel, "gapleft 16");
    favoritesPanel.add(favoriteSystemList, "growx");
    JLabel favoritesFavoritesLabel = getTitleListLabel(Messages.getMessage("favorites.favorites"),
            Icons.getInstance().getStar());
    favoritesFavoritesLabel.setLabelFor(favoritesUserList);
    favoritesFavoritesLabel.setDisplayedMnemonic(Messages.getMessage("favorites.favorites.mnemonic").charAt(0));
    favoritesPanel.add(favoritesFavoritesLabel, "gapleft 16");
    favoritesPanel.add(favoritesUserList, "growx");

    if (favoriteJVfsList.getModel().getSize() > 0) {
        JLabel favoritesJVfsFileChooser = getTitleListLabel(
                Messages.getMessage("favorites.JVfsFileChooserBookmarks"), null);
        favoritesJVfsFileChooser.setDisplayedMnemonic(
                Messages.getMessage("favorites.JVfsFileChooserBookmarks.mnemonic").charAt(0));
        favoritesJVfsFileChooser.setLabelFor(favoriteJVfsList);
        favoritesPanel.add(favoritesJVfsFileChooser, "gapleft 16");
        favoritesPanel.add(favoriteJVfsList, "growx");
    }

    tableFiles.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
                tableFiles.getActionMap().get(ACTION_OPEN).actionPerformed(null);
            }
        }
    });
    tableFiles.addKeyListener(new QuickSearchKeyAdapter());

    cardLayout = new CardLayout();
    tablePanel = new JPanel(cardLayout);
    loadingProgressBar = new JProgressBar();
    loadingProgressBar.setStringPainted(true);
    loadingProgressBar.setString(Messages.getMessage("browser.loading"));
    loadingProgressBar.setIndeterminate(true);
    loadingIconLabel = new JLabel(Icons.getInstance().getNetworkStatusOnline());
    skipCheckingLinksButton = new JToggleButton(Messages.getMessage("browser.skipCheckingLinks"));
    skipCheckingLinksButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            if (taskContext != null) {
                taskContext.setStop(skipCheckingLinksButton.isSelected());
            }
        }
    });

    showHidCheckBox = new JCheckBox(Messages.getMessage("browser.showHidden.label"), showHidden);
    showHidCheckBox.setToolTipText(Messages.getMessage("browser.showHidden.tooltip"));
    showHidCheckBox.setMnemonic(Messages.getMessage("browser.showHidden.mnemonic").charAt(0));
    Font tmpFont = showHidCheckBox.getFont();
    showHidCheckBox.setFont(tmpFont.deriveFont(tmpFont.getSize() * 0.9f));
    showHidCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateUiFilters();
        }
    });

    final String defaultFilterText = Messages.getMessage("browser.nameFilter.defaultText");
    filterField = new JTextField("", 16);
    filterField.setForeground(filterField.getDisabledTextColor());
    filterField.setToolTipText(Messages.getMessage("browser.nameFilter.tooltip"));
    PromptSupport.setPrompt(defaultFilterText, filterField);
    filterField.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            documentChanged();
        }

        void documentChanged() {
            if (filterField.getText().length() == 0) {
                updateUiFilters();
            }
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            documentChanged();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            documentChanged();
        }
    });
    filterField.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            updateUiFilters();
        }
    });

    AbstractAction actionClearRegexFilter = new

    AbstractAction(Messages.getMessage("browser.nameFilter.clearFilterText")) {

        @Override
        public void actionPerformed(ActionEvent e) {
            filterField.setText("");
        }
    };
    filterField.getActionMap().put(ACTION_FOCUS_ON_TABLE, actionFocusOnTable);
    filterField.getActionMap().put(ACTION_CLEAR_REGEX_FILTER, actionClearRegexFilter);

    filterField.getInputMap(WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), ACTION_FOCUS_ON_TABLE);
    filterField.getInputMap(WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), ACTION_FOCUS_ON_TABLE);
    filterField.getInputMap(WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0),
            ACTION_FOCUS_ON_TABLE);
    filterField.getInputMap(WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
            ACTION_FOCUS_ON_TABLE);
    filterField.getInputMap(WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
            ACTION_CLEAR_REGEX_FILTER);

    JLabel nameFilterLabel = new JLabel(Messages.getMessage("browser.nameFilter"));
    nameFilterLabel.setLabelFor(filterField);
    nameFilterLabel.setDisplayedMnemonic(Messages.getMessage("browser.nameFilter.mnemonic").charAt(0));

    sorter.setRowFilter(createFilter());
    statusLabel = new JLabel();

    actionApproveButton = new JButton();
    actionApproveButton.setFont(actionApproveButton.getFont().deriveFont(Font.BOLD));
    actionCancelButton = new JButton();

    ActionMap browserActionMap = this.getActionMap();
    browserActionMap.put(ACTION_FOCUS_ON_REGEX_FILTER, new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            filterField.requestFocus();
            filterField.selectAll();
            GuiUtils.blinkComponent(filterField);
        }
    });

    browserActionMap.put(ACTION_FOCUS_ON_PATH, new SetFocusOnAction(pathField));
    browserActionMap.put(ACTION_SWITCH_SHOW_HIDDEN, new ClickOnJComponentAction(showHidCheckBox));
    browserActionMap.put(ACTION_REFRESH, refreshAction);
    browserActionMap.put(ACTION_ADD_CURRENT_LOCATION_TO_FAVORITES, addCurrentLocationToFavoriteAction);
    browserActionMap.put(ACTION_GO_UP, goUpAction);
    browserActionMap.put(ACTION_FOCUS_ON_TABLE, new SetFocusOnAction(tableFiles));

    InputMap browserInputMap = this.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    browserInputMap.put(KeyStroke.getKeyStroke("control F"), ACTION_FOCUS_ON_REGEX_FILTER);
    browserInputMap.put(KeyStroke.getKeyStroke("control L"), ACTION_FOCUS_ON_PATH);
    browserInputMap.put(KeyStroke.getKeyStroke("F4"), ACTION_FOCUS_ON_PATH);
    browserInputMap.put(KeyStroke.getKeyStroke("control H"), ACTION_SWITCH_SHOW_HIDDEN);
    browserInputMap.put(KeyStroke.getKeyStroke("control R"), ACTION_REFRESH);
    browserInputMap.put(KeyStroke.getKeyStroke("F5"), ACTION_REFRESH);
    browserInputMap.put(KeyStroke.getKeyStroke("control D"), ACTION_ADD_CURRENT_LOCATION_TO_FAVORITES);
    browserInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK), ACTION_GO_UP);
    browserInputMap.put(KeyStroke.getKeyStroke("control T"), ACTION_FOCUS_ON_TABLE);

    //DO layout
    // create the layer for the panel using our custom layerUI
    tableScrollPane = new JScrollPane(tableFiles);

    JPanel tableScrollPaneWithFilter = new JPanel(new BorderLayout());
    tableScrollPaneWithFilter.add(tableScrollPane);
    JToolBar filtersToolbar = new JToolBar("Filters");
    filtersToolbar.setFloatable(false);
    filtersToolbar.setBorderPainted(true);
    tableScrollPaneWithFilter.add(filtersToolbar, BorderLayout.SOUTH);
    filtersToolbar.add(nameFilterLabel);
    filtersToolbar.add(filterField);
    filtersToolbar.add(showHidCheckBox);
    JSplitPane tableWithPreviewPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true,
            tableScrollPaneWithFilter, previewComponent);
    tableWithPreviewPane.setOneTouchExpandable(true);

    JPanel loadingPanel = new JPanel(new MigLayout());
    loadingPanel.add(loadingIconLabel, "right");
    loadingPanel.add(loadingProgressBar, "left, w 420:420:500,wrap");
    loadingPanel.add(skipCheckingLinksButton, "span, right");
    tablePanel.add(loadingPanel, LOADING);
    tablePanel.add(tableWithPreviewPane, TABLE);

    JSplitPane jSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(favoritesPanel),
            tablePanel);
    jSplitPane.setOneTouchExpandable(true);
    jSplitPane.setDividerLocation(180);

    JPanel southPanel = new JPanel(new MigLayout("", "[]push[][]", ""));
    southPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    southPanel.add(statusLabel);
    southPanel.add(actionApproveButton);
    southPanel.add(actionCancelButton);

    this.add(upperPanel, BorderLayout.NORTH);
    this.add(jSplitPane, BorderLayout.CENTER);
    this.add(southPanel, BorderLayout.SOUTH);

    try {
        selectionChanged();
    } catch (FileSystemException e) {
        LOGGER.error("Can't initialize default selection mode", e);
    }
    // Why this not done in EDT?
    // Is it assume that constructor is invoked from an  EDT?
    try {
        if (initialPath == null) {
            goToUrl(VFSUtils.getUserHome());
        } else {
            try {
                FileObject resolveFile = VFSUtils.resolveFileObject(initialPath);
                if (resolveFile != null && resolveFile.getType() == FileType.FILE) {
                    loadAndSelSingleFile(resolveFile);
                    pathField.setText(resolveFile.getURL().toString());
                    targetFileSelected = true;
                    return;
                }
            } catch (FileSystemException fse) {
                // Intentionally empty
            }
            goToUrl(initialPath);
        }
    } catch (FileSystemException e1) {
        LOGGER.error("Can't initialize default location", e1);
    }
    showTable();
}

From source file:rentalshop.Window.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from  w w w.  j a  v a 2 s  .c om
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jMenu1 = new javax.swing.JMenu();
    jMenu2 = new javax.swing.JMenu();
    jMenu3 = new javax.swing.JMenu();
    jMenuItem1 = new javax.swing.JMenuItem();
    jButton1 = new javax.swing.JButton();
    buttonGroup1 = new javax.swing.ButtonGroup();
    buttonGroup2 = new javax.swing.ButtonGroup();
    buttonGroup3 = new javax.swing.ButtonGroup();
    buttonGroup4 = new javax.swing.ButtonGroup();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    producerText = new javax.swing.JTextField();
    modelText = new javax.swing.JTextField();
    spzText = new javax.swing.JTextField();
    priceText = new javax.swing.JTextField();
    manufacturedText = new javax.swing.JTextField();
    jScrollPane1 = new javax.swing.JScrollPane();
    carTable = new javax.swing.JTable();
    carTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent lse) {
            if (!lse.getValueIsAdjusting()) {
                carRow = carTable.getSelectedRow();
                //System.out.println("Selection Changed on car: "+carRow+" row");

                if (carRow != -1) {
                    carLabel.setText(
                            java.util.ResourceBundle.getBundle("Resource/Czech").getString("Edit row"));
                    carSave.setText(java.util.ResourceBundle.getBundle("Resource/Czech").getString("Edit row"));

                    producerText.setText((String) carTable.getValueAt(carRow, 1));
                    modelText.setText((String) carTable.getValueAt(carRow, 2));
                    spzText.setText((String) carTable.getValueAt(carRow, 3));
                    manufacturedText.setText((String) carTable.getValueAt(carRow, 4).toString());
                    priceText.setText((String) carTable.getValueAt(carRow, 5).toString());
                }
            }
        }
    });
    carLabel = new javax.swing.JLabel();
    carSave = new javax.swing.JButton();
    carClear = new javax.swing.JButton();
    carDeleteRow = new javax.swing.JButton();
    carCancel = new javax.swing.JButton();
    jPanel3 = new javax.swing.JPanel();
    jLabel8 = new javax.swing.JLabel();
    jLabel9 = new javax.swing.JLabel();
    jLabel10 = new javax.swing.JLabel();
    jLabel11 = new javax.swing.JLabel();
    jLabel12 = new javax.swing.JLabel();
    nameText = new javax.swing.JTextField();
    surnameText = new javax.swing.JTextField();
    dlnText = new javax.swing.JTextField();
    debtsText = new javax.swing.JTextField();
    icnText = new javax.swing.JTextField();
    jScrollPane2 = new javax.swing.JScrollPane();
    customerTable = new javax.swing.JTable();
    customerTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent lse) {
            if (!lse.getValueIsAdjusting()) {
                custRow = customerTable.getSelectedRow();
                //System.out.println("Selection Changed on customer: "+custRow+" row");

                if (custRow != -1) {
                    custLabel.setText(
                            java.util.ResourceBundle.getBundle("Resource/Czech").getString("Edit row"));
                    customerSave.setText(
                            java.util.ResourceBundle.getBundle("Resource/Czech").getString("Edit row"));

                    nameText.setText((String) customerTable.getValueAt(custRow, 1));
                    surnameText.setText((String) customerTable.getValueAt(custRow, 2));
                    dlnText.setText((String) customerTable.getValueAt(custRow, 3).toString());
                    icnText.setText((String) customerTable.getValueAt(custRow, 4).toString());
                    debtsText.setText((String) customerTable.getValueAt(custRow, 5).toString());
                }
            }
        }
    });
    custLabel = new javax.swing.JLabel();
    customerSave = new javax.swing.JButton();
    customerClear = new javax.swing.JButton();
    custDeleteRow = new javax.swing.JButton();
    custCancel = new javax.swing.JButton();
    jPanel4 = new javax.swing.JPanel();
    jLabel15 = new javax.swing.JLabel();
    jLabel16 = new javax.swing.JLabel();
    jLabel17 = new javax.swing.JLabel();
    jLabel18 = new javax.swing.JLabel();
    fromText = new javax.swing.JTextField();
    toText = new javax.swing.JTextField();
    jScrollPane3 = new javax.swing.JScrollPane();
    orderTable = new javax.swing.JTable();
    orderTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent lse) {
            if (!lse.getValueIsAdjusting()) {
                orderRow = orderTable.getSelectedRow();
                //System.out.println("Selection Changed on order: "+orderRow+" row");

                if (orderRow != -1) {
                    orderLabel.setText(
                            java.util.ResourceBundle.getBundle("Resource/Czech").getString("Edit row"));
                    orderSave.setText(
                            java.util.ResourceBundle.getBundle("Resource/Czech").getString("Edit row"));

                    fromText.setText((String) orderTable.getValueAt(orderRow, 1).toString());
                    toText.setText((String) orderTable.getValueAt(orderRow, 2).toString());
                    //cbxCar.setSelectedIndex();
                    //cbxCust.setSelectedIndex();
                }
            }
        }
    });
    orderLabel = new javax.swing.JLabel();
    orderSave = new javax.swing.JButton();
    orderClear = new javax.swing.JButton();
    cbxCar = new javax.swing.JComboBox();
    cbxCust = new javax.swing.JComboBox();
    orderDeleteRow = new javax.swing.JButton();
    orderCancel = new javax.swing.JButton();

    jMenu1.setText("jMenu1");

    jMenu2.setText("jMenu2");

    jMenu3.setText("jMenu3");

    jMenuItem1.setText("jMenuItem1");

    jButton1.setText("jButton1");

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("Resource/Czech"); // NOI18N
    setTitle(bundle.getString("RentalShop")); // NOI18N
    setResizable(false);

    java.util.ResourceBundle bundle1 = java.util.ResourceBundle.getBundle("Resource/Czech_cs"); // NOI18N
    jTabbedPane1.setName(bundle1.getString("Order")); // NOI18N

    jPanel1.setPreferredSize(new java.awt.Dimension(850, 458));

    jLabel1.setText(bundle.getString("Producer")); // NOI18N

    jLabel2.setText(bundle.getString("Model")); // NOI18N

    jLabel3.setText(bundle1.getString("SPZ")); // NOI18N

    jLabel4.setText(bundle.getString("Manufactured")); // NOI18N

    jLabel5.setText(bundle.getString("Price")); // NOI18N

    carTable.setModel(new CarTableModel());
    jScrollPane1.setViewportView(carTable);

    carLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    carLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    carLabel.setText(bundle.getString("Add")); // NOI18N

    carSave.setText(bundle.getString("Save")); // NOI18N
    carSave.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            carSaveActionPerformed(evt);
        }
    });

    carClear.setText(bundle.getString("Clear")); // NOI18N
    carClear.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            carClearActionPerformed(evt);
        }
    });

    carDeleteRow.setText(bundle1.getString("Delete row")); // NOI18N
    carDeleteRow.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            carDeleteRowActionPerformed(evt);
        }
    });

    carCancel.setText(bundle1.getString("cancel")); // NOI18N
    carCancel.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            carCancelActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane1)
                    .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout
                                    .createSequentialGroup()
                                    .addGroup(jPanel1Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel3).addComponent(jLabel1))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addGroup(jPanel1Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(producerText,
                                                    javax.swing.GroupLayout.Alignment.TRAILING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, 250,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(spzText, javax.swing.GroupLayout.Alignment.TRAILING,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                    jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    false)
                                            .addComponent(carLabel, javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout
                                                    .createSequentialGroup().addComponent(jLabel5)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addComponent(priceText,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(carSave, javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, 400,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGap(0, 0, Short.MAX_VALUE)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66,
                                    Short.MAX_VALUE)
                            .addGroup(jPanel1Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(carClear, javax.swing.GroupLayout.PREFERRED_SIZE, 400,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout
                                            .createSequentialGroup().addComponent(jLabel2)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(modelText, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    250, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout
                                            .createSequentialGroup().addComponent(jLabel4)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(manufacturedText,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, 250,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout
                                            .createSequentialGroup()
                                            .addComponent(carCancel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(carDeleteRow, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    250, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addContainerGap()));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(carDeleteRow).addComponent(carCancel))
                            .addComponent(carLabel, javax.swing.GroupLayout.Alignment.TRAILING))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                    jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addGroup(jPanel1Layout.createSequentialGroup()
                                                    .addComponent(jLabel2)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                    .addComponent(jLabel4).addGap(13, 13, 13))
                                            .addGroup(jPanel1Layout.createSequentialGroup()
                                                    .addGroup(jPanel1Layout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.BASELINE)
                                                            .addComponent(producerText,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                                            .addComponent(jLabel1))
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addGroup(jPanel1Layout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.BASELINE)
                                                            .addComponent(spzText,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                                            .addComponent(jLabel3))
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                                            .addGroup(jPanel1Layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.BASELINE)
                                                    .addComponent(jLabel5).addComponent(priceText,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout
                                    .createSequentialGroup()
                                    .addComponent(modelText, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(manufacturedText, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(29, 29, 29)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(carSave).addComponent(carClear))
                    .addContainerGap()));

    jTabbedPane1.addTab(bundle.getString("Car"), jPanel1); // NOI18N

    jLabel8.setText(bundle.getString("Name")); // NOI18N

    jLabel9.setText(bundle.getString("Surname")); // NOI18N

    jLabel10.setText(bundle.getString("Driving")); // NOI18N

    jLabel11.setText(bundle.getString("Identification")); // NOI18N

    jLabel12.setText(bundle.getString("Debts")); // NOI18N

    customerTable.setModel(new CustomerTableModel());
    jScrollPane2.setViewportView(customerTable);

    custLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    custLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    custLabel.setText(bundle1.getString("Add")); // NOI18N

    customerSave.setText(bundle.getString("Save")); // NOI18N
    customerSave.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            customerSaveActionPerformed(evt);
        }
    });

    customerClear.setText(bundle.getString("Clear")); // NOI18N
    customerClear.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            customerClearActionPerformed(evt);
        }
    });

    custDeleteRow.setText(bundle1.getString("Delete row")); // NOI18N
    custDeleteRow.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            custDeleteRowActionPerformed(evt);
        }
    });

    custCancel.setText(bundle1.getString("cancel")); // NOI18N
    custCancel.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            custCancelActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(jPanel3Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addGroup(jPanel3Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane2)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel3Layout.createSequentialGroup().addGroup(jPanel3Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel3Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    false)
                                            .addGroup(jPanel3Layout.createSequentialGroup()
                                                    .addComponent(jLabel8)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addComponent(nameText,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(customerSave, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    400, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(jPanel3Layout.createSequentialGroup()
                                                    .addComponent(jLabel12)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addComponent(debtsText,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(jPanel3Layout.createSequentialGroup()
                                                    .addComponent(jLabel10,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 119,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addComponent(dlnText,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addComponent(custLabel))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66,
                                            Short.MAX_VALUE)
                                    .addGroup(jPanel3Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout
                                                    .createSequentialGroup()
                                                    .addComponent(custCancel,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(custDeleteRow,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout
                                                    .createSequentialGroup().addComponent(jLabel9)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addComponent(surnameText,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                                            .addComponent(jLabel11).addGap(71, 71, 71)
                                                            .addComponent(icnText,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addComponent(customerClear,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 400,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addContainerGap()));
    jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 323, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(custLabel)
                            .addGroup(jPanel3Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(custDeleteRow).addComponent(custCancel)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(nameText, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8).addComponent(jLabel9).addComponent(surnameText,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(dlnText, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10).addComponent(jLabel11).addComponent(icnText,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel12)
                            .addComponent(debtsText, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(customerClear).addComponent(customerSave))
                    .addContainerGap()));

    custLabel.getAccessibleContext().setAccessibleName(bundle1.getString("Add")); // NOI18N

    jTabbedPane1.addTab(bundle.getString("Customer"), jPanel3); // NOI18N

    jLabel15.setText(bundle.getString("from")); // NOI18N

    jLabel16.setText(bundle.getString("to")); // NOI18N

    jLabel17.setText(bundle.getString("Car")); // NOI18N

    jLabel18.setText(bundle.getString("Customer")); // NOI18N

    orderTable.setModel(new OrderTableModel());
    jScrollPane3.setViewportView(orderTable);

    orderLabel.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    orderLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    orderLabel.setText(bundle1.getString("Add")); // NOI18N

    orderSave.setText(bundle.getString("Save")); // NOI18N
    orderSave.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            orderSaveActionPerformed(evt);
        }
    });

    orderClear.setText(bundle.getString("Clear")); // NOI18N
    orderClear.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            orderClearActionPerformed(evt);
        }
    });

    orderDeleteRow.setText(bundle1.getString("Delete row")); // NOI18N
    orderDeleteRow.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            orderDeleteRowActionPerformed(evt);
        }
    });

    orderCancel.setText(bundle1.getString("cancel")); // NOI18N
    orderCancel.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            orderCancelActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(jPanel4Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap().addGroup(jPanel4Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane3)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel4Layout.createSequentialGroup().addGroup(jPanel4Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel4Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    false)
                                            .addComponent(orderSave, javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 400,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(jPanel4Layout.createSequentialGroup()
                                                    .addGroup(jPanel4Layout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                            .addComponent(jLabel15).addComponent(jLabel17,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 37,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addGroup(jPanel4Layout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                                    false)
                                                            .addComponent(fromText,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE, 250,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(cbxCar, 0,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    Short.MAX_VALUE))))
                                    .addComponent(orderLabel))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66,
                                            Short.MAX_VALUE)
                                    .addGroup(jPanel4Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout
                                                    .createSequentialGroup()
                                                    .addComponent(orderCancel,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(orderDeleteRow,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(orderClear, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    400, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout
                                                    .createSequentialGroup()
                                                    .addGroup(jPanel4Layout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                            .addComponent(jLabel16).addComponent(jLabel18))
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addGroup(jPanel4Layout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                                    false)
                                                            .addComponent(toText,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE, 250,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(cbxCust, 0,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    Short.MAX_VALUE))))))
                    .addContainerGap()));
    jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 336,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(orderLabel).addComponent(orderDeleteRow).addComponent(orderCancel))
                    .addGap(4, 4, 4)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(toText, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel16)
                            .addComponent(fromText, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel15))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel18).addComponent(jLabel17)
                            .addComponent(cbxCar, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
                            .addComponent(cbxCust, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(orderSave).addComponent(orderClear))
                    .addContainerGap()));

    jTabbedPane1.addTab(bundle1.getString("Order"), jPanel4); // NOI18N

    getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER);
    jTabbedPane1.getAccessibleContext().setAccessibleName(bundle.getString("Car")); // NOI18N

    pack();
}

From source file:richtercloud.document.scanner.gui.DocumentScanner.java

/**
 * Creates new DocumentScanner which does nothing unless
 *
 * @throws richtercloud.document.scanner.gui.TesseractNotFoundException
 *//*from   ww  w. j  a va 2 s  .c  o  m*/
/*
internal implementation notes:
- resources are opened in init methods only (see https://richtercloud.de:446/doku.php?id=programming:java#resource_handling for details)
*/
public DocumentScanner() throws BinaryNotFoundException {
    this.parseArguments();
    assert HOME_DIR.exists();
    if (!CONFIG_DIR.exists()) {
        CONFIG_DIR.mkdir();
        LOGGER.info("created inexisting configuration directory '{}'", CONFIG_DIR_NAME);
    }
    try {
        this.tesseractOCREngineConfPanel = new TesseractOCREngineConfPanel();
    } catch (IOException | InterruptedException ex) {
        throw new RuntimeException(ex);
    }

    this.initComponents();

    //loading properties depends on initComponents because exceptions are
    //handled with GUI elements
    this.configFile = new File(CONFIG_DIR, CONFIG_FILE_NAME);
    if (this.configFile.exists()) {
        this.loadProperties(); //initializes this.conf
    } else {
        try {
            this.documentScannerConf = new DocumentScannerConf(entityManager, messageHandler, ENTITY_CLASSES,
                    derbyPersistenceStorageSchemeChecksumFile, xMLStorageFile);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
        LOGGER.info("no previous configuration found in configuration directry '{}', using default values",
                CONFIG_DIR.getAbsolutePath());
        //new configuration will be persisted in shutdownHook
    }

    //after loading DocumentScannerConf
    for (StorageConf<?, ?> availableStorageConf : this.documentScannerConf.getAvailableStorageConfs()) {
        this.storageListModel.addElement(availableStorageConf);
    }

    this.onDeviceUnset();
    Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override
        public void run() {
            LOGGER.info("running {} shutdown hooks", DocumentScanner.class);
            DocumentScanner.this.shutdownHook();
        }
    });
    this.oCREngineConfPanelMap.put(TesseractOCREngineConf.class, this.tesseractOCREngineConfPanel);
    this.oCREngineComboBoxModel.addElement(TesseractOCREngineConf.class);
    this.oCRDialogEngineComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            Class<? extends OCREngineConf<?>> clazz = (Class<? extends OCREngineConf<?>>) e.getItem();
            OCREngineConfPanel<?> cREngineConfPanel = DocumentScanner.this.oCREngineConfPanelMap.get(clazz);
            DocumentScanner.this.oCRDialogPanel.removeAll();
            DocumentScanner.this.oCRDialogPanel.add(cREngineConfPanel);
            DocumentScanner.this.oCRDialogPanel.revalidate();
            DocumentScanner.this.pack();
            DocumentScanner.this.oCRDialogPanel.repaint();
        }
    });
    this.oCRDialogPanel.setLayout(new BoxLayout(this.oCRDialogPanel, BoxLayout.X_AXIS));
    //set initial panel state
    this.oCRDialogPanel.removeAll();
    this.oCRDialogPanel.add(this.tesseractOCREngineConfPanel);
    this.oCRDialogPanel.revalidate();
    this.pack();
    this.oCRDialogPanel.repaint();

    this.storageCreateDialogTypeComboBoxModel.addElement(DerbyPersistenceStorageConf.class);
    this.storageCreateDialogTypeComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            Class<? extends StorageConf<?, ?>> clazz = (Class<? extends StorageConf<?, ?>>) e.getItem();
            StorageConfPanel<?> storageConfPanel = DocumentScanner.this.storageConfPanelMap.get(clazz);
            DocumentScanner.this.storageCreateDialogPanel.removeAll();
            DocumentScanner.this.storageCreateDialogPanel.add(storageConfPanel);
            DocumentScanner.this.storageCreateDialogPanel.revalidate();
            DocumentScanner.this.pack();
            DocumentScanner.this.storageCreateDialogPanel.repaint();
        }
    });

    this.storageList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            DocumentScanner.this.storageDialogSelectButton
                    .setEnabled(DocumentScanner.this.storageListModel.getSize() > 0
                            && DocumentScanner.this.storageList.getSelectedIndices().length > 0);
        }
    });
    File amountMoneyUsageStatisticsStorageFile = new File(CONFIG_DIR,
            AMOUNT_MONEY_USAGE_STATISTICS_STORAGE_FILE_NAME);
    File amountMoneyCurrencyStorageFile = new File(CONFIG_DIR, AMOUNT_MONEY_CURRENCY_STORAGE_FILE_NAME);
    try {
        this.amountMoneyUsageStatisticsStorage = new FileAmountMoneyUsageStatisticsStorage(
                amountMoneyUsageStatisticsStorageFile);
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    this.amountMoneyCurrencyStorage = new FileAmountMoneyCurrencyStorage(amountMoneyCurrencyStorageFile);
    JPAAmountMoneyMappingTypeHandlerFactory fieldHandlerFactory = new JPAAmountMoneyMappingTypeHandlerFactory(
            entityManager, INITIAL_QUERY_LIMIT_DEFAULT, messageHandler, BIDIRECTIONAL_HELP_DIALOG_TITLE);
    this.typeHandlerMapping = fieldHandlerFactory.generateTypeHandlerMapping();

    //after entity manager creation
    this.typeHandlerMapping.put(new TypeToken<List<AnyType>>() {
    }.getType(), new JPAEntityListTypeHandler(entityManager, messageHandler, BIDIRECTIONAL_HELP_DIALOG_TITLE));
}

From source file:ro.nextreports.designer.querybuilder.SelectionColumnPanel.java

private void buildUI() {

    setLayout(new GridBagLayout());

    final DBViewer viewer = Globals.getDBViewer();

    schemaCombo = new JComboBox();
    schemaCombo.setPreferredSize(comboDim);

    schemaCombo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            String schema = (String) e.getItem();
            shownColumnModel.clear();//  www  . ja va  2 s  .c  om
            columnModel.clear();
            tableModel.clear();
            try {
                DBInfo dbInfo = viewer.getDBInfo(schema, DBInfo.TABLES | DBInfo.VIEWS);
                List<DBTable> tables = dbInfo.getTables();
                Collections.sort(tables);
                for (DBTable table : tables) {
                    tableModel.addElement(table);
                }
            } catch (NextSqlException ex) {
                LOG.error(ex.getMessage(), ex);
                ex.printStackTrace();
            }
        }
    });

    try {
        List<String> schemas = viewer.getSchemas();
        String schemaName = viewer.getUserSchema();
        Collections.sort(schemas);
        boolean added = false;
        for (String schema : schemas) {
            if (DefaultSchemaManager.getInstance().isVisible(
                    DefaultDataSourceManager.getInstance().getConnectedDataSource().getName(), schema)) {
                added = true;
                schemaCombo.addItem(schema);
            }
        }

        if ((schema == null) || schema.equals(DefaultDBViewer.NO_SCHEMA_NAME)) {
            schema = DefaultDBViewer.NO_SCHEMA_NAME;//viewer.getUserSchema();
        }
        if (!added) {
            schemaCombo.addItem(schema);
        }
        schemaCombo.setSelectedItem(schema);
    } catch (NextSqlException e) {
        LOG.error(e.getMessage(), e);
        e.printStackTrace();
    }

    // create table list
    tableList = new JXList(tableModel);
    tableList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tableList.setCellRenderer(new DBTableCellRenderer());

    // create column list
    columnList = new JXList(columnModel);
    if (singleSelection) {
        columnList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    } else {
        columnList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    }
    columnList.setCellRenderer(new DBColumnCellRenderer());

    shownColumnList = new JXList(shownColumnModel);
    if (singleSelection) {
        shownColumnList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    } else {
        columnList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    }
    addDoubleClick();

    shownColumnList.setCellRenderer(new DBColumnCellRenderer());
    shownColumnList.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent mouseEvent) {
            if ((mouseEvent.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) {
                JPopupMenu popupMenu = new JPopupMenu();
                JMenuItem menuItem = new JMenuItem(new DeselectListAction(shownColumnList));
                popupMenu.add(menuItem);
                popupMenu.show((Component) mouseEvent.getSource(), mouseEvent.getX(), mouseEvent.getY());
            }
        }
    });

    tableList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting() == false) {
                int index = tableList.getSelectedIndex();
                if (index == -1) {
                    return;
                }
                DBTable table = (DBTable) tableModel.getElementAt(index);
                try {
                    List<DBColumn> columns = null;
                    try {
                        columns = viewer.getColumns(table.getSchema(), table.getName());
                    } catch (MalformedTableNameException e1) {
                        Show.error("Malformed table name : " + table.getName());
                        return;
                    }
                    Collections.sort(columns);
                    columnModel.clear();
                    shownColumnModel.clear();
                    for (DBColumn column : columns) {
                        columnModel.addElement(column);
                        shownColumnModel.addElement(column);
                    }
                } catch (NextSqlException e1) {
                    LOG.error(e1.getMessage(), e1);
                    e1.printStackTrace();
                    Show.error(e1);
                }
            }
        }
    });

    columnList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            shownColumnList.clearSelection();
        }
    });

    scrTable = new JScrollPane(tableList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrTable.setPreferredSize(scrDim);
    scrTable.setMinimumSize(scrDim);
    scrTable.setBorder(new TitledBorder(I18NSupport.getString("parameter.source.tables")));
    scrColumn = new JScrollPane(columnList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrColumn.setPreferredSize(scrDim);
    scrColumn.setMinimumSize(scrDim);
    scrColumn.setBorder(new TitledBorder(I18NSupport.getString("parameter.source.columns")));
    scrShownColumn = new JScrollPane(shownColumnList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrShownColumn.setPreferredSize(scrDim);
    scrShownColumn.setMinimumSize(scrDim);
    scrShownColumn.setBorder(new TitledBorder(I18NSupport.getString("parameter.source.shown.columns")));

    JPanel schemaPanel = new JPanel();
    schemaPanel.setLayout(new BoxLayout(schemaPanel, BoxLayout.X_AXIS));
    schemaPanel.add(new JLabel("Schema"));
    schemaPanel.add(Box.createHorizontalStrut(5));
    schemaPanel.add(schemaCombo);

    add(schemaPanel, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    add(scrTable, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 5), 0, 0));
    add(scrColumn, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));
    if (show) {
        add(scrShownColumn, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST,
                GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    }
}

From source file:ru.goodfil.catalog.ui.forms.CarsPanel.java

public CarsPanel() {
    initComponents();/*from w  ww.j a va  2  s .c o  m*/

    motorsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting())
                return;
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    onMotorSelected();
                    adjustButtonsEnabledProperty();
                }
            });
        }
    });
    motorsTable.setRowHeight(20);

    filtersTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting())
                return;
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    adjustButtonsEnabledProperty();
                }
            });
        }
    });
    filtersTable.setRowHeight(20);

    allFiltersTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting())
                return;
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    adjustButtonsEnabledProperty();
                }
            });
        }
    });
    allFiltersTable.setRowHeight(20);

    reReadVechicleTypes();
    reReadFilterTypes();

    filterTypeResolver = createFilterTypeResolver();

    vechicleTypesList.setModel(vechicleTypes);
    manufactorsList.setModel(manufactors);
    seriesList.setModel(series);
    motorsTable.setModel(new MotorTableAdapter(motors));
    motorsTable.setRowSorter(new MotorTableSorter((MotorTableAdapter) motorsTable.getModel()));

    filtersTable
            .setModel(new SmallFilterTableAdapter(filters, filterTypeResolver, filtersAndMotorsForComments));
    allFiltersTable.setModel(new SmallFilterTableAdapter(allFilters, filterTypeResolver));

    // ??   ?   ?  
    if (System.getProperty("catalog.mode.fromMann") != null
            && System.getProperty("catalog.mode.fromMann").equals("1")) {
        manufactorsList.setCellRenderer(new MannListsCellRenderer(MannListsCellRenderer.MANUFACTOR));
        seriesList.setCellRenderer(new MannListsCellRenderer(MannListsCellRenderer.SERIA));
        filtersTable.setDefaultRenderer(Object.class,
                new MannTablesCellRenderer(MannTablesCellRenderer.FILTER));
        allFiltersTable.setDefaultRenderer(Object.class,
                new MannTablesCellRenderer(MannTablesCellRenderer.FILTER));
        motorsTable.setDefaultRenderer(Object.class, new MannTablesCellRenderer(MannTablesCellRenderer.MOTOR));
    } else {
        filtersTable.setDefaultRenderer(Object.class, new FilterTableCellRenderer());
        allFiltersTable.setDefaultRenderer(Object.class, new FilterTableCellRenderer());
    }
    adjustButtonsEnabledProperty();
}

From source file:ru.goodfil.catalog.ui.forms.CarsPanel.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Sasha Ivanov
    DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance();
    panel1 = new JPanel();
    label1 = new JLabel();
    createTypeBtn = new JButton();
    editTypeBtn = new JButton();
    removeTypeBtn = new JButton();
    label2 = new JLabel();
    joinManufactorsBtn = new JButton();
    createManufactorBtn = new JButton();
    editManufactorBtn = new JButton();
    removeManufactorBtn = new JButton();
    label3 = new JLabel();
    joinSeriesBtn = new JButton();
    createSeriaBtn = new JButton();
    editSeriaBtn = new JButton();
    removeSeriaBtn = new JButton();
    scrollPane1 = new JScrollPane();
    vechicleTypesList = new JList();
    scrollPane2 = new JScrollPane();
    manufactorsList = new JList();
    scrollPane3 = new JScrollPane();
    seriesList = new JList();
    panel10 = new JPanel();
    label5 = new JLabel();
    createMotorBtn = new JButton();
    editMotorBtn = new JButton();
    removeMotorBtn = new JButton();
    joinMotorsBtn = new JButton();
    scrollPane4 = new JScrollPane();
    motorsTable = new JTable();
    panel3 = new JPanel();
    label6 = new JLabel();
    label7 = new JLabel();
    panel4 = new JPanel();
    label4 = compFactory.createLabel("\u0424\u0438\u043b\u044c\u0442\u0440");
    filterSearchField = new JTextField();
    filterSearchBtn = new JButton();
    scrollPane5 = new JScrollPane();
    filtersTable = new JTable();
    filterRelationComment = new JButton();
    attachFilterBtn = new JButton();
    scrollPane6 = new JScrollPane();
    allFiltersTable = new JTable();
    detachFilterBtn = new JButton();
    listsPopupMenu = new JPopupMenu();
    miCopyToExcel = new JMenuItem();
    miExportToExcel = new JMenuItem();
    menuItem1 = new JMenuItem();
    menuItem3 = new JMenuItem();
    menuItem2 = new JMenuItem();
    menuItem4 = new JMenuItem();
    CellConstraints cc = new CellConstraints();

    //======== this ========

    // JFormDesigner evaluation mark
    setBorder(/*from   w  w  w .  java2  s .  co m*/
            new javax.swing.border.CompoundBorder(
                    new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                            "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                            javax.swing.border.TitledBorder.BOTTOM,
                            new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                    getBorder()));
    addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent e) {
            if ("border".equals(e.getPropertyName()))
                throw new RuntimeException();
        }
    });

    setLayout(new FormLayout("default:grow", "fill:default:grow"));

    //======== panel1 ========
    {
        panel1.setLayout(new FormLayout(
                "default:grow, $lcgap, 3*(21pt), $lcgap, default:grow, $lcgap, 21dlu, $lcgap, 3*(21pt), $lcgap, default:grow, $lcgap, 21dlu, $lcgap, 3*(21pt)",
                "fill:21pt, fill:50dlu:grow, $lgap, min, fill:100dlu:grow, $lgap, fill:80dlu:grow"));

        //---- label1 ----
        label1.setText("\u0422\u0438\u043f \u0422\u0421");
        label1.setFont(label1.getFont().deriveFont(label1.getFont().getStyle() | Font.BOLD));
        panel1.add(label1, cc.xy(1, 1));

        //---- createTypeBtn ----
        createTypeBtn.setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
        createTypeBtn.setAlignmentY(0.0F);
        createTypeBtn.setToolTipText(
                "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0438\u043f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430");
        createTypeBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                createTypeBtnActionPerformed(e);
            }
        });
        panel1.add(createTypeBtn, cc.xy(3, 1));

        //---- editTypeBtn ----
        editTypeBtn.setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
        editTypeBtn.setToolTipText(
                "\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430");
        editTypeBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                editTypeBtnActionPerformed(e);
            }
        });
        panel1.add(editTypeBtn, cc.xy(4, 1));

        //---- removeTypeBtn ----
        removeTypeBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
        removeTypeBtn.setToolTipText(
                "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0442\u0438\u043f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430");
        removeTypeBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                removeTypeBtnActionPerformed(e);
            }
        });
        panel1.add(removeTypeBtn, cc.xy(5, 1));

        //---- label2 ----
        label2.setText("\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c");
        label2.setFont(label2.getFont().deriveFont(label2.getFont().getStyle() | Font.BOLD));
        panel1.add(label2, cc.xy(7, 1));

        //---- joinManufactorsBtn ----
        joinManufactorsBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/recycle_24.png")));
        joinManufactorsBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                joinManufactorsBtnActionPerformed(e);
            }
        });
        panel1.add(joinManufactorsBtn, cc.xy(9, 1));

        //---- createManufactorBtn ----
        createManufactorBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
        createManufactorBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                createManufactorBtnActionPerformed(e);
            }
        });
        panel1.add(createManufactorBtn, cc.xy(11, 1));

        //---- editManufactorBtn ----
        editManufactorBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
        editManufactorBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                editManufactorBtnActionPerformed(e);
            }
        });
        panel1.add(editManufactorBtn, cc.xy(12, 1));

        //---- removeManufactorBtn ----
        removeManufactorBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
        removeManufactorBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                removeManufactorBtnActionPerformed(e);
            }
        });
        panel1.add(removeManufactorBtn, cc.xy(13, 1));

        //---- label3 ----
        label3.setText("\u0421\u0435\u0440\u0438\u044f");
        label3.setFont(label3.getFont().deriveFont(label3.getFont().getStyle() | Font.BOLD));
        panel1.add(label3, cc.xy(15, 1));

        //---- joinSeriesBtn ----
        joinSeriesBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/recycle_24.png")));
        joinSeriesBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                joinSeriesBtnActionPerformed(e);
            }
        });
        panel1.add(joinSeriesBtn, cc.xy(17, 1));

        //---- createSeriaBtn ----
        createSeriaBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
        createSeriaBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                createSeriaBtnActionPerformed(e);
            }
        });
        panel1.add(createSeriaBtn, cc.xy(19, 1));

        //---- editSeriaBtn ----
        editSeriaBtn.setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
        editSeriaBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                editSeriaBtnActionPerformed(e);
            }
        });
        panel1.add(editSeriaBtn, cc.xy(20, 1));

        //---- removeSeriaBtn ----
        removeSeriaBtn
                .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
        removeSeriaBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                removeSeriaBtnActionPerformed(e);
            }
        });
        panel1.add(removeSeriaBtn, cc.xy(21, 1));

        //======== scrollPane1 ========
        {

            //---- vechicleTypesList ----
            vechicleTypesList.setDoubleBuffered(true);
            vechicleTypesList.addListSelectionListener(new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    vechicleTypesListValueChanged(e);
                }
            });
            vechicleTypesList.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    vechicleTypesListKeyPressed(e);
                }
            });
            vechicleTypesList.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    vechicleTypesListMouseClicked(e);
                }
            });
            scrollPane1.setViewportView(vechicleTypesList);
        }
        panel1.add(scrollPane1, cc.xywh(1, 2, 5, 1));

        //======== scrollPane2 ========
        {

            //---- manufactorsList ----
            manufactorsList.setDoubleBuffered(true);
            manufactorsList.addListSelectionListener(new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    manufactorsListValueChanged(e);
                }
            });
            manufactorsList.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    manufactorsListKeyPressed(e);
                }
            });
            manufactorsList.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    manufactorsListMouseClicked(e);
                }
            });
            scrollPane2.setViewportView(manufactorsList);
        }
        panel1.add(scrollPane2, cc.xywh(7, 2, 7, 1));

        //======== scrollPane3 ========
        {

            //---- seriesList ----
            seriesList.addListSelectionListener(new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    seriesListValueChanged(e);
                }
            });
            seriesList.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    seriesListKeyPressed(e);
                }
            });
            seriesList.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    seriesListMouseClicked(e);
                }
            });
            scrollPane3.setViewportView(seriesList);
        }
        panel1.add(scrollPane3, cc.xywh(15, 2, 7, 1));

        //======== panel10 ========
        {
            panel10.setLayout(new FormLayout("default, $lcgap, 4*(21dlu)", "default"));

            //---- label5 ----
            label5.setText("\u0414\u0432\u0438\u0433\u0430\u0442\u0435\u043b\u0438");
            label5.setFont(label5.getFont().deriveFont(label5.getFont().getStyle() | Font.BOLD));
            panel10.add(label5, cc.xy(1, 1));

            //---- createMotorBtn ----
            createMotorBtn
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
            createMotorBtn.setAlignmentY(0.0F);
            createMotorBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    createMotorBtnActionPerformed(e);
                }
            });
            panel10.add(createMotorBtn, cc.xy(3, 1));

            //---- editMotorBtn ----
            editMotorBtn
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
            editMotorBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    editMotorBtnActionPerformed(e);
                }
            });
            panel10.add(editMotorBtn, cc.xy(4, 1));

            //---- removeMotorBtn ----
            removeMotorBtn.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
            removeMotorBtn.setEnabled(false);
            removeMotorBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    removeMotorBtnActionPerformed(e);
                }
            });
            panel10.add(removeMotorBtn, cc.xy(5, 1));

            //---- joinMotorsBtn ----
            joinMotorsBtn.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/recycle_24.png")));
            joinMotorsBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    joinMotorsBtnActionPerformed(e);
                }
            });
            panel10.add(joinMotorsBtn, cc.xy(6, 1));
        }
        panel1.add(panel10, cc.xywh(1, 4, 21, 1));

        //======== scrollPane4 ========
        {

            //---- motorsTable ----
            motorsTable.setAutoCreateRowSorter(true);
            motorsTable.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    motorsTableKeyPressed(e);
                }
            });
            motorsTable.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    motorsTableMouseClicked(e);
                }
            });
            scrollPane4.setViewportView(motorsTable);
        }
        panel1.add(scrollPane4, cc.xywh(1, 5, 21, 1));

        //======== panel3 ========
        {
            panel3.setLayout(new FormLayout("default:grow, $lcgap, 21dlu, $lcgap, default:grow",
                    "3*(default), $lgap, default, $lgap, fill:default:grow"));

            //---- label6 ----
            label6.setText(
                    "\u041f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b");
            label6.setFont(label6.getFont().deriveFont(label6.getFont().getStyle() | Font.BOLD));
            panel3.add(label6, cc.xy(1, 1));

            //---- label7 ----
            label7.setText("\u0412\u0441\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b");
            label7.setFont(label7.getFont().deriveFont(label7.getFont().getStyle() | Font.BOLD));
            panel3.add(label7, cc.xy(5, 1));

            //======== panel4 ========
            {
                panel4.setLayout(new FormLayout("default, $lcgap, default:grow, 21pt", "21dlu"));
                panel4.add(label4, cc.xy(1, 1));

                //---- filterSearchField ----
                filterSearchField.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        filterSearchFieldKeyPressed(e);
                    }
                });
                panel4.add(filterSearchField, cc.xy(3, 1));

                //---- filterSearchBtn ----
                filterSearchBtn.setIcon(
                        new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/find_next_24.png")));
                filterSearchBtn.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        filterSearchBtnActionPerformed(e);
                    }
                });
                panel4.add(filterSearchBtn, cc.xy(4, 1));
            }
            panel3.add(panel4, cc.xy(5, 2));

            //======== scrollPane5 ========
            {

                //---- filtersTable ----
                filtersTable.setAutoCreateRowSorter(true);
                filtersTable.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent e) {
                        filtersTableMouseClicked(e);
                    }
                });
                scrollPane5.setViewportView(filtersTable);
            }
            panel3.add(scrollPane5, cc.xywh(1, 2, 1, 6));

            //---- filterRelationComment ----
            filterRelationComment
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit.png")));
            filterRelationComment.setToolTipText(
                    "\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043a \u0444\u0438\u043b\u044c\u0442\u0440\u0443 \u0443 \u0434\u0430\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b");
            filterRelationComment.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    filterRelationCommentActionPerformed(e);
                }
            });
            panel3.add(filterRelationComment, cc.xy(3, 2));

            //---- attachFilterBtn ----
            attachFilterBtn.setIcon(new ImageIcon(
                    getClass().getResource("/ru/goodfil/catalog/ui/icons/arrow_left_green_24.png")));
            attachFilterBtn.setToolTipText(
                    "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e\u0441\u0442\u044c");
            attachFilterBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    attachFilterBtnActionPerformed(e);
                }
            });
            panel3.add(attachFilterBtn, cc.xy(3, 3));

            //======== scrollPane6 ========
            {

                //---- allFiltersTable ----
                allFiltersTable.setAutoCreateRowSorter(true);
                allFiltersTable.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseClicked(MouseEvent e) {
                        allFiltersTableMouseClicked(e);
                    }
                });
                scrollPane6.setViewportView(allFiltersTable);
            }
            panel3.add(scrollPane6, cc.xywh(5, 3, 1, 5));

            //---- detachFilterBtn ----
            detachFilterBtn.setIcon(new ImageIcon(
                    getClass().getResource("/ru/goodfil/catalog/ui/icons/arrow_right_green_24.png")));
            detachFilterBtn.setToolTipText(
                    "\u0423\u0431\u0440\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440 \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e\u0441\u0442\u0438");
            detachFilterBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    detachFilterBtnActionPerformed(e);
                }
            });
            panel3.add(detachFilterBtn, cc.xy(3, 5));
        }
        panel1.add(panel3, cc.xywh(1, 7, 21, 1));
    }
    add(panel1, cc.xy(1, 1));

    //======== listsPopupMenu ========
    {
        listsPopupMenu.addPopupMenuListener(new PopupMenuListener() {
            @Override
            public void popupMenuCanceled(PopupMenuEvent e) {
            }

            @Override
            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            }

            @Override
            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                listsPopupMenuPopupMenuWillBecomeVisible(e);
            }
        });

        //---- miCopyToExcel ----
        miCopyToExcel.setText("\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 Excel");
        miCopyToExcel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                miCopyToExcelActionPerformed(e);
            }
        });
        listsPopupMenu.add(miCopyToExcel);

        //---- miExportToExcel ----
        miExportToExcel.setText("\u0412\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432 Excel");
        miExportToExcel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                miExportToExcelActionPerformed(e);
            }
        });
        listsPopupMenu.add(miExportToExcel);
        listsPopupMenu.addSeparator();

        //---- menuItem1 ----
        menuItem1.setText(
                "\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0443\u0444\u0435\u0440");
        menuItem1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                copyToClipboard(e);
            }
        });
        listsPopupMenu.add(menuItem1);

        //---- menuItem3 ----
        menuItem3.setText(
                "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430");
        menuItem3.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                pasteFromClipboard(e);
            }
        });
        listsPopupMenu.add(menuItem3);
        listsPopupMenu.addSeparator();

        //---- menuItem2 ----
        menuItem2.setText(
                "\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u0431\u0443\u0444\u0435\u0440 (\u0421 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c)");
        menuItem2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                cutToClipboard(e);
            }
        });
        listsPopupMenu.add(menuItem2);

        //---- menuItem4 ----
        menuItem4.setText(
                "\u0412\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430");
        menuItem4.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                pasteFromClipboard(e);
            }
        });
        listsPopupMenu.add(menuItem4);
    }
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:ru.goodfil.catalog.ui.forms.FiltersPanel.java

public FiltersPanel() {
    initComponents();//w ww .  j a  v a  2  s  .  c o m

    filterTypeResolver = createFilterTypeResolver();
    filterFormResolver = createFilterFormResolver();

    ManufactorModelAdapter manufactorModelAdapter = new ManufactorModelAdapter();
    List<Manufactor> theManufactors = carsService.getAllManufactors();
    for (Manufactor manufactor : theManufactors) {
        manufactorModelAdapter.addManufactor(manufactor);
    }
    manufactors = new SelectionInList<ManufactorModel>(manufactorModelAdapter.getList());

    series = new SelectionInList<SeriaModel>();

    cbManufactors.setModel(new ComboBoxAdapter<ManufactorModel>(manufactors));
    cbManufactors.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                ManufactorModel manufactorModel = (ManufactorModel) e.getItem();
                reReadSeries(manufactorModel.getManufactorIds());
            }
        }
    });

    cbSeria.setModel(new ComboBoxAdapter<SeriaModel>(series));
    tblAllMotors.setModel(new BigMotorTableAdapter(allMotors));
    tblAllMotors.setRowSorter(new BigMotorTableSorter((BigMotorTableAdapter) tblAllMotors.getModel()));
    tblAllMotors.setRowHeight(20);
    tblAllMotors.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            adjustButtonsEnabled();
        }
    });

    tblMotors.setModel(new BigMotorTableAdapter(motors));
    tblMotors.setRowSorter(new BigMotorTableSorter((BigMotorTableAdapter) tblMotors.getModel()));
    tblMotors.setRowHeight(20);
    tblMotors.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            adjustButtonsEnabled();
        }
    });

    final BigFilterTableAdapter tblFiltersAdapter = new BigFilterTableAdapter(filters, filterTypeResolver,
            filterFormResolver);

    tblFiltersAdapter.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            if (e.getType() == TableModelEvent.UPDATE) {
                BigFilterTableAdapter adapter = (BigFilterTableAdapter) e.getSource();
                int row = e.getFirstRow();

                Filter filter = adapter.getRow(row);
                filtersService.updateFilter(filter);
            }
        }
    });

    tblFilters.setUpdateSelectionOnSort(true);
    tblFilters.setModel(tblFiltersAdapter);
    tblFilters.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }

            adjustButtonsEnabled();

            Long filterId = getSelectedFilterId();
            reReadMotors(filterId);
            reReadOes(filterId);
        }
    });
    tblFilters.setRowHeight(20);

    tblAllOes.setModel(new OeModelTableModel(allOes));
    tblAllOes.setRowHeight(20);
    tblAllOes.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            adjustButtonsEnabled();
        }
    });

    tblOes.setModel(new OeModelTableModel(oes));
    tblOes.setRowHeight(20);
    tblOes.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            adjustButtonsEnabled();
        }
    });
    // ??   ?   ?  
    if (System.getProperty("catalog.mode.fromMann") != null
            && System.getProperty("catalog.mode.fromMann").equals("1")) {
        tblFilters.setDefaultRenderer(Object.class, new MannTablesCellRenderer(MannTablesCellRenderer.FILTER));
        tblMotors.setDefaultRenderer(Object.class, new MannTablesCellRenderer(MannTablesCellRenderer.AMOTOR));
        tblAllMotors.setDefaultRenderer(Object.class,
                new MannTablesCellRenderer(MannTablesCellRenderer.AMOTOR));
        tblOes.setDefaultRenderer(Object.class, new MannTablesCellRenderer(MannTablesCellRenderer.OE));
        tblAllOes.setDefaultRenderer(Object.class, new MannTablesCellRenderer(MannTablesCellRenderer.OE));
    } else {
        tblFilters.setDefaultRenderer(Object.class, new FilterTableCellRenderer());
    }
    adjustButtonsEnabled();
    //        globalHotkeys();
}

From source file:ru.goodfil.catalog.ui.forms.OePanel.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - ????? ???????
    panel1 = new JPanel();
    panel2 = new JPanel();
    btnCreateBrand = new JButton();
    btnEditBrand = new JButton();
    btnRemoveBrand = new JButton();
    btnUnionBrand = new JButton();
    hSpacer1 = new JPanel(null);
    tbSearchBrand = new JTextField();
    btnSearchBrand = new JButton();
    scrollPane1 = new JScrollPane();
    lstBrands = new JList();
    lLstBrandsStatus = new JLabel();
    panel3 = new JPanel();
    panel4 = new JPanel();
    btnCreateOe = new JButton();
    btnEditOe = new JButton();
    btnRemoveOe = new JButton();
    btnUnionOe = new JButton();
    hSpacer2 = new JPanel(null);
    tbSearchOe = new JTextField();
    btnSearchOe = new JButton();
    scrollPane2 = new JScrollPane();
    lstOes = new JList();
    lLstOesStatus = new JLabel();
    popupMenu1 = new JPopupMenu();
    menuItem1 = new JMenuItem();
    menuItem2 = new JMenuItem();
    menuItem3 = new JMenuItem();
    menuItem4 = new JMenuItem();
    popupMenu2 = new JPopupMenu();
    menu1 = new JMenu();
    menuItem5 = new JMenuItem();
    menuItem6 = new JMenuItem();
    CellConstraints cc = new CellConstraints();

    //======== this ========

    // JFormDesigner evaluation mark
    setBorder(//from   www.j ava 2s .  com
            new javax.swing.border.CompoundBorder(
                    new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                            "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                            javax.swing.border.TitledBorder.BOTTOM,
                            new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                    getBorder()));
    addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent e) {
            if ("border".equals(e.getPropertyName()))
                throw new RuntimeException();
        }
    });

    setLayout(new FormLayout("default:grow, $lcgap, default:grow", "fill:default:grow"));

    //======== panel1 ========
    {
        panel1.setBorder(new TitledBorder(
                "\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u0438"));
        panel1.setLayout(
                new FormLayout("default:grow", "fill:21dlu, $lgap, fill:default:grow, $lgap, default"));

        //======== panel2 ========
        {
            panel2.setLayout(new FormLayout("4*(21dlu), default:grow, 100dlu, 21dlu", "fill:default:grow"));

            //---- btnCreateBrand ----
            btnCreateBrand
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
            btnCreateBrand.setToolTipText(
                    "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnCreateBrand.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnCreateBrandActionPerformed(e);
                }
            });
            panel2.add(btnCreateBrand, cc.xy(1, 1));

            //---- btnEditBrand ----
            btnEditBrand
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
            btnEditBrand.setToolTipText(
                    "\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnEditBrand.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnEditBrandActionPerformed(e);
                }
            });
            panel2.add(btnEditBrand, cc.xy(2, 1));

            //---- btnRemoveBrand ----
            btnRemoveBrand.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
            btnRemoveBrand.setToolTipText(
                    "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnRemoveBrand.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnRemoveBrandActionPerformed(e);
                }
            });
            panel2.add(btnRemoveBrand, cc.xy(3, 1));

            //---- btnUnionBrand ----
            btnUnionBrand.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/recycle_24.png")));
            btnUnionBrand.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnUnionBrandActionPerformed(e);
                }
            });
            panel2.add(btnUnionBrand, cc.xy(4, 1));
            panel2.add(hSpacer1, cc.xy(5, 1));

            //---- tbSearchBrand ----
            tbSearchBrand.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    tbSearchBrandKeyTyped(e);
                }

                @Override
                public void keyReleased(KeyEvent e) {
                    tbSearchBrandKeyTyped(e);
                }

                @Override
                public void keyTyped(KeyEvent e) {
                    tbSearchBrandKeyTyped(e);
                }
            });
            tbSearchBrand.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    tbSearchBrandFocusGained(e);
                }

                @Override
                public void focusLost(FocusEvent e) {
                    tbSearchBrandFocusGained(e);
                }
            });
            panel2.add(tbSearchBrand, cc.xy(6, 1));

            //---- btnSearchBrand ----
            btnSearchBrand.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/find_next_24.png")));
            btnSearchBrand.setToolTipText(
                    "\u041f\u043e\u0438\u0441\u043a \u043c\u043e\u0442\u043e\u0440\u043e\u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438\u0437 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0440\u0438\u0438");
            btnSearchBrand.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnSearchBrandActionPerformed(e);
                }
            });
            panel2.add(btnSearchBrand, cc.xy(7, 1));
        }
        panel1.add(panel2, cc.xy(1, 1));

        //======== scrollPane1 ========
        {

            //---- lstBrands ----
            lstBrands.setToolTipText(
                    "\u0415\u0441\u043b\u0438 \u0448\u0440\u0438\u0444\u0442 \u0411\u0440\u0435\u043d\u0434\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d \u043f\u043e\u043b\u0443\u0436\u0438\u0440\u043d\u044b\u043c, \u0442\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0435\u043d \u0432 \u043e\u0442\u0447\u0443\u0436\u0434\u0430\u0435\u043c\u043e\u0439 \u043a\u043e\u043f\u0438\u0438, \u0434\u043b\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043e\u043a. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043d\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d, \u0442\u043e \u0432\u0438\u0434\u0435\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.");
            lstBrands.addListSelectionListener(new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    lstBrandsValueChanged(e);
                }
            });
            lstBrands.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    lstBrandsKeyPressed(e);
                }
            });
            lstBrands.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    lstBrandsMouseClicked(e);
                }
            });
            scrollPane1.setViewportView(lstBrands);
        }
        panel1.add(scrollPane1, cc.xy(1, 3));

        //---- lLstBrandsStatus ----
        lLstBrandsStatus.setText("text");
        panel1.add(lLstBrandsStatus, cc.xy(1, 5));
    }
    add(panel1, cc.xy(1, 1));

    //======== panel3 ========
    {
        panel3.setBorder(new TitledBorder("\u041d\u043e\u043c\u0435\u0440\u0430 \u041e\u0415"));
        panel3.setLayout(new FormLayout("default:grow", "default, $lgap, fill:default:grow, $lgap, default"));

        //======== panel4 ========
        {
            panel4.setLayout(new FormLayout("4*(21dlu), default:grow, 100dlu, 21dlu", "fill:21dlu"));

            //---- btnCreateOe ----
            btnCreateOe
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/add_24.png")));
            btnCreateOe.setToolTipText(
                    "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnCreateOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnCreateOeActionPerformed(e);
                }
            });
            panel4.add(btnCreateOe, cc.xy(1, 1));

            //---- btnEditOe ----
            btnEditOe
                    .setIcon(new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/edit_24.png")));
            btnEditOe.setToolTipText(
                    "\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnEditOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnEditOeActionPerformed(e);
                }
            });
            panel4.add(btnEditOe, cc.xy(2, 1));

            //---- btnRemoveOe ----
            btnRemoveOe.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/delete_24.png")));
            btnRemoveOe.setToolTipText(
                    "\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440");
            btnRemoveOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnRemoveOeActionPerformed(e);
                }
            });
            panel4.add(btnRemoveOe, cc.xy(3, 1));

            //---- btnUnionOe ----
            btnUnionOe.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/recycle_24.png")));
            btnUnionOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnUnionOeActionPerformed(e);
                }
            });
            panel4.add(btnUnionOe, cc.xy(4, 1));
            panel4.add(hSpacer2, cc.xy(5, 1));

            //---- tbSearchOe ----
            tbSearchOe.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    tbSearchOeKeyPressed(e);
                }

                @Override
                public void keyReleased(KeyEvent e) {
                    tbSearchOeKeyPressed(e);
                }
            });
            tbSearchOe.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    tbSearchOeFocusGained(e);
                }

                @Override
                public void focusLost(FocusEvent e) {
                    tbSearchOeFocusGained(e);
                }
            });
            panel4.add(tbSearchOe, cc.xy(6, 1));

            //---- btnSearchOe ----
            btnSearchOe.setIcon(
                    new ImageIcon(getClass().getResource("/ru/goodfil/catalog/ui/icons/find_next_24.png")));
            btnSearchOe.setToolTipText(
                    "\u041f\u043e\u0438\u0441\u043a \u043c\u043e\u0442\u043e\u0440\u043e\u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438\u0437 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0435\u0440\u0438\u0438");
            btnSearchOe.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnSearchOeActionPerformed(e);
                }
            });
            panel4.add(btnSearchOe, cc.xy(7, 1));
        }
        panel3.add(panel4, cc.xy(1, 1));

        //======== scrollPane2 ========
        {

            //---- lstOes ----
            lstOes.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    lstOesKeyPressed(e);
                }
            });
            lstOes.addListSelectionListener(new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    lstOesValueChanged(e);
                }
            });
            lstOes.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    lstOesMouseClicked(e);
                }
            });
            scrollPane2.setViewportView(lstOes);
        }
        panel3.add(scrollPane2, cc.xy(1, 3));

        //---- lLstOesStatus ----
        lLstOesStatus.setText("text");
        panel3.add(lLstOesStatus, cc.xy(1, 5));
    }
    add(panel3, cc.xy(3, 1));

    //======== popupMenu1 ========
    {
        popupMenu1.addPopupMenuListener(new PopupMenuListener() {
            @Override
            public void popupMenuCanceled(PopupMenuEvent e) {
            }

            @Override
            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            }

            @Override
            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
                popupMenu1PopupMenuWillBecomeVisible(e);
            }
        });

        //---- menuItem1 ----
        menuItem1.setText(
                "\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0431\u0443\u0444\u0435\u0440");
        menuItem1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                copyToClipboard(e);
            }
        });
        popupMenu1.add(menuItem1);

        //---- menuItem2 ----
        menuItem2.setText(
                "\u0412\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430");
        menuItem2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                pasteFromClipboard(e);
            }
        });
        popupMenu1.add(menuItem2);
        popupMenu1.addSeparator();

        //---- menuItem3 ----
        menuItem3.setText(
                "\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u0431\u0443\u0444\u0435\u0440 (\u0421 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c)");
        menuItem3.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                cutToClipboard(e);
            }
        });
        popupMenu1.add(menuItem3);

        //---- menuItem4 ----
        menuItem4.setText(
                "\u0412\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0437 \u0431\u0443\u0444\u0435\u0440\u0430");
        menuItem4.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                pasteFromClipboard(e);
            }
        });
        popupMenu1.add(menuItem4);
    }

    //======== popupMenu2 ========
    {

        //======== menu1 ========
        {
            menu1.setText(
                    "\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043e\u0442\u0447\u0443\u0436\u0434\u0430\u0435\u043c\u043e\u0439 \u043a\u043e\u043f\u0438\u0438");

            //---- menuItem5 ----
            menuItem5.setText("\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c");
            menuItem5.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItemReprezentInStandalone(e);
                }
            });
            menu1.add(menuItem5);

            //---- menuItem6 ----
            menuItem6.setText("\u041d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c");
            menuItem6.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItemDontReprezentInStandalone(e);
                }
            });
            menu1.add(menuItem6);
        }
        popupMenu2.add(menu1);
    }
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}