本文介绍了如何让jformattedtextfield上的边框在出错时变为红色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用NetBeans Design GUI界面。我希望jFormattedTextField在出错时变为红色。我没有办法做到这一点。



提前致谢。



我尝试了什么:



我将字段的默认边框更改为Etched,在此之下,我添加了代码以打开highlite:

如果rm [1] {setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(255,0,0),null));}

否则

{setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(153,153,153),null));};



除了愚蠢的编辑器第二次从null中添加最后一位。由于它是受保护的代码,因此无法更改。

I am using NetBeans Design GUI interface. I want a jFormattedTextField to turn red on error. I don't see a way to do it.

Thanks in advance.

What I have tried:

I changed the default border for the field to Etched, and under that, I added code to turn the highlite on:
if rm[1] {setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(255, 0, 0), null));}
else
{setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(153, 153, 153), null));};

Except the stupid editor adds in the last bit from null on a second time. And since it is protected code, you can't change it.

推荐答案


这篇关于如何让jformattedtextfield上的边框在出错时变为红色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-07 16:57