最近在做毕设,碰到图片所示的问题,请问有人知道如何解决吗?
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
public class NumberDialog extends JDialog implements ActionListener{
Container c;
JLabel l,l1;
JComboBox jcb;
JCheckBox jcb1,jcb2;
JButton SureButton,CancelButton;
String ColName;
public NumberDialog(String s){//
ColName=s;
c=this.getContentPane();
this.setLayout(null);//不采用任何布局方式
init7();
setTitle("数据类型选择");
this.setSize(420,330);
this.setLocation(480,170);
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setVisible(true);
}
void init7() {
c.setBounds(0,0,420,330);
l=new JLabel("对于NUMBER类型的"+ColName+"变量,");
l.setBounds(50,15,400,30);
l.setFont(new Font("微软雅黑",Font.PLAIN,12));
c.add(l);
l1=new JLabel("您选择的数据类型为:");
l1.setBounds(50,40,400,30);
l1.setFont(new Font("微软雅黑",Font.PLAIN,12));
c.add(l1);
jcb=new JComboBox();
jcb.setOpaque(false);
jcb.setFont(new Font("微软雅黑",Font.PLAIN,12));
jcb.setBounds(50,75,250,25);
jcb.addItem("INT");
jcb.addItem("FLOAT");
jcb.addItem("DOUBLE");
c.add(jcb);
jcb1=new JCheckBox("作为之后预校验的默认选择");
jcb1.setFont(new Font("微软雅黑",Font.PLAIN,12));
jcb1.setBounds(50,110,400,30);
c.add(jcb1);
jcb2=new JCheckBox("作为之后数据库迁移的默认选择");
jcb2.setFont(new Font("微软雅黑",Font.PLAIN,12));
jcb2.setBounds(50,140,400,30);
c.add(jcb2);
SureButton=new JButton("确定");
SureButton.setBounds(200,230,70,35);
SureButton.addActionListener(this);
SureButton.setFont(new Font("微软雅黑",Font.PLAIN,12));
SureButton.setBackground(Color.white);
c.add(SureButton);
CancelButton=new JButton("取消");
CancelButton.setBounds(280,230,70,35);
CancelButton.addActionListener(this);
CancelButton.setFont(new Font("微软雅黑",Font.PLAIN,12));
CancelButton.setBackground(Color.white);
c.add(CancelButton);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==SureButton) {
dispose();
}
if(e.getSource()==CancelButton) {
}
}
}