Mercurial > hg > ltpda
view src/MPipeline2/src/mpipeline/parametersoverview/ParametersOverviewCellRenderer.java @ 16:91f21a0aab35 database-connection-manager
Update utils.jquery
* * *
Update utils.jmysql.getsinfo
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
/* * Copyright (c) 2010 Max-Planck-Gesellschaft, Ingo Diepholz <ingo.diepholz(at)aei.mpg.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package mpipeline.parametersoverview; import java.awt.Color; import java.awt.Component; import javax.swing.JButton; import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellRenderer; /** * * @author Ingo Diepholz <ingo.diepholz(at)aei.mpg.de> */ public class ParametersOverviewCellRenderer extends DefaultTableCellRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { // return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (column != 3) { Object obj = table.getValueAt(row, column); TableCellRenderer tr = null; if (obj == null) { tr = new DefaultTableCellRenderer(); } else { tr = table.getDefaultRenderer(obj.getClass()); } return tr.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); } else { JButton b = new JButton("..."); if (isSelected) { // b.setForeground(table.getSelectionForeground()); // b.setBackground(table.getSelectionBackground()); } else { b.setForeground(table.getForeground()); b.setBackground(table.getBackground()); } b.setFont(table.getFont()); if (hasFocus) { Border border = null; if (isSelected) { border = UIManager.getBorder("Table.focusSelectedCellHighlightBorder"); } if (border == null) { border = UIManager.getBorder("Table.focusCellHighlightBorder"); } b.setBorder(border); if (!isSelected && table.isCellEditable(row, column)) { Color col; col = UIManager.getColor("Table.focusCellForeground"); if (col != null) { b.setForeground(col); } col = UIManager.getColor("Table.focusCellBackground"); if (col != null) { b.setBackground(col); } } } else { b.setBorder(new EmptyBorder(1, 1, 1, 1)); } return (b); } } }