本文整理汇总了Java中javax.swing.JTable.getRowHeight方法的典型用法代码示例。如果您正苦于以下问题:Java JTable.getRowHeight方法的具体用法?Java JTable.getRowHeight怎么用?Java JTable.getRowHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTable
的用法示例。
在下文中一共展示了JTable.getRowHeight方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import javax.swing.JTable; //导入方法依赖的package包/类
void update(MapRule rule,JTable table,int row){
this.rule=rule;
int rowHeight=50;
int h=table.getRowHeight(row);
if(h!=rowHeight){
table.setRowHeight(row, rowHeight);
}
String name=rule.getName();
if(name==null){
name="无";
}else if(name.trim().equals("")){
name="无";
}
label_wan_address.setText("名称: "+rule.name+" 加速端口: "+rule.dst_port);
label2.setText("本地端口: "+rule.getListen_port());
}
示例2: configureRowHeight
import javax.swing.JTable; //导入方法依赖的package包/类
public static void configureRowHeight(JTable table) {
int height = table.getRowHeight();
Font cellFont = UIManager.getFont("TextField.font");
if (cellFont != null) {
FontMetrics metrics = table.getFontMetrics(cellFont);
if (metrics != null) {
height = metrics.getHeight() + 2;
}
}
table.setRowHeight(Math.max(table.getRowHeight(), height));
}
示例3: getTableCellEditorComponent
import javax.swing.JTable; //导入方法依赖的package包/类
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
this.table = table;
this.row = row;
this.column = column;
this.originalRowHeight = table.getRowHeight(row);
this.confirmationKey = KeyEvent.VK_UNDEFINED;
table.setRowHeight(row, (int) (originalRowHeight*1.5));
return this.getEditorComponent(value);
}
示例4: getTableCellRendererComponent
import javax.swing.JTable; //导入方法依赖的package包/类
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
setText(value.toString());
setSize(table.getColumnModel().getColumn(column).getWidth(), getPreferredSize().height);
if (table.getRowHeight(row) != getPreferredSize().height) {
table.setRowHeight(row, getPreferredSize().height);
}
return this;
}
示例5: getTableCellRendererComponent
import javax.swing.JTable; //导入方法依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column)
{
TreeMap<Effect, Double> map = brain.getValueMapAt(row, column);
if (map == null)
{
// set Background of first two cells (which only show health and
// object of interaction)
Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
cell.setBackground(this.getColorByRow(table, row));
return cell;
}
else
{
if(map.size()*15 > table.getRowHeight(row))
table.setRowHeight(row, map.size()*15);
// print effect in grey-tone which corresponds with its probability
// (the darker the writing, the more probable the effect)
JLabel ret = new JLabel();
// open html; contains the effect in its particular grey
String s = "<html>";
// iterate over the different observed effects
// example: energy increase and object destruction can appear after
// one action
for (Entry<Effect, Double> entry : map.entrySet())
{
// get probability of the effect from brain
float probability = (float) entry.getValue().doubleValue();
// create grey-tone corresponding to probability
String hexColor = createHexaColor(probability);
// add effect in corresponding color to the string
s += "<font color=" + hexColor + ">"
+ entry.getKey().toString() + "<br>"+ "</font>";
}
s += "</html>"; // close html-
ret.setText(s);
// make background of ret (JLabel) visible
//ret.setOpaque(true);
//ret.setBackground(this.getColorByRow(table, row));
return ret;
}
}