简体   繁体   English

JFrame标题栏重叠图形

[英]JFrame title bar overlapping graphics

i was following the David Brackeen's Developing Games in Java book and i made a simple script that allows to enter windowed mode. 我正在关注David Brackeen的Java开发游戏书,我制作了一个简单的脚本,允许进入窗口模式。 Well .. the problem is that when i draw the buttons the title bar overlaps them . 嗯..问题是,当我绘制按钮时,标题栏与它们重叠。 Is there a way to fix it ? 有办法解决吗?

ScreenShot: 截图:

在此输入图像描述 See it? 看见? The bar overlaps the buttons! 酒吧与按钮重叠!

Here is the netbeans project (the main source file is MenuTest): http://www.mediafire.com/?tyc16am8ga517c7 这是netbeans项目(主要源文件是MenuTest): http//www.mediafire.com/ ? tyc16am8ga517c7

1) use proper LayoutManager instead of setSize / setBounds 1)使用适当的LayoutManager而不是setSize / setBounds

2) use paintComponent() for Swing JComponents instead of paint() method 2)使用paintComponent()为Swing JComponents而不是paint()方法

3) use KeyBindinds rather than KeyListener 3)使用KeyBindinds而不是KeyListener

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM