简体   繁体   English

如何设置对象的可见性优先级? 聊天应用。 Java Jframe、Netbeans

[英]How do I set visibility priority of objects? Chat app. Java Jframe, Netbeans

I'm making a chat app.我正在制作一个聊天应用程序。 that looks like this:看起来像这样:

http://puu.sh/k5wsp/718e56afe1.png

I have a submenu called "private" that toggles the users rights to read chatlogs.我有一个名为“private”的子菜单,可以切换用户阅读聊天记录的权限。

http://puu.sh/k5wuR/493faddcb4.png

However, when I read chatlogs into the Jtextarea (the chatbox), the submenus appear behind the chat history label.但是,当我将聊天记录读入 Jtextarea(聊天框)时,子菜单出现在聊天记录标签后面。

http://puu.sh/k5wxY/b1e81160d3.png

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.

相关问题 单击 IntelliJ 按钮后,如何将 JFrame 的可见性设置为 False? - How do I set JFrame's visibility to False after button click on IntelliJ? 我如何将mysql的数据库连接方法存储在java netbeans类中,并在需要时在jFrame中调用它 - how do i store Database connectivity methods of mysql in a java netbeans class and call it whenever i need it in a jFrame 如何在NetBeans中设置我的JFrame的setDefaultCloseOperation()值? - How can I set my JFrame's setDefaultCloseOperation() value in NetBeans? 我想将聊天窗口/选项集成到我的 web 应用程序中。 我从哪说起呢? - I want to integrate a chat window/option into my web app. Where do I start? 如何在Netbeans中为Undecorated JFrame添加阴影 - How do I add shadow to Undecorated JFrame in Netbeans 如何在显示NetBeans中特定目录的JFrame中创建JTree? - How do I create a JTree in a JFrame showing a specific directory in NetBeans? Tomcat:如何在Netbeans中设置Java系统属性? - Tomcat: How do I set up a Java system property in Netbeans? 如何在NetBeans中向JFrame或JPanel添加对象数组? - How to add an array of objects to a JFrame or a JPanel in Netbeans? 如何从JFrame 2检索JFrame 1中设置的类字段 - How Do I Retrieve Class Fields Set in JFrame 1 from JFrame 2 创建一个多线程Java Server聊天应用程序。 - Creating a Multi-threaded Java Server Chat App.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM