Computer Science Canada How to make a JInternalFrame non-clickable? |
Author: | Blockgen [ Fri Jun 07, 2013 8:27 pm ] |
Post subject: | How to make a JInternalFrame non-clickable? |
I'm trying to make a game where you have to shoot down a certain object based on certain information. I want to display this information in a JInternalFrame. However if someone clicks or closes the JInternalFrame, then they cannot return to the game, it will just be frozen. Is there a way to avoid this? |
Author: | Zren [ Fri Jun 07, 2013 8:39 pm ] |
Post subject: | RE:How to make a JInternalFrame non-clickable? |
Did you look at the documentation for the class? |
Author: | Blockgen [ Fri Jun 07, 2013 9:02 pm ] | ||||
Post subject: | Re: How to make a JInternalFrame non-clickable? | ||||
Just did. The most relevant method is the isSelected method, which i can use in an if statement so that if isSelected == true then I can dispose of it. However I don't know where exactly to put it, since I'm using JLayeredPane as well, and that doesn't give me a name for the JInternalFrame. Here is my code for reference:
Here's the InternalFrameMaker class
|
Author: | Zren [ Fri Jun 07, 2013 9:04 pm ] |
Post subject: | RE:How to make a JInternalFrame non-clickable? |
What about setCloseable()? |
Author: | Blockgen [ Fri Jun 07, 2013 9:12 pm ] |
Post subject: | Re: How to make a JInternalFrame non-clickable? |
They'll still be able to click it, which will make the program useless. Even if the JInternalFrame is gone, it still won't work . |
Author: | Blockgen [ Fri Jun 07, 2013 9:14 pm ] |
Post subject: | Re: How to make a JInternalFrame non-clickable? |
Wow. I just tried the program again, and when I closed the JInternalFrame, the game kept working. And now I tried it again, and it doesn't. |
Author: | Blockgen [ Fri Jun 07, 2013 9:21 pm ] |
Post subject: | Re: How to make a JInternalFrame non-clickable? |
Hmm, so apparently I have to click outside the whole JFrame, and then click it again to make it work. Do you know of a possible way to circumvent this? |
Author: | chromium [ Sat Jun 08, 2013 9:08 am ] |
Post subject: | Re: How to make a JInternalFrame non-clickable? |
.setEnabled(false) |
Author: | Blockgen [ Sat Jun 08, 2013 4:31 pm ] |
Post subject: | Re: How to make a JInternalFrame non-clickable? |
I can't do that because I'm extending the JInternalFrame. So if I were to make a button, I'd have no variable to put for it. |
Author: | Zren [ Sat Jun 08, 2013 4:45 pm ] |
Post subject: | RE:How to make a JInternalFrame non-clickable? |
I just noticed you put setClosable(true). Don't you want setClosable(false)? |
Author: | chromium [ Sat Jun 08, 2013 4:54 pm ] |
Post subject: | Re: How to make a JInternalFrame non-clickable? |
ERMAHGERD Some one haaalppp me pleaasee: http://compsci.ca/v3/viewtopic.php?t=33643 |
Author: | Blockgen [ Sat Jun 08, 2013 7:20 pm ] |
Post subject: | Re: How to make a JInternalFrame non-clickable? |
If I set it to false, then If someone was to click the JInternalFrame, then there would be no way to return to the game. |
Author: | Brendon77 [ Sat Jul 20, 2013 12:19 am ] |
Post subject: | Re: How to make a JInternalFrame non-clickable? |
If you know please tell me, what way is best for return the game? |
Author: | Zren [ Sat Jul 20, 2013 11:34 am ] |
Post subject: | Re: How to make a JInternalFrame non-clickable? |
Brendon77 @ Sat Jul 20, 2013 12:19 am wrote: If you know please tell me, what way is best for return the game?
Eh? |
Author: | nullptr [ Sun Jul 21, 2013 9:45 pm ] |
Post subject: | Re: How to make a JInternalFrame non-clickable? |
If I'm understanding you correctly, you want an area that can't be clicked or closed, and that's part of the UI. In that case, why not just use a JPanel or a JTextArea? |