private void uiStyle () { contentPane.setBackground(new Color(36, 36, 36)); topPanel.setBackground(new Color(36, 36, 36)); topPanel.setForeground(new Color(255, 255, 255)); table.setBackground(new Color(46, 46, 46)); table.setForeground(new Color(255, 255, 255)); bottomPanel.setBackground(new Color(36, 36, 36)); bottomPanel.setForeground(new Color(255, 255, 255)); buttonPanel.setBackground(new Color(36, 36, 36)); buttonPanel.setForeground(new Color(255, 255, 255)); scrollPane.setBorder(BorderFactory.createEmptyBorder()); scrollPane.setBackground(new Color(36, 36, 36)); scrollPane.getViewport().setBackground(new Color(36, 36, 36)); warningNotice.setForeground(new Color(255, 20, 20)); warningNotice2.setForeground(new Color(255, 20, 20)); }
relationTable.setBackground(new java.awt.Color(255, 204, 204));
JFrame frame = new JFrame(); frame.setSize(300,300); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTable table = new JTable(5, 5); table.setBackground(Color.GRAY); frame.setLayout(new FlowLayout()); frame.add(table);
// Add Table JTable table=new JTable(data,columns); c.gridx=0; c.gridy=1; c.weightx=1; c.weighty=1; c.gridwidth=c.REMAINDER; c.fill=GridBagConstraints.HORIZONTAL; // this line solves the problem table.setBackground(Color.RED); table.setMinimumSize(new Dimension(400,400)); cp.add(table, c);
JFrame jframe = new JFrame(); jframe.setExtendedState(JFrame.MAXIMIZED_BOTH); GridLayout layout = new GridLayout(); //chose your favorite JTable jtable = new JTable(); jtable.setBackground(Color.yellow); Container contentPane = jframe.getContentPane(); contentPane.setLayout(layout); contentPane.add(jtable); jframe.setVisible(true);
public void setBackground(Color color) { super.setBackground(color); if (color != null) { bgColor1 = color; bgColor2 = darker(color); } }
JFrame jframe = new JFrame(); jframe.setExtendedState(JFrame.MAXIMIZED_BOTH); JTable jtable = new JTable(); jtable.setBackground(Color.yellow); jframe.getContentPane().add(jtable); jframe.setVisible(true);
String[] colNames = {"Item", "Count"}; DefaultTableModel dtm = new DefaultTableModel(colNames, 0); JPanel j = new JPanel(new BorderLayout()); JTable t = new JTable(dtm); t.setBackground(Color.GREEN); t.getTableHeader().setReorderingAllowed(false); t.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); t.getColumnModel().getColumn(0).setPreferredWidth(113); j.add(new JScrollPane(t), BorderLayout.CENTER);
private void enableTable(boolean custEnabled, boolean sysEnabled, JTable table, PowerTableModel model, JButton addButton, JButton deleteButton) { table.setEnabled(custEnabled); Color greyColor = new Color(240, 240, 240); Color blueColor = new Color(184, 207, 229); table.setBackground(sysEnabled ? greyColor : Color.WHITE); table.setSelectionBackground(sysEnabled ? greyColor : blueColor); addButton.setEnabled(custEnabled); deleteButton.setEnabled(custEnabled); if (custEnabled && (model.getRowCount() > 0)) { deleteButton.setEnabled(true); addButton.setEnabled(true); } }
JTable table = new JTable(data, columns); table.setModel(model); table.setBackground(Color.LIGHT_GRAY); table.setForeground(Color.black); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); table.setFillsViewportHeight(true);
public void initTransferTable() { getTransferTable().setBackground(Color.white); updateTransferTable(); }
/** Allows to subclasses initialize table * @param t */ private void initializeTable() { table.setModel(tableModel); TableSheetCell tableCell = new TableSheetCell(tableModel); table.setDefaultRenderer(Node.Property.class, tableCell); table.setDefaultEditor(Node.Property.class, tableCell); table.getTableHeader().setDefaultRenderer(tableCell); table.setShowGrid(false); table.setIntercellSpacing(new Dimension(0, 0)); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getTableHeader().setReorderingAllowed(false); if (UIManager.getColor("Panel.background") != null) { // NOI18N table.setBackground(UIManager.getColor("Panel.background")); // NOI18N table.setSelectionBackground(UIManager.getColor("Panel.background")); // NOI18N } }
/** Allows to subclasses initialize table * @param t */ private void initializeTable() { table.setModel(tableModel); TableSheetCell tableCell = new TableSheetCell(tableModel); table.setDefaultRenderer(Node.Property.class, tableCell); table.setDefaultEditor(Node.Property.class, tableCell); table.getTableHeader().setDefaultRenderer(tableCell); table.setShowGrid(false); table.setIntercellSpacing(new Dimension(0, 0)); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getTableHeader().setReorderingAllowed(false); if (UIManager.getColor("Panel.background") != null) { // NOI18N table.setBackground(UIManager.getColor("Panel.background")); // NOI18N table.setSelectionBackground(UIManager.getColor("Panel.background")); // NOI18N } }
/** Allows to subclasses initialize table * @param t */ private void initializeTable() { table.setModel(tableModel); tableCell = new TableSheetCell(tableModel); table.setDefaultRenderer(Node.Property.class, tableCell); table.setDefaultEditor(Node.Property.class, tableCell); table.getTableHeader().setDefaultRenderer(tableCell); table.setShowGrid(false); table.setIntercellSpacing(new Dimension(0, 0)); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getTableHeader().setReorderingAllowed(false); if (UIManager.getColor("Panel.background") != null) { // NOI18N table.setBackground(UIManager.getColor("Panel.background")); // NOI18N table.setSelectionBackground(UIManager.getColor("Panel.background")); // NOI18N } }
public ImportShapeSummaryPanel(){ this.setLayout(new MigLayout("wrap 1")); JLabel summaryText = new JLabel(Bundle.ImportShapeSummaryPanel_summary_text()); this.add(summaryText); tableModel = new DefaultTableModel(); importedtable = new JTable(tableModel); importedtable.setBorder(new EmptyBorder(0,0,0,0)); importedtable.setBackground(Color.white); JScrollPane importedTableScrolPane = new JScrollPane(importedtable); importedTableScrolPane.setBackground(Color.white); importedTableScrolPane.setBorder(new EmptyBorder(0, 0, 0, 0)); importedTableScrolPane.getViewport().setBackground(Color.white); this.add(importedTableScrolPane); }
/** * Create the main GUI panel which contains the argument table. * * @return the main GUI panel */ private Component makeMainPanel() { initializeTableModel(); table = new JTable(tableModel); table.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer()); table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); if (this.background != null) { table.setBackground(this.background); } JMeterUtils.applyHiDPI(table); return makeScrollPane(table); }
@Override public void installUI (JComponent c) { super.installUI (c); JTable table = (JTable) c; table.setOpaque (false); table.setSelectionForeground (UIManager.getColor ("Table.selectionForeground")); table.setBackground (UIManager.getColor ("Table.background")); table.setFont (UIManager.getFont ("Table.font")); table.setBorder (UIManager.getBorder ("Table.border")); table.setGridColor (UIManager.getColor ("Table.gridColor")); table.setSelectionBackground (UIManager.getColor ("Table.selectionBackground")); table.getTableHeader ().setResizingAllowed (true); int rowHeight = UIManager.getInt ("Table.rowHeight"); if (rowHeight > 0) { table.setRowHeight (rowHeight); } else { table.setRowHeight (table.getRowHeight () + 25); } table.setDefaultRenderer (Object.class, new MaterialTableCellRenderer ()); table.setDefaultEditor (Object.class, new MaterialTableCellEditor ()); }
private static JTable createRowHeadersTable(final JTable userTable, int startingNumber) { final JTable rowHeadersTable = new JBTable(new RowHeadersTableModel(userTable.getModel().getRowCount(), startingNumber)); // this is where you set the width of the row headers rowHeadersTable.createDefaultColumnsFromModel(); // make the rows look and behave like headers rowHeadersTable.setBackground(rowHeadersTable.getTableHeader().getBackground()); rowHeadersTable.setForeground(rowHeadersTable.getTableHeader().getForeground()); rowHeadersTable.setFont(rowHeadersTable.getTableHeader().getFont()); rowHeadersTable.setRowHeight(userTable.getRowHeight()); rowHeadersTable.getTableHeader().setReorderingAllowed(false); rowHeadersTable.setRowSelectionAllowed(true); rowHeadersTable.setCellSelectionEnabled(true); rowHeadersTable.setFocusable(true); rowHeadersTable.setDragEnabled(true); rowHeadersTable.setSelectionMode(userTable.getSelectionModel().getSelectionMode()); return rowHeadersTable; }
public JTable getTable(){ if( table!=null )return table; synchronized(this){ if( table!=null )return table; table = new JTable(); table.setAutoCreateRowSorter(false); table.setAutoCreateColumnsFromModel(false); table.setModel(getSortRowTM()); table.setDefaultEditor(PropertyValue.class, getPropertyEditor()); table.setDefaultRenderer(PropertyValue.class, getPropertyRender()); table.setBackground(Color.white); table.setFillsViewportHeight(true); //table.setOpaque(false); table.setShowVerticalLines(true); return table; } } //</editor-fold>
@Override protected void synchronizeEditableState() { if (table != null) { boolean tableEnabled = isEnabled(); table.setEnabled(tableEnabled); table.setBackground(tableEnabled ? Color.WHITE : Color.LIGHT_GRAY); table.setForeground(tableEnabled ? Color.BLACK : Color.DARK_GRAY); table.repaint(); getTableModel().setEditable(isEditable()); } checkActionStates(); }