本文整理汇总了Java中java.awt.event.PaintEvent.getUpdateRect方法的典型用法代码示例。如果您正苦于以下问题:Java PaintEvent.getUpdateRect方法的具体用法?Java PaintEvent.getUpdateRect怎么用?Java PaintEvent.getUpdateRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.PaintEvent
的用法示例。
在下文中一共展示了PaintEvent.getUpdateRect方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: coalescePaintEvent
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
@Override
public void coalescePaintEvent(PaintEvent e) {
Rectangle r = e.getUpdateRect();
if (!(e instanceof IgnorePaintEvent)) {
paintArea.add(r, e.getID());
}
if (log.isLoggable(PlatformLogger.Level.FINEST)) {
switch(e.getID()) {
case PaintEvent.UPDATE:
log.finest("coalescePaintEvent: UPDATE: add: x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
return;
case PaintEvent.PAINT:
log.finest("coalescePaintEvent: PAINT: add: x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
return;
}
}
}
示例2: coalescePaintEvent
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
public void coalescePaintEvent(PaintEvent e) {
Rectangle r = e.getUpdateRect();
if (!(e instanceof IgnorePaintEvent)) {
paintArea.add(r, e.getID());
}
if (true) {
switch(e.getID()) {
case PaintEvent.UPDATE:
if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("XCP coalescePaintEvent : UPDATE : add : x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
}
return;
case PaintEvent.PAINT:
if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
}
return;
}
}
}
示例3: coalescePaintEvent
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
public void coalescePaintEvent(PaintEvent e) {
Rectangle r = e.getUpdateRect();
if (!(e instanceof IgnorePaintEvent)) {
paintArea.add(r, e.getID());
}
if (log.isLoggable(PlatformLogger.FINEST)) {
switch(e.getID()) {
case PaintEvent.UPDATE:
log.finest("coalescePaintEvent: UPDATE: add: x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
return;
case PaintEvent.PAINT:
log.finest("coalescePaintEvent: PAINT: add: x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
return;
}
}
}
示例4: coalescePaintEvent
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
public void coalescePaintEvent(PaintEvent e) {
Rectangle r = e.getUpdateRect();
if (!(e instanceof IgnorePaintEvent)) {
paintArea.add(r, e.getID());
}
if (true) {
switch(e.getID()) {
case PaintEvent.UPDATE:
log.finer("XCP coalescePaintEvent : UPDATE : add : x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
return;
case PaintEvent.PAINT:
log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
return;
}
}
}
示例5: coalescePaintEvent
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
public void coalescePaintEvent(PaintEvent e) {
Rectangle r = e.getUpdateRect();
if (!(e instanceof IgnorePaintEvent)) {
paintArea.add(r, e.getID());
}
if (log.isLoggable(PlatformLogger.Level.FINEST)) {
switch(e.getID()) {
case PaintEvent.UPDATE:
log.finest("coalescePaintEvent: UPDATE: add: x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
return;
case PaintEvent.PAINT:
log.finest("coalescePaintEvent: PAINT: add: x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ", height = " + r.height);
return;
}
}
}
示例6: processPaintEvent
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
private void processPaintEvent(PaintEvent event) {
if (redrawManager == null || getIgnoreRepaint()) {
return;
}
Rectangle clipRect = event.getUpdateRect();
if ((clipRect.width <= 0) || (clipRect.height <= 0)) {
return;
}
Graphics g = getGraphics();
if (g == null) {
return;
}
initGraphics(g, event);
if (event.getID() == PaintEvent.PAINT) {
paint(g);
} else {
update(g);
}
((CommonGraphics2D)g).flush();
g.dispose();
}
示例7: initGraphics
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
void initGraphics(Graphics g, PaintEvent e) {
Rectangle clip = e.getUpdateRect();
if (clip instanceof ClipRegion) {
g.setClip(((ClipRegion) clip).getClip());
} else {
g.setClip(clip);
}
if (isPrepainter()) {
prepaint(g);
} else if (!isLightweight() && (e.getID() == PaintEvent.PAINT)) {
g.setColor(getBackground());
g.fillRect(0, 0, w, h);
}
g.setFont(getFont());
g.setColor(getForeground());
}
示例8: coalescePaintEvent
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
public void coalescePaintEvent(PaintEvent e) {
Rectangle r = e.getUpdateRect();
if (!(e instanceof IgnorePaintEvent)) {
paintArea.add(r, e.getID());
}
if (true) {
switch(e.getID()) {
case PaintEvent.UPDATE:
if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("XCP coalescePaintEvent : UPDATE : add : x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
}
return;
case PaintEvent.PAINT:
if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("XCP coalescePaintEvent : PAINT : add : x = " +
r.x + ", y = " + r.y + ", width = " + r.width + ",height = " + r.height);
}
return;
}
}
}
示例9: processPaintEvent
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
private void processPaintEvent(PaintEvent event) {
if (redrawManager == null) {
return;
}
Rectangle clipRect = event.getUpdateRect();
if ((clipRect.width <= 0) || (clipRect.height <= 0)) {
return;
}
Graphics g = getGraphics();
if (g == null) {
return;
}
initGraphics(g, event);
if (!getIgnoreRepaint()) {
if (event.getID() == PaintEvent.PAINT) {
paint(g);
} else {
update(g);
}
}
g.dispose();
}
示例10: coalesceEvents
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
/**
* This is called by the EventQueue if two events with the same event id
* and owner component are queued. Returns a new combined event, or null if
* no combining is done. The coelesced events are currently mouse moves
* (intermediate ones are discarded) and paint events (a merged paint is
* created in place of the two events).
*
* @param existingEvent the event on the queue
* @param newEvent the new event that might be entered on the queue
* @return null if both events are kept, or the replacement coelesced event
*/
protected AWTEvent coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent)
{
AWTEvent coalesced = null;
switch (existingEvent.id)
{
case MouseEvent.MOUSE_MOVED:
case MouseEvent.MOUSE_DRAGGED:
// Just drop the old (intermediate) event and return the new one.
MouseEvent me1 = (MouseEvent) existingEvent;
MouseEvent me2 = (MouseEvent) newEvent;
if (me1.getModifiers() == me2.getModifiers())
coalesced = newEvent;
break;
case PaintEvent.PAINT:
case PaintEvent.UPDATE:
// For heavyweights the EventQueue should ask the peer.
if (peer == null || peer instanceof LightweightPeer)
{
PaintEvent pe1 = (PaintEvent) existingEvent;
PaintEvent pe2 = (PaintEvent) newEvent;
Rectangle r1 = pe1.getUpdateRect();
Rectangle r2 = pe2.getUpdateRect();
if (r1.contains(r2))
coalesced = existingEvent;
else if (r2.contains(r1))
coalesced = newEvent;
}
else
{
// Replace the event and let the heavyweight figure out the expanding
// of the repaint area.
coalesced = newEvent;
}
break;
default:
coalesced = null;
}
return coalesced;
}
示例11: handleEvent
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
public void handleEvent(AWTEvent e)
{
// This can only happen when an application posts a PaintEvent for
// a lightweight component directly. We still support painting for
// this case.
if (e instanceof PaintEvent)
{
PaintEvent pe = (PaintEvent) e;
Component target = (Component) e.getSource();
if (target != null && target.isShowing())
{
Graphics g = target.getGraphics();
if (g != null)
{
try
{
Rectangle clip = pe.getUpdateRect();
g.setClip(clip);
target.paint(g);
}
finally
{
g.dispose();
}
}
}
}
}
示例12: coalescePaintEvent
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
public void coalescePaintEvent (PaintEvent e)
{
synchronized (this)
{
Rectangle newRect = e.getUpdateRect();
if (currentPaintArea == null)
currentPaintArea = newRect;
else
Rectangle.union(currentPaintArea, newRect, currentPaintArea);
}
}
示例13: coalescePaintEvent
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
/**
* Coalesces the specified paint event.
*
* @param e the paint event
*/
public void coalescePaintEvent(PaintEvent e)
{
synchronized (this)
{
Rectangle newRect = e.getUpdateRect();
if (paintArea == null)
paintArea = newRect;
else
Rectangle.union(paintArea, newRect, paintArea);
}
}
示例14: mergePaintEvents
import java.awt.event.PaintEvent; //导入方法依赖的package包/类
private PaintEvent mergePaintEvents(PaintEvent a, PaintEvent b) {
Rectangle aRect = a.getUpdateRect();
Rectangle bRect = b.getUpdateRect();
if (bRect.contains(aRect)) {
return b;
}
if (aRect.contains(bRect)) {
return a;
}
return null;
}