title: How can I implement my LayoutManager without instanceOf?
body: <p>For a certain layout that I'm working on, I need to make my own <code>LayoutManager</code>.</p>
  
  <p>It will lay out different components depending on what type they are: <code>Label</code>s in one way, Separators in another way, and everything else in a third way. </p>
  
  <p>I can easily implement this and to determine the different positions for different types of components, if I make a method:</p>
  
  <pre><code>private Dimension calculatePositionForComponent(Component component) {
    if (component instanceOf JLabel)
       ...
    if (component instanceOf JSeparator)
       ...
  }
  </code></pre>
  
  <p>Is there a better way to do this, without using <code>instanceOf</code>?</p>
  
  <p>(And no, I don't HAVE to make my own <code>LayoutManager</code>, but it makes things extremely easier if i do ;) )</p>
  
  <p>thanks in advance</p>
  
  <p>/B</p>