java中编号文本框为什么显示不可编辑灰色状态,代码有什么错误吗,怎么才能变成可编译的??
publicclassStaffextendsJPanel{privatestaticfinallongserialVersionUID=1L;JTextFieldtex...
public class Staff extends JPanel {
private static final long serialVersionUID = 1L;
JTextField textField = new JTextField();
JTextField textField_1 = new JTextField();
{
JLabel label = new JLabel("编 号:");
label.setBounds(107, 60, 84, 15);
add(label);
}
{
JLabel label = new JLabel("姓 名:");
label.setBounds(390, 60, 68, 15);
add(label);
}
{
textField.setBounds(171, 57, 112, 21);
add(textField);
textField.setColumns(10);
}
{
textField_1.setBounds(448, 57, 112, 21);
add(textField_1);
textField_1.setColumns(10);
}
{
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (textField_1.getText().equals("")){
new JOptionPane();
JOptionPane.showMessageDialog(null, "所有数据均不能为空!");
} else {
String sqlInsert = "insert into t_employee values('"
+ textField.getText() + "','"
+ textField_1.getText() + "')";
十分着急啊,望大家畅所欲言 展开
private static final long serialVersionUID = 1L;
JTextField textField = new JTextField();
JTextField textField_1 = new JTextField();
{
JLabel label = new JLabel("编 号:");
label.setBounds(107, 60, 84, 15);
add(label);
}
{
JLabel label = new JLabel("姓 名:");
label.setBounds(390, 60, 68, 15);
add(label);
}
{
textField.setBounds(171, 57, 112, 21);
add(textField);
textField.setColumns(10);
}
{
textField_1.setBounds(448, 57, 112, 21);
add(textField_1);
textField_1.setColumns(10);
}
{
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (textField_1.getText().equals("")){
new JOptionPane();
JOptionPane.showMessageDialog(null, "所有数据均不能为空!");
} else {
String sqlInsert = "insert into t_employee values('"
+ textField.getText() + "','"
+ textField_1.getText() + "')";
十分着急啊,望大家畅所欲言 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询