Short IF - ELSE statement

前端 未结 6 1893
萌比男神i
萌比男神i 2020-11-27 04:15

I\'m trying to make my code more readable, so I decided to use some short IF statements.

Here\'s my code which doesn\'t work (\"not a statement\"):

         


        
6条回答
  •  时光取名叫无心
    2020-11-27 04:31

    I'm a little late to the party but for future readers.

    From what i can tell, you're just wanting to toggle the visibility state right? Why not just use the ! operator?

    jxPanel6.setVisible(!jxPanel6.isVisible);
    

    It's not an if statement but I prefer this method for code related to your example.

提交回复
热议问题