怎么改变JList的选项的字体??? list.setFont(font);试过了吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 好像没有什么问题呀下面的代码运行的很好 字体被设为了 斜体import javax.swing.*;import java.awt.*;import java.util.Vector;public class Frame1 extends JFrame { JScrollPane jScrollPane1 = new JScrollPane(); JList jList1 = new JList(); public static void main(String[] args){ Frame1 t = new Frame1(); t.setLocation(50,30); t.setSize(500,200); t.show(); } public Frame1() { this.getContentPane().add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.getViewport().add(jList1, null); Vector v = new Vector(); v.addElement("1234"); v.addElement("4565"); v.addElement("qwet"); v.addElement("asdr"); v.addElement("zxcg"); v.addElement("fghf"); Font f = new Font("宋体",Font.ITALIC,12); this.jList1.setFont(f); //设置字体 this.jList1.setListData(v); }} 还要怎么样啊!setfont就行了! list 谁有java调用.net的dll简单例子 用ActionMap/InputMap添加JPanel上的键盘事件问题 怎么获取Byte每个Bit位数据 sleep 函数延时问题 java 怎么获取一天的开始时间和结束时间 对象被创建时,对象的构造函数是否先于一切动作而运行呢? jbuilder环境下编写的程序能否脱离jbuilder运行? thread考题一道?? 远程过程调用出现的一个问题 JAVA如何更好的解决继承的问题呢? 入门问题——什么是JFC?
下面的代码运行的很好 字体被设为了 斜体import javax.swing.*;
import java.awt.*;
import java.util.Vector;public class Frame1 extends JFrame {
JScrollPane jScrollPane1 = new JScrollPane();
JList jList1 = new JList(); public static void main(String[] args){
Frame1 t = new Frame1();
t.setLocation(50,30);
t.setSize(500,200);
t.show();
} public Frame1() {
this.getContentPane().add(jScrollPane1, BorderLayout.CENTER);
jScrollPane1.getViewport().add(jList1, null); Vector v = new Vector();
v.addElement("1234");
v.addElement("4565");
v.addElement("qwet");
v.addElement("asdr");
v.addElement("zxcg");
v.addElement("fghf"); Font f = new Font("宋体",Font.ITALIC,12);
this.jList1.setFont(f); //设置字体
this.jList1.setListData(v);
}}