How to recreate resources file in Unicenta?

If you have accidentally delete the resources file or its content in unicenta and wondering how to restore them?

Here we are going to recreate “Ticket.Close” as the example.

Step 1 – to recreate Ticket.Close

You can locate this screen in Unicenta "Administration" panel, "Maintenance", Under "Resources"

Step 2 – copy and paste the code

Name the resource to “Ticket.Close” and choose its format as text.

Hit “Save” button before leave this screen.




Here's the original content of "Ticket.Close"

import java.awt.Font;
import javax.swing.plaf.FontUIResource;
import com.openbravo.pos.payment.PaymentInfo;
import javax.swing.JOptionPane;
import javax.swing.JDialog;
boolean isCash = false;
String change = "";
PaymentInfo p = ticket.payments.getFirst();
if ("cash".equals(p.getName())) {
isCash = true;
change = p.printChange();
// Get details of the original font before we change it otherwise all dialogboxes will use new settings
JOptionPane pane = new JOptionPane();
Font originalFont=pane.getFont();
UIManager.put("OptionPane.buttonFont", new FontUIResource(new Font("ARIAL",Font.PLAIN,20)));
message = "Change: " + change;
JLabel FontText = new JLabel(message);
FontText.setFont (new Font ( "Arial", Font.BOLD, 36) );
if(isCash) {
JOptionPane pane = new JOptionPane();
pane.setPreferredSize( new Dimension(450,150));
JDialog dialog = pane.createDialog("Cash payment");
new Thread(new Runnable() {
void run() {;
// Return to default settings
UIManager.put("OptionPane.buttonFont", new FontUIResource(new Font(originalFont.getName(),originalFont.getStyle(),originalFont.getSize())));

Before you edit any resource file, it’s recommended to copy and paste then in a text editor and save as a copy.