public Battery() { super(); lightPosition = Orientation.NORTH; INNER_BOUNDS = new Rectangle(40, 18); initialized = false; init(INNER_BOUNDS.width, INNER_BOUNDS.height); addComponentListener(COMPONENT_LISTENER); } // </editor-fold>
public Battery() { super(); lightPosition = Orientation.NORTH; INNER_BOUNDS = new Rectangle(40, 18); initialized = false; init(INNER_BOUNDS.width, INNER_BOUNDS.height); addComponentListener(COMPONENT_LISTENER); } // </editor-fold>
@Override public void setBorder(final Border BORDER) { super.setBorder(BORDER); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); } // </editor-fold>
@Override public void setBorder(final Border BORDER) { super.setBorder(BORDER); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); } // </editor-fold>
@Override public void setPreferredSize(final Dimension DIM) { super.setPreferredSize(new Dimension(DIM.width, (int) (0.45 * DIM.width))); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); initialized = true; }
@Override public void setSize(final Dimension DIM) { super.setPreferredSize(new java.awt.Dimension(DIM.width, (int) (0.45 * DIM.width))); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); initialized = true; }
@Override public void setPreferredSize(final Dimension DIM) { super.setPreferredSize(new Dimension(DIM.width, (int) (0.45 * DIM.width))); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); initialized = true; }
@Override public void setSize(final Dimension DIM) { super.setPreferredSize(new java.awt.Dimension(DIM.width, (int) (0.45 * DIM.width))); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); initialized = true; }
@Override public void setBounds(final Rectangle BOUNDS) { super.setBounds(new java.awt.Rectangle(BOUNDS.x, BOUNDS.y, BOUNDS.width, (int) (0.45 * BOUNDS.width))); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); initialized = true; }
@Override public void setSize(final int WIDTH, final int HEIGHT) { super.setSize(WIDTH, (int) (0.45 * WIDTH)); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); initialized = true; }
@Override public void setBounds(final int X, final int Y, final int WIDTH, final int HEIGHT) { super.setBounds(X, Y, WIDTH, (int) (0.45 * WIDTH)); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); initialized = true; }
@Override public void setBounds(final int X, final int Y, final int WIDTH, final int HEIGHT) { super.setBounds(X, Y, WIDTH, (int) (0.45 * WIDTH)); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); initialized = true; }
@Override public void setSize(final int WIDTH, final int HEIGHT) { super.setSize(WIDTH, (int) (0.45 * WIDTH)); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); initialized = true; }
@Override public void setMinimumSize(final Dimension DIM) { int width = DIM.width < 40 ? 40 : DIM.width; int height = DIM.height < 18 ? 18 : DIM.height; super.setMinimumSize(new Dimension(width, height)); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); invalidate(); repaint(); }
/** * Set the position of the light that affects the gradient of the battery frame * @param LIGHT_POSITION */ public void setLightPosition(final Orientation LIGHT_POSITION) { lightPosition = LIGHT_POSITION; init(getWidth(), getHeight()); repaint(INNER_BOUNDS); }
@Override public void setMinimumSize(final Dimension DIM) { int width = DIM.width < 40 ? 40 : DIM.width; int height = DIM.height < 18 ? 18 : DIM.height; super.setMinimumSize(new Dimension(width, height)); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); invalidate(); repaint(); }
/** * Sets the current charge of the battery as integer from 0 - 100 * @param VALUE */ public void setValue(final int VALUE) { value = VALUE < 0 ? 0 : (VALUE > 100 ? 100 : VALUE); init(getWidth(), getHeight()); repaint(INNER_BOUNDS); }
@Override public void setMaximumSize(final Dimension DIM) { int width = DIM.width > 1920 ? 1920 : DIM.width; int height = DIM.height > 864 ? 864 : DIM.height; super.setMaximumSize(new Dimension(width, height)); calcInnerBounds(); init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width)); invalidate(); repaint(); }
/** * Sets the current charge of the battery as integer from 0 - 100 * @param VALUE */ public void setValue(final int VALUE) { value = VALUE < 0 ? 0 : (VALUE > 100 ? 100 : VALUE); init(getWidth(), getHeight()); repaint(INNER_BOUNDS); }
/** * Set the position of the light that affects the gradient of the battery frame * @param LIGHT_POSITION */ public void setLightPosition(final Orientation LIGHT_POSITION) { lightPosition = LIGHT_POSITION; init(getWidth(), getHeight()); repaint(INNER_BOUNDS); }