src/macosx/classes/sun/lwawt/LWWindowPeer.java
Print this page
*** 143,154 ****
} else {
// first we check if user provided alpha for background. This is
// similar to what Apple's Java do.
// Since JDK7 we should rely on setOpacity() only.
// this.opacity = c.getAlpha();
- // System.out.println("Delegate assigns alpha (we ignore setOpacity()):"
- // +this.opacity);
}
if (!target.isForegroundSet()) {
target.setForeground(SystemColor.windowText);
// we should not call setForeground because it will call a repaint
--- 143,152 ----
*** 157,183 ****
platformWindow.initialize(target, this, ownerDelegate);
}
@Override
! public void initialize() {
if (getTarget() instanceof Frame) {
! setTitle(((Frame)getTarget()).getTitle());
! setState(((Frame)getTarget()).getExtendedState());
} else if (getTarget() instanceof Dialog) {
! setTitle(((Dialog)getTarget()).getTitle());
}
setAlwaysOnTop(getTarget().isAlwaysOnTop());
updateMinimumSize();
! setOpacity(getTarget().getOpacity());
! setOpaque(getTarget().isOpaque());
! super.initialize();
updateInsets(platformWindow.getInsets());
}
// Just a helper method
public PlatformWindow getPlatformWindow() {
return platformWindow;
--- 155,187 ----
platformWindow.initialize(target, this, ownerDelegate);
}
@Override
! void initializeImpl() {
! super.initializeImpl();
if (getTarget() instanceof Frame) {
! setTitle(((Frame) getTarget()).getTitle());
! setState(((Frame) getTarget()).getExtendedState());
} else if (getTarget() instanceof Dialog) {
! setTitle(((Dialog) getTarget()).getTitle());
}
setAlwaysOnTop(getTarget().isAlwaysOnTop());
updateMinimumSize();
! final float opacity = getTarget().getOpacity();
! if (opacity < 1.0f) {
! setOpacity(opacity);
! }
! setOpaque(getTarget().isOpaque());
updateInsets(platformWindow.getInsets());
+ if (getSurfaceData() == null) {
+ replaceSurfaceData();
+ }
}
// Just a helper method
public PlatformWindow getPlatformWindow() {
return platformWindow;
*** 211,239 ****
platformWindow.dispose();
super.disposeImpl();
}
@Override
! public void setVisible(final boolean visible) {
! if (getSurfaceData() == null) {
! replaceSurfaceData();
! }
!
! if (isVisible() == visible) {
! return;
! }
! super.setVisible(visible);
!
// TODO: update graphicsConfig, see 4868278
! // TODO: don't notify the delegate if our visibility is unchanged
!
! // it is important to call this method on EDT
! // to prevent the deadlocks during the painting of the lightweight delegates
! //TODO: WHY? This is a native-system related call. Perhaps NOT calling
! // the painting procedure right from the setVisible(), but rather relying
! // on the native Expose event (or, scheduling the repainting asynchronously)
! // is better?
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
platformWindow.setVisible(visible);
if (isSimpleWindow()) {
--- 215,236 ----
platformWindow.dispose();
super.disposeImpl();
}
@Override
! protected void setVisibleImpl(final boolean visible) {
! super.setVisibleImpl(visible);
// TODO: update graphicsConfig, see 4868278
! // In the super.setVisibleImpl() we post PaintEvent to EDT.
! // Then we schedule this method on EDT too. So we'll have correct
! // texture at the time when the window will appear on the screen and
! // we'll simply make the blit in the native callback.
! // invokeLater() can be deleted, but in this case we get a lag between
! // windows showing and content painting.
! // Note: don't forget to delete invokeLater from CPlatformWindow.dispose
! // if this one will be deleted.
! // TODO if EDT is blocked we cannot show the window.
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
platformWindow.setVisible(visible);
if (isSimpleWindow()) {
*** 980,991 ****
backBuffer = (BufferedImage) platformWindow.createBackBuffer();
if (backBuffer != null) {
Graphics g = backBuffer.getGraphics();
try {
Rectangle r = getBounds();
! g.setColor(getBackground());
! g.fillRect(0, 0, r.width, r.height);
if (oldBB != null) {
// Draw the old back buffer to the new one
g.drawImage(oldBB, 0, 0, null);
oldBB.flush();
}
--- 977,989 ----
backBuffer = (BufferedImage) platformWindow.createBackBuffer();
if (backBuffer != null) {
Graphics g = backBuffer.getGraphics();
try {
Rectangle r = getBounds();
! g.setColor(getForeground());
! ((Graphics2D) g).setBackground(getBackground());
! g.clearRect(0, 0, r.width, r.height);
if (oldBB != null) {
// Draw the old back buffer to the new one
g.drawImage(oldBB, 0, 0, null);
oldBB.flush();
}