java取得panel位置,java中panel顯示不出來_為什么我的JPanel中的某些項目沒有顯示?

 2023-11-30 阅读 25 评论 0

摘要:您可以在此處使用GridBagLayout而不是使用null布局:GridBagConstraints gridBagConstraints;panel = new JPanel();findLabel = new javax.swing.JLabel();findField = new javax.swing.JTextField();java取得panel位置?replaceLabel = new javax.swi

您可以在此處使用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();

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/3/185915.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息