Topic: 请问像QQ那样对话框或主程序的最大化,最小化,关闭是怎么实现的? |
Print this page |
1.请问像QQ那样对话框或主程序的最大化,最小化,关闭是怎么实现的? | Copy to clipboard |
Posted by: elliott Posted on: 2005-01-20 13:08 不是系统本身的那种最大化,小化关闭的按钮... 它是不是把标题栏去掉,然后自已画了张图片在上面,包括那些最大化,小化等图标. 然后自已监时事件,看是否有鼠标移动到上面? 是的话,就把图标加亮? 当用户点击就关闭? |
2.Re:请问像QQ那样对话框或主程序的最大化,最小化,关闭是怎么实现的? [Re: elliott] | Copy to clipboard |
Posted by: elysium922 Posted on: 2005-01-20 17:11 Basically, that is the way of it. As you can't directly overwrite the paint mechanism of the title bar and its buttons in Java (or can you?), you have to use a stripped down window without all these stuff and draw everything yourself. BTW, you can use the same technique to draw custom widgets (or components, as they're called in Java), though you might want to use a custom look-and-feel instead of reinventing the wheel. |
3.Re:请问像QQ那样对话框或主程序的最大化,最小化,关闭是怎么实现的? [Re: elliott] | Copy to clipboard |
Posted by: elysium922 Posted on: 2005-01-20 17:17 Sorry, I reached this link from the "latest posts" list and I thought your question is about Swing. Anyway, I don't think you can do that in SWT either, although I'm not completely sure about it. Anyway, take a look at lumaQQ (is this spelling correct?), which is a Java implementation of QQ, using SWT as its UI library. |
4.Re:请问像QQ那样对话框或主程序的最大化,最小化,关闭是怎么实现的? [Re: elliott] | Copy to clipboard |
Posted by: kite Posted on: 2005-01-24 11:04 用SWT完全可以做到 |
5.Re:请问像QQ那样对话框或主程序的最大化,最小化,关闭是怎么实现的? [Re: elliott] | Copy to clipboard |
Posted by: elliott Posted on: 2005-01-24 13:15 请问能否简单的描述一下该怎么做么? 谢谢.. 或能否留个MSN或QQ,指点一下小弟.. |
6.Re:请问像QQ那样对话框或主程序的最大化,最小化,关闭是怎么实现的? [Re: elliott] | Copy to clipboard |
Posted by: kite Posted on: 2005-01-24 18:28 你可以创建一个shell使用NO_TRIM属性,这样,你就获得了一个没有titlebar的窗口,然后用layout控制你的button所在的位置即可。在这种情况下的shell你可以通过api控制shell的最大化,最小化,关闭等,至于这些button的美化,你怎么做都可以,事件的监听就跟你自己说的一样。 如: final Shell mainWin = new Shell(display,SWT.NO_TRIM); shell.setLayout(new GridLayout()); Button maxButton = new Button(mainWin,SWT.NONE); Button closeButton = new Button(mainWin,SWT.NONE); closeButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent event) { mainWin.dispose(); } }); |
7.Re:请问像QQ那样对话框或主程序的最大化,最小化,关闭是怎么实现的? [Re: elliott] | Copy to clipboard |
Posted by: cnfree Posted on: 2005-02-17 22:05 SWT.NO_TRIM,采用这个属性之后,窗口最大化最好不要使用setMaximized()方法,否则会覆盖到整个窗口,只能采用setSize来控制,Window操作系统底部一行高度为28。 最后改变布局只用重新调用layout方法就可以了 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |