@Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); RoundRectangle2D.Double rectangle = new RoundRectangle2D.Double(x, y, width - 1, height - 1, radius, radius); Area rectangleArea = new Area(rectangle); Area area = new Area(new Rectangle(0, 0, width, height)); area.subtract(rectangleArea); g2d.setClip(area); g2d.setColor(c.getParent().getBackground()); g2d.fillRect(0, 0, width, height); g2d.setClip(null); if (color == null) { g2d.setColor(c.getBackground()); } else { g2d.setColor(color); } g2d.setStroke(stroke); g2d.draw(rectangleArea); }
Container parent = c.getParent(); if (parent!=null) { g2.setColor(parent.getBackground()); Area corner = new Area(new Rectangle2D.Float(x, y, width, height)); corner.subtract(new Area(round));
... Container container = getContentPane(); container.setBackground(new Color(240,240,240)); ... nonEditableTextField.setBackground(container.getBackground()); ...
@Override public Color getBackground() { return root.getContentPane().getBackground(); }
/** * Paints this effect. * @param g canvas */ public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setBackground(target.getParent().getBackground()); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f)); g.drawImage(shadow.render(target.getWidth(), target.getHeight(), borderRadius, level.getValue(), MaterialShadow.Type.SQUARE), 0, 0, null); }
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { final Component c = delegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); final Container mapView = SwingUtilities.getAncestorOfClass(MapView.class, table); if(mapView != null) c.setBackground(mapView.getBackground()); final int height = (int) (((AttributeTable)table).getZoom() * 6); final Dimension preferredSize = new Dimension(1, height); c.setPreferredSize(preferredSize); return c; } }
/** * Overriden to paint the background of the component but keeping the rounded * corners. */ @Override public void update(Graphics g, JComponent c) { if (c.isOpaque()) { g.setColor(c.getParent().getBackground()); g.fillRect(0, 0, c.getWidth(), c.getHeight()); g.setColor(c.getBackground()); g.fillRect(0, getRoundHeight(), c.getWidth(), c.getHeight() - getRoundHeight()); } paint(g, c); }
/** * Overriden to paint the background of the component but keeping the rounded * corners. */ public void update(Graphics g, JComponent c) { if (c.isOpaque()) { g.setColor(c.getParent().getBackground()); g.fillRect(0, 0, c.getWidth(), c.getHeight()); g.setColor(c.getBackground()); g.fillRect(0, getRoundHeight(), c.getWidth(), c.getHeight() - getRoundHeight()); } paint(g, c); }
/** * Overriden to paint the background of the component but keeping the rounded * corners. */ public void update(Graphics g, JComponent c) { if (c.isOpaque()) { g.setColor(c.getParent().getBackground()); g.fillRect(0, 0, c.getWidth(), c.getHeight()); g.setColor(c.getBackground()); g.fillRect(0, getRoundHeight(), c.getWidth(), c.getHeight() - getRoundHeight()); } paint(g, c); }
public void mouseExited( MouseEvent e ) { setBackground( _bkColor != null ? _bkColor : getParent().getBackground() ); }
/** * Overriden to paint the background of the component but keeping the rounded * corners. */ @Override public void update(Graphics g, JComponent c) { if (c.isOpaque()) { g.setColor(c.getParent().getBackground()); g.fillRect(0, 0, c.getWidth(), c.getHeight()); g.setColor(c.getBackground()); g.fillRect(0, getRoundHeight(), c.getWidth(), c.getHeight() - getRoundHeight()); } paint(g, c); }
/** Creates new form ResourceImageEditor */ public ResourceImageEditor() { initComponents(); this.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ResourceImageEditor.class, "ResourceImageEditor.accessible.name")); this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ResourceImageEditor.class, "ResourceImageEditor.accessible.description")); this.textFieldImage.setBackground(this.textFieldImage.getParent().getBackground()); this.textFieldNumTiles.setBackground(this.textFieldNumTiles.getParent().getBackground()); this.textFieldSize.setBackground(this.textFieldSize.getParent().getBackground()); this.resourceComponent = new ResourceImageList(); this.panelResourceList.add(new JScrollPane(this.resourceComponent)); }
@Override public void addNotify() { super.addNotify(); setBackground( getParent().getBackground() ); }
@Override public void addNotify() { super.addNotify(); setBackground( getParent().getBackground() ); }
@Override public void addNotify() { super.addNotify(); setBackground( getParent().getBackground() ); }
/** * If mouse leaves the transferable set its parent color mode to inactive, * i.e., display it with the color as defined by * <code>setInactiveColor()</code> * * @param mouseEvent the mouse event */ @Override public void mouseExited(MouseEvent mouseEvent) { Connector i = (Connector) getParent(); i.setBackground(this.getParent().getParent().getBackground()); i.setSelected(false); }
public void mouseExited( MouseEvent e ) { setBorderPainted( isBorderConstant() ); setBackground( _bkColor != null ? _bkColor : getParent().getBackground() ); }
protected void drawSingleLine(Graphics _g, String _s, int _x, int _y, int _w) { Color bg=getBackground(); if(!isOpaque()) { Container p=getParent(); if(p!=null) bg=p.getBackground(); } BuFontChooser.drawStringWithStyle (_g,_s,_x,_y,style_|(isUnderlined() ? BuFontChooser.UNDERLINED : 0),bg); //_g.drawString(_s,_x,_y); //if(isUnderlined()) _g.drawLine(_x,_y+2,_x+_w-1,_y+2); }
@Override public Color getBackground() { return getStyleable().getParent() != null ? getStyleable().getParent().getBackground() : getStyleable().getNoneStyle().getBackground(); }
public Color getBackground() { return getStyleable().getParent() != null ? getStyleable().getParent().getBackground() : getStyleable().getNoneStyle().getBackground(); }