java系统消息提示或警告等对话框的显示字体修改都不大方便
干嘛不自个写个JDialog用以显示?给你个简单的
public class ShowAlert extends JDialog {
private String strMsg;
private Font font14 = new Font("Dialog", 0, 14);
private JPanel jPanel1 = new JPanel();
private XYLayout xYLayout1 = new XYLayout();
private JLabel jLabel1 = new JLabel();
private JButton jButton1 = new JButton(); public ShowStrLongAlert(Dialog owner, boolean modal, String title, String msg) {
super(owner, modal);
try {
this.setTitle(title);//标题
this.setResizable(false);//取消java热咖啡图标
strMsg = msg;//消息体
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
jPanel1.setLayout(xYLayout1);
jLabel1.setFont(font14);
jLabel1.setText(strMsg); jButton1.setFont(font14);
jButton1.setText("确 定"); this.setSize(350,130);
this.getContentPane().add(jPanel1, BorderLayout.CENTER);
jPanel1.add(jLabel1,new XYConstraints(70, 6, 221, 49));
jPanel1.add(jButton1,new XYConstraints(138, 70, 75, 25)); }
void jButton1_actionPerformed(ActionEvent e) {
this.dispose();
}
}
干嘛不自个写个JDialog用以显示?给你个简单的
public class ShowAlert extends JDialog {
private String strMsg;
private Font font14 = new Font("Dialog", 0, 14);
private JPanel jPanel1 = new JPanel();
private XYLayout xYLayout1 = new XYLayout();
private JLabel jLabel1 = new JLabel();
private JButton jButton1 = new JButton(); public ShowStrLongAlert(Dialog owner, boolean modal, String title, String msg) {
super(owner, modal);
try {
this.setTitle(title);//标题
this.setResizable(false);//取消java热咖啡图标
strMsg = msg;//消息体
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
jPanel1.setLayout(xYLayout1);
jLabel1.setFont(font14);
jLabel1.setText(strMsg); jButton1.setFont(font14);
jButton1.setText("确 定"); this.setSize(350,130);
this.getContentPane().add(jPanel1, BorderLayout.CENTER);
jPanel1.add(jLabel1,new XYConstraints(70, 6, 221, 49));
jPanel1.add(jButton1,new XYConstraints(138, 70, 75, 25)); }
void jButton1_actionPerformed(ActionEvent e) {
this.dispose();
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货