JAVA jtable 表格字体变颜色
发布网友
发布时间:2022-04-22 03:12
我来回答
共1个回答
热心网友
时间:2023-12-17 07:26
根据条件变色,在覆写public void paint(Graphics g)里面,设置条件语句选择执行,我这里有个字体闪烁语句是这样的,你看有用不
class StartPanel extends JPanel implements Runnable
{
int count = 0;
public void paint(Graphics g)
{
super.paint(g);
g.fillRect(0,0,800,700);
if(count%2==0)
{
g.setColor(Color.YELLOW);
}
else
{
g.setColor(Color.RED);
}
Font myFont = new Font("Lithos Pro Regular",Font.BOLD,120);
g.setFont(myFont);
g.drawString("WELCOME",125,300);
g.setColor(Color.WHITE);
Font myFont1 = new Font("Stencil Std",Font.BOLD,80);
g.setFont(myFont1);
g.drawString("WELCOME",50,450);
}
@Override
public void run()
{
// TODO Auto-generated method stub
while(true)
{
try
{
Thread.sleep(500);
}
catch (Exception e)
{
// TODO: handle exception
e.printStackTrace();
}
count++;
this.repaint();
}
}
}