class p {
myJPanel y=new myJPanel ();
}
class myJPanel extends JPanel(
JButton b =new JButton ();
JPanel p=new JPanel();
JFrame f=new JFrame();
p.setcolor(Color.red);
p.add(b);
j.add(p);
j.setsize(300,300);
j.setvisible(true);
}
setFont 为什么不能像setcolor那样用?
myJPanel y=new myJPanel ();
}
class myJPanel extends JPanel(
JButton b =new JButton ();
JPanel p=new JPanel();
JFrame f=new JFrame();
p.setcolor(Color.red);
p.add(b);
j.add(p);
j.setsize(300,300);
j.setvisible(true);
}
setFont 为什么不能像setcolor那样用?
可以的 JPanel也有这个setFont()方法
setFont(Font.BOLD)可以像setcolor(Color.red)的写法吗?
Font,无法用一个词描述出来,你总要说,什么体、多大...如果说希望Font API便利一点,倒是希望有个类似于addStyle()之类的方法,可以在固有的字体上加某种风格。可惜没有。