Question about GUI with JFrame

+1 Ammar Zakaria · December 30, 2015
How do you add a button in the middle of the screen with text on it, like "Start" for example, that when you click on it, it opens a new window?
Thank you.

Post a Reply

Replies

Oldest  Newest  Rating
+1 Nicholas Eason · December 31, 2015
Well, set the JFrame's layout to BorderLayout, then place the button in BorderLayout.CENTER

Next, add an action listener to the button, and inside the actionPerformed method, create a new JFrame like you did with the original one
  • 1

Java / Android Development

107,278 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator