符合条件的变颜色
并且能变多个
是jtable的单元格字体颜色
JAVA jtable 表格字体变颜色
答案:1 悬赏:40 手机版
解决时间 2021-02-14 03:25
- 提问者网友:蓝琪梦莎
- 2021-02-13 05:43
最佳答案
- 五星知识达人网友:由着我着迷
- 2021-02-13 07:18
根据条件变色,在覆写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();
}
}
}
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();
}
}
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯