没有 AWT 的 Java GUI 侦听器 [英] Java GUI listeners without AWT

查看:17
本文介绍了没有 AWT 的 Java GUI 侦听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名初级 Java 开发人员,仅从互联网教程中学习.我正在学习全屏 GUI 应用程序.昨天有人告诉我,我不应该在我的程序中使用 AWT,因为它已经过时了.我已经知道轻量级和重量级组件,主要问题是鼠标和键盘侦听器.为什么 AWT 已经过时了?如何制作没有AWT的程序(给JComponents等添加监听器)(什么样的Swing东西可以代替AWT)?

I am a starting Java developer, learning just from internet tutorials. I am learning full screen GUI applications. I was told yesterday that I shouldn't use AWT in my programs, because it is outdated. I already know about light and heavyweight components, the main problem is the mouse and keyboard listeners. Why is AWT outdated? How to make a program without AWT (adding listeners to JComponents etc) (what kind of Swing things can replace the AWT)?

推荐答案

您误解了提供给您的信息.您应该避免将 Swing 组件与 AWT 组件 一起使用.可以将 Swing 与 AWT 侦听器结构、布局管理器等一起使用,实际上不可能不这样做.

You're mis-interpreting the information given to you. You should avoid using Swing components with AWT components. It's OK to use Swing with the AWT listener structure, layout managers, etc. and in fact it's impossible not to.

这篇关于没有 AWT 的 Java GUI 侦听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆