简体   繁体   中英

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.

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

However, when I read chatlogs into the Jtextarea (the chatbox), the submenus appear behind the chat history label.

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

The label isn't a component of the 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. Use a JLabel which is a Swing component. – camickr

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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