|
10 | 10 | import com.openfin.desktop.channel.ChannelClient; |
11 | 11 | import com.openfin.desktop.win32.ExternalWindowObserver; |
12 | 12 | import com.sun.jna.Native; |
13 | | -import com.sun.jna.platform.win32.User32; |
14 | 13 | import com.sun.jna.platform.win32.WinDef; |
15 | 14 |
|
16 | 15 | import org.json.JSONArray; |
@@ -214,27 +213,14 @@ private void setHasFrame(JFrame frame, boolean hasFrame) { |
214 | 213 | @Override |
215 | 214 | public void run() { |
216 | 215 | System.out.println(windowName + " hasFrame=" + hasFrame); |
217 | | - |
218 | | - Dimension size = frame.getSize(); |
219 | 216 | WinDef.HWND hWnd = new WinDef.HWND(); |
220 | 217 | hWnd.setPointer(Native.getComponentPointer(frame)); |
221 | | - |
222 | | - int style = User32.INSTANCE.GetWindowLong(hWnd, User32.GWL_STYLE); |
223 | | - |
224 | | - if (hasFrame) { |
225 | | - frame.setResizable(true); |
226 | | -// style = style & ~User32.WS_CHILD; |
227 | | - style = style | User32.WS_CAPTION | User32.WS_BORDER | User32.WS_THICKFRAME; |
228 | | - } else { |
229 | | - frame.setResizable(false); |
230 | | - style = style &~ User32.WS_CAPTION &~ User32.WS_BORDER &~ User32.WS_THICKFRAME; |
231 | | -// style = style | User32.WS_CHILD; |
232 | | - } |
233 | | - User32.INSTANCE.SetWindowLong(hWnd, User32.GWL_STYLE, style); |
234 | | - User32.INSTANCE.RedrawWindow(hWnd, null, null, new WinDef.DWORD((User32.RDW_FRAME | User32.RDW_INVALIDATE))); |
235 | | - frame.setSize(size.width, size.height + 1); |
| 218 | + LayoutFrame.this.externalWindowObserver.setHasFrame(hWnd, hasFrame); |
| 219 | + frame.setResizable(hasFrame); |
236 | 220 | frame.invalidate(); |
| 221 | + frame.validate(); |
237 | 222 | frame.repaint(); |
| 223 | + SwingUtilities.updateComponentTreeUI(frame); |
238 | 224 | } |
239 | 225 | }); |
240 | 226 | } |
|
0 commit comments