Example text in JTextField

后端 未结 7 2063
独厮守ぢ
独厮守ぢ 2021-01-18 05:15

I am looking for a way to put example text into a swing JTextField and have it grayed out. The example text should then disappear as soon as any thing is entered into that t

7条回答
  •  清酒与你
    2021-01-18 05:46

    If you can use external librairies, the Swing components from Jide software have what you are looking for; it's called LabeledTextField (javadoc) and it's part of the JIDE Common Layer (Open Source Project) - which is free. It's doing what mklhmnn suggested.

提交回复
热议问题