Java Code Examples for javax.swing.JTable#setName()

The following examples show how to use javax.swing.JTable#setName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MosaicExpressionsPanel.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private JScrollPane createVariablesTable(final String labelName) {
    variablesTable = new JTable();
    variablesTable.setName(labelName);
    variablesTable.setRowSelectionAllowed(true);
    bindingCtx.bind("variables", new VariablesTableAdapter(variablesTable));
    bindingCtx.bindEnabledState("variables", false, "updateMode", true);
    variablesTable.addMouseListener(createExpressionEditorMouseListener(variablesTable, false));

    final JTableHeader tableHeader = variablesTable.getTableHeader();
    tableHeader.setName(labelName);
    tableHeader.setReorderingAllowed(false);
    tableHeader.setResizingAllowed(true);

    final TableColumnModel columnModel = variablesTable.getColumnModel();
    columnModel.setColumnSelectionAllowed(false);

    final TableColumn nameColumn = columnModel.getColumn(0);
    nameColumn.setPreferredWidth(100);
    nameColumn.setCellRenderer(new TCR());

    final TableColumn expressionColumn = columnModel.getColumn(1);
    expressionColumn.setPreferredWidth(400);
    expressionColumn.setCellRenderer(new TCR());
    final ExprEditor exprEditor = new ExprEditor(false);
    expressionColumn.setCellEditor(exprEditor);
    bindingCtx.addPropertyChangeListener("updateMode", new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            final boolean enabled = Boolean.FALSE.equals(evt.getNewValue());
            exprEditor.button.setEnabled(enabled);
        }
    });

    final JScrollPane scrollPane = new JScrollPane(variablesTable);
    scrollPane.setName(labelName);
    scrollPane.setPreferredSize(new Dimension(PREFERRED_TABLE_WIDTH, 150));

    return scrollPane;
}
 
Example 2
Source File: CheckoutForm.java    From azure-devops-intellij with MIT License 4 votes vote down vote up
/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
    createUIComponents();
    contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayoutManager(10, 3, new Insets(0, 0, 0, 0), -1, -1));
    contentPanel.setName("");
    final JLabel label1 = new JLabel();
    this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.SelectRepository"));
    contentPanel.add(label1, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    repositoryFilter = new JTextField();
    repositoryFilter.setName("");
    contentPanel.add(repositoryFilter, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JLabel label2 = new JLabel();
    this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.ParentDirectory"));
    contentPanel.add(label2, new GridConstraints(5, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label3 = new JLabel();
    this.$$$loadLabelText$$$(label3, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.DirectoryName"));
    contentPanel.add(label3, new GridConstraints(7, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    directoryName = new JTextField();
    directoryName.setName("");
    contentPanel.add(directoryName, new GridConstraints(8, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    contentPanel.add(userAccountPanel, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    repositoryTableScrollPane = new JScrollPane();
    contentPanel.add(repositoryTableScrollPane, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    repositoryTable = new JTable();
    repositoryTable.setFillsViewportHeight(true);
    repositoryTable.setName("");
    repositoryTable.setShowHorizontalLines(false);
    repositoryTable.setShowVerticalLines(false);
    repositoryTableScrollPane.setViewportView(repositoryTable);
    parentDirectory = new TextFieldWithBrowseButton();
    contentPanel.add(parentDirectory, new GridConstraints(6, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    helpPanel = new HelpPanel();
    helpPanel.setHelpText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.helpText"));
    helpPanel.setPopupText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.Instructions"));
    contentPanel.add(helpPanel, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    advancedCheckBox = new JCheckBox();
    advancedCheckBox.setText("example text");
    contentPanel.add(advancedCheckBox, new GridConstraints(9, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    busySpinner = new BusySpinnerPanel();
    contentPanel.add(busySpinner, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    refreshButton.setToolTipText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("CheckoutDialog.RefreshButton.ToolTip"));
    contentPanel.add(refreshButton, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, 1, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}
 
Example 3
Source File: PixelExtractionParametersForm.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
private JComponent[] createCoordinatesComponents() {
    Product selectedProduct = appContext.getSelectedProduct();
    if (selectedProduct != null) {
        final PlacemarkGroup pinGroup = selectedProduct.getPinGroup();
        for (int i = 0; i < pinGroup.getNodeCount(); i++) {
            coordinateTableModel.addPlacemark(pinGroup.get(i));
        }
    }

    JTable coordinateTable = new JTable(coordinateTableModel);
    coordinateTable.setName("coordinateTable");
    coordinateTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
    coordinateTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    coordinateTable.setRowSelectionAllowed(true);
    coordinateTable.getTableHeader().setReorderingAllowed(false);
    coordinateTable.setDefaultRenderer(Double.class, new DecimalTableCellRenderer(new DecimalFormat("0.0000")));
    coordinateTable.setPreferredScrollableViewportSize(new Dimension(250, 100));
    coordinateTable.getColumnModel().getColumn(1).setCellEditor(new DecimalCellEditor(-90, 90));
    coordinateTable.getColumnModel().getColumn(2).setCellEditor(new DecimalCellEditor(-180, 180));

    final DateFormat dateFormat = ProductData.UTC.createDateFormat("yyyy-MM-dd'T'HH:mm:ss"); // ISO 8601
    final DateFormat timeFormat = ProductData.UTC.createDateFormat("HH:mm:ss"); // ISO 8601
    DateTimePickerCellEditor cellEditor = new DateTimePickerCellEditor(dateFormat, timeFormat);
    cellEditor.setClickCountToStart(1);
    coordinateTable.getColumnModel().getColumn(3).setCellEditor(cellEditor);
    coordinateTable.getColumnModel().getColumn(3).setPreferredWidth(200);
    final DateCellRenderer dateCellRenderer = new DateCellRenderer(dateFormat);
    dateCellRenderer.setHorizontalAlignment(SwingConstants.RIGHT);
    coordinateTable.getColumnModel().getColumn(3).setCellRenderer(dateCellRenderer);
    final JScrollPane rasterScrollPane = new JScrollPane(coordinateTable);

    final AbstractButton addButton = ToolButtonFactory.createButton(ADD_ICON, false);
    addButton.addActionListener(new AddPopupListener());
    final AbstractButton removeButton = ToolButtonFactory.createButton(REMOVE_ICON, false);
    removeButton.addActionListener(new RemovePlacemarksListener(coordinateTable, coordinateTableModel));
    final JPanel buttonPanel = new JPanel();
    final BoxLayout layout = new BoxLayout(buttonPanel, BoxLayout.Y_AXIS);
    buttonPanel.setLayout(layout);
    buttonPanel.add(addButton);
    buttonPanel.add(removeButton);
    return new JComponent[]{rasterScrollPane, buttonPanel};
}
 
Example 4
Source File: MosaicExpressionsPanel.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
private JScrollPane createConditionsTable(final String labelName) {
    conditionsTable = new JTable() {
        private static final long serialVersionUID = 1L;

        @Override
        public Class getColumnClass(int column) {
            if (column == 2) {
                return Boolean.class;
            } else {
                return super.getColumnClass(column);
            }
        }
    };
    conditionsTable.setName(labelName);
    conditionsTable.setRowSelectionAllowed(true);
    bindingCtx.bind("conditions", new ConditionsTableAdapter(conditionsTable));
    bindingCtx.bindEnabledState("conditions", false, "updateMode", true);
    conditionsTable.addMouseListener(createExpressionEditorMouseListener(conditionsTable, true));

    final JTableHeader tableHeader = conditionsTable.getTableHeader();
    tableHeader.setName(labelName);
    tableHeader.setReorderingAllowed(false);
    tableHeader.setResizingAllowed(true);

    final TableColumnModel columnModel = conditionsTable.getColumnModel();
    columnModel.setColumnSelectionAllowed(false);

    final TableColumn nameColumn = columnModel.getColumn(0);
    nameColumn.setPreferredWidth(100);
    nameColumn.setCellRenderer(new TCR());

    final TableColumn expressionColumn = columnModel.getColumn(1);
    expressionColumn.setPreferredWidth(360);
    expressionColumn.setCellRenderer(new TCR());
    final ExprEditor cellEditor = new ExprEditor(true);
    expressionColumn.setCellEditor(cellEditor);
    bindingCtx.addPropertyChangeListener("updateMode", new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            final boolean enabled = Boolean.FALSE.equals(evt.getNewValue());
            cellEditor.button.setEnabled(enabled);
        }
    });


    final TableColumn outputColumn = columnModel.getColumn(2);
    outputColumn.setPreferredWidth(40);

    final JScrollPane pane = new JScrollPane(conditionsTable);
    pane.setName(labelName);
    pane.setPreferredSize(new Dimension(PREFERRED_TABLE_WIDTH, 80));

    return pane;
}
 
Example 5
Source File: PlacemarkManagerTopComponent.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
public void initUI() {
    setLayout(new BorderLayout());
    placemarkTable = new JTable(placemarkTableModel);
    placemarkTable.setRowSorter(new TableRowSorter<>(placemarkTableModel));
    placemarkTable.setName("placemarkTable");
    placemarkTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    placemarkTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    placemarkTable.setRowSelectionAllowed(true);
    // IMPORTANT: We set ReorderingAllowed=false, because we export the
    // table model AS IS to a flat text file.
    placemarkTable.getTableHeader().setReorderingAllowed(false);

    ToolTipSetter toolTipSetter = new ToolTipSetter();
    placemarkTable.addMouseMotionListener(toolTipSetter);
    placemarkTable.addMouseListener(toolTipSetter);
    placemarkTable.addMouseListener(new PopupListener());
    placemarkTable.getSelectionModel().addListSelectionListener(new PlacemarkTableSelectionHandler());
    updateTableModel();

    final TableColumnModel columnModel = placemarkTable.getColumnModel();
    columnModel.addColumnModelListener(new ColumnModelListener());

    JScrollPane tableScrollPane = new JScrollPane(placemarkTable);
    JPanel mainPane = new JPanel(new BorderLayout(4, 4));
    mainPane.add(tableScrollPane, BorderLayout.CENTER);

    buttonPane = new PlacemarkManagerButtons(this);

    JPanel content = new JPanel(new BorderLayout(4, 4));
    content.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    content.add(BorderLayout.CENTER, mainPane);
    content.add(BorderLayout.EAST, buttonPane);
    Component southExtension = getSouthExtension();
    if (southExtension != null) {
        content.add(BorderLayout.SOUTH, southExtension);
    }
    content.setPreferredSize(new Dimension(420, 200));

    setCurrentView(snapApp.getSelectedProductSceneView());
    setProduct(snapApp.getSelectedProduct(VIEW));
    snapApp.getSelectionSupport(ProductSceneView.class).addHandler(new ProductSceneViewSelectionChangeHandler());
    snapApp.getProductManager().addListener(new ProductRemovedListener());
    updateUIState();
    add(content, BorderLayout.CENTER);
}