本文整理汇总了Java中com.intellij.ui.table.JBTable类的典型用法代码示例。如果您正苦于以下问题:Java JBTable类的具体用法?Java JBTable怎么用?Java JBTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JBTable类属于com.intellij.ui.table包,在下文中一共展示了JBTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupTable
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
private void setupTable() {
myTable = new JBTable();
myTableModel = new MyTableModel();
myTable.setModel(myTableModel);
myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
refreshValidatingComponent();
}
});
myTable.setCellSelectionEnabled(false);
myTable.setColumnSelectionAllowed(false);
myTable.setRowSelectionAllowed(false);
myTable.getTableHeader().setReorderingAllowed(false);
}
示例2: createTablePanel
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
private static JPanel createTablePanel(final JBTable table) {
return ToolbarDecorator.createDecorator(table)
.disableUpAction()
.disableDownAction()
.setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton anActionButton) {
final TableCellEditor cellEditor = table.getCellEditor();
if (cellEditor != null) {
cellEditor.stopCellEditing();
}
final TableModel model = table.getModel();
((EditableModel)model).addRow();
TableUtil.editCellAt(table, model.getRowCount() - 1, 0);
}
})
.createPanel();
}
示例3: RevisionsList
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
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);
}
示例4: navigateToSelectedUsage
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
private void navigateToSelectedUsage(JBTable source) {
int[] rows = source.getSelectedRows();
List<Usage> navigations = null;
for(int row:rows) {
Object valueAt = source.getModel().getValueAt(row, 0);
if (valueAt instanceof Usage) {
if (navigations == null) navigations = new SmartList<Usage>();
Usage at = (Usage)valueAt;
navigations.add(at);
}
}
if (navigations != null) {
applyTo(FindManager.getInstance(myProject).getFindInProjectModel(), false);
doCancelAction();
navigations.get(0).navigate(true);
for(int i = 1; i < navigations.size(); ++i) navigations.get(i).highlightInEditor();
}
}
示例5: createUIComponents
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
private void createUIComponents() {
Splitter splitter = new Splitter(false, 0.5f, 0.2f, 0.8f);
myBody = splitter;
myComponentsTable = new JBTable();
myComponentDescription = new JTextPane();
splitter.setShowDividerIcon(false);
splitter.setShowDividerControls(false);
splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myComponentsTable, false));
splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myComponentDescription, false));
myComponentDescription.setFont(UIUtil.getLabelFont());
myComponentDescription.setEditable(false);
myComponentDescription.setBorder(BorderFactory.createEmptyBorder(WizardConstants.STUDIO_WIZARD_INSET_SIZE,
WizardConstants.STUDIO_WIZARD_INSET_SIZE,
WizardConstants.STUDIO_WIZARD_INSET_SIZE,
WizardConstants.STUDIO_WIZARD_INSET_SIZE));
}
示例6: JPanel
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
/**
* 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);
}
示例7: createTable
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
private JComponent createTable(List<String[]> properties) {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
JBTable table = new JBTable(new AuditModel(properties));
table.setDefaultRenderer(String.class, new MyTableCellRenderer());
table.setRowSelectionAllowed(false);
table.setColumnSelectionAllowed(false);
table.setCellSelectionEnabled(false);
table.setShowGrid(false);
table.setShowHorizontalLines(true);
table.setGridColor(table.getGridColor().brighter());
table.getTableHeader().setResizingAllowed(false);
table.getTableHeader().setDefaultRenderer(new MyHeaderCellRenderer());
panel.add(table.getTableHeader());
panel.add(table);
return panel;
}
示例8: navigateToSelectedUsage
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
private void navigateToSelectedUsage(JBTable source) {
int[] rows = source.getSelectedRows();
List<Usage> navigations = null;
for (int row : rows) {
Object valueAt = source.getModel().getValueAt(row, 0);
if (valueAt instanceof Usage) {
if (navigations == null) navigations = new SmartList<>();
Usage at = (Usage)valueAt;
navigations.add(at);
}
}
if (navigations != null) {
doCancelAction();
navigations.get(0).navigate(true);
for (int i = 1; i < navigations.size(); ++i) navigations.get(i).highlightInEditor();
}
}
示例9: installOn
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
@Override
public void installOn(@Nonnull final Component c) {
super.installOn(c);
if (c instanceof JBTable) {
String key = "navigate.to.usage";
JComponent component = (JComponent)c;
component.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), key);
component.getActionMap().put(key, new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
navigateToSelectedUsage((JBTable)c);
}
});
//anAction.registerCustomShortcutSet(CommonShortcuts.ENTER, component);
registerNavigateToSourceShortcutOnComponent((JBTable)c, component);
}
}
示例10: initComponent
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
@Override
public void initComponent() {
model = new DateTimeTableModel();
final KeyStroke shortcutPaste = KeymapUtil.getKeyStroke(CommonShortcuts.getPaste());
final DateTimeColumnModel columns = new DateTimeColumnModel("Unix timestamp (ms)", "Datetime", "Format");
final ComboBox defaultPatterns = new ComboBox(DateTimePattern.getPatterns());
defaultPatterns.setEditable(true);
columns.getColumn(2).setCellEditor(new DefaultCellEditor(defaultPatterns));
final JBTable table = new JBTable(model, columns);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setAutoCreateRowSorter(true);
table.registerKeyboardAction(e -> model.addRows(DateTimeUtil.getClipboardDateTimes()), shortcutPaste, JComponent.WHEN_FOCUSED);
final JBScrollPane scrollPane = new JBScrollPane(table);
final DefaultActionGroup group = new DefaultActionGroup();
group.add(new AddRowAction(model));
group.add(new DeleteRowAction(model, table));
final SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false);
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("datetimeconverterbar", group, false);
toolbar.setTargetComponent(panel);
panel.add(scrollPane);
panel.setToolbar(toolbar.getComponent());
component = panel;
}
示例11: getTreeCellRendererComponent
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
DefaultTreeCellRenderer cellRenderer = (DefaultTreeCellRenderer) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
tree.putClientProperty(TREE_TABLE_TREE_KEY, new JBTable());
cellRenderer.setIcon(null);
return cellRenderer;
}
示例12: getTreeCellRendererComponent
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
DefaultTreeCellRenderer cellRenderer = (JBDefaultTreeCellRenderer) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
tree.putClientProperty(TREE_TABLE_TREE_KEY, new JBTable()); // Avoid setting TreeUnfocusedSelectionBackground
// Set icon
Issue topIssue = ((ScanTreeNode) value).getTopIssue();
cellRenderer.setIcon(IconUtils.load(StringUtils.lowerCase(topIssue.getSeverity().toString())));
return cellRenderer;
}
示例13: init
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
private void init() {
classList = new ArrayList<ClassEntity>(files.size());
for (VirtualFile vf : files) {
classList.add(Utils.getFrom(project, vf));
}
if (!classList.isEmpty()) {
this.classEntity = classList.get(0);
}
ClassTableModel model = new ClassTableModel(classList);
table = new JBTable(model);
model.setTableEditor(table);
scrollPane.setViewportView(table);
}
示例14: createUIComponents
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
private void createUIComponents() {
tabbedPane = new JTabbedPane();
table1 = new JBTable();
table1.setFillsViewportHeight(true);
table1.setComponentPopupMenu(createPopupMenu());
scrollPane1 = new JBScrollPane(table1);
table1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
setCellRenderer();
btnAddNewKey = new JButton();
}
示例15: createUIComponents
import com.intellij.ui.table.JBTable; //导入依赖的package包/类
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());
}