com.intellij.ui.table.JBTable Java Examples
The following examples show how to use
com.intellij.ui.table.JBTable.
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: SubmissionsPanel.java From leetcode-editor with Apache License 2.0 | 7 votes |
public SubmissionsPanel(@Nullable Project project, TableModel tableModel) { super(project, true); jpanel = new JBPanel(new BorderLayout()); jpanel.setMinimumSize(new Dimension(400, 400)); jpanel.setPreferredSize(new Dimension(400, 400)); table = new JBTable(tableModel); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getTableHeader().setReorderingAllowed(false); table.setRowSelectionAllowed(true); table.setRowSelectionInterval(0, 0); table.getColumnModel().getColumn(0).setPreferredWidth(350); table.getColumnModel().getColumn(1).setPreferredWidth(200); table.getColumnModel().getColumn(2).setPreferredWidth(100); table.getColumnModel().getColumn(3).setPreferredWidth(200); table.getColumnModel().getColumn(4).setPreferredWidth(100); jpanel.add(new JBScrollPane(table, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER); setModal(true); init(); }
Example #2
Source File: SolutionPanel.java From leetcode-editor with Apache License 2.0 | 6 votes |
public SolutionPanel(@Nullable Project project, TableModel tableModel) { super(project, true); this.jpanel = new JBPanel(new BorderLayout());; jpanel.setPreferredSize(new Dimension(600, 400)); table = new JBTable(tableModel); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getTableHeader().setReorderingAllowed(false); table.setRowSelectionAllowed(true); table.setRowSelectionInterval(0, 0); table.getColumnModel().getColumn(0).setPreferredWidth(350); table.getColumnModel().getColumn(1).setPreferredWidth(200); table.getColumnModel().getColumn(2).setPreferredWidth(700); jpanel.add(new JBScrollPane(table, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER); setModal(true); init(); }
Example #3
Source File: ChooseLabelDialog.java From p4ic4idea with Apache License 2.0 | 6 votes |
private void createUIComponents() { searchResultsModel = new ListTableModel<>( new ColumnInfo<P4Label, String>(P4Bundle.getString("search.label.label-name")) { @Nullable @Override public String valueOf(P4Label o) { return o == null ? null : o.getName(); } }, new ColumnInfo<P4Label, String>(P4Bundle.getString("search.label.label-description")) { @Nullable @Override public String valueOf(P4Label o) { return o == null ? null : o.getDescription(); } }); mySearchResults = new JBTable(searchResultsModel); mySearchResults.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mySearchSpinner = new AsyncProcessIcon("Searching for labels"); }
Example #4
Source File: TableContextMenuMouseAdapter.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 6 votes |
@Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { JBTable table = (JBTable) e.getComponent(); int selectedRow = table.rowAtPoint(e.getPoint()); int selectedColumn = table.columnAtPoint(e.getPoint()); Object value = table.getModel().getValueAt(selectedRow, selectedColumn); DataContext dataContext = DataManager.getInstance() .getDataContext(table, e.getX(), e.getY()); cast(value, Tree.class) .map(tree -> { TreePath path = tree.getPathForLocation(e.getX(), e.getY()); return contextMenuService.getContextMenu(path); }) .orElseGet(() -> { String columnName = table.getModel().getColumnName(selectedColumn); return new ObjectModel(trim(value), columnName, String.valueOf(value), null, value) .getContextMenu(); }) .ifPresent(c -> c.showPopup(dataContext)); } }
Example #5
Source File: TableRowUtilities.java From intellij-csv-validator with Apache License 2.0 | 6 votes |
private static JTable createRowHeadersTable(final JTable userTable, int startingNumber) { final JBTable rowHeadersTable = new JBTable(new RowHeadersTableModel(userTable.getModel().getRowCount(), startingNumber)); // this is where you set the width of the row headers rowHeadersTable.createDefaultColumnsFromModel(); // make the rows look and behave like headers rowHeadersTable.setBackground(rowHeadersTable.getTableHeader().getBackground()); rowHeadersTable.setForeground(rowHeadersTable.getTableHeader().getForeground()); rowHeadersTable.setFont(rowHeadersTable.getTableHeader().getFont()); rowHeadersTable.setRowHeight(userTable.getRowHeight()); rowHeadersTable.getTableHeader().setReorderingAllowed(false); rowHeadersTable.setRowSelectionAllowed(true); rowHeadersTable.setCellSelectionEnabled(true); rowHeadersTable.setFocusable(true); rowHeadersTable.setDragEnabled(true); rowHeadersTable.setSelectionMode(userTable.getSelectionModel().getSelectionMode()); rowHeadersTable.getEmptyText().setText(""); return rowHeadersTable; }
Example #6
Source File: CsvTableEditorActionListeners.java From intellij-csv-validator with Apache License 2.0 | 6 votes |
@Override public void deleteSelectedColumns(CsvTableEditorSwing tableEditor) { if (tableEditor.hasErrors()) { return; } tableEditor.removeTableChangeListener(); try { JBTable table = tableEditor.getTable(); int[] selectedColumns = table.getSelectedColumns(); if (selectedColumns == null || selectedColumns.length == 0) { return; } int focusedRow = table.getSelectedRow(); tableEditor.removeColumns(selectedColumns); selectCell(table, focusedRow, selectedColumns[0]); } finally { tableEditor.applyTableChangeListener(); } }
Example #7
Source File: CsvTableEditorActionListeners.java From intellij-csv-validator with Apache License 2.0 | 6 votes |
@Override public void addColumn(CsvTableEditorSwing tableEditor, boolean before) { if (tableEditor.hasErrors()) { return; } tableEditor.removeTableChangeListener(); try { JBTable table = tableEditor.getTable(); int currentColumn = table.getSelectedColumn(); int currentRow = table.getSelectedRow(); tableEditor.addColumn(currentColumn, before); selectCell(table, currentRow, before ? currentColumn + 1 : currentColumn); } finally { tableEditor.applyTableChangeListener(); } }
Example #8
Source File: RevisionsList.java From consulo with Apache License 2.0 | 6 votes |
public RevisionsList(SelectionListener l) { table = new JBTable(); table.setModel(new MyModel(Collections.<RevisionItem>emptyList(), Collections.<RevisionItem, Period>emptyMap())); table.setTableHeader(null); table.setShowGrid(false); table.setRowMargin(0); table.getColumnModel().setColumnMargin(0); table.resetDefaultFocusTraversalKeys(); table.setDefaultRenderer(Object.class, new MyCellRenderer(table)); table.getEmptyText().setText(VcsBundle.message("history.empty")); addSelectionListener(l); }
Example #9
Source File: CoverageViewBuilder.java From consulo with Apache License 2.0 | 5 votes |
CoverageViewBuilder(final Project project, final JList list, final Model model, final AbstractTreeStructure treeStructure, final JBTable table) { super(project, list, model, treeStructure, AlphaComparator.INSTANCE, false); myTable = table; ProgressManager.getInstance().run(new Task.Backgroundable(project, "Building coverage report...") { @Override public void run(@Nonnull ProgressIndicator indicator) { buildRoot(); } @RequiredUIAccess @Override public void onSuccess() { ensureSelectionExist(); updateParentTitle(); } }); myFileStatusListener = new FileStatusListener() { @Override public void fileStatusesChanged() { table.repaint(); } @Override public void fileStatusChanged(@Nonnull VirtualFile virtualFile) { table.repaint(); } }; myCoverageViewExtension = ((CoverageViewTreeStructure)myTreeStructure).myData .getCoverageEngine().createCoverageViewExtension(myProject, ((CoverageViewTreeStructure)myTreeStructure).myData, ((CoverageViewTreeStructure)myTreeStructure).myStateBean); FileStatusManager.getInstance(myProject).addFileStatusListener(myFileStatusListener); }
Example #10
Source File: StripeTable.java From consulo with Apache License 2.0 | 5 votes |
public static void apply(@Nonnull JBTable table) { table.setAutoResizeMode(AUTO_RESIZE_OFF); table.setTableHeader(createTableHeader(table.getColumnModel())); table.getTableHeader().setReorderingAllowed(false); //setOpaque(false); table.setGridColor(GRID_COLOR); table.setIntercellSpacing(new Dimension(1, 0)); table.setShowGrid(false); table.setStriped(true); }
Example #11
Source File: DirDiffDialog.java From consulo with Apache License 2.0 | 5 votes |
public DirDiffDialog(Project project, DirDiffTableModel model) { super(project); setModal(false); myModel = model; setTitle("Directory Diff"); init(); final JBTable table = myDiffPanel.getTable(); table.setColumnSelectionAllowed(false); table.getTableHeader().setReorderingAllowed(false); table.getTableHeader().setResizingAllowed(false); Disposer.register(getDisposable(), myModel); Disposer.register(project, getDisposable()); }
Example #12
Source File: DualView.java From consulo with Apache License 2.0 | 5 votes |
private void changeViewTo(JTable view) { myCurrentView = view; if (myCurrentView != null) { myCurrentView.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); if (myCurrentView instanceof JBTable) { ((JBTable)myCurrentView).setStriped(true); } final int row = myCurrentView.getSelectedRow(); myCurrentView.scrollRectToVisible(myCurrentView.getCellRect(row, 0, true)); } }
Example #13
Source File: CruciblePanel.java From Crucible4IDEA with MIT License | 5 votes |
private static void setUpColumnWidths(@NotNull final JBTable table) { table.getColumnModel().getColumn(0).setMinWidth(130); //ID table.getColumnModel().getColumn(0).setMaxWidth(130); //ID table.getColumnModel().getColumn(1).setMinWidth(400); //message table.getColumnModel().getColumn(1).setPreferredWidth(400); //message table.getColumnModel().getColumn(2).setMinWidth(130); //State table.getColumnModel().getColumn(2).setMaxWidth(130); //State table.getColumnModel().getColumn(3).setMinWidth(200); //Author table.getColumnModel().getColumn(3).setMaxWidth(200); //Author table.getColumnModel().getColumn(4).setMinWidth(130); //Date table.getColumnModel().getColumn(4).setMaxWidth(130); //Date }
Example #14
Source File: DetailsPanel.java From Crucible4IDEA with MIT License | 5 votes |
public static void setUpColumnWidths(@NotNull final JBTable table) { final TableColumnModel columnModel = table.getColumnModel(); columnModel.getColumn(0).setMinWidth(400); //message columnModel.getColumn(0).setPreferredWidth(400); //message columnModel.getColumn(1).setMinWidth(200); //Author columnModel.getColumn(1).setMaxWidth(200); //Author columnModel.getColumn(2).setMinWidth(130); //Date columnModel.getColumn(2).setMaxWidth(130); //Date }
Example #15
Source File: AddCommentAction.java From Crucible4IDEA with MIT License | 5 votes |
private void addGeneralComment(@NotNull final Project project, DataContext dataContext) { final CommentForm commentForm = new CommentForm(project, true, myIsReply, null); commentForm.setReview(myReview); if (myIsReply) { final JBTable contextComponent = (JBTable)getContextComponent(); final int selectedRow = contextComponent.getSelectedRow(); if (selectedRow >= 0) { final Object parentComment = contextComponent.getValueAt(selectedRow, 0); if (parentComment instanceof Comment) { commentForm.setParentComment(((Comment)parentComment)); } } else return; } final JBPopup balloon = CommentBalloonBuilder.getNewCommentBalloon(commentForm, myIsReply ? CrucibleBundle .message("crucible.new.reply.$0", commentForm.getParentComment().getPermId()) : CrucibleBundle .message("crucible.new.comment.$0", myReview.getPermaId())); balloon.addListener(new JBPopupListener() { @Override public void onClosed(LightweightWindowEvent event) { if(!commentForm.getText().isEmpty()) { // do not try to save draft if text is empty commentForm.postComment(); } final JComponent component = getContextComponent(); if (component instanceof GeneralCommentsTree) { ((GeneralCommentsTree)component).refresh(); } } }); commentForm.setBalloon(balloon); balloon.showInBestPositionFor(dataContext); commentForm.requestFocus(); }
Example #16
Source File: IgnoreSettingsPanel.java From idea-gitignore with MIT License | 5 votes |
/** Create UI components. */ private void createUIComponents() { templatesListPanel = new TemplatesListPanel(); editorPanel = new EditorPanel(); editorPanel.setPreferredSize(new Dimension(Integer.MAX_VALUE, 200)); templatesSplitter = new Splitter(false, 0.3f); templatesSplitter.setFirstComponent(templatesListPanel); templatesSplitter.setSecondComponent(editorPanel); languagesTable = new JBTable(); languagesTable.setModel(new LanguagesTableModel()); languagesTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); languagesTable.setColumnSelectionAllowed(false); languagesTable.setRowHeight(22); languagesTable.getColumnModel().getColumn(2).setCellRenderer(new BooleanTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSel, boolean hasFocus, int row, int column) { boolean editable = table.isCellEditable(row, column); Object newValue = editable ? value : null; return super.getTableCellRendererComponent(table, newValue, isSel, hasFocus, row, column); } }); languagesTable.setPreferredScrollableViewportSize( new Dimension(-1, languagesTable.getRowHeight() * IgnoreBundle.LANGUAGES.size() / 2) ); languagesTable.setStriped(true); languagesTable.setShowGrid(false); languagesTable.setBorder(JBUI.Borders.empty()); languagesTable.setDragEnabled(false); languagesPanel = ScrollPaneFactory.createScrollPane(languagesTable); }
Example #17
Source File: TableModelEditor.java From consulo with Apache License 2.0 | 5 votes |
/** * source will be copied, passed list will not be used directly * * Implement {@link DialogItemEditor} instead of {@link CollectionItemEditor} if you want provide dialog to edit. */ public TableModelEditor(@Nonnull List<T> items, @Nonnull ColumnInfo[] columns, @Nonnull CollectionItemEditor<T> itemEditor, @Nonnull String emptyText) { super(itemEditor); model = new MyListTableModel(columns, new ArrayList<>(items)); table = new TableView<>(model); table.setDefaultEditor(Enum.class, ComboBoxTableCellEditor.INSTANCE); table.setStriped(true); table.setEnableAntialiasing(true); preferredScrollableViewportHeightInRows(JBTable.PREFERRED_SCROLLABLE_VIEWPORT_HEIGHT_IN_ROWS); new TableSpeedSearch(table); ColumnInfo firstColumn = columns[0]; if ((firstColumn.getColumnClass() == boolean.class || firstColumn.getColumnClass() == Boolean.class) && firstColumn.getName().isEmpty()) { TableUtil.setupCheckboxColumn(table.getColumnModel().getColumn(0)); } boolean needTableHeader = false; for (ColumnInfo column : columns) { if (!StringUtil.isEmpty(column.getName())) { needTableHeader = true; break; } } if (!needTableHeader) { table.setTableHeader(null); } table.getEmptyText().setText(emptyText); MyRemoveAction removeAction = new MyRemoveAction(); toolbarDecorator = ToolbarDecorator.createDecorator(table, this).setRemoveAction(removeAction).setRemoveActionUpdater(removeAction); if (itemEditor instanceof DialogItemEditor) { addDialogActions(); } }
Example #18
Source File: CardLayoutDevices.java From AndroidWiFiADB with Apache License 2.0 | 5 votes |
private void createTableDevices() { AndroidDevicesTableModel model = new AndroidDevicesTableModel(); for (Device device : devices) { model.add(device); } tableDevices = new JBTable(model); configureTableAppearance(); panelDevices = new JPanel(new BorderLayout()); panelDevices.add(tableDevices.getTableHeader(), BorderLayout.NORTH); panelDevices.add(tableDevices, BorderLayout.CENTER); }
Example #19
Source File: CsvTableEditorActionListeners.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
@Override public void clearSelectedCells(CsvTableEditorSwing tableEditor) { if (tableEditor.hasErrors()) { return; } tableEditor.removeTableChangeListener(); try { JBTable table = tableEditor.getTable(); int[] selectedRows = table.getSelectedRows(); int[] selectedColumns = table.getSelectedColumns(); if (selectedRows == null || selectedRows.length == 0 || selectedColumns == null || selectedColumns.length == 0) { return; } int focusedRow = table.getSelectedRow(); int focusedColumn = table.getSelectedColumn(); tableEditor.clearCells(selectedColumns, selectedRows); selectCell(table, focusedRow, focusedColumn); } finally { tableEditor.applyTableChangeListener(); } }
Example #20
Source File: MuleRemoteDebuggerConfPanel.java From mule-intellij-plugins with Apache License 2.0 | 5 votes |
private void createUIComponents() { NumberFormat format = NumberFormat.getInstance(); format.setGroupingUsed(false); NumberFormatter formatter = new NumberFormatter(format); formatter.setValueClass(Integer.class); formatter.setMaximum(65535); formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(true); portTextField = new JFormattedTextField(formatter); jvmPortTextField = new JFormattedTextField(formatter); appsMap = new JBTable(new ModulesTableModel()); }
Example #21
Source File: ResolveConflictsForm.java From azure-devops-intellij with MIT License | 5 votes |
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { myContentPanel = new JPanel(); myContentPanel.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); final JPanel panel1 = new JPanel(); panel1.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1)); myContentPanel.add(panel1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); myAcceptYoursButton = new JButton(); myAcceptYoursButton.setEnabled(false); myAcceptYoursButton.setText("Accept Yours"); myAcceptYoursButton.setMnemonic('Y'); myAcceptYoursButton.setDisplayedMnemonicIndex(7); panel1.add(myAcceptYoursButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final Spacer spacer1 = new Spacer(); panel1.add(spacer1, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); myAcceptTheirsButton = new JButton(); myAcceptTheirsButton.setEnabled(false); myAcceptTheirsButton.setText("Accept Theirs"); myAcceptTheirsButton.setMnemonic('T'); myAcceptTheirsButton.setDisplayedMnemonicIndex(7); panel1.add(myAcceptTheirsButton, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); myMergeButton = new JButton(); myMergeButton.setEnabled(false); myMergeButton.setText("Merge"); myMergeButton.setMnemonic('M'); myMergeButton.setDisplayedMnemonicIndex(0); panel1.add(myMergeButton, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); final JBScrollPane jBScrollPane1 = new JBScrollPane(); myContentPanel.add(jBScrollPane1, new GridConstraints(0, 0, 1, 1, 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)); myItemsTable = new JBTable(); myItemsTable.putClientProperty("Table.isFileList", Boolean.FALSE); jBScrollPane1.setViewportView(myItemsTable); }
Example #22
Source File: InitializrUtil.java From intellij-spring-assistant with MIT License | 5 votes |
/** * Set defaults so that the table looks & acts more like a list * * @param table table */ public static void resetTableLookAndFeelToSingleSelect(JBTable table) { table.setRowMargin(0); table.setShowColumns(false); table.setShowGrid(false); table.setShowVerticalLines(false); table.setCellSelectionEnabled(false); table.setRowSelectionAllowed(true); table.setSelectionMode(SINGLE_SELECTION); }
Example #23
Source File: CsvTableEditorSwing.java From intellij-csv-validator with Apache License 2.0 | 4 votes |
protected JBTable getTable() { return this.tblEditor; }
Example #24
Source File: DirDiffTableModel.java From consulo with Apache License 2.0 | 4 votes |
public JBTable getTable() { return myTable; }
Example #25
Source File: CsvTableEditorSwing.java From intellij-csv-validator with Apache License 2.0 | 4 votes |
protected void createUIComponents() { tblEditor = new JBTable(new DefaultTableModel(0, 0)); lnkTextEditor = new LinkLabel("Open file in text editor", null); }
Example #26
Source File: AddEditRemovePanel.java From consulo with Apache License 2.0 | 4 votes |
protected JBTable createTable() { return new JBTable(); }
Example #27
Source File: AddEditRemovePanel.java From consulo with Apache License 2.0 | 4 votes |
public JBTable getTable() { return myTable; }
Example #28
Source File: HintUpdateSupply.java From consulo with Apache License 2.0 | 4 votes |
public HintUpdateSupply(@Nonnull JBTable table) { installSupply(table); installTableListener(table); }
Example #29
Source File: OrderPanel.java From consulo with Apache License 2.0 | 4 votes |
protected OrderPanel(Class<T> entryClass, boolean showCheckboxes) { super(new BorderLayout()); myEntryClass = entryClass; myEntryTable = new JBTable(new MyTableModel(showCheckboxes)); myEntryTable.setShowGrid(false); myEntryTable.setDragEnabled(false); myEntryTable.setShowHorizontalLines(false); myEntryTable.setShowVerticalLines(false); myEntryTable.setIntercellSpacing(new Dimension(0, 0)); myEntryTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); myEntryTable.registerKeyboardAction( new ActionListener() { public void actionPerformed(ActionEvent e) { if(getCheckboxColumn() == -1) return; final int[] selectedRows = myEntryTable.getSelectedRows(); boolean currentlyMarked = true; for (int idx = 0; idx < selectedRows.length; idx++) { final int selectedRow = selectedRows[idx]; if (selectedRow < 0 || !myEntryTable.isCellEditable(selectedRow, getCheckboxColumn())) { return; } currentlyMarked &= ((Boolean)myEntryTable.getValueAt(selectedRow, getCheckboxColumn())).booleanValue(); } for (int idx = 0; idx < selectedRows.length; idx++) { myEntryTable.setValueAt(currentlyMarked? Boolean.FALSE : Boolean.TRUE, selectedRows[idx], getCheckboxColumn()); } } }, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), JComponent.WHEN_FOCUSED ); add(ScrollPaneFactory.createScrollPane(myEntryTable), BorderLayout.CENTER); if (myEntryTable.getRowCount() > 0) { myEntryTable.getSelectionModel().setSelectionInterval(0,0); } }
Example #30
Source File: VariableUI.java From CodeGen with MIT License | 4 votes |
private void createUIComponents() { // TODO: place custom component creation code here splitPanel = new JPanel(); splitPanel.setPreferredSize(JBUI.size(300, 400)); jSplitPane = new JSplitPane(); jSplitPane.setOrientation(0); jSplitPane.setContinuousLayout(true); jSplitPane.setBorder(BorderFactory.createEmptyBorder()); varPanel = new JPanel(new BorderLayout()); varPanel.setBorder(IdeBorderFactory.createTitledBorder("Predefined Variables", false)); varTable = new JBTable(); varTable.getEmptyText().setText("No Variables"); //不可整列移动 varTable.getTableHeader().setReorderingAllowed(false); //不可拉动表格 varTable.getTableHeader().setResizingAllowed(false); JPanel panel = ToolbarDecorator.createDecorator(varTable) .setAddAction(it -> addAction()) .setRemoveAction(it -> removeAction()) .setEditAction(it -> editAction()).createPanel(); varPanel.add(panel, BorderLayout.CENTER); descPanel = new JPanel(new BorderLayout()); descPanel.setBorder(IdeBorderFactory.createTitledBorder("Default Variables \\& Directives", false)); String inHouseVariables; try { inHouseVariables = FileUtil.loadTextAndClose(VariableUI.class.getResourceAsStream("/variables.md")); } catch (Exception e) { inHouseVariables = "something error"; } descArea = new JTextArea(); descArea.setText(inHouseVariables); descArea.setEditable(false); descPanel.add(ScrollPaneFactory.createScrollPane(descArea), BorderLayout.CENTER); // ignore fields ignorePane = new JPanel(); ignorePane.setBorder(IdeBorderFactory.createTitledBorder("The Ignore Fields", false)); }