/** * Draws the background image (if there is one) aligned within the specified area. * * @param g2 the graphics device. * @param area the area. */ protected void drawBackgroundImage(Graphics2D g2, Rectangle2D area) { if (this.backgroundImage != null) { Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC, this.backgroundAlpha)); Rectangle2D dest = new Rectangle2D.Double( 0.0, 0.0, this.backgroundImage.getWidth(null), this.backgroundImage.getHeight(null) ); Align.align(dest, area, this.backgroundImageAlignment); g2.drawImage( this.backgroundImage, (int) dest.getX(), (int) dest.getY(), (int) dest.getWidth() + 1, (int) dest.getHeight() + 1, null ); g2.setComposite(originalComposite); } }
/** * Draws the background image (if there is one) aligned within the * specified area. * * @param g2 the graphics device. * @param area the area. * * @see #getBackgroundImage() * @see #getBackgroundImageAlignment() * @see #getBackgroundImageAlpha() */ protected void drawBackgroundImage(Graphics2D g2, Rectangle2D area) { if (this.backgroundImage != null) { Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, this.backgroundImageAlpha)); Rectangle2D dest = new Rectangle2D.Double(0.0, 0.0, this.backgroundImage.getWidth(null), this.backgroundImage.getHeight(null)); Align.align(dest, area, this.backgroundImageAlignment); g2.drawImage(this.backgroundImage, (int) dest.getX(), (int) dest.getY(), (int) dest.getWidth() + 1, (int) dest.getHeight() + 1, null); g2.setComposite(originalComposite); } }
/** * Draws the background image (if there is one) aligned within the * specified area. * * @param g2 the graphics device. * @param area the area. * * @see #getBackgroundImage() * @see #getBackgroundImageAlignment() * @see #getBackgroundImageAlpha() */ public void drawBackgroundImage(Graphics2D g2, Rectangle2D area) { if (this.backgroundImage == null) { return; // nothing to do } Composite savedComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, this.backgroundImageAlpha)); Rectangle2D dest = new Rectangle2D.Double(0.0, 0.0, this.backgroundImage.getWidth(null), this.backgroundImage.getHeight(null)); Align.align(dest, area, this.backgroundImageAlignment); Shape savedClip = g2.getClip(); g2.clip(area); g2.drawImage(this.backgroundImage, (int) dest.getX(), (int) dest.getY(), (int) dest.getWidth() + 1, (int) dest.getHeight() + 1, null); g2.setClip(savedClip); g2.setComposite(savedComposite); }
/** * Draws the background image (if there is one) aligned within the * specified area. * * @param g2 the graphics device. * @param area the area. * * @see #getBackgroundImage() * @see #getBackgroundImageAlignment() * @see #getBackgroundImageAlpha() */ public void drawBackgroundImage(Graphics2D g2, Rectangle2D area) { if (this.backgroundImage != null) { Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, this.backgroundImageAlpha)); Rectangle2D dest = new Rectangle2D.Double(0.0, 0.0, this.backgroundImage.getWidth(null), this.backgroundImage.getHeight(null)); Align.align(dest, area, this.backgroundImageAlignment); g2.drawImage(this.backgroundImage, (int) dest.getX(), (int) dest.getY(), (int) dest.getWidth() + 1, (int) dest.getHeight() + 1, null); g2.setComposite(originalComposite); } }
public List getTagList() { List tags = new java.util.ArrayList(); tags.add(new Tag(new Integer(Align.BOTTOM), I18n.getString("Global.Property.Bottom"))); tags.add(new Tag(new Integer(Align.BOTTOM_LEFT), I18n.getString("Global.Property.BottomLeft"))); tags.add(new Tag(new Integer(Align.BOTTOM_RIGHT), I18n.getString("Global.Property.BottomRight"))); tags.add(new Tag(new Integer(Align.CENTER), I18n.getString("Global.Property.Center"))); tags.add(new Tag(new Integer(Align.FIT), I18n.getString("Global.Property.Fit"))); tags.add(new Tag(new Integer(Align.FIT_HORIZONTAL), I18n.getString("Global.Property.FitHorizontal"))); tags.add(new Tag(new Integer(Align.FIT_VERTICAL), I18n.getString("Global.Property.FitVertical"))); tags.add(new Tag(new Integer(Align.LEFT), I18n.getString("Global.Property.Left"))); tags.add(new Tag(new Integer(Align.RIGHT), I18n.getString("Global.Property.Right"))); tags.add(new Tag(new Integer(Align.TOP), I18n.getString("Global.Property.Top"))); tags.add(new Tag(new Integer(Align.TOP_LEFT), I18n.getString("Global.Property.TopLeft"))); tags.add(new Tag(new Integer(Align.TOP_RIGHT), I18n.getString("Global.Property.TopRight"))); return tags; }
@Override public Object convertUponGet(Object value) { if (value == null) { return null; } return new Integer(Align.BOTTOM).equals(value) ? "Align.BOTTOM" : new Integer(Align.BOTTOM_LEFT).equals(value) ? "Align.BOTTOM_LEFT" : new Integer(Align.BOTTOM_RIGHT).equals(value) ? "Align.BOTTOM_RIGHT" : new Integer(Align.CENTER).equals(value) ? "Align.CENTER" : new Integer(Align.FIT).equals(value) ? "Align.FIT" : new Integer(Align.FIT_HORIZONTAL).equals(value) ? "Align.FIT_HORIZONTAL" : new Integer(Align.FIT_VERTICAL).equals(value) ? "Align.FIT_VERTICAL" : new Integer(Align.LEFT).equals(value) ? "Align.LEFT" : new Integer(Align.RIGHT).equals(value) ? "Align.RIGHT" : new Integer(Align.TOP).equals(value) ? "Align.TOP" : new Integer(Align.TOP_LEFT).equals(value) ? "Align.TOP_LEFT" : new Integer(Align.TOP_RIGHT).equals(value) ? "Align.TOP_RIGHT" : null; }
@Override public Object convertUponSet(Object value) { if (value == null) { return null; } return "Align.BOTTOM".equals(value) ? new Integer(Align.BOTTOM) : "Align.BOTTOM_LEFT".equals(value) ? new Integer(Align.BOTTOM_LEFT) : "Align.BOTTOM_RIGHT".equals(value) ? new Integer(Align.BOTTOM_RIGHT) : "Align.CENTER".equals(value) ? new Integer(Align.CENTER) : "Align.FIT".equals(value) ? new Integer(Align.FIT) : "Align.FIT_HORIZONTAL".equals(value) ? new Integer(Align.FIT_HORIZONTAL) : "Align.FIT_VERTICAL".equals(value) ? new Integer(Align.FIT_VERTICAL) : "Align.LEFT".equals(value) ? new Integer(Align.LEFT) : "Align.RIGHT".equals(value) ? new Integer(Align.RIGHT) : "Align.TOP".equals(value) ? new Integer(Align.TOP) : "Align.TOP_LEFT".equals(value) ? new Integer(Align.TOP_LEFT) : "Align.TOP_RIGHT".equals(value) ? new Integer(Align.TOP_RIGHT) : null; }
private void montaTela() { add(pnGeral); txtMatricula.setFont(fntPad01); txtApelido.setFont(fntPad01); txtApelido.setHorizontalAlignment(Align.CENTER); txtApelido.setBackground(Color.WHITE); txtMatricula.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1)); piFoto.setBorder(null); txtRelogio.setFont(fntPad01); txtData.setFont(fntPad01); txtData.setBorder(null); txtRelogio.setBorder(null); txtApelido.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1)); txtApelido.setForeground(Color.BLUE); pnLogo.setPreferredSize(new Dimension(510, 50)); pnGeral.add(pnLogo, BorderLayout.NORTH); pnLogo.add(lbLogo, BorderLayout.CENTER); pnFoto.setPreferredSize(new Dimension(154, 200)); pnGeral.add(pnFoto, BorderLayout.EAST); pnCampos.setPreferredSize(new Dimension(410, 100)); pnGeral.add(pnCampos, BorderLayout.WEST); pnCampos.adic(new JLabelPad("Matricula"), 7, 5, 300, 20); pnCampos.adic(txtMatricula, 7, 25, 150, 26); pnCampos.adic(txtData, 180, 30, 85, 20); pnCampos.adic(txtRelogio, 265, 30, 75, 20); pnFoto.adic(piFoto, 5, 5, 142, 189); pnFoto.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1)); piFoto.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1)); pnFoto.setBackground(Color.WHITE); pnFoto.adic(txtApelido, 5, 205, 142, 26); txtData.setVlrDate(new Date()); txtData.setEditable(false); txtRelogio.setEditable(false); txtApelido.setEditable(false); txtMatricula.requestFocus(); }