本文整理了Java中java.awt.Container.getBackground()
方法的一些代码示例,展示了Container.getBackground()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Container.getBackground()
方法的具体详情如下:
包路径:java.awt.Container
类名称:Container
方法名:getBackground
暂无
代码示例来源:origin: winder/Universal-G-Code-Sender
@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);
}
代码示例来源:origin: ron190/jsql-injection
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));
代码示例来源:origin: stackoverflow.com
...
Container container = getContentPane();
container.setBackground(new Color(240,240,240));
...
nonEditableTextField.setBackground(container.getBackground());
...
代码示例来源:origin: org.japura/japura-gui
@Override
public Color getBackground() {
return root.getContentPane().getBackground();
}
代码示例来源:origin: leMaik/swing-material
/**
* 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);
}
代码示例来源:origin: freeplane/freeplane
@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;
}
}
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
/**
* 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);
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
/**
* 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);
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop
/**
* 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);
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
public void mouseExited( MouseEvent e )
{
setBackground( _bkColor != null ? _bkColor : getParent().getBackground() );
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
/**
* 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);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-vmd-game
/** 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));
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
@Override
public void addNotify()
{
super.addNotify();
setBackground( getParent().getBackground() );
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
@Override
public void addNotify()
{
super.addNotify();
setBackground( getParent().getBackground() );
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
@Override
public void addNotify()
{
super.addNotify();
setBackground( getParent().getBackground() );
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
/**
* 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);
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
public void mouseExited( MouseEvent e )
{
setBorderPainted( isBorderConstant() );
setBackground( _bkColor != null ? _bkColor : getParent().getBackground() );
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
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);
}
代码示例来源:origin: org.softsmithy.lib/softsmithy-lib-swing
@Override
public Color getBackground() {
return getStyleable().getParent() != null ? getStyleable().getParent().getBackground()
: getStyleable().getNoneStyle().getBackground();
}
代码示例来源:origin: org.softsmithy.lib/lib-core
public Color getBackground() {
return getStyleable().getParent() != null ? getStyleable().getParent().getBackground() :
getStyleable().getNoneStyle().getBackground();
}
内容来源于网络,如有侵权,请联系作者删除!