Friday 8 June 2018

java - Is displaying a new JFrame a good pratice?

I have a class called NewSale which extends JFrame



The JFrame is used by the user to create a sale (add products, choose payment method, etc).



When the user starts a new sale the software instantiates the NewSale class.



But when a NewSale is already instantiated the software disposes the older one and starts a new one.



Like this:




// declaration
public static NewSale newSale;

// the menu item calls this method
public static void startNewSale(){
try{
newSale.dispose();
}catch(Exception e{
}


newSale = newSale();
}


My question is: Is this a good practice or is there a better way to do it?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...