File tree Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change 22import javax .swing .*;
33import java .awt .event .*;
44
5- public class Main extends JFrame {
5+ public class Main extends JFrame {
66 // Menubar
77 static JMenuBar menuBar ;
88
@@ -48,7 +48,7 @@ public class Main extends JFrame {
4848
4949 setTitle ("Eightsoft" );
5050 setSize (800 , 800 );
51- // setLocation(200, 100 );
51+ setLocation (300 , 5 );
5252 setVisible (true );
5353 setDefaultCloseOperation (JFrame .EXIT_ON_CLOSE );
5454 }
@@ -64,6 +64,7 @@ public void actionPerformed(ActionEvent e) {
6464 else if (e .getSource () == menuItem2 ) {
6565 // Creating Object
6666 Sorting sort = new Sorting ();
67+ setVisible (false ); // will close the previous window
6768 System .out .println ("Menu Item 2 choosed" );
6869 }
6970 else if (e .getSource () == menuItem2 ) {
Original file line number Diff line number Diff line change @@ -54,15 +54,9 @@ public class Sorting extends Main {
5454 pPanel1 .setBackground (Color .CYAN );
5555 pPanel2 .setBackground (Color .YELLOW );
5656
57- // pPanel1.add(p1Sorting);
58- // pPanel2.add(p2Sorting);
59- // p1Sorting.setVisible(true);
60- // p2Sorting.setVisible(true);
61-
6257 // Add Panels to the panel
6358 add (pPanel1 , BorderLayout .NORTH );
6459 add (pPanel2 , BorderLayout .CENTER );
6560
6661 }
67-
6862}
You can’t perform that action at this time.
0 commit comments