What is the difference between
setBorder(new TitledBorder(""));
and
setBorder(BorderFactory.createTitledBorder(""));
and which advantages/disadvantages do they have?
BorderFactory
actually might not create new instances each time you call it, but return a reference to an existing one, therefore saving some resources. See also the javadoc.
You can also check out the actual implementation if you really want to know what's going on inside BorderFactory
;-)