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


Java JTable.setBackground方法代码示例

本文整理汇总了Java中javax.swing.JTable.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java JTable.setBackground方法的具体用法?Java JTable.setBackground怎么用?Java JTable.setBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JTable的用法示例。


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

示例1: createConstraintsTable

import javax.swing.JTable; //导入方法依赖的package包/类
public JTable createConstraintsTable(boolean rebuild) {		
    JTable table = new JTable(new VRPTableModel(rebuild));	      
    
    table.setPreferredScrollableViewportSize(new Dimension(60, 60));
    table.setAutoscrolls(true);
    table.setAutoCreateColumnsFromModel(true);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    table.setMaximumSize(new Dimension(60, 60));
    table.setBackground(Color.LIGHT_GRAY);
    table.setBorder(BorderFactory.createCompoundBorder());
    table.setForeground(Color.BLACK);
    table.setShowGrid(true);
    
      return table;
}
 
开发者ID:guilhebl,项目名称:routerapp,代码行数:16,代码来源:VRPSettings.java

示例2: JFormularioAVencer

import javax.swing.JTable; //导入方法依赖的package包/类
public JFormularioAVencer(AdministradorPagos modelo){
	super(modelo);
	this.setTitle("Cheques Próximos a Vencer (prox. 10 días)");
	this.setSize(345, 200);
	this.setLocation(720, 220);
	this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	this.getContentPane().setBackground(new Color(255, 103, 17));
	this.getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.PAGE_AXIS));
	tabla = new JTable(new TablaChequesAVencer(modelo.obtenerChequesAVencer()));
	this.getContentPane().add(tabla);
	tabla.setBackground(new Color(255, 103, 17));
	btnDepositar = new JButton("Depositar");
	this.getContentPane().add(btnDepositar);
	btnCancelar = new JButton("Cancelar");
	this.getContentPane().add(btnCancelar);
	
	btnDepositar.addActionListener(
		new DepositoChequesController(this.getModelo(), this)
	);
	
	btnCancelar.addActionListener(new ActionListener(){
		public void actionPerformed(ActionEvent e){
			dispose();
		}
	});
}
 
开发者ID:edelgado-uade,项目名称:ioo.tp,代码行数:27,代码来源:JFormularioAVencer.java

示例3: checkTableGridLines

import javax.swing.JTable; //导入方法依赖的package包/类
private static void checkTableGridLines() {

        TableModel dataModel = new AbstractTableModel() {
            public int getColumnCount() {
                return 10;
            }

            public int getRowCount() {
                return 10;
            }

            public Object getValueAt(int row, int col) {
                return " ";
            }
        };

        DefaultTableCellRenderer r = new DefaultTableCellRenderer();
        r.setOpaque(true);
        r.setBackground(CELL_RENDERER_BACKGROUND_COLOR);

        JTable table = new JTable(dataModel);
        table.setSize(WIDTH, HEIGHT);
        table.setDefaultRenderer(Object.class, r);
        table.setGridColor(GRID_COLOR);
        table.setShowGrid(true);
        table.setShowHorizontalLines(true);
        table.setShowVerticalLines(true);
        table.setBackground(TABLE_BACKGROUND_COLOR);

        checkTableGridLines(table);
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:DrawGridLinesTest.java

示例4: AttrTable

import javax.swing.JTable; //导入方法依赖的package包/类
public AttrTable(Window parent) {
	super(new BorderLayout());
	this.parent = parent;

	titleEnabled = true;
	title = new TitleLabel();
	title.setHorizontalAlignment(SwingConstants.CENTER);
	title.setVerticalAlignment(SwingConstants.CENTER);
	tableModel = new TableModelAdapter(parent, NULL_ATTR_MODEL);
	table = new JTable(tableModel);
	table.setDefaultEditor(Object.class, editor);
	table.setTableHeader(null);
	table.setRowHeight(20);

	Font baseFont = title.getFont();
	int titleSize = Math.round(baseFont.getSize() * 1.2f);
	Font titleFont = baseFont.deriveFont((float) titleSize).deriveFont(Font.BOLD);
	title.setFont(titleFont);
	Color bgColor = new Color(240, 240, 240);
	setBackground(bgColor);
	table.setBackground(bgColor);
	Object renderer = table.getDefaultRenderer(String.class);
	if (renderer instanceof JComponent) {
		((JComponent) renderer).setBackground(Color.WHITE);
	}

	JScrollPane tableScroll = new JScrollPane(table);

	this.add(title, BorderLayout.PAGE_START);
	this.add(tableScroll, BorderLayout.CENTER);
	LocaleManager.addLocaleListener(this);
	localeChanged();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:34,代码来源:AttrTable.java

示例5: JFormularioChequesLog

import javax.swing.JTable; //导入方法依赖的package包/类
public JFormularioChequesLog(AdministradorPagos modelo) {
	super(modelo);
	this.setTitle("Log de cheques");
	this.setSize(345, 200);
	this.setLocation(10, 430);
	this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	tabla = new JTable(new TablaChequesLog(modelo.obtenerListaCheques()));
	this.getContentPane().add(tabla);
	tabla.setBackground(new Color(212, 208, 169));
	
}
 
开发者ID:edelgado-uade,项目名称:ioo.tp,代码行数:12,代码来源:JFormularioChequesLog.java

示例6: JFormularioChequesPagos

import javax.swing.JTable; //导入方法依赖的package包/类
public JFormularioChequesPagos(AdministradorPagos modelo) {
	super(modelo);
	this.setTitle("Listado de cheques usados para pagar");
	this.setSize(345, 200);
	this.setLocation(1075, 430);
	this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	tabla = new JTable(new TablaChequesDepositados(modelo.obtenerChequesPagos()));
	this.getContentPane().add(tabla);
	tabla.setBackground(new Color(212, 208, 169));
}
 
开发者ID:edelgado-uade,项目名称:ioo.tp,代码行数:11,代码来源:JFormularioChequesPagos.java

示例7: JFormularioChequesDisponibles

import javax.swing.JTable; //导入方法依赖的package包/类
public JFormularioChequesDisponibles(AdministradorPagos modelo) {
	super(modelo);
	this.setTitle("Listado de cheques disponibles");
	this.setSize(345, 200);
	this.setLocation(365, 430);
	this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	tabla = new JTable(new TablaChequesDisponibles(modelo.obtenerChequesDisponibles()));
	this.getContentPane().add(tabla);
	tabla.setBackground(new Color(212, 208, 169));
}
 
开发者ID:edelgado-uade,项目名称:ioo.tp,代码行数:11,代码来源:JFormularioChequesDisponibles.java

示例8: JFormularioChequesDepositados

import javax.swing.JTable; //导入方法依赖的package包/类
public JFormularioChequesDepositados(AdministradorPagos modelo) {
	super(modelo);
	this.setTitle("Listado de cheques despositados");
	this.setSize(345, 200);
	this.setLocation(720, 430);
	this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	tabla = new JTable(new TablaChequesDepositados(modelo.obtenerChequesDepositados()));
	this.getContentPane().add(tabla);
	tabla.setBackground(new Color(212, 208, 169));
}
 
开发者ID:edelgado-uade,项目名称:ioo.tp,代码行数:11,代码来源:JFormularioChequesDepositados.java

示例9: initialize

import javax.swing.JTable; //导入方法依赖的package包/类
/**
 * Initialize the contents of the frame.
 */
private void initialize() {
    frame = new JFrame("Library Book Loan System - Notifications");
    frame.setResizable(false);
    frame.setBounds(100, 100, 438, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
    JPanel panel = new JPanel();
    frame.getContentPane().add(panel, BorderLayout.CENTER);
    panel.setLayout(null);
    
    JLabel lblNotifications = new JLabel("Notifications");
    lblNotifications.setHorizontalAlignment(SwingConstants.CENTER);
    lblNotifications.setFont(new Font("Segoe UI Light", Font.PLAIN, 14));
    lblNotifications.setBounds(10, 40, 414, 22);
    panel.add(lblNotifications);
    
    JLabel label_1 = new JLabel("Library Book Loan System");
    label_1.setHorizontalAlignment(SwingConstants.CENTER);
    label_1.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
    label_1.setBounds(10, 11, 414, 25);
    panel.add(label_1);
    
    JPanel panel_1 = new JPanel();
    panel_1.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Available Books", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
    panel_1.setBounds(10, 73, 414, 177);
    panel.add(panel_1);
    panel_1.setLayout(null);
    
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(10, 22, 394, 144);
    panel_1.add(scrollPane);
    
    Object columnNames[] = { "No", "Message" };
    Object rowData[][] = getNotifications();
    
    table = new JTable(rowData, columnNames)
    {
        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    
    table.setBackground(Color.white);
    table.setOpaque(true);
    
    
    table.getTableHeader().setReorderingAllowed(false);
    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(table.getModel());
    table.setRowSorter(sorter);

    List<RowSorter.SortKey> sortKeys = new ArrayList<>(25);
    sortKeys.add(new RowSorter.SortKey(0, SortOrder.ASCENDING));
    sorter.setSortKeys(sortKeys);
    
    table.getColumnModel().getColumn(0).setMaxWidth(40);
    scrollPane.setViewportView(table);
    
}
 
开发者ID:hisener,项目名称:bbm487s2017g1,代码行数:63,代码来源:CustomerNotifications.java


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