I have a frame (main
). There are two buttons: Items and Sale.
When I click button Items
it opens a frame (Items
)
and I want to, when I click on button Sale
, it should close the Items
and open Sale
.
This is Items
frame:
public class Items extends JFrame {
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Items frame = new Items();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
UPDATE :- here is my sale class
public class Sale extends JFrame {
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Sale frame = new Sale();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
No comments:
Post a Comment