0

Why is the following method is not static?

public Insets getBorderInsets(Component c)

It returns the insets of the supplied Component. But since it is not static I need to create a border object to call this. What is the point? Am I missing something?

The way it is supposed to be used:

Border  b = BorderFactory.createRaisedBevelBorder();
Inset i = b.getBoderInsets(someComponent);
WVrock
  • 1,725
  • 3
  • 22
  • 30
  • didn't you created it probably? – Sarthak Mittal Dec 02 '14 at 17:27
  • @SarthakMittal Anyone who uses this method probably needs a Border object thats true but what is the point? I was following an example code and this was pretty confusing for me. – WVrock Dec 02 '14 at 17:30
  • 2
    `"Why is the following method is [sic] not static?"` -- Because [you can't have static methods on an interface.](http://stackoverflow.com/questions/512877/why-cant-i-define-a-static-method-in-a-java-interface) – azurefrog Dec 02 '14 at 17:33
  • @azurefrog. Ok I didn't realize that border is an interface. That was what I was missing. Thanks – WVrock Dec 02 '14 at 17:34

0 Answers0