本文整理汇总了Java中com.intellij.ui.table.JBTable.setRowHeight方法的典型用法代码示例。如果您正苦于以下问题:Java JBTable.setRowHeight方法的具体用法?Java JBTable.setRowHeight怎么用?Java JBTable.setRowHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.table.JBTable
的用法示例。
在下文中一共展示了JBTable.setRowHeight方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUIComponents
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
/** 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.setPreferredScrollableViewportSize(new Dimension(-1,
languagesTable.getRowHeight() * IgnoreBundle.LANGUAGES.size() / 2));
languagesTable.setStriped(true);
languagesTable.setShowGrid(false);
languagesTable.setBorder(createEmptyBorder());
languagesTable.setDragEnabled(false);
languagesPanel = ScrollPaneFactory.createScrollPane(languagesTable);
donatePanel = new JBPanel(new BorderLayout());
donatePanel.setBorder(new EmptyBorder(10, 0, 10, 0));
donatePanel.add(new JBLabel(IgnoreBundle.message("settings.general.donate")), BorderLayout.WEST);
donatePanel.add(createLink(
"Donate with PayPal",
"https://www.paypal.me/hsz"
), BorderLayout.CENTER);
}
示例2: TargetOptionsComponent
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
public TargetOptionsComponent(Project project)
{
super(new GridBagLayout());
myProject = project;
//setBorder(BorderFactory.createTitledBorder("Bytecode target level"));
myCbProjectTargetLevel = createTargetOptionsCombo();
myTable = new JBTable(new TargetLevelTableModel());
myTable.setRowHeight(22);
myTable.getEmptyText().setText("All modules will be compiled with project bytecode version");
final TableColumn moduleColumn = myTable.getColumnModel().getColumn(0);
moduleColumn.setHeaderValue("Module");
moduleColumn.setCellRenderer(new ModuleCellRenderer());
final TableColumn targetLevelColumn = myTable.getColumnModel().getColumn(1);
final String columnTitle = "Target bytecode version";
targetLevelColumn.setHeaderValue(columnTitle);
targetLevelColumn.setCellEditor(new TargetLevelCellEditor());
targetLevelColumn.setCellRenderer(new TargetLevelCellRenderer());
final int width = myTable.getFontMetrics(myTable.getFont()).stringWidth(columnTitle) + 10;
targetLevelColumn.setPreferredWidth(width);
targetLevelColumn.setMinWidth(width);
targetLevelColumn.setMaxWidth(width);
add(new JLabel("Project bytecode version (leave blank for jdk default): "), constraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NONE));
add(myCbProjectTargetLevel, constraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NONE));
add(new JLabel("Per-module bytecode version(obsolete - use module extension settings):"), constraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.NONE));
final JPanel tableComp = ToolbarDecorator.createDecorator(myTable).disableUpAction().disableDownAction().setRemoveAction(anActionButton -> removeSelectedModules()).createPanel();
tableComp.setPreferredSize(new Dimension(myTable.getWidth(), 150));
add(tableComp, constraints(0, 2, 2, 1, 1.0, 1.0, GridBagConstraints.BOTH));
}
示例3: createAdditionalPanels
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
@NotNull
protected List<Pair<String,JPanel>> createAdditionalPanels() {
// this method is invoked before constructor body
myExceptionsModel = new ExceptionsTableModel(myMethod.getMethod().getThrowsList());
myExceptionsModel.setTypeInfos(myMethod.getMethod());
final JBTable table = new JBTable(myExceptionsModel);
table.setStriped(true);
table.setRowHeight(20);
table.getColumnModel().getColumn(0).setCellRenderer(new CodeFragmentTableCellRenderer(myProject));
final JavaCodeFragmentTableCellEditor cellEditor = new JavaCodeFragmentTableCellEditor(myProject);
cellEditor.addDocumentListener(new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
final int row = table.getSelectedRow();
final int col = table.getSelectedColumn();
myExceptionsModel.setValueAt(cellEditor.getCellEditorValue(), row, col);
updateSignature();
}
});
table.getColumnModel().getColumn(0).setCellEditor(cellEditor);
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.getSelectionModel().setSelectionInterval(0, 0);
table.setSurrendersFocusOnKeystroke(true);
myPropExceptionsButton = new AnActionButton(RefactoringBundle.message("changeSignature.propagate.exceptions.title"), null, AllIcons.Hierarchy.Caller) {
@Override
public void actionPerformed(AnActionEvent e) {
final Ref<JavaCallerChooser> chooser = new Ref<JavaCallerChooser>();
Consumer<Set<PsiMethod>> callback = new Consumer<Set<PsiMethod>>() {
@Override
public void consume(Set<PsiMethod> psiMethods) {
myMethodsToPropagateExceptions = psiMethods;
myExceptionPropagationTree = chooser.get().getTree();
}
};
chooser.set(new JavaCallerChooser(myMethod.getMethod(),
myProject,
RefactoringBundle.message("changeSignature.exception.caller.chooser"),
myExceptionPropagationTree,
callback));
chooser.get().show();
}
};
myPropExceptionsButton.setShortcut(CustomShortcutSet.fromString("alt X"));
final JPanel panel = ToolbarDecorator.createDecorator(table).addExtraAction(myPropExceptionsButton).createPanel();
panel.setBorder(IdeBorderFactory.createEmptyBorder());
myExceptionsModel.addTableModelListener(mySignatureUpdater);
final ArrayList<Pair<String, JPanel>> result = new ArrayList<Pair<String, JPanel>>();
final String message = RefactoringBundle.message("changeSignature.exceptions.panel.border.title");
result.add(Pair.create(message, panel));
return result;
}
示例4: createVariablesTable
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private JComponent createVariablesTable() {
final String[] names = {
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.name"),
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.expression"),
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.default.value"),
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.skip.if.defined")
};
// Create a model of the data.
TableModel dataModel = new VariablesModel(names);
// Create the table
myTable = new JBTable(dataModel);
myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myTable.setPreferredScrollableViewportSize(new Dimension(500, myTable.getRowHeight() * 8));
myTable.getColumn(names[0]).setPreferredWidth(120);
myTable.getColumn(names[1]).setPreferredWidth(200);
myTable.getColumn(names[2]).setPreferredWidth(200);
myTable.getColumn(names[3]).setPreferredWidth(100);
if (myVariables.size() > 0) {
myTable.getSelectionModel().setSelectionInterval(0, 0);
}
ComboBox comboField = new ComboBox();
Macro[] macros = MacroFactory.getMacros();
Arrays.sort(macros, new Comparator<Macro> () {
@Override
public int compare(@NotNull Macro m1, @NotNull Macro m2) {
return m1.getPresentableName().compareTo(m2.getPresentableName());
}
});
eachMacro:
for (Macro macro : macros) {
for (TemplateContextType contextType : myContextTypes) {
if (macro.isAcceptableInContext(contextType)) {
comboField.addItem(macro.getPresentableName());
continue eachMacro;
}
}
}
comboField.setEditable(true);
DefaultCellEditor cellEditor = new DefaultCellEditor(comboField);
cellEditor.setClickCountToStart(1);
myTable.getColumn(names[1]).setCellEditor(cellEditor);
myTable.setRowHeight(comboField.getPreferredSize().height);
JTextField textField = new JTextField();
/*textField.addMouseListener(
new PopupHandler(){
public void invokePopup(Component comp,int x,int y){
showCellPopup((JTextField)comp,x,y);
}
}
);*/
cellEditor = new DefaultCellEditor(textField);
cellEditor.setClickCountToStart(1);
myTable.setDefaultEditor(String.class, cellEditor);
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTable).disableAddAction().disableRemoveAction();
return decorator.createPanel();
}
示例5: createUIComponents
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private void createUIComponents() {
myTable = new JBTable();
myTable.setRowHeight(myTable.getFontMetrics(UIManager.getFont("Table.font").deriveFont(Font.BOLD)).getHeight() + 4);
}
示例6: createAdditionalPanels
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
@NotNull
@Override
protected List<Pair<String, JPanel>> createAdditionalPanels() {
// this method is invoked before constructor body
myExceptionsModel = new ExceptionsTableModel(myMethod.getMethod().getThrowsList());
myExceptionsModel.setTypeInfos(myMethod.getMethod());
final JBTable table = new JBTable(myExceptionsModel);
table.setStriped(true);
table.setRowHeight(20);
table.getColumnModel().getColumn(0).setCellRenderer(new CodeFragmentTableCellRenderer(myProject));
final JavaCodeFragmentTableCellEditor cellEditor = new JavaCodeFragmentTableCellEditor(myProject);
cellEditor.addDocumentListener(new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
final int row = table.getSelectedRow();
final int col = table.getSelectedColumn();
myExceptionsModel.setValueAt(cellEditor.getCellEditorValue(), row, col);
updateSignature();
}
});
table.getColumnModel().getColumn(0).setCellEditor(cellEditor);
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.getSelectionModel().setSelectionInterval(0, 0);
table.setSurrendersFocusOnKeystroke(true);
/* myPropExceptionsButton = new AnActionButton( //todo propagate parameters
RefactoringBundle.message("changeSignature.propagate.exceptions.title"), null, PlatformIcons.NEW_EXCEPTION) {
@Override
public void actionPerformed(AnActionEvent e) {
final Ref<JavaCallerChooser> chooser = new Ref<JavaCallerChooser>();
Consumer<Set<PsiMethod>> callback = new Consumer<Set<PsiMethod>>() {
@Override
public void consume(Set<PsiMethod> psiMethods) {
myMethodsToPropagateExceptions = psiMethods;
myExceptionPropagationTree = chooser.get().getTree();
}
};
chooser.set(new JavaCallerChooser(myMethod.getMethod(),
myProject,
RefactoringBundle.message("changeSignature.exception.caller.chooser"),
myExceptionPropagationTree,
callback));
chooser.get().show();
}
};
myPropExceptionsButton.setShortcut(CustomShortcutSet.fromString("alt X"));*/
final JPanel panel = ToolbarDecorator.createDecorator(table).createPanel();
//.addExtraAction(myPropExceptionsButton).createPanel();
panel.setBorder(IdeBorderFactory.createEmptyBorder());
myExceptionsModel.addTableModelListener(mySignatureUpdater);
final ArrayList<Pair<String, JPanel>> result = new ArrayList<Pair<String, JPanel>>();
final String message = RefactoringBundle.message("changeSignature.exceptions.panel.border.title");
result.add(Pair.create(message, panel));
return result;
}
示例7: createAdditionalPanels
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
@NotNull
protected List<Pair<String,JPanel>> createAdditionalPanels() {
// this method is invoked before constructor body
myExceptionsModel = new ExceptionsTableModel(myMethod.getMethod().getThrowsList());
myExceptionsModel.setTypeInfos(myMethod.getMethod());
final JBTable table = new JBTable(myExceptionsModel);
table.setStriped(true);
table.setRowHeight(20);
table.getColumnModel().getColumn(0).setCellRenderer(new CodeFragmentTableCellRenderer(myProject));
final JavaCodeFragmentTableCellEditor cellEditor = new JavaCodeFragmentTableCellEditor(myProject);
cellEditor.addDocumentListener(new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
final int row = table.getSelectedRow();
final int col = table.getSelectedColumn();
myExceptionsModel.setValueAt(cellEditor.getCellEditorValue(), row, col);
updateSignature();
}
});
table.getColumnModel().getColumn(0).setCellEditor(cellEditor);
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.getSelectionModel().setSelectionInterval(0, 0);
table.setSurrendersFocusOnKeystroke(true);
myPropExceptionsButton = new AnActionButton(RefactoringBundle.message("changeSignature.propagate.exceptions.title"), null, PlatformIcons.NEW_EXCEPTION) {
@Override
public void actionPerformed(AnActionEvent e) {
final Ref<JavaCallerChooser> chooser = new Ref<JavaCallerChooser>();
Consumer<Set<PsiMethod>> callback = new Consumer<Set<PsiMethod>>() {
@Override
public void consume(Set<PsiMethod> psiMethods) {
myMethodsToPropagateExceptions = psiMethods;
myExceptionPropagationTree = chooser.get().getTree();
}
};
chooser.set(new JavaCallerChooser(myMethod.getMethod(),
myProject,
RefactoringBundle.message("changeSignature.exception.caller.chooser"),
myExceptionPropagationTree,
callback));
chooser.get().show();
}
};
myPropExceptionsButton.setShortcut(CustomShortcutSet.fromString("alt X"));
final JPanel panel = ToolbarDecorator.createDecorator(table).addExtraAction(myPropExceptionsButton).createPanel();
panel.setBorder(IdeBorderFactory.createEmptyBorder());
myExceptionsModel.addTableModelListener(mySignatureUpdater);
final ArrayList<Pair<String, JPanel>> result = new ArrayList<Pair<String, JPanel>>();
final String message = RefactoringBundle.message("changeSignature.exceptions.panel.border.title");
result.add(Pair.create(message, panel));
return result;
}
示例8: createVariablesTable
import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private JComponent createVariablesTable() {
final String[] names = {
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.name"),
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.expression"),
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.default.value"),
CodeInsightBundle.message("templates.dialog.edit.variables.table.column.skip.if.defined")
};
// Create a model of the data.
TableModel dataModel = new VariablesModel(names);
// Create the table
myTable = new JBTable(dataModel);
myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myTable.setPreferredScrollableViewportSize(new Dimension(500, myTable.getRowHeight() * 8));
myTable.getColumn(names[0]).setPreferredWidth(120);
myTable.getColumn(names[1]).setPreferredWidth(200);
myTable.getColumn(names[2]).setPreferredWidth(200);
myTable.getColumn(names[3]).setPreferredWidth(100);
if (myVariables.size() > 0) {
myTable.getSelectionModel().setSelectionInterval(0, 0);
}
JComboBox comboField = new JComboBox();
Macro[] macros = MacroFactory.getMacros();
Arrays.sort(macros, new Comparator<Macro> () {
@Override
public int compare(Macro m1, Macro m2) {
return m1.getPresentableName().compareTo(m2.getPresentableName());
}
});
eachMacro:
for (Macro macro : macros) {
for (TemplateContextType contextType : myContextTypes) {
if (macro.isAcceptableInContext(contextType)) {
comboField.addItem(macro.getPresentableName());
continue eachMacro;
}
}
}
comboField.setEditable(true);
DefaultCellEditor cellEditor = new DefaultCellEditor(comboField);
cellEditor.setClickCountToStart(1);
myTable.getColumn(names[1]).setCellEditor(cellEditor);
myTable.setRowHeight(comboField.getPreferredSize().height);
JTextField textField = new JTextField();
/*textField.addMouseListener(
new PopupHandler(){
public void invokePopup(Component comp,int x,int y){
showCellPopup((JTextField)comp,x,y);
}
}
);*/
cellEditor = new DefaultCellEditor(textField);
cellEditor.setClickCountToStart(1);
myTable.setDefaultEditor(String.class, cellEditor);
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTable).disableAddAction().disableRemoveAction();
return decorator.createPanel();
}