📄 progressrenderer.java
字号:
/* * @(#) ProgressRenderer.java * Copyright 2004 HWStudio. All rights reserved. */package hws.item.smart.utility.share;//导入核心Java类库import java.awt.Component;import javax.swing.JTable;import javax.swing.JProgressBar;import javax.swing.table.TableCellRenderer;/** * This class renders a JProgressBar in a table cell * * @version 0.1 2005-08-30 * @author Hwerz */public class ProgressRenderer extends JProgressBar implements TableCellRenderer { /*------------------------------------------------------------------------* * 构造函数 * *------------------------------------------------------------------------*/ /** * Create a new instance of this class * * @param min the minimum value of the progress bar * @param max the maximum value of the progress bar */ public ProgressRenderer(int min, int max) { super(min, max); setStringPainted(true); } /*------------------------------------------------------------------------* * 实现方法 * *------------------------------------------------------------------------*/ /** * 实现接口TableCellRenderer的方法 * * @param table the JTable that is asking the renderer to draw; can be null * @param value the value of the cell to be rendered * @param isSelected true if the cell is to be rendered with the selection * highlighted; otherwise false * @param hasFocus if true, render cell appropriately * @param row the row index of the cell being drawn * @param column the column index of the cell being drawn * @return this JProgressBar as the renderer for the given table cell */ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { setValue(Integer.parseInt(value.toString())); return this; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -