鱼C论坛

 找回密码
 立即注册
查看: 5964|回复: 8

[已解决]GUI创建窗口

[复制链接]
发表于 2021-5-23 22:44:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
做成如图所示的效果,贴上自己写的全是bug的代码,实在找不出来了
  1. package Test_1;

  2. import javax.swing.*;
  3. import java.awt.*;

  4. public class Register extends JFrame {
  5.     JLabel lb1,lb2,lb3,lb4,lb5,lb6,lb7;
  6.     JTextField jtf1,jtf2,jtf3,jtf4;
  7.     JRadioButton radioM,radioF;//单选框
  8.     JPasswordField jpf1,jpf2;
  9.     JButton jb1,jb2;
  10.     ButtonGroup group;

  11.     JCheckBox checkBox1,checkBox2,checkBox3;//复选框

  12.     JComboBox<String> comBox;//下拉列表

  13.     public Register(){

  14.         init();
  15.         setVisible(true);
  16.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  17.     }

  18.     void init(){
  19.         setLayout(new FlowLayout());


  20.        lb1=new JLabel("账号");
  21.        add(lb1);

  22.        jtf1=new JTextField(10);
  23.        add(jtf1);

  24.        lb2=new JLabel("密码");
  25.        add(lb2);

  26.        jpf1=new JPasswordField(10);
  27.        add(jpf1);

  28.        lb3=new JLabel("再次密码");
  29.        add(lb3);

  30.        jpf2=new JPasswordField(10);
  31.        add(jpf2);

  32.        lb4=new JLabel("性别");
  33.        add(lb4);

  34.        group =new ButtonGroup();
  35.        radioM=new JRadioButton("男");
  36.        radioF=new JRadioButton("女");

  37.        group.add(radioF);
  38.        group.add(radioM);

  39.        lb5=new JLabel("学历");
  40.        comBox =new JComboBox<String>();
  41.         comBox.addItem("初中");
  42.         comBox.addItem("高中");
  43.         comBox.addItem("大学");
  44.         add(comBox);

  45.         lb6=new JLabel("爱好");
  46.         add(lb6);

  47.         checkBox1=new JCheckBox("体育");
  48.         checkBox1=new JCheckBox("音乐");
  49.         checkBox1=new JCheckBox("游戏");
  50.         add(checkBox1);
  51.         add(checkBox2);
  52.         add(checkBox3);
  53. //        checkBox1=

  54.         lb7=new JLabel("简介");
  55.         add(lb7);
  56.         jtf2=new JTextField(30);
  57.         JScrollPane jtf21=new JScrollPane(jtf2);//滚动面板
  58.         jtf21.setHorizontalScrollBarPolicy(jtf21.HORIZONTAL_SCROLLBAR_ALWAYS);//设置水平方向滚动条。
  59.         jtf21.setVerticalScrollBarPolicy(jtf21.VERTICAL_SCROLLBAR_ALWAYS);//总是显示垂直方向滚动条。

  60.         jb1=new JButton("注册");
  61.         jb2=new JButton("查看");
  62.     }

  63.     public static void main(String[] args) {
  64.        Register r1=new Register();
  65.        r1.setBounds(100,100,450,260);
  66.        r1.setTitle("Register");
  67.     }
  68. }
复制代码
最佳答案
2021-5-25 13:39:46
还是回复一下子吧,按你的页面布局自己写的,能用就用,不能用就参考吧。
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */

  5. /*
  6. * TestJFrame.java
  7. *
  8. * Created on 2021-5-20, 14:49:33
  9. */

  10. package com.gc.nb.gui;

  11. /**
  12. *
  13. * @author Administrator
  14. */
  15. public class TestJFrame extends javax.swing.JFrame {

  16.     /** Creates new form TestJFrame */
  17.     public TestJFrame() {
  18.         initComponents();
  19.     }

  20.     /** This method is called from within the constructor to
  21.      * initialize the form.
  22.      * WARNING: Do NOT modify this code. The content of this method is
  23.      * always regenerated by the Form Editor.
  24.      */
  25.     @SuppressWarnings("unchecked")
  26.     // <editor-fold defaultstate="collapsed" desc="Generated Code">
  27.     private void initComponents() {

  28.         buttonGroup1 = new javax.swing.ButtonGroup();
  29.         jPanel1 = new javax.swing.JPanel();
  30.         jLabel1 = new javax.swing.JLabel();
  31.         jLabel2 = new javax.swing.JLabel();
  32.         jLabel3 = new javax.swing.JLabel();
  33.         jLabel4 = new javax.swing.JLabel();
  34.         jRadioButton1 = new javax.swing.JRadioButton();
  35.         jRadioButton2 = new javax.swing.JRadioButton();
  36.         jLabel5 = new javax.swing.JLabel();
  37.         jComboBox1 = new javax.swing.JComboBox();
  38.         jLabel6 = new javax.swing.JLabel();
  39.         jCheckBox1 = new javax.swing.JCheckBox();
  40.         jCheckBox2 = new javax.swing.JCheckBox();
  41.         jCheckBox3 = new javax.swing.JCheckBox();
  42.         jLabel7 = new javax.swing.JLabel();
  43.         textArea1 = new java.awt.TextArea();
  44.         jButton1 = new javax.swing.JButton();
  45.         jButton2 = new javax.swing.JButton();

  46.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

  47.         jPanel1.setName("jPanel1"); // NOI18N

  48.         jLabel1.setText("用户名:");
  49.         jLabel1.setName("jLabel1"); // NOI18N

  50.         jLabel2.setText("密码:");
  51.         jLabel2.setName("jLabel2"); // NOI18N

  52.         jLabel3.setText("再次密码:");
  53.         jLabel3.setName("jLabel3"); // NOI18N

  54.         jLabel4.setText("性别");
  55.         jLabel4.setName("jLabel4"); // NOI18N

  56.         jRadioButton1.setText("男");
  57.         jRadioButton1.setName("jRadioButton1"); // NOI18N

  58.         jRadioButton2.setText("女");
  59.         jRadioButton2.setName("jRadioButton2"); // NOI18N

  60.         jLabel5.setText("学历:");
  61.         jLabel5.setName("jLabel5"); // NOI18N

  62.         jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "大学", "高中", "初中", "小学" }));
  63.         jComboBox1.setName("jComboBox1"); // NOI18N

  64.         jLabel6.setText("爱好:");
  65.         jLabel6.setName("jLabel6"); // NOI18N

  66.         jCheckBox1.setText("体育");
  67.         jCheckBox1.setName("jCheckBox1"); // NOI18N

  68.         jCheckBox2.setText("音乐");
  69.         jCheckBox2.setName("jCheckBox2"); // NOI18N

  70.         jCheckBox3.setText("游戏");
  71.         jCheckBox3.setName("jCheckBox3"); // NOI18N

  72.         jLabel7.setText("简介:");
  73.         jLabel7.setName("jLabel7"); // NOI18N

  74.         textArea1.setName("textArea1"); // NOI18N

  75.         jButton1.setText("注册");
  76.         jButton1.setName("jButton1"); // NOI18N

  77.         jButton2.setText("查看");
  78.         jButton2.setName("jButton2"); // NOI18N

  79.         javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  80.         jPanel1.setLayout(jPanel1Layout);
  81.         jPanel1Layout.setHorizontalGroup(
  82.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  83.             .addGroup(jPanel1Layout.createSequentialGroup()
  84.                 .addContainerGap()
  85.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  86.                     .addGroup(jPanel1Layout.createSequentialGroup()
  87.                         .addComponent(jButton1)
  88.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 85, Short.MAX_VALUE)
  89.                         .addComponent(jButton2))
  90.                     .addComponent(jLabel1)
  91.                     .addComponent(jLabel2)
  92.                     .addComponent(jLabel3)
  93.                     .addGroup(jPanel1Layout.createSequentialGroup()
  94.                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  95.                             .addComponent(jLabel4)
  96.                             .addComponent(jLabel5))
  97.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  98.                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  99.                             .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  100.                             .addGroup(jPanel1Layout.createSequentialGroup()
  101.                                 .addComponent(jRadioButton1)
  102.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  103.                                 .addComponent(jRadioButton2))))
  104.                     .addGroup(jPanel1Layout.createSequentialGroup()
  105.                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  106.                             .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
  107.                                 .addComponent(jLabel7)
  108.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  109.                                 .addComponent(textArea1, 0, 0, Short.MAX_VALUE))
  110.                             .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
  111.                                 .addComponent(jLabel6)
  112.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  113.                                 .addComponent(jCheckBox1)
  114.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  115.                                 .addComponent(jCheckBox2)))
  116.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  117.                         .addComponent(jCheckBox3)))
  118.                 .addContainerGap(24, Short.MAX_VALUE))
  119.         );
  120.         jPanel1Layout.setVerticalGroup(
  121.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  122.             .addGroup(jPanel1Layout.createSequentialGroup()
  123.                 .addContainerGap()
  124.                 .addComponent(jLabel1)
  125.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  126.                 .addComponent(jLabel2)
  127.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  128.                 .addComponent(jLabel3)
  129.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  130.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  131.                     .addComponent(jLabel4)
  132.                     .addComponent(jRadioButton1)
  133.                     .addComponent(jRadioButton2))
  134.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  135.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  136.                     .addComponent(jLabel5)
  137.                     .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  138.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  139.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  140.                     .addComponent(jLabel6)
  141.                     .addComponent(jCheckBox1)
  142.                     .addComponent(jCheckBox2)
  143.                     .addComponent(jCheckBox3))
  144.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  145.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  146.                     .addComponent(jLabel7)
  147.                     .addComponent(textArea1, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE))
  148.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  149.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  150.                     .addComponent(jButton1)
  151.                     .addComponent(jButton2))
  152.                 .addContainerGap(161, Short.MAX_VALUE))
  153.         );

  154.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  155.         getContentPane().setLayout(layout);
  156.         layout.setHorizontalGroup(
  157.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  158.             .addGroup(layout.createSequentialGroup()
  159.                 .addGap(35, 35, 35)
  160.                 .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  161.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  162.         );
  163.         layout.setVerticalGroup(
  164.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  165.             .addGroup(layout.createSequentialGroup()
  166.                 .addContainerGap()
  167.                 .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  168.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  169.         );

  170.         pack();
  171.     }// </editor-fold>

  172.     /**
  173.     * @param args the command line arguments
  174.     */
  175.     public static void main(String args[]) {
  176.         java.awt.EventQueue.invokeLater(new Runnable() {
  177.             public void run() {
  178.                 new TestJFrame().setVisible(true);
  179.             }
  180.         });
  181.     }

  182.     // Variables declaration - do not modify
  183.     private javax.swing.ButtonGroup buttonGroup1;
  184.     private javax.swing.JButton jButton1;
  185.     private javax.swing.JButton jButton2;
  186.     private javax.swing.JCheckBox jCheckBox1;
  187.     private javax.swing.JCheckBox jCheckBox2;
  188.     private javax.swing.JCheckBox jCheckBox3;
  189.     private javax.swing.JComboBox jComboBox1;
  190.     private javax.swing.JLabel jLabel1;
  191.     private javax.swing.JLabel jLabel2;
  192.     private javax.swing.JLabel jLabel3;
  193.     private javax.swing.JLabel jLabel4;
  194.     private javax.swing.JLabel jLabel5;
  195.     private javax.swing.JLabel jLabel6;
  196.     private javax.swing.JLabel jLabel7;
  197.     private javax.swing.JPanel jPanel1;
  198.     private javax.swing.JRadioButton jRadioButton1;
  199.     private javax.swing.JRadioButton jRadioButton2;
  200.     private java.awt.TextArea textArea1;
  201.     // End of variables declaration

  202. }
复制代码
实验7-java.png
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-5-23 22:45:29 | 显示全部楼层
乖巧
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2021-5-23 22:48:05 | 显示全部楼层
水一下
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-5-23 23:36:57 | 显示全部楼层

回帖奖励 +5 鱼币

第六十七到第六十八行 另外建议不用swing 太丑了 虽然说自己可以美化 但是蛮麻烦的 建议可以学学JavaFx 蛮不错的
bot-4.png
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 1 反对 0

使用道具 举报

发表于 2021-5-25 11:47:05 | 显示全部楼层

回帖奖励 +5 鱼币

本帖最后由 连帅帅 于 2021-5-25 11:49 编辑

最近也在搞这笔玩意(公司让用的),都淘汰的东西了,搞不懂为什么还在有人用
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-5-25 12:01:50 | 显示全部楼层

回帖奖励 +5 鱼币

感谢分享!
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-5-25 13:39:46 | 显示全部楼层    本楼为最佳答案   
还是回复一下子吧,按你的页面布局自己写的,能用就用,不能用就参考吧。
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */

  5. /*
  6. * TestJFrame.java
  7. *
  8. * Created on 2021-5-20, 14:49:33
  9. */

  10. package com.gc.nb.gui;

  11. /**
  12. *
  13. * @author Administrator
  14. */
  15. public class TestJFrame extends javax.swing.JFrame {

  16.     /** Creates new form TestJFrame */
  17.     public TestJFrame() {
  18.         initComponents();
  19.     }

  20.     /** This method is called from within the constructor to
  21.      * initialize the form.
  22.      * WARNING: Do NOT modify this code. The content of this method is
  23.      * always regenerated by the Form Editor.
  24.      */
  25.     @SuppressWarnings("unchecked")
  26.     // <editor-fold defaultstate="collapsed" desc="Generated Code">
  27.     private void initComponents() {

  28.         buttonGroup1 = new javax.swing.ButtonGroup();
  29.         jPanel1 = new javax.swing.JPanel();
  30.         jLabel1 = new javax.swing.JLabel();
  31.         jLabel2 = new javax.swing.JLabel();
  32.         jLabel3 = new javax.swing.JLabel();
  33.         jLabel4 = new javax.swing.JLabel();
  34.         jRadioButton1 = new javax.swing.JRadioButton();
  35.         jRadioButton2 = new javax.swing.JRadioButton();
  36.         jLabel5 = new javax.swing.JLabel();
  37.         jComboBox1 = new javax.swing.JComboBox();
  38.         jLabel6 = new javax.swing.JLabel();
  39.         jCheckBox1 = new javax.swing.JCheckBox();
  40.         jCheckBox2 = new javax.swing.JCheckBox();
  41.         jCheckBox3 = new javax.swing.JCheckBox();
  42.         jLabel7 = new javax.swing.JLabel();
  43.         textArea1 = new java.awt.TextArea();
  44.         jButton1 = new javax.swing.JButton();
  45.         jButton2 = new javax.swing.JButton();

  46.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

  47.         jPanel1.setName("jPanel1"); // NOI18N

  48.         jLabel1.setText("用户名:");
  49.         jLabel1.setName("jLabel1"); // NOI18N

  50.         jLabel2.setText("密码:");
  51.         jLabel2.setName("jLabel2"); // NOI18N

  52.         jLabel3.setText("再次密码:");
  53.         jLabel3.setName("jLabel3"); // NOI18N

  54.         jLabel4.setText("性别");
  55.         jLabel4.setName("jLabel4"); // NOI18N

  56.         jRadioButton1.setText("男");
  57.         jRadioButton1.setName("jRadioButton1"); // NOI18N

  58.         jRadioButton2.setText("女");
  59.         jRadioButton2.setName("jRadioButton2"); // NOI18N

  60.         jLabel5.setText("学历:");
  61.         jLabel5.setName("jLabel5"); // NOI18N

  62.         jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "大学", "高中", "初中", "小学" }));
  63.         jComboBox1.setName("jComboBox1"); // NOI18N

  64.         jLabel6.setText("爱好:");
  65.         jLabel6.setName("jLabel6"); // NOI18N

  66.         jCheckBox1.setText("体育");
  67.         jCheckBox1.setName("jCheckBox1"); // NOI18N

  68.         jCheckBox2.setText("音乐");
  69.         jCheckBox2.setName("jCheckBox2"); // NOI18N

  70.         jCheckBox3.setText("游戏");
  71.         jCheckBox3.setName("jCheckBox3"); // NOI18N

  72.         jLabel7.setText("简介:");
  73.         jLabel7.setName("jLabel7"); // NOI18N

  74.         textArea1.setName("textArea1"); // NOI18N

  75.         jButton1.setText("注册");
  76.         jButton1.setName("jButton1"); // NOI18N

  77.         jButton2.setText("查看");
  78.         jButton2.setName("jButton2"); // NOI18N

  79.         javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  80.         jPanel1.setLayout(jPanel1Layout);
  81.         jPanel1Layout.setHorizontalGroup(
  82.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  83.             .addGroup(jPanel1Layout.createSequentialGroup()
  84.                 .addContainerGap()
  85.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  86.                     .addGroup(jPanel1Layout.createSequentialGroup()
  87.                         .addComponent(jButton1)
  88.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 85, Short.MAX_VALUE)
  89.                         .addComponent(jButton2))
  90.                     .addComponent(jLabel1)
  91.                     .addComponent(jLabel2)
  92.                     .addComponent(jLabel3)
  93.                     .addGroup(jPanel1Layout.createSequentialGroup()
  94.                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  95.                             .addComponent(jLabel4)
  96.                             .addComponent(jLabel5))
  97.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  98.                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  99.                             .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  100.                             .addGroup(jPanel1Layout.createSequentialGroup()
  101.                                 .addComponent(jRadioButton1)
  102.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  103.                                 .addComponent(jRadioButton2))))
  104.                     .addGroup(jPanel1Layout.createSequentialGroup()
  105.                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  106.                             .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
  107.                                 .addComponent(jLabel7)
  108.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  109.                                 .addComponent(textArea1, 0, 0, Short.MAX_VALUE))
  110.                             .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
  111.                                 .addComponent(jLabel6)
  112.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  113.                                 .addComponent(jCheckBox1)
  114.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  115.                                 .addComponent(jCheckBox2)))
  116.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  117.                         .addComponent(jCheckBox3)))
  118.                 .addContainerGap(24, Short.MAX_VALUE))
  119.         );
  120.         jPanel1Layout.setVerticalGroup(
  121.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  122.             .addGroup(jPanel1Layout.createSequentialGroup()
  123.                 .addContainerGap()
  124.                 .addComponent(jLabel1)
  125.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  126.                 .addComponent(jLabel2)
  127.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  128.                 .addComponent(jLabel3)
  129.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  130.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  131.                     .addComponent(jLabel4)
  132.                     .addComponent(jRadioButton1)
  133.                     .addComponent(jRadioButton2))
  134.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  135.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  136.                     .addComponent(jLabel5)
  137.                     .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  138.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  139.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  140.                     .addComponent(jLabel6)
  141.                     .addComponent(jCheckBox1)
  142.                     .addComponent(jCheckBox2)
  143.                     .addComponent(jCheckBox3))
  144.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  145.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  146.                     .addComponent(jLabel7)
  147.                     .addComponent(textArea1, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE))
  148.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  149.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  150.                     .addComponent(jButton1)
  151.                     .addComponent(jButton2))
  152.                 .addContainerGap(161, Short.MAX_VALUE))
  153.         );

  154.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  155.         getContentPane().setLayout(layout);
  156.         layout.setHorizontalGroup(
  157.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  158.             .addGroup(layout.createSequentialGroup()
  159.                 .addGap(35, 35, 35)
  160.                 .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  161.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  162.         );
  163.         layout.setVerticalGroup(
  164.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  165.             .addGroup(layout.createSequentialGroup()
  166.                 .addContainerGap()
  167.                 .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  168.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  169.         );

  170.         pack();
  171.     }// </editor-fold>

  172.     /**
  173.     * @param args the command line arguments
  174.     */
  175.     public static void main(String args[]) {
  176.         java.awt.EventQueue.invokeLater(new Runnable() {
  177.             public void run() {
  178.                 new TestJFrame().setVisible(true);
  179.             }
  180.         });
  181.     }

  182.     // Variables declaration - do not modify
  183.     private javax.swing.ButtonGroup buttonGroup1;
  184.     private javax.swing.JButton jButton1;
  185.     private javax.swing.JButton jButton2;
  186.     private javax.swing.JCheckBox jCheckBox1;
  187.     private javax.swing.JCheckBox jCheckBox2;
  188.     private javax.swing.JCheckBox jCheckBox3;
  189.     private javax.swing.JComboBox jComboBox1;
  190.     private javax.swing.JLabel jLabel1;
  191.     private javax.swing.JLabel jLabel2;
  192.     private javax.swing.JLabel jLabel3;
  193.     private javax.swing.JLabel jLabel4;
  194.     private javax.swing.JLabel jLabel5;
  195.     private javax.swing.JLabel jLabel6;
  196.     private javax.swing.JLabel jLabel7;
  197.     private javax.swing.JPanel jPanel1;
  198.     private javax.swing.JRadioButton jRadioButton1;
  199.     private javax.swing.JRadioButton jRadioButton2;
  200.     private java.awt.TextArea textArea1;
  201.     // End of variables declaration

  202. }
复制代码
qwdqw.png
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-5-28 08:20:37 | 显示全部楼层

回帖奖励 +5 鱼币

原来java作这么一个界面这么复杂吗,感觉python做出来没什么难度
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-5-29 09:14:47 | 显示全部楼层

回帖奖励 +5 鱼币

连帅帅 发表于 2021-5-25 11:47
最近也在搞这笔玩意(公司让用的),都淘汰的东西了,搞不懂为什么还在有人用

能跨平台
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-5-15 11:33

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表