diff --git a/base/src/org/compiere/print/CPrinter.java b/base/src/org/compiere/print/CPrinter.java index af674fc535..fd85b7fc21 100644 --- a/base/src/org/compiere/print/CPrinter.java +++ b/base/src/org/compiere/print/CPrinter.java @@ -19,6 +19,8 @@ package org.compiere.print; import java.awt.event.*; import java.awt.print.*; import javax.print.*; +import javax.swing.DefaultComboBoxModel; + import org.compiere.swing.*; import org.compiere.util.*; @@ -36,6 +38,9 @@ public class CPrinter extends CComboBox implements ActionListener */ public static String[] getPrinterNames() { + // Refresh print services every time the combobox is constructed + s_services = PrintServiceLookup.lookupPrintServices(null,null); + String[] retValue = new String[s_services.length]; for (int i = 0; i < s_services.length; i++) retValue[i] = s_services[i].getName(); @@ -154,5 +159,13 @@ public class CPrinter extends CComboBox implements ActionListener } return PrintServiceLookup.lookupDefaultPrintService(); } // getPrintService + + /** + * Refresh printer list + */ + public void refresh() { + removeAllItems(); + setModel(new DefaultComboBoxModel(getPrinterNames())); + } } // CPrinter diff --git a/client/src/org/compiere/apps/ALogin.java b/client/src/org/compiere/apps/ALogin.java index 3a94e44add..c2fc8c54fb 100644 --- a/client/src/org/compiere/apps/ALogin.java +++ b/client/src/org/compiere/apps/ALogin.java @@ -438,8 +438,10 @@ public final class ALogin extends CDialog { if (e.getActionCommand().equals(ConfirmPanel.A_OK)) { - if (loginTabPane.getSelectedIndex() == 0) + if (loginTabPane.getSelectedIndex() == 0) { connectionOK(); // first ok + printerField.refresh(); + } else { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));