Example usage for javax.swing.event ListSelectionEvent getValueIsAdjusting

List of usage examples for javax.swing.event ListSelectionEvent getValueIsAdjusting

Introduction

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

Prototype

public boolean getValueIsAdjusting() 

Source Link

Document

Returns whether or not this is one in a series of multiple events, where changes are still being made.

Usage

From source file:pcgen.gui2.dialog.ChooserDialog.java

@Override
public void valueChanged(ListSelectionEvent e) {
    if (availTable != null && !e.getValueIsAdjusting()) {
        if (e.getSource() == availTable.getSelectionModel()
                && availTable.getSelectedObject() instanceof InfoFacade) {
            InfoFacade target = (InfoFacade) availTable.getSelectedObject();
            InfoFactory factory = chooser.getInfoFactory();
            if (factory != null && target != null) {
                infoPane.setText(factory.getHTMLInfo(target));
            }/*w  w w.j  a v  a 2s  .  c o  m*/
        }
    }
}

From source file:pcgen.gui2.sources.AdvancedSourceSelectionPanel.java

@Override
public void valueChanged(ListSelectionEvent e) {
    if (!e.getValueIsAdjusting()) {
        if (e.getSource() == availableTable.getSelectionModel()) {
            int selectedRow = availableTable.getSelectedRow();
            if (selectedRow != -1) {
                final Object data = availableTable.getModel().getValueAt(selectedRow, 0);
                if (data != null && data instanceof CampaignFacade) {
                    setSelectedCampaign((CampaignFacade) data);
                }/*from ww w  .  j a  v a 2  s  .com*/
            }
        } else if (e.getSource() == selectedTable.getSelectionModel()) {
            int selectedRow = selectedTable.getSelectedRow();
            if (selectedRow != -1) {
                final Object data = selectedTable.getModel().getValueAt(selectedRow, 0);
                if (data != null && data instanceof CampaignFacade) {
                    setSelectedCampaign((CampaignFacade) data);
                }
            }
        }
    }
}

From source file:pcgen.gui2.tabs.skill.SkillTreeViewModel.java

@Override
public void valueChanged(ListSelectionEvent arg0) {
    if (arg0.getValueIsAdjusting()) {
        return;/*from   ww  w  . j a  va2  s . c  o  m*/
    }

    if (table.getSelectedTreeView() == COST_NAME || table.getSelectedTreeView() == COST_TYPE_NAME) {
        table.setTreeViewModel(this);
    } else {
        table.refreshModelData();
    }
}

From source file:pcgen.gui2.tabs.spells.SpellInfoHandler.java

@Override
public void valueChanged(ListSelectionEvent e) {
    if (!e.getValueIsAdjusting()) {
        Object obj;//from  w  w w.j  a  va2  s . c  o m
        if (e.getSource() == availableTable.getSelectionModel()) {
            obj = availableTable.getSelectedObject();
        } else {
            obj = selectedTable.getSelectedObject();
        }
        if (obj instanceof SpellNode) {
            SpellNode node = (SpellNode) obj;
            String text = character.getInfoFactory().getHTMLInfo(node.getSpell());
            currText = text;
            spellsPane.setText(text);
        } else if (obj instanceof RootNode) {
            RootNode node = (RootNode) obj;
            String text = character.getInfoFactory().getSpellBookInfo(node.getName());
            if (!StringUtils.isEmpty(text)) {
                currText = text;
                spellsPane.setText(text);
            }
        }
    }
}

From source file:pl.otros.logview.filter.ThreadFilter.java

public ThreadFilter() {
    super(NAME, DESCRIPTION);
    selectedThread = new HashSet<String>();
    listModel = new DefaultListModel();
    jList = new JList(listModel);
    jList.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    jList.addListSelectionListener(new ListSelectionListener() {
        @Override/*from  w w  w  . j  a  va  2s .  c om*/
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                selectedThread.clear();
                Object[] selectedValues = jList.getSelectedValues();
                for (Object selectedValue : selectedValues) {
                    selectedThread.add((String) selectedValue);
                }
                listener.valueChanged();
            }
        }
    });
    JLabel jLabel = new JLabel("Threads:");
    jLabel.setLabelFor(jList);
    jLabel.setDisplayedMnemonic('t');
    panel = new JPanel(new MigLayout());
    panel.add(jLabel, "wrap");
    panel.add(new JScrollPane(jList), "wrap, right, growx");
    panel.add(new JLabel("Use CTRL for multi selection"), "wrap");
    panel.add(new JXHyperlink(new AbstractAction("Invert selection") {
        @Override
        public void actionPerformed(ActionEvent e) {
            invertSelection();
        }
    }), "wrap");
    panel.add(new JXHyperlink(new AbstractAction("Clear selection") {
        @Override
        public void actionPerformed(ActionEvent e) {
            clearSelection();
        }
    }), "wrap");
    panel.add(new JXHyperlink(new AbstractAction("Reload threads") {
        @Override
        public void actionPerformed(ActionEvent e) {
            reloadThreads();
        }
    }), "wrap");
}

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

public LogViewPanel(final LogDataTableModel dataTableModel, TableColumns[] visibleColumns,
        final OtrosApplication otrosApplication) {
    super();/*from  w  w w . ja  va2  s .  com*/
    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.vfs.browser.preview.PreviewListener.java

@Override
public void valueChanged(ListSelectionEvent listSelectionEvent) {
    if (listSelectionEvent.getValueIsAdjusting()) {
        return;/* www . j a v a  2 s.  c o  m*/
    }
    boolean previewEnabled = previewComponent.isPreviewEnabled();
    if (!previewEnabled) {
        return;
    }
    FileObject fileObjectToPreview = null;
    for (FileObject fileObject : vfsBrowser.getSelectedFiles()) {
        try {
            if (fileObject.getType().equals(FileType.FILE)) {
                fileObjectToPreview = fileObject;
                break;
            }
        } catch (FileSystemException e) {
            LOGGER.error("Can't resolve file", e);
        }
    }

    if (fileObjectToPreview != null) {
        makePreview(fileObjectToPreview);
    } else {
        clearPreview();
    }
}

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  ww w.ja v  a 2  s.  c o m*/
 */
@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:ru.goodfil.catalog.ui.forms.CarsPanel.java

public CarsPanel() {
    initComponents();//w  w  w .  ja  v a2s .  com

    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 vechicleTypesListValueChanged(ListSelectionEvent e) {
    if (e != null && e.getValueIsAdjusting())
        return;//from  w  w  w . j  av a2  s. c  o  m

    manufactorsList.clearSelection();
    manufactors.clear();

    seriesList.clearSelection();
    series.clear();

    motorsTable.clearSelection();
    motors.clear();

    filtersTable.clearSelection();
    filters.clear();

    Long selectedVechicleTypeId = getSelectedVechicleTypeId();
    if (selectedVechicleTypeId != null)
        reReadManufactors(selectedVechicleTypeId);

    adjustButtonsEnabledProperty();
}