题目就是做出来这个界面,但是我代码运行窗口没有任何内容,谁能帮我看看谢谢
```java
import javax.swing.*;
import java.awt.*;
class Demo6__1 extends JFrame {
JPanel j1 = new JPanel();
// JPanel j2 = new JPanel();
JButton btn10 = new JButton("."); JButton btn11 = new JButton("-");
JTextField txt1 ;
public void Jtxt(){
txt1 = new JTextField(10);
j1.add(txt1);
}
public void Jbtn(){
JButton a[] = new JButton[10];
for (int i = 0;i<=9;i++){//循环添加按钮
a[i] = new JButton(String.valueOf(i));
j1.add(a[i]);
}
j1.add(btn10);
j1.add(btn11);
}
public void Display(){
setVisible(true);
setResizable(true);
setSize(600,600);
j1.setLayout(new FlowLayout());
// j2.setLayout(new FlowLayout());
Jtxt();
Jbtn();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}
public class Demo6_1 {
public static void main(String[] args) {
new Demo6__1().Display();
}
}
看这个
https://blog.csdn.net/qq_43803536/article/details/124386564
找到错误了,在类题里面添加一个add(j1)就行了,主要是忘了把自己建的容器放在窗口中了,导致容器里的组件都显示不出来。
@Transactional
public int insertUser(User user) throws Exception
{
// 新增用户信息
int rows = userMapper.insertUser(user);
// 新增用户岗位关联
insertUserPost(user);
// 新增用户与角色管理
insertUserRole(user);
// 模拟抛出SQLException异常
boolean flag = true;
if (flag)
{
throw new RuntimeException("发生异常了..");
}
return rows;
}