[英]How do I set visibility priority of objects? Chat app. Java Jframe, Netbeans
I'm making a chat app.我正在制作一个聊天应用程序。 that looks like this:看起来像这样:
I have a submenu called "private" that toggles the users rights to read chatlogs.我有一个名为“private”的子菜单,可以切换用户阅读聊天记录的权限。
However, when I read chatlogs into the Jtextarea (the chatbox), the submenus appear behind the chat history label.但是,当我将聊天记录读入 Jtextarea(聊天框)时,子菜单出现在聊天记录标签后面。
The label isn't a component of the Jtextarea.标签不是 Jtextarea 的组件。 How do I fix this?我该如何解决?
EDIT More information.编辑更多信息。 I know that the problem occurs when I read in a chatlog, because I no longer have this problem when removing the following from the code.我知道当我在聊天记录中阅读时会出现问题,因为从代码中删除以下内容时不再出现此问题。 chatBox.read(reader, chatLog);
What I mean by not having this problem is, I can toggle the private on and off and click on objects in the friendlist, without the "chatroom" label getting in the way of the submenu.没有这个问题的意思是,我可以打开和关闭私人并单击好友列表中的对象,而“聊天室”标签不会妨碍子菜单。
Don't use a Label.不要使用标签。 That is an AWT component.那是一个 AWT 组件。 Use a JLabel which is a Swing component.使用作为 Swing 组件的 JLabel。 – camickr – camickr
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.