How to open new JFrame by clicking on button in other JFrame?

How to maximize JFrame?

  • I want to know how to maximize a JFrame, and I know I can do: setExtendedState(JFrame.MAXIMIZED_BOTH) but the problem with that is that the Maximize button is still there, instead of it being changed to a minimize button like it should be. So basically, how do I simulate a click to the maximize button?

  • Answer:

    You can do it in actionPerformed function. public void actionPerformed(ActionEvent e) { if("Maximize".equals(e.getActionCommand(… { maximizeFrame(frame); } } Here "frame" is the name of your JFrame. And remember, to be able to access the frame in this function; declare "JFrame frame;" inside the class and outside any other function.

Austin at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.