您可以在此處使用GridBagLayout而不是使用null布局:
GridBagConstraints gridBagConstraints;
panel = new JPanel();
findLabel = new javax.swing.JLabel();
findField = new javax.swing.JTextField();
java取得panel位置?replaceLabel = new javax.swing.JLabel();
replaceField = new javax.swing.JTextField();
replaceAllButton = new javax.swing.JButton();
replaceButton = new javax.swing.JButton();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
panel.setLayout(new GridBagLayout());
java setbounds,findLabel.setText("Find :");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.ipadx = 94;
gridBagConstraints.ipady = 30;
panel.add(findLabel, gridBagConstraints);
gridBagConstraints = new GridBagConstraints();
jpa pageable、gridBagConstraints.ipadx = 149;
panel.add(findField, gridBagConstraints);
replaceLabel.setText("Replace With :");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
jframe和jpanel的區別、gridBagConstraints.ipadx = 34;
gridBagConstraints.ipady = 23;
panel.add(replaceLabel, gridBagConstraints);
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
java add、gridBagConstraints.ipadx = 149;
panel.add(replaceField, gridBagConstraints);
replaceAllButton.setText("Find And Replace All");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
java怎么輸入?gridBagConstraints.ipady = 9;
panel.add(replaceAllButton, gridBagConstraints);
replaceButton.setText("Replace");
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
java編程是什么,gridBagConstraints.ipadx = 99;
gridBagConstraints.ipady = 8;
panel.add(replaceButton, gridBagConstraints);
//adding panel to the jframe
getContentPane().add(panel, BorderLayout.CENTER);
pack();
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态