Crossfire JXClient, Trunk  R20561
GUIFill.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff.
19  * Copyright (C) 2006-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.gui.misc;
23 
28 import java.awt.Color;
29 import java.awt.Graphics;
30 import java.awt.Graphics2D;
31 import java.awt.Transparency;
32 import org.jetbrains.annotations.NotNull;
33 
38 public class GUIFill extends AbstractGUIElement {
39 
43  private static final long serialVersionUID = 1;
44 
48  @NotNull
49  private final Color color;
50 
59  public GUIFill(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final Color color, final float alpha) {
60  super(tooltipManager, elementListener, name, alpha < 1.0F ? Transparency.TRANSLUCENT : Transparency.OPAQUE);
61  this.color = color;
62  }
63 
67  @Override
68  public void paintComponent(@NotNull final Graphics g) {
69  super.paintComponent(g);
70  final Graphics2D g2 = (Graphics2D)g;
71  g2.setBackground(color);
72  g2.clearRect(0, 0, getWidth(), getHeight());
73  }
74 
75 }
static final long serialVersionUID
The serial version UID.
Definition: GUIFill.java:43
final TooltipManager tooltipManager
The TooltipManager to update.
final Color color
The Color to paint.
Definition: GUIFill.java:49
A GUIElement that fills an area with a given color.
Definition: GUIFill.java:38
final GUIElementListener elementListener
The GUIElementListener to notify.
Interface defining an abstract GUI element.
Definition: GUIElement.java:32
void paintComponent(@NotNull final Graphics g)
Definition: GUIFill.java:68
GUIFill(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final Color color, final float alpha)
Creates a new instance.
Definition: GUIFill.java:59
Abstract base class for GUI elements to be shown in Guis.