Example usage for java.awt.event MouseEvent getPoint

List of usage examples for java.awt.event MouseEvent getPoint

Introduction

In this page you can find the example usage for java.awt.event MouseEvent getPoint.

Prototype

public Point getPoint() 

Source Link

Document

Returns the x,y position of the event relative to the source component.

Usage

From source file:de.codesourcery.eve.skills.ui.components.impl.MarketPriceEditorComponent.java

/**
 * Populates the context-sensitive popup menu by examining the current table
 * selection.//from w  w  w .j a v  a2  s .  co m
 * 
 * @param event
 * @param selectedRows
 * @return <code>true</code> if the updated popup menu hast at least one
 *         menu item
 */
protected boolean populatePopupMenu(MouseEvent event, int[] selectedRows) {

    if (log.isDebugEnabled()) {
        log.debug("maybeShowPopup(): selection = " + ObjectUtils.toString(selectedRows));
    }

    popupMenu.removeAll();

    final int column = table.columnAtPoint(event.getPoint());
    if (column < 0) {
        log.warn("maybeShowPopup(): Invalid column at point " + event.getPoint());
        return false;
    }

    log.debug("maybeShowPopup(): column = " + column);

    // gather all selected rows
    final List<TableEntry> data = new ArrayList<TableEntry>();

    for (int row : selectedRows) {
        final TableEntry row2 = tableModel.getRow(row);
        System.out.println(">>> selected row: " + row2.getItemName());
        data.add(row2);
    }

    populatePopupMenuFor(column, data);

    return popupMenu.getComponentCount() > 0;
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.reporting.AnnotationReportCanvas.java

public void mouseReleased(MouseEvent e) {

    // Drag and drop
    if (is_dragndrop && was_dragged) {
        if (mouse_end_point != null)
            xorSelections(mouse_start_point, mouse_end_point);

        moveSelections(e.getPoint().x - mouse_start_point.x, e.getPoint().y - mouse_start_point.y);
    } else if (is_resizing && was_dragged) {
        if (mouse_end_point != null)
            xorResizing(start_position, mouse_start_point, mouse_end_point);
        rescaleSelections(scaleFactor(start_position, mouse_start_point, e.getPoint()));
    } else if (is_movingcp && was_dragged) {
        if (mouse_end_point != null)
            xorConnection(start_position, mouse_start_point, mouse_end_point);
        moveControlPointTo(start_position, e.getPoint());
    } else if (mouse_start_point != null) {
        if (mouse_end_point != null)
            xorRectangle(mouse_start_point, mouse_end_point);

        Rectangle mouse_rect = makeRectangle(mouse_start_point, e.getPoint());
        if (MouseUtils.isNothingPressed(e))
            setSelection(getAnnotationsInside(mouse_rect));
        else if (MouseUtils.isCtrlPressed(e))
            addSelection(getAnnotationsInside(mouse_rect));
    }/* w ww . j  a va 2 s  . c  o m*/

    // reset
    start_position = null;
    is_resizing = false;
    is_movingcp = false;
    is_dragndrop = false;
    was_dragged = false;
    mouse_start_point = null;
    mouse_end_point = null;
    repaint();
}

From source file:org.yccheok.jstock.gui.charting.InvestmentFlowLayerUI.java

private void processEvent(MouseEvent e, JXLayer layer) {
    if (MouseEvent.MOUSE_DRAGGED == e.getID()) {
        return;/* w w w.  j a  v  a  2s . co  m*/
    }

    if (MouseEvent.MOUSE_CLICKED == e.getID()) {
        // Transfer focus to chart if user clicks on the chart.
        this.investmentFlowChartJDialog.getChartPanel().requestFocus();
    }

    final Point mousePoint = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), layer);

    final boolean status0 = this.updateInvestPoint(mousePoint);
    final boolean status1 = this.updateROIPoint(mousePoint);

    if (status0 || status1) {
        this.setDirty(true);
    }
}

From source file:gdt.jgui.entity.query.JQueryPanel.java

private void showHeader() {
    try {//from w w w  .  jav a  2 s. c  o  m
        Entigrator entigrator = console.getEntigrator(entihome$);
        Sack query = entigrator.getEntityAtKey(entityKey$);

        if (!query.existsElement("header.item")) {
            query.createElement("header.item");
            query.putElementItem("header.item", new Core("name", entityKey$, "number"));
            query.putElementItem("header.item", new Core("type", LABEL_KEY, "label"));
        }
        if (!query.existsElement("header.element")) {
            query.createElement("header.element");
            query.putElementItem("header.element", new Core("0", entityKey$, "none"));
            query.putElementItem("header.element", new Core("1", LABEL_KEY, "property"));
        }
        Core[] ca = query.elementGet("header.item");
        ArrayList<String> sl = new ArrayList<String>();
        int i = 0;
        for (Core c : ca)
            if (c.value != null) {
                sl.add(c.value);
            }
        Collections.sort(sl, new ItemComparator());
        Core element;
        for (String s : sl) {
            //       System.out.println("JQueryPanel.showHeader:item="+s);
            for (Core c : ca) {
                if (s.equals(c.value)) {
                    element = query.getElementItem("header.element", c.name);
                    //            System.out.println("JQueryPanel.showHeader:order="+i);
                    element.type = String.valueOf(i++);
                    query.putElementItem("header.element", element);
                    break;
                }
            }
        }
        entigrator.save(query);
        DefaultTableModel model = new DefaultTableModel(null, sl.toArray(new String[0]));
        table.setModel(model);
        table.getTableHeader().setDefaultRenderer(new SimpleHeaderRenderer());
        table.getTableHeader().addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                try {
                    int col = table.columnAtPoint(e.getPoint());
                    String col$ = String.valueOf(col);
                    String itemName$ = table.getColumnName(col);

                    //          System.out.println("Column index=" + col+" item="+ itemName$);
                    String element$ = null;
                    String field$ = null;
                    Entigrator entigrator = console.getEntigrator(entihome$);
                    Sack query = entigrator.getEntityAtKey(entityKey$);
                    Core[] ca = query.elementGet("header.element");
                    String headerKey$ = null;
                    //      System.out.println("JQueryPanel:header listener:item name="+itemName$);
                    for (Core c : ca)
                        if (col$.equals(c.type)) {
                            element$ = c.value;
                            headerKey$ = c.name;
                            break;
                        }

                    Core item = query.getElementItem("header.item", headerKey$);

                    //       System.out.println("JQueryPanel:header listener:element=" +element$ + " item=" + itemName$+" field="+field$);

                    setSelection(elementComboBox, element$);
                    setSelection(itemNameComboBox, item.value);

                    setSelection(itemNameFieldComboBox, item.type);
                } catch (Exception ee) {
                    Logger.getLogger(JQueryPanel.class.getName()).severe(ee.toString());
                }
            }
        });
    } catch (Exception e) {
        LOGGER.severe(e.toString());
    }
}

From source file:nosqltools.MainForm.java

/**
 * Creates new form MainForm and sets the necessary properties for the main
 * form/*from www .  ja va 2 s .  co m*/
 */
public MainForm() {
    Image img = null;
    try {
        img = ImageIO.read(new File("resources/mongoicon.png"));
    } catch (IOException e) {
    }
    this.setIconImage(img);
    initComponents();
    setExtendedState(JFrame.MAXIMIZED_BOTH);
    fc.setFileFilter(filter);

    textArea = new RSyntaxTextArea(20, 60);
    textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JSON);
    textArea.setCodeFoldingEnabled(true);
    textArea.setAntiAliasingEnabled(true);
    Table_JSON.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            int row = Table_JSON.rowAtPoint(evt.getPoint());
            int col = Table_JSON.columnAtPoint(evt.getPoint());

            JOptionPane.showMessageDialog(null,
                    "Value in the cell clicked :" + " " + Table_JSON.getValueAt(row, col).toString());

            if (json_util.isArray(Table_JSON.getValueAt(row, col).toString())) {
                if (JOptionPane.showConfirmDialog(null, "View the array as a table:", "VIEW",
                        JOptionPane.OK_CANCEL_OPTION) == JOptionPane.YES_OPTION) {
                    Panel_Views.setEnabled(false);
                    Panel_Connections.setEnabled(false);
                    jMenuBar1.setEnabled(false);

                    if (row >= 0 && col >= 0) {

                        TableForm tableForm = new TableForm(Table_JSON.getValueAt(row, col).toString());
                    }
                }
            }
        }
    });
    RTextScrollPane sp = new RTextScrollPane(textArea);
    sp.setFoldIndicatorEnabled(true);
    Panel_Text.add(sp);
    Save_File.setEnabled(false);

    Panel_Text.setVisible(false);
    Panel_Table.setVisible(false);
    Panel_Hierarchical.setVisible(false);
    Panel_Compare.setVisible(false);
    Panel_Compare_Upper.setVisible(false);
    Panel_Connect.setVisible(false);

    util.changeTextAreaTheme(textArea);

}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.reporting.AnnotationReportCanvas.java

public void mouseDragged(MouseEvent e) {
    was_dragged = true;/*  w ww. j a  v a  2 s.c om*/

    // if is dragging don't update selection
    if (is_dragndrop) {
        if (mouse_end_point != null)
            xorSelections(mouse_start_point, mouse_end_point);
        mouse_end_point = e.getPoint();
        xorSelections(mouse_start_point, mouse_end_point);
    } else if (is_resizing) {
        if (mouse_end_point != null)
            xorResizing(start_position, mouse_start_point, mouse_end_point);
        mouse_end_point = e.getPoint();
        xorResizing(start_position, mouse_start_point, mouse_end_point);
    } else if (is_movingcp) {
        if (mouse_end_point != null)
            xorConnection(start_position, mouse_start_point, mouse_end_point);
        mouse_end_point = e.getPoint();
        xorConnection(start_position, mouse_start_point, mouse_end_point);
    } else if (mouse_start_point != null) {
        if (mouse_end_point != null)
            xorRectangle(mouse_start_point, mouse_end_point);
        mouse_end_point = e.getPoint();
        xorRectangle(mouse_start_point, mouse_end_point);
    }

    dragAndScroll(e);
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakListChartPanel.java

public void mouseReleased(MouseEvent e) {
    if (MouseUtils.isPopupTrigger(e)) {
        // clear all
        if (zoom_rectangle != null) {
            Graphics2D g2 = (Graphics2D) getGraphics();
            g2.setXORMode(java.awt.Color.gray);
            g2.draw(zoom_rectangle);/*from w w w.jav  a  2s. c  o m*/
            g2.dispose();
        }
        mouse_start_point = null;
        zoom_rectangle = null;

        // open popup
        current_peak = findPeakAt(e.getPoint());
        enforceSelection(current_peak);
        createPopupMenu(current_peak != null).show(theChartPanel, e.getX(), e.getY());
    } else {
        if (zoom_rectangle != null && mouse_start_point != null) {
            if (Math.abs(e.getX() - mouse_start_point.getX()) > 10) {
                //if( e.getX() < mouse_start_point.getX() ) {
                // unzoom all
                //    onZoomNone();
                //}
                //else {        

                // zoom area           
                double start_x = Math.min(e.getX(), mouse_start_point.getX());
                double end_x = Math.max(e.getX(), mouse_start_point.getX());

                Rectangle2D data_area = theChartPanel.getScreenDataArea((int) start_x,
                        (int) mouse_start_point.getY());
                double new_lower_bound = screenToDataCoordX(start_x);
                double new_upper_bound = screenToDataCoordX(Math.min(end_x, data_area.getMaxX()));
                thePlot.getDomainAxis().setRange(new Range(new_lower_bound, new_upper_bound));
            } else {
                // clear rectangle
                Graphics2D g2 = (Graphics2D) getGraphics();
                g2.setXORMode(java.awt.Color.gray);
                g2.draw(zoom_rectangle);
                g2.dispose();
            }
        }

        // restore zooming
        if (!was_moving && is_moving)
            onActivateZooming();

        zoom_rectangle = null;
        mouse_start_point = null;
    }
}

From source file:com.unicauca.braim.braimclient.BraimGui.java

private void add_mouse_listener_to_list() {

    MouseListener mouseListener = new MouseAdapter() {
        @Override//from  w  w w  . j  a  va2 s. c o  m
        public void mouseClicked(MouseEvent mouseEvent) {
            JList theList = (JList) mouseEvent.getSource();
            if (mouseEvent.getClickCount() == 2) {
                int index = theList.locationToIndex(mouseEvent.getPoint());
                if (index >= 0) {
                    actualSong = actualSongList[index];
                    lbl_song_name.setText(actualSong.getName());
                    play_song(actualSong);
                }
            }
        }
    };
    list_songs.addMouseListener(mouseListener);
}

From source file:org.nuclos.client.ui.collect.result.ResultController.java

/**
 * TODO: Make this package visible again.
 *///  w  ww .ja v a  2 s. c  om
public void setupResultPanel() {
    if (NuclosEntity.isNuclosEntity(getEntity().getName())) {
        this.getResultPanel().setActionsEnabled(false);
    }
    this.getResultPanel().addActionsVisibleListener(actionsVisibleListener);

    setupActions();

    // add selection listener for Result table:
    final JTable tblResult = this.getResultPanel().getResultTable();

    tblResult.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    tblResult.getSelectionModel().addListSelectionListener(newListSelectionListener(tblResult));

    this.getResultPanel().btnToggleSelectionMode.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            getResultPanel().setToggleSelection(!getResultPanel().isToggleSelection());
        }
    });
    this.getResultPanel().btnSelectAllRows.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (tblResult.getRowCount() > 0) {
                tblResult.getSelectionModel().setSelectionInterval(0, tblResult.getRowCount() - 1);
            }
        }
    });
    this.getResultPanel().btnDeSelectAllRows.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            tblResult.getSelectionModel().clearSelection();
        }
    });
    this.getResultPanel().addResultKeyListener(new ResultKeyListener() {
        @Override
        public boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
            if (e.getKeyCode() == ESC) {
                if (!pressed) {
                    tblResult.getSelectionModel().clearSelection();
                    return true;
                }
            } else if (e.getKeyCode() == UP || e.getKeyCode() == DOWN) {
                if (pressed) {
                    /* Warum wird dies bentigt?
                     * BasicTableUI.actionPerformed(...) sendet ein ungewolltes changeSelection mit toggle=false bei PFEIL-NACH-OBEN/-UNTEN (siehe unten).
                     * Der Standard in der Ergebnisansicht soll aber ein umgedrehtes Verhalten fr Mausklicks sein. (siehe Implementierung 
                     *       ResultPanel: super.changeSelection(rowIndex, columnIndex, alternateSelectionToggle? !toggle: toggle, extend);)  
                     * 
                     * else if (!inSelection) {
                          *       moveWithinTableRange(table, dx, dy);
                          *       table.changeSelection(leadRow, leadColumn, false, extend);
                         * }
                     */
                    getResultPanel().setAlternateSelectionToggle(false);
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            getResultPanel().setAlternateSelectionToggle(true);
                        }
                    });
                }
            }
            return false;
        }
    });

    // add mouse listener for double click in table:
    this.mouselistenerTableDblClick = new MouseAdapter() {

        private long lastClick = 0l;

        @Override
        public void mouseClicked(MouseEvent ev) {
            if (SwingUtilities.isLeftMouseButton(ev)) {
                if (lastClick + MainFrameTabbedPane.DOUBLE_CLICK_SPEED > System.currentTimeMillis()) {
                    int iRow = tblResult.rowAtPoint(ev.getPoint());
                    if (iRow >= 0 && iRow < tblResult.getRowCount()) {
                        tblResult.getSelectionModel().setSelectionInterval(iRow, iRow);
                        SwingUtilities.invokeLater(new Runnable() {
                            @Override
                            public void run() {
                                if (getSelectedCollectableFromTableModel() != null) {
                                    clctctl.cmdViewSelectedCollectables();
                                }
                            }
                        });
                    }
                }

                lastClick = System.currentTimeMillis();
            }
        }
    };
    getResultPanel().addDoubleClickMouseListener(this.mouselistenerTableDblClick);

    if (!SecurityCache.getInstance()
            .isActionAllowed(Actions.ACTION_WORKSPACE_CUSTOMIZE_ENTITY_AND_SUBFORM_COLUMNS)
            && getMainFrame().getWorkspace().isAssigned()) {
        getResultPanel().getResultTable().getTableHeader().setReorderingAllowed(false);
    }

    // change column ordering in table model when table columns are reordered by dragging a column with the mouse:
    getResultPanel().addColumnModelListener(newColumnModelListener());
    PreferencesUpdateListener pul = newResultTablePreferencesUpdateListener();
    getResultPanel().addColumnModelListener(pul);

    getResultPanel().addPopupMenuListener();
    getResultPanel().getSearchFilterBar().addEnabledListener(new ResetMainFilterEnabledListener());

    getResultPanel().setActionsVisible(
            getCollectController().getPreferences().getBoolean(RESULT_ACTIONS_VISIBLE, true));
}

From source file:gdt.jgui.entity.query.JQueryPanel.java

/**
 * The default constructor.// w  w w.j  ava2s . c  om
 */
public JQueryPanel() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 100, 0, 0 };
    gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0 };
    setLayout(gridBagLayout);
    JLabel lblElement = new JLabel("Element");

    GridBagConstraints gbc_lblElement = new GridBagConstraints();
    gbc_lblElement.insets = new Insets(5, 5, 5, 5);
    gbc_lblElement.gridx = 0;
    gbc_lblElement.gridy = 0;
    gbc_lblElement.anchor = GridBagConstraints.FIRST_LINE_START;
    add(lblElement, gbc_lblElement);

    elementComboBox = new JComboBox<String>();
    GridBagConstraints gbc_elementComboBox = new GridBagConstraints();
    gbc_elementComboBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_elementComboBox.insets = new Insets(0, 0, 5, 0);
    gbc_elementComboBox.gridx = 1;
    gbc_elementComboBox.gridy = 0;
    gbc_elementComboBox.anchor = GridBagConstraints.FIRST_LINE_START;
    add(elementComboBox, gbc_elementComboBox);
    elementComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            try {
                initItemNameSelector();
            } catch (Exception ee) {
                LOGGER.severe(ee.toString());
            }
        }
    });
    JLabel lblItemNameField = new JLabel("Item field");
    GridBagConstraints gbc_lblItemField = new GridBagConstraints();
    gbc_lblItemField.insets = new Insets(5, 5, 5, 5);
    gbc_lblItemField.gridx = 0;
    gbc_lblItemField.gridy = 1;
    gbc_lblItemField.anchor = GridBagConstraints.FIRST_LINE_START;

    add(lblItemNameField, gbc_lblItemField);

    itemNameFieldComboBox = new JComboBox<String>();
    GridBagConstraints gbc_itemNameFieldComboBox = new GridBagConstraints();
    gbc_itemNameFieldComboBox.insets = new Insets(0, 0, 5, 0);
    gbc_itemNameFieldComboBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_itemNameFieldComboBox.gridx = 1;
    gbc_itemNameFieldComboBox.gridy = 1;
    gbc_itemNameFieldComboBox.anchor = GridBagConstraints.FIRST_LINE_START;
    add(itemNameFieldComboBox, gbc_itemNameFieldComboBox);
    itemNameFieldComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            try {
                initItemNameSelector();
                initItemValueSelector();
            } catch (Exception ee) {
                LOGGER.severe(ee.toString());
            }
        }
    });
    JLabel itemTitle = new JLabel("Item title");
    GridBagConstraints gbc_lblItemtitle = new GridBagConstraints();
    gbc_lblItemtitle.insets = new Insets(5, 5, 5, 5);
    gbc_lblItemtitle.gridx = 0;
    gbc_lblItemtitle.gridy = 2;
    gbc_lblItemtitle.anchor = GridBagConstraints.FIRST_LINE_START;
    add(itemTitle, gbc_lblItemtitle);

    itemNameComboBox = new JComboBox<String>();
    GridBagConstraints gbc_itemComboBox = new GridBagConstraints();
    gbc_itemComboBox.insets = new Insets(0, 0, 5, 0);
    gbc_itemComboBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_itemComboBox.gridx = 1;
    gbc_itemComboBox.gridy = 2;
    gbc_itemComboBox.anchor = GridBagConstraints.FIRST_LINE_START;
    add(itemNameComboBox, gbc_itemComboBox);
    itemNameComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            try {
                initItemValueSelector();
            } catch (Exception ee) {
                LOGGER.severe(ee.toString());
            }
        }
    });

    JLabel itemValue = new JLabel("Item value");
    GridBagConstraints gbc_lblItemValue = new GridBagConstraints();
    gbc_lblItemValue.insets = new Insets(5, 5, 5, 5);
    gbc_lblItemValue.weighty = 0.0;
    gbc_lblItemValue.gridx = 0;
    gbc_lblItemValue.gridy = 3;
    gbc_lblItemValue.anchor = GridBagConstraints.FIRST_LINE_START;
    add(itemValue, gbc_lblItemValue);

    itemValueComboBox = new JComboBox<String>();
    GridBagConstraints gbc_itemValueComboBox = new GridBagConstraints();
    gbc_itemValueComboBox.insets = new Insets(0, 0, 5, 0);
    gbc_itemValueComboBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_itemValueComboBox.gridx = 1;
    gbc_itemValueComboBox.gridy = 3;
    gbc_itemValueComboBox.anchor = GridBagConstraints.FIRST_LINE_START;
    add(itemValueComboBox, gbc_itemValueComboBox);
    table = new JTable();
    JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    table.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            int row = table.rowAtPoint(evt.getPoint());
            int col = table.columnAtPoint(evt.getPoint());
            System.out.println("JQueryPanel:cell click:row=" + row + " column=" + col);
            if (col == 1) {
                String label$ = (String) table.getValueAt(row, 1);
                System.out.println("JQueryPanel:cell click:label=" + label$);
                Entigrator entigrator = console.getEntigrator(entihome$);
                String entity$ = entigrator.indx_keyAtLabel(label$);
                JEntityFacetPanel efp = new JEntityFacetPanel();
                String efpLocator$ = efp.getLocator();
                efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$);
                efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, entity$);
                JConsoleHandler.execute(console, efpLocator$);
            }
        }
    });
    GridBagConstraints gbc_scroll_panel = new GridBagConstraints();
    gbc_scroll_panel.anchor = GridBagConstraints.NORTH;
    gbc_scroll_panel.gridwidth = 2;
    gbc_scroll_panel.weighty = 1.0;
    gbc_scroll_panel.fill = GridBagConstraints.HORIZONTAL;
    gbc_scroll_panel.gridx = 0;
    gbc_scroll_panel.gridy = 4;
    add(scrollPane, gbc_scroll_panel);
    scrollPane.setMinimumSize(scrollPane.getPreferredSize());
}