我想使我的JTextfield
不可見和只讀,但該值必須顯示在窗口框架中。我在Eclipse中使用窗口生成器。如何使JTextField(Eclipse窗口生成器)只讀
JLabel lblLabel1 = new JLabel("Default DITA-OT File :");
lblLabel1.setBounds(10, 79, 123, 14);
frmPdfPublisher.getContentPane().add(lblLabel1);
JSeparator separator = new JSeparator();
separator.setBounds(10, 140, 414, 2);
frmPdfPublisher.getContentPane().add(separator);
JSeparator separator_1 = new JSeparator();
separator_1.setBounds(10, 257, 414, 2);
frmPdfPublisher.getContentPane().add(separator_1);
textField_1 = new JTextField();
textField_1.setBounds(138, 76, 286, 20);
frmPdfPublisher.getContentPane().add(textField_1);
textField_1.setColumns(10);
textField_1.setVisible(false);
嘗試在該[線程]該溶液(http://stackoverflow.com/questions/3081713/how刪除邊框要麼 - 設置文本框不可見 - 框架內) –
@DataPro我可以設置可見和不可見。但是會顯示任何價值?值顯示可見。例如: - 就像我們在右鍵單擊 - >屬性 - >文件位置中看到的一樣。 ? –
1)爲了更好地提供幫助,請發佈[MCVE]或[簡短,獨立,正確的示例](http://www.sscce.org/)。 2)Java GUI必須在不同的語言環境中使用不同的PLAF來處理不同的操作系統,屏幕大小,屏幕分辨率等。因此,它們不利於像素的完美佈局。請使用佈局管理器或[它們的組合](http://stackoverflow.com/a/5630271/418556)以及[white space]的佈局填充和邊框(http://stackoverflow.com/a/17874718/ 418556)。 ..「 –