📄 y.java
字号:
package com.hoya.games.sp;
import java.awt.Color;
import java.awt.Component;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
final class y extends JLabel
implements ListCellRenderer
{
protected static Border a;
protected FontMetrics b = null;
protected Insets c = new Insets(0, 0, 0, 0);
protected int d = 50;
protected int[] e = null;
public y()
{
a = new EmptyBorder(1, 1, 1, 1);
setOpaque(true);
setBorder(a);
}
public final Component getListCellRendererComponent(JList paramJList, Object paramObject, int paramInt, boolean paramBoolean1, boolean paramBoolean2)
{
setText(paramObject.toString());
setBackground(paramJList.getBackground());
setForeground(paramJList.getForeground());
setFont(paramJList.getFont());
setBorder(a);
return this;
}
public final void a(int[] paramArrayOfInt)
{
this.e = paramArrayOfInt;
}
private int a(int paramInt)
{
if (this.e == null)
return (this.d * paramInt);
int i = this.e.length;
if ((paramInt >= 0) && (paramInt < i))
return this.e[paramInt];
return (this.e[(i - 1)] + this.d * (paramInt - i + 1));
}
public final void paintComponent(Graphics paramGraphics)
{
String str1;
super.paintComponent(paramGraphics);
Color localColor = paramGraphics.getColor();
this.b = paramGraphics.getFontMetrics();
paramGraphics.setColor(getBackground());
paramGraphics.fillRect(0, 0, getWidth(), getHeight());
getBorder().paintBorder(this, paramGraphics, 0, 0, getWidth(), getHeight());
paramGraphics.setColor(getForeground());
paramGraphics.setFont(getFont());
this.c = getInsets();
int i = this.c.left;
int j = this.c.top + this.b.getAscent();
int k = (str1 = getText()).indexOf("\t");
String str2 = str1.substring(0, k);
String str3 = str1.substring(k + 1);
paramGraphics.drawString(str2, i, j);
i += this.b.stringWidth(str2);
for (int l = 0; i >= a(l); ++l);
i = a(l);
paramGraphics.drawString(str3, i, j);
paramGraphics.setColor(localColor);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -