【发布时间】:2017-05-13 15:30:54
【问题描述】:
我想让我的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);
【问题讨论】:
-
在thread尝试这个解决方案
-
@DataPro 我可以设置可见和不可见。但这会显示任何价值吗?显示的值是可见的。例如:- 就像我们在右键单击-> 属性-> 文件位置上看到的那样。 ?
-
1) 为了尽快获得更好的帮助,请发帖 minimal reproducible example 或 Short, Self Contained, Correct Example。 2) Java GUI 必须在不同的语言环境中使用不同的 PLAF 在不同的操作系统、屏幕尺寸、屏幕分辨率等上工作。因此,它们不利于像素完美布局。而是使用布局管理器,或combinations of them 以及white space 的布局填充和边框。 ..
-
.. 3) ".. 值应该在 Eclipse 中可见" 什么?该值应该对用户不可见,但在您的 IDE 中可见?问题的文本表明您希望用户在一个窗口中键入,但该值在另一个窗口中可见。请edit这个问题并澄清实际需要什么。
-
@AndrewThompson 完成谢谢
标签: java eclipse swing windowbuilder