@Override public void setSize(final Dimension DIM) { final int SIZE = DIM.width <= DIM.height ? DIM.width : DIM.height; super.setSize(new Dimension(SIZE, SIZE)); calcInnerBounds(); init(getGaugeBounds().width, getGaugeBounds().height); setInitialized(true); }
@Override public void setSize(final int WIDTH, final int HEIGHT) { final int SIZE = WIDTH <= HEIGHT ? WIDTH : HEIGHT; super.setSize(SIZE, SIZE); calcInnerBounds(); init(getGaugeBounds().width, getGaugeBounds().height); setInitialized(true); }
@Override public void setMinimumSize(final Dimension DIM) { int width = DIM.width < 50 ? 50 : DIM.width; int height = DIM.height < 50 ? 50 : DIM.height; final int SIZE = width <= height ? width : height; super.setMinimumSize(new Dimension(SIZE, SIZE)); calcInnerBounds(); init(getGaugeBounds().width, getGaugeBounds().height); setInitialized(true); invalidate(); repaint(); }
@Override public void setBounds(final int X, final int Y, final int WIDTH, final int HEIGHT) { if (WIDTH <= HEIGHT) { // vertical int yNew; switch (verticalAlignment) { case SwingConstants.TOP: yNew = Y; break; case SwingConstants.BOTTOM: yNew = Y + (HEIGHT - WIDTH); break; case SwingConstants.CENTER: default: yNew = Y + ((HEIGHT - WIDTH) / 2); break; } super.setBounds(X, yNew, WIDTH, WIDTH); } else { // horizontal int xNew; switch (horizontalAlignment) { case SwingConstants.LEFT: xNew = X; break; case SwingConstants.RIGHT: xNew = X + (WIDTH - HEIGHT); break; case SwingConstants.CENTER: default: xNew = X + ((WIDTH - HEIGHT) / 2); break; } super.setBounds(xNew, Y, HEIGHT, HEIGHT); } calcInnerBounds(); init(getGaugeBounds().width, getGaugeBounds().height); setInitialized(true); }
@Override public void setBounds(final Rectangle BOUNDS) { if (BOUNDS.width <= BOUNDS.height) { // vertical int yNew; switch (verticalAlignment) { case SwingConstants.TOP: yNew = BOUNDS.y; break; case SwingConstants.BOTTOM: yNew = BOUNDS.y + (BOUNDS.height - BOUNDS.width); break; case SwingConstants.CENTER: default: yNew = BOUNDS.y + ((BOUNDS.height - BOUNDS.width) / 2); break; } super.setBounds(BOUNDS.x, yNew, BOUNDS.width, BOUNDS.width); } else { // horizontal int xNew; switch (horizontalAlignment) { case SwingConstants.LEFT: xNew = BOUNDS.x; break; case SwingConstants.RIGHT: xNew = BOUNDS.x + (BOUNDS.width - BOUNDS.height); break; case SwingConstants.CENTER: default: xNew = BOUNDS.x + ((BOUNDS.width - BOUNDS.height) / 2); break; } super.setBounds(xNew, BOUNDS.y, BOUNDS.height, BOUNDS.height); } calcInnerBounds(); init(getGaugeBounds().width, getGaugeBounds().height); setInitialized(true); }
// <editor-fold defaultstate="collapsed" desc="Misc"> @Override public void dispose() { CLOCK_TIMER.removeActionListener(this); super.dispose(); }
@Override public void setBorder(Border BORDER) { super.setBorder(BORDER); calcInnerBounds(); init(getInnerBounds().width, getInnerBounds().height); }