From an answer to your previous question you know that some PL&Fs may clobber the border.
From an answer to your previous question you know that some PL&Fs may clobber the border. The obvious solution is to therefore override the setBorder method that the PL&F is calling, and discard the change. JTextField text = new JTextField() { @Override public void setBorder(Border border) { // No!
} }.
1. It's not elegant, but probably the best that can be done considering the limitations of Swing. – finnw Feb 17 '10 at 20:40.
JTextField textField = new JTextField(); textField. SetBorder(javax.swing.BorderFactory. CreateEmptyBorder()); java.sun.com/javase/6/docs/api/javax/swi... When setting the border to 'null', you're actually telling the look & feel to use the native border style (of the operating system) if there is one.
1 +1 for mentioning the reason WHY null does not work as expected – Nils Schmidt Feb 17 '10 at 15:37 should be -1. Because it does not work. The solution that works is the one suggested that says: override setBorder to do nothing – Markus V.
Feb 17 '10 at 15:40 This may or may not work depending upon context, for non-obvious reasons. Stackoverflow. Com/questions/2281539/… However, it is good information and I don't see any reason for downvoting it.
– Tom Hawtin - tackline Feb 17 '10 at 15:55 As Tom says, this may work upon context. Given the context from OP, this would work splendidly. Thanks Tom, btw.
:) – Björn Feb 17 '10 at 15:56.
Try setting it to BorderFactory. CreateEmptyBorder() instead of null. Sometimes this "does the trick" because setting it to null actually has a different meaning.
If that does not work, it is possible that the look and feel you are using is overriding something. Are you using the default or something custom?
If that's your attitude to programming I would not want to get near my team. Shall I add revalidate and repaint as well? – Markus V.
Feb 17 '10 at 15:41 1 @Markus, in my experience with Swing, problems with it are often not limited to one issue, but rather have to be peeled like an onion. Without seeing your entire code, I don't know if this would completely solve the problem. If I was dealing with the bug, this would be the first thing I would try.
If it didn't work, I'd try to investigate whether the look-and-feel (if you're using something fancy) is interfering. – Uri Feb 17 '10 at 15:51.
No you cant remove the border, Especially over the display of the AWT components. They use the native widget set (are drawn outside Java). Try to make the line that similar to your background.. example if your background is white then you have to : setBorder(BorderFactory.
CreateLineBorder(Color. White)); then set the background as white : setBackground(Color. White).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.