⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jdtablerenderer.java

📁 本程序用来实现对网络流量的获取及分析功能。可以分离出tcp/udp报文,http协议
💻 JAVA
字号:
package jdumper.ui;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.border.*;

class JDTableRenderer extends JLabel implements TableCellRenderer
{
	protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1); 

	public JDTableRenderer(){
		setOpaque(true);
	}

	public Component getTableCellRendererComponent(JTable table,
			Object value,boolean isSelected,boolean hasFocus,int row,int column){
		
		if(isSelected){
			super.setForeground(table.getSelectionForeground());
			super.setBackground(table.getSelectionBackground());
		}else{
			super.setForeground(table.getForeground());
			super.setBackground(table.getBackground());
		}
		
		setFont(table.getFont());

		if(hasFocus){
	    setBorder( UIManager.getBorder("Table.focusCellHighlightBorder") );
		}else{
			setBorder(noFocusBorder);
		}
		
		if(value==null){
			setText("Not Available");
			return this;
		}
		
		setText(value.toString());
		
		if(value.getClass().equals(Integer.class) || value.getClass().equals(Long.class)){
			setHorizontalAlignment(SwingConstants.RIGHT);
		}
		
		// ---- begin optimization to avoid painting background ----
		Color back = getBackground();
		boolean colorMatch = (back != null) && ( back.equals(table.getBackground()) ) && table.isOpaque();
		setOpaque(!colorMatch);
		// ---- end optimization to aviod painting background ----

		return this;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -