本文整理了Java中javax.swing.JTable.getColumn()
方法的一些代码示例,展示了JTable.getColumn()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.getColumn()
方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:getColumn
暂无
代码示例来源:origin: stackoverflow.com
JTable table = new JTable(new JTableModel());
JScrollPane scrollPane = new JScrollPane(table);
table.setFillsViewportHeight(true);
TableCellRenderer buttonRenderer = new JTableButtonRenderer();
table.getColumn("Button1").setCellRenderer(buttonRenderer);
table.getColumn("Button2").setCellRenderer(buttonRenderer);
代码示例来源:origin: stackoverflow.com
table.getColumn("Button").setCellRenderer(new ButtonRenderer());
table.getColumn("Button").setCellEditor(new ButtonEditor(new JCheckBox()));
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-common
public int computePreferredWidth(final int _indexInView){
final JTable t = getTable();
final TableColumn c = t.getColumn(t.getColumnName(_indexInView));
return computePreferredWidth(t, c, _indexInView);
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
private void updateOrder() {
TableColumn column;
TableColumnModel columnModel = table.getColumnModel();
TableModel model = table.getModel();
String columnName = "";
for (int i = 0; i < columnCount; i++) {
columnName = model.getColumnName(i);
column = table.getColumn(columnName);
int modelIndex = column.getModelIndex();
int orderIndex = getOrderIndex(modelIndex, modelIndex);
if (i != orderIndex) {
table.moveColumn(columnModel.getColumnIndex(columnName), orderIndex);
}
}
}
代码示例来源:origin: abel533/DBMetadata
/**
* 处理标题列的居中
*
* @param dbField
*/
public void prcessDbFieldHeader(JTable dbField) {
dbField.getColumn(fieldNames[4]).setPreferredWidth(40);
dbField.getColumn(fieldNames[4]).setMinWidth(40);
dbField.getColumn(fieldNames[4]).setMaxWidth(40);
dbField.getColumn(fieldNames[5]).setPreferredWidth(40);
dbField.getColumn(fieldNames[5]).setMinWidth(40);
dbField.getColumn(fieldNames[5]).setMaxWidth(40);
}
代码示例来源:origin: stackoverflow.com
final JTable table = new JTable(tableModel);
table.getTableHeader().addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent mouseEvent) {
int selectedHeader = table.convertColumnIndexToModel(table
.columnAtPoint(mouseEvent.getPoint()));
table.getColumn(table.getColumnName(selectedHeader))
.setCellRenderer(new DefaultTableCellRenderer() {
public void setBackground(Color c) {
super.setBackground(Color.blue);
}
});
};
});
代码示例来源:origin: stackoverflow.com
JTable table = new JTable();
table.getColumn("columnName").setCellEditor(new Editor_name(new JCheckBox()));
代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) {
if (column > keys.length) {
throw new IndexOutOfBoundsException("colum can not be greater than " + keys.length);
}
TableColumn col = table.getColumn(table.getColumnName(column));
int index = col.getModelIndex();
value = _(keys[index]);
JComponent rendererComponent = (JComponent) delegate.getTableCellRendererComponent(table, value, isSelected, hasfocus, row, column);
rendererComponent.setToolTipText(_(tips[index]));
return rendererComponent;
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http
@Override
protected void sizeColumns(JTable table) {
GuiUtils.fixSize(table.getColumn(INCLUDE_EQUALS), table);
GuiUtils.fixSize(table.getColumn(ENCODE_OR_NOT), table);
}
代码示例来源:origin: stackoverflow.com
JTable studentTable = new JTable( model );
studentTable.removeColumn( studentTable.getColumn("Subject") );
studentTable.removeColumn( studentTable.getColumn("Staff") );
代码示例来源:origin: Waikato/weka-trunk
private int getColumnIndex(String columnName) {
return m_table.getColumn(columnName).getModelIndex();
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
private int getColumnIndex(String columnName) {
return m_table.getColumn(columnName).getModelIndex();
}
代码示例来源:origin: stackoverflow.com
User user = new User("Zack", "Yoshyaro");
DefaultTableModel model = new DefaultTableModel(new Object[]{"First", "Last"}, 0);
model.addRow(new Object[]{user, user}); // note user must be added for each column, but it's the same object
JTable table = new JTable(model);
TableColumn firstName = table.getColumn("First");
firstName.setCellRenderer(...); // a cell renderer that shows user.getFirstName();
TableColumn lastName = table.getColumn("Last");
lastName.setCellRenderer(...); // a cell renderer that shows user.getLastName();
代码示例来源:origin: no.uib/jsparklines
/**
* Turns the bar chart renderer on or off. When turned off the underlying
* values are shown.
*
* @param evt
*/
private void showJSparklinesJCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showJSparklinesJCheckBoxActionPerformed
showBothJCheckBox.setEnabled(showJSparklinesJCheckBox.isSelected());
showGradientJCheckBox.setEnabled(showJSparklinesJCheckBox.isSelected());
((JSparklinesBarChartTableCellRenderer) singleValuesJTable.getColumn("Fold Change").getCellRenderer()).showNumbers(!showJSparklinesJCheckBox.isSelected());
((JSparklinesBarChartTableCellRenderer) singleValuesJTable.getColumn("Peptides").getCellRenderer()).showNumbers(!showJSparklinesJCheckBox.isSelected());
((JSparklinesBarChartTableCellRenderer) singleValuesJTable.getColumn("Coverage").getCellRenderer()).showNumbers(!showJSparklinesJCheckBox.isSelected());
singleValuesJTable.revalidate();
singleValuesJTable.repaint();
}//GEN-LAST:event_showJSparklinesJCheckBoxActionPerformed
代码示例来源:origin: no.uib/jsparklines
/**
* Displays the number _and_ the chart or just the chart for the bar chart
* example.
*
* @param evt
*/
private void showBothJCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showBothJCheckBoxActionPerformed
((JSparklinesBarChartTableCellRenderer) singleValuesJTable.getColumn("Fold Change").getCellRenderer()).showNumberAndChart(showBothJCheckBox.isSelected(), 40);
((JSparklinesBarChartTableCellRenderer) singleValuesJTable.getColumn("Peptides").getCellRenderer()).showNumberAndChart(showBothJCheckBox.isSelected(), 40);
((JSparklinesBarChartTableCellRenderer) singleValuesJTable.getColumn("Coverage").getCellRenderer()).showNumberAndChart(showBothJCheckBox.isSelected(), 40);
singleValuesJTable.revalidate();
singleValuesJTable.repaint();
}//GEN-LAST:event_showBothJCheckBoxActionPerformed
代码示例来源:origin: no.uib/jsparklines
/**
* Add or remove the reference line from the 3D values plot.
*
* @param evt
*/
private void reference3dValuesJCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reference3dValuesJCheckBoxActionPerformed
// add or remove the reference area
if (reference3dValuesJCheckBox.isSelected()) {
((JSparklines3dTableCellRenderer) treeDimensionalDataSeriesJTable.getColumn("Spread").getCellRenderer()).addXAxisReferenceArea("DatasetB", 33, 66, Color.ORANGE, 0.3f);
} else {
((JSparklines3dTableCellRenderer) treeDimensionalDataSeriesJTable.getColumn("Spread").getCellRenderer()).removeXAxisReferenceArea("DatasetB");
}
// repaint the table to update the plot
treeDimensionalDataSeriesJTable.revalidate();
treeDimensionalDataSeriesJTable.repaint();
}//GEN-LAST:event_reference3dValuesJCheckBoxActionPerformed
代码示例来源:origin: no.uib/jsparklines
/**
* Add or remove the reference line from the multiple values plot.
*
* @param evt
*/
private void referenceMultipleValuesJCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_referenceMultipleValuesJCheckBoxActionPerformed
// add or remove the reference area
if (referenceMultipleValuesJCheckBox.isSelected()) {
((JSparklinesTableCellRenderer) multipleValuesJTable.getColumn("Change").getCellRenderer()).addReferenceArea("Middle", 4, 6, Color.LIGHT_GRAY, 0.5f);
} else {
((JSparklinesTableCellRenderer) multipleValuesJTable.getColumn("Change").getCellRenderer()).removeReferenceArea("Middle");
}
// repaint the table to update the plot
multipleValuesJTable.revalidate();
multipleValuesJTable.repaint();
}//GEN-LAST:event_referenceMultipleValuesJCheckBoxActionPerformed
代码示例来源:origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.revisionmachine
/**
* Initialize JTable that contains namespaces
*/
private void initTable()
{
namespaces = new JTable(new FilterTableModel());
namespaces.removeColumn(namespaces.getColumn("#"));
namespaces.setFillsViewportHeight(true);
namespaces.setPreferredScrollableViewportSize(new Dimension(500, 70));
// Create the scroll pane and add the table to it.
JScrollPane scrollPane = new JScrollPane(namespaces);
scrollPane.setBounds(70, 10, 300, 200);
this.add(scrollPane);
}
代码示例来源:origin: joel-costigliola/assertj-swing
@RunsInEDT
@Nonnull private static TableCell findCell(final @Nonnull JTable table, final int row, final @Nonnull Object columnId) {
TableCell result = execute(() -> {
int column = columnIndexByIdentifier(table, columnId);
if (column == -1) {
failColumnIndexNotFound(columnId);
}
table.convertColumnIndexToView(table.getColumn(columnId).getModelIndex());
return new TableCell(row, column);
});
return checkNotNull(result);
}
代码示例来源:origin: dkpro/dkpro-jwpl
/**
* Initialize JTable that contains namespaces
*/
private void initTable()
{
namespaces = new JTable(new FilterTableModel());
namespaces.removeColumn(namespaces.getColumn("#"));
namespaces.setFillsViewportHeight(true);
namespaces.setPreferredScrollableViewportSize(new Dimension(500, 70));
// Create the scroll pane and add the table to it.
JScrollPane scrollPane = new JScrollPane(namespaces);
scrollPane.setBounds(70, 10, 300, 200);
this.add(scrollPane);
}
内容来源于网络,如有侵权,请联系作者删除!