import javax.swing.*; public class NonEditableTextFieldExample { public static void main(String[] args) { JFrame frame = new JFrame("Non-Editable TextField Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 200); JPanel panel = new JPanel(); JTextField editableField = new JTextField("Editable Text"); JTextField nonEditableField = new JTextField("Non-Editable Text"); // Make the nonEditableField not editable nonEditableField.setEditable(false); panel.add(editableField); panel.add(nonEditableField); frame.add(panel); frame.setVisible(true); } }