/** * Calculates the area that is available for painting the display */ private void calcInnerBounds() { final Insets INSETS = getInsets(); INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, getWidth() - INSETS.left - INSETS.right, getHeight() - INSETS.top - INSETS.bottom); }
/** * Calculates the area that is available for painting the display */ private void calcInnerBounds() { final Insets INSETS = getInsets(); INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, getWidth() - INSETS.left - INSETS.right, getHeight() - INSETS.top - INSETS.bottom); }
@Override public void componentResized(ComponentEvent event) { final int SIZE = getWidth() <= getHeight() ? getWidth() : getHeight(); Container parent = getParent(); if ((parent != null) && (parent.getLayout() == null)) { if (SIZE < getMinimumSize().width || SIZE < getMinimumSize().height) { setSize(getMinimumSize()); } else{ setSize(SIZE, SIZE); } } else { if (SIZE < getMinimumSize().width || SIZE < getMinimumSize().height) { setPreferredSize(getMinimumSize()); } else{ setPreferredSize(new Dimension(SIZE, SIZE)); } } calcInnerBounds(); init(getInnerBounds().width, getInnerBounds().height); } };
@Override public void componentResized(ComponentEvent event) { final int SIZE = getWidth() <= getHeight() ? getWidth() : getHeight(); Container parent = getParent(); if ((parent != null) && (parent.getLayout() == null)) { if (SIZE < getMinimumSize().width || SIZE < getMinimumSize().height) { setSize(getMinimumSize()); } else{ setSize(SIZE, SIZE); } } else { if (SIZE < getMinimumSize().width || SIZE < getMinimumSize().height) { setPreferredSize(getMinimumSize()); } else{ setPreferredSize(new Dimension(SIZE, SIZE)); } } calcInnerBounds(); init(getInnerBounds().width, getInnerBounds().height); } };