@Override
public void paint(Graphics g, JComponent c) {
// TODO Auto-generated method stub
g.setColor(Color.BLACK)
int y = (int) c.getSize().getHeight()
int x = (int) c.getSize().getWidth()
System.out.println(x+" "+y)
g.drawLine(0, y-1, x-1, y-1)
g.drawLine(x-1, 0, x-1, y-1)
super.paint(g, c)
}
}
JLabel是默认透明的JLabel jl = new JLabel("This is a JLabel")
jl.setOpaque(false)//是不是前面设true了
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)