当前位置: 首页>>代码示例>>Java>>正文


Java DefaultTableCellHeaderRenderer类代码示例

本文整理汇总了Java中sun.swing.table.DefaultTableCellHeaderRenderer的典型用法代码示例。如果您正苦于以下问题:Java DefaultTableCellHeaderRenderer类的具体用法?Java DefaultTableCellHeaderRenderer怎么用?Java DefaultTableCellHeaderRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DefaultTableCellHeaderRenderer类属于sun.swing.table包,在下文中一共展示了DefaultTableCellHeaderRenderer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: lebarkolom

import sun.swing.table.DefaultTableCellHeaderRenderer; //导入依赖的package包/类
private void lebarkolom(){
    TableColumn column;
    jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); 
    column = jTable1.getColumnModel().getColumn(0); 
    column.setPreferredWidth(40);
    column = jTable1.getColumnModel().getColumn(1); 
    column.setPreferredWidth(150); 
    column = jTable1.getColumnModel().getColumn(2); 
    column.setPreferredWidth(300); 
    
     //rata tengah untuk judul kolom
    DefaultTableCellHeaderRenderer tengahRenderer = new DefaultTableCellHeaderRenderer();
    tengahRenderer.setHorizontalAlignment(DefaultTableCellHeaderRenderer.CENTER);
    jTable1.getColumnModel().getColumn(0).setHeaderRenderer(tengahRenderer);
    jTable1.getColumnModel().getColumn(1).setHeaderRenderer(tengahRenderer);
    jTable1.getColumnModel().getColumn(2).setHeaderRenderer(tengahRenderer);
    
    
    //rata tengah untuk kolom 0 (ID Kategori)
    DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
    centerRenderer.setHorizontalAlignment(DefaultTableCellRenderer.CENTER);
    jTable1.getColumnModel().getColumn(0).setCellRenderer(centerRenderer);
}
 
开发者ID:ahmadx,项目名称:Borneo-Bengkel,代码行数:24,代码来源:fSatuan.java

示例2: main

import sun.swing.table.DefaultTableCellHeaderRenderer; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    DefaultTableCellHeaderRenderer.getColumnSortOrder(null, 0);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:4,代码来源:bug6788484.java

示例3: initTable

import sun.swing.table.DefaultTableCellHeaderRenderer; //导入依赖的package包/类
private void initTable(List<PropTypeBean> paramList){
    table = new JBTable();
    PropTypesModel model = new PropTypesModel();
    String[] columnNames = {
            "name",
            "type",
            "isRequired",
            "describe",
            "ops"};
    Object[][] data = new Object[paramList.size()][5];
    for (int i = 0; i < paramList.size(); i++) {
        data[i][0] = paramList.get(i).name;
        data[i][1] = paramList.get(i).type;
        data[i][2] = paramList.get(i).isRequired;
        data[i][3] = paramList.get(i).describe;
        data[i][4] = false;
    }
    model.setDataVector(data,columnNames);
    table.setModel(model);
    final DefaultListSelectionModel defaultListSelectionModel = new DefaultListSelectionModel();
    defaultListSelectionModel.setSelectionMode(SINGLE_SELECTION);
    table.setSelectionModel(defaultListSelectionModel);
    // form header center
    DefaultTableCellHeaderRenderer thr = new DefaultTableCellHeaderRenderer();
    thr.setHorizontalAlignment(JLabel.CENTER);
    table.getTableHeader().setDefaultRenderer(thr);
    //render special column
    TableColumn nameColumn = table.getColumn("name");
    TableColumn typeColumn = table.getColumn("type");
    TableColumn isRequireColumn = table.getColumn("isRequired");
    TableColumn infoColumn = table.getColumn("describe");
    TableColumn operationColumn = table.getColumn("ops");
    nameColumn.setCellRenderer(new TextRenderer(true));
    nameColumn.setCellEditor(new DefaultCellEditor(new TextRenderer(false)));
    typeColumn.setCellEditor(new DefaultCellEditor(new ComboBoxRenderer()));
    typeColumn.setCellRenderer(new ComboBoxRenderer());
    typeColumn.setMaxWidth(150);
    isRequireColumn.setCellEditor(new DefaultCellEditor(new CheckBoxRenderer()));
    isRequireColumn.setCellRenderer(new CheckBoxRenderer());
    isRequireColumn.setMaxWidth(100);
    infoColumn.setCellEditor(new DefaultCellEditor(new JTextField()){
        @Override
        public boolean isCellEditable(EventObject anEvent) {
            return false;
        }
    });
    infoColumn.setMinWidth(120);
    infoColumn.setMaxWidth(150);
    ButtonEditor buttonEditor = new ButtonEditor();
    operationColumn.setCellRenderer(new ButtonRenderer());
    operationColumn.setCellEditor(buttonEditor);
    operationColumn.setMinWidth(100);
    operationColumn.setMaxWidth(100);
    sp.setViewportView(table);
}
 
开发者ID:dpzxsm,项目名称:ReactPropTypes-Plugin,代码行数:56,代码来源:PropTypesDialog.java

示例4: lebarkolom

import sun.swing.table.DefaultTableCellHeaderRenderer; //导入依赖的package包/类
private void lebarkolom(){
    TableColumn column;
    jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); 
    column = jTable1.getColumnModel().getColumn(0); 
    column.setPreferredWidth(40);
    column = jTable1.getColumnModel().getColumn(1); 
    column.setPreferredWidth(200); 
    column = jTable1.getColumnModel().getColumn(2); 
    column.setPreferredWidth(100); 
    column = jTable1.getColumnModel().getColumn(3); 
    column.setPreferredWidth(50); 
    column = jTable1.getColumnModel().getColumn(4); 
    column.setPreferredWidth(100); 
    column = jTable1.getColumnModel().getColumn(5); 
    column.setPreferredWidth(75); 
    
    //rata tengah untuk judul kolom
    DefaultTableCellHeaderRenderer tengahRenderer = new DefaultTableCellHeaderRenderer();
    tengahRenderer.setHorizontalAlignment(DefaultTableCellHeaderRenderer.CENTER);
    jTable1.getColumnModel().getColumn(0).setHeaderRenderer(tengahRenderer);
    jTable1.getColumnModel().getColumn(1).setHeaderRenderer(tengahRenderer);
    jTable1.getColumnModel().getColumn(2).setHeaderRenderer(tengahRenderer);
    jTable1.getColumnModel().getColumn(3).setHeaderRenderer(tengahRenderer);
    jTable1.getColumnModel().getColumn(4).setHeaderRenderer(tengahRenderer);
    jTable1.getColumnModel().getColumn(5).setHeaderRenderer(tengahRenderer);
    
    //rata tengah untuk kolom 0 (ID Kategori)
    DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
    centerRenderer.setHorizontalAlignment(DefaultTableCellRenderer.CENTER);
    jTable1.getColumnModel().getColumn(0).setCellRenderer(centerRenderer);
    jTable1.getColumnModel().getColumn(2).setCellRenderer(centerRenderer);
    jTable1.getColumnModel().getColumn(3).setCellRenderer(centerRenderer);
    //jTable1.getColumnModel().getColumn(5).setCellRenderer(centerRenderer);
    
    //rata kanan untuk kolom duit-duitan.
    DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
    rightRenderer.setHorizontalAlignment(DefaultTableCellRenderer.RIGHT);
    jTable1.getColumnModel().getColumn(4).setCellRenderer(rightRenderer);
    jTable1.getColumnModel().getColumn(5).setCellRenderer(rightRenderer);
    
    
    
    
   
}
 
开发者ID:ahmadx,项目名称:Borneo-Bengkel,代码行数:46,代码来源:fSparePart.java

示例5: lebarkolom

import sun.swing.table.DefaultTableCellHeaderRenderer; //导入依赖的package包/类
private void lebarkolom(){
        TableColumn column;
        jTable1.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); 
        column = jTable1.getColumnModel().getColumn(0); 
        column.setPreferredWidth(50);
        column = jTable1.getColumnModel().getColumn(1); 
        column.setPreferredWidth(150); 
        column = jTable1.getColumnModel().getColumn(2); 
        column.setPreferredWidth(250); 
        column = jTable1.getColumnModel().getColumn(3); 
        column.setPreferredWidth(150); 
        column = jTable1.getColumnModel().getColumn(4); 
        column.setPreferredWidth(75); 
        column = jTable1.getColumnModel().getColumn(5); 
        column.setPreferredWidth(150); 
        
        
        //rata tengah untuk judul kolom
        DefaultTableCellHeaderRenderer tengahRenderer = new DefaultTableCellHeaderRenderer();
        tengahRenderer.setHorizontalAlignment(DefaultTableCellHeaderRenderer.CENTER);
        jTable1.getColumnModel().getColumn(0).setHeaderRenderer(tengahRenderer);
        jTable1.getColumnModel().getColumn(1).setHeaderRenderer(tengahRenderer);
        jTable1.getColumnModel().getColumn(2).setHeaderRenderer(tengahRenderer);
        jTable1.getColumnModel().getColumn(3).setHeaderRenderer(tengahRenderer);
        jTable1.getColumnModel().getColumn(4).setHeaderRenderer(tengahRenderer);
        jTable1.getColumnModel().getColumn(5).setHeaderRenderer(tengahRenderer);
        
        
        //rata tengah untuk kolom 0 (ID Kategori)
        DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
        centerRenderer.setHorizontalAlignment(DefaultTableCellRenderer.CENTER);
        jTable1.getColumnModel().getColumn(0).setCellRenderer(centerRenderer);
//        jTable1.getColumnModel().getColumn(2).setCellRenderer(centerRenderer);
//        jTable1.getColumnModel().getColumn(3).setCellRenderer(centerRenderer);
//        jTable1.getColumnModel().getColumn(5).setCellRenderer(centerRenderer);
        
        //rata kanan untuk kolom duit-duitan.
//        DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer();
//        rightRenderer.setHorizontalAlignment(DefaultTableCellRenderer.RIGHT);
//        jTable1.getColumnModel().getColumn(4).setCellRenderer(rightRenderer);
    
    }
 
开发者ID:ahmadx,项目名称:Borneo-Bengkel,代码行数:43,代码来源:fMekanik.java

示例6: createDefaultRenderer

import sun.swing.table.DefaultTableCellHeaderRenderer; //导入依赖的package包/类
/**
 *  Returns a default renderer to be used when no header renderer
 *  is defined by a <code>TableColumn</code>.
 *
 *  @return the default table column renderer
 * @since 1.3
 */
protected TableCellRenderer createDefaultRenderer() {
    return new DefaultTableCellHeaderRenderer();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:JTableHeader.java


注:本文中的sun.swing.table.DefaultTableCellHeaderRenderer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。