🔒 Closed Restart button or restart key

Status
Not open for further replies.
boss gising ka ?
paano maclose yung old program kasi once nag spacebar ako mag rrun ulit yung file pero naiiwang bukas yung naunang file
Initialize mo yung jframe sa labas para madispose sa Restart function.
Taos dispose mo, then setvisible mo again.
Code:
public static void Restart()
    {
        ex.setVisible(false);
        ex.dispose();
        EventQueue.invokeLater(() -> {
           ex = new Snake();
           ex.setVisible(true);
        });
    }
 
Initialize mo yung jframe sa labas para madispose sa Restart function.
Taos dispose mo, then setvisible mo again.
Code:
public static void Restart()
    {
        ex.setVisible(false);
        ex.dispose();
        EventQueue.invokeLater(() -> {
           ex = new Snake();
           ex.setVisible(true);
        });
    }

wait boss analyze ko lang to code mo ^_^ thanks po
 
Status
Not open for further replies.

About this Thread

  • 28
    Replies
  • 2K
    Views
  • 3
    Participants
Last reply from:
PHC-B L 4 C K

Trending Topics

Online now

Members online
1,056
Guests online
14,568
Total visitors
15,624

Forum statistics

Threads
2,366,047
Posts
29,432,943
Members
1,045,659
Latest member
ethanp
Back
Top