I want to make my JTextfield
invisible and read only but the value must be shown in a window frame. I am using window builder in 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);
if you want to make it read only than
JLable
is better option to do this work .However if you want to use
JTextfield
than make text field as a private member and use a method to settext field hidden .Change the color of Textfield and make it same As color of Panel or frame .
And Remove Border Either by overriding setBorder method or by Passing "null" to