/** * Calculates the rectangle that specifies the area that is available * for painting the gauge. This means that if the component has insets * that are larger than 0, these will be taken into account. */ private void calcInnerBounds() { // final java.awt.Insets INSETS = getInsets(); // if (getWidth() - INSETS.left - INSETS.right < getHeight() - INSETS.top - INSETS.bottom) { // INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, getWidth() - INSETS.left - INSETS.right, getHeight() - INSETS.top - INSETS.bottom); // } else { // INNER_BOUNDS.setBounds(INSETS.left + (int) (((double) (getWidth() - INSETS.left - INSETS.right) - (double) (getHeight() - INSETS.top - INSETS.bottom)) / 2.0), INSETS.top, getHeight() - INSETS.top - INSETS.bottom, getHeight() - INSETS.top - INSETS.bottom); // } final Insets INSETS = getInsets(); final int SIZE = (getWidth() - INSETS.left - INSETS.right) <= (getHeight() - INSETS.top - INSETS.bottom) ? (getWidth() - INSETS.left - INSETS.right) : (getHeight() - INSETS.top - INSETS.bottom); //INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, getWidth() - INSETS.left - INSETS.right, getHeight() - INSETS.top - INSETS.bottom); INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, SIZE, SIZE); }
/** * Calculates the rectangle that specifies the area that is available * for painting the gauge. This means that if the component has insets * that are larger than 0, these will be taken into account. */ private void calcInnerBounds() { // final java.awt.Insets INSETS = getInsets(); // if (getWidth() - INSETS.left - INSETS.right < getHeight() - INSETS.top - INSETS.bottom) { // INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, getWidth() - INSETS.left - INSETS.right, getHeight() - INSETS.top - INSETS.bottom); // } else { // INNER_BOUNDS.setBounds(INSETS.left + (int) (((double) (getWidth() - INSETS.left - INSETS.right) - (double) (getHeight() - INSETS.top - INSETS.bottom)) / 2.0), INSETS.top, getHeight() - INSETS.top - INSETS.bottom, getHeight() - INSETS.top - INSETS.bottom); // } final Insets INSETS = getInsets(); final int SIZE = (getWidth() - INSETS.left - INSETS.right) <= (getHeight() - INSETS.top - INSETS.bottom) ? (getWidth() - INSETS.left - INSETS.right) : (getHeight() - INSETS.top - INSETS.bottom); //INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, getWidth() - INSETS.left - INSETS.right, getHeight() - INSETS.top - INSETS.bottom); INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, SIZE, SIZE); }