Fix CFrame positioning on multiple monitors when opened from main menu.
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2975622
This commit is contained in:
parent
d12023af1e
commit
842ce2be4c
|
@ -145,9 +145,10 @@ public final class AEnv
|
|||
public static void positionScreen (Window window, int position)
|
||||
{
|
||||
window.pack();
|
||||
Dimension sSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
// take into account task bar and other adornments
|
||||
GraphicsConfiguration config = window.getGraphicsConfiguration();
|
||||
Rectangle bounds = config.getBounds();
|
||||
Dimension sSize = bounds.getSize();
|
||||
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(config);
|
||||
sSize.width -= (insets.left + insets.right);
|
||||
sSize.height -= (insets.top + insets.bottom);
|
||||
|
@ -201,7 +202,7 @@ public final class AEnv
|
|||
y = (sSize.height - wSize.height);
|
||||
}
|
||||
//
|
||||
window.setLocation(x + insets.left, y + insets.top);
|
||||
window.setLocation(bounds.x + x + insets.left, bounds.y + y + insets.top);
|
||||
} // positionScreen
|
||||
|
||||
/**
|
||||
|
|
|
@ -241,7 +241,7 @@ public class AMenuStartItem extends Thread implements ActionListener
|
|||
}
|
||||
|
||||
SwingUtilities.invokeLater(m_updatePB); // 1
|
||||
frame = new AWindow();
|
||||
frame = new AWindow(m_menu.getGraphicsConfiguration());
|
||||
boolean OK = false;
|
||||
if (AD_Workbench_ID != 0)
|
||||
OK = frame.initWorkbench(AD_Workbench_ID);
|
||||
|
@ -284,7 +284,7 @@ public class AMenuStartItem extends Thread implements ActionListener
|
|||
if (IsSOTrx != null && IsSOTrx.equals("Y"))
|
||||
isSO = true;
|
||||
m_timer.stop();
|
||||
ProcessDialog pd = new ProcessDialog (AD_Process_ID, isSO);
|
||||
ProcessDialog pd = new ProcessDialog (m_menu.getGraphicsConfiguration(), AD_Process_ID, isSO);
|
||||
if (!pd.init())
|
||||
return;
|
||||
m_timer.start();
|
||||
|
@ -333,7 +333,7 @@ public class AMenuStartItem extends Thread implements ActionListener
|
|||
return;
|
||||
}
|
||||
}
|
||||
ff = new FormFrame();
|
||||
ff = new FormFrame(m_menu.getGraphicsConfiguration());
|
||||
SwingUtilities.invokeLater(m_updatePB); // 1
|
||||
boolean ok = ff.openForm(AD_Form_ID);
|
||||
if (!ok) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.compiere.apps;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.Image;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
|
@ -44,11 +45,21 @@ public class AWindow extends CFrame
|
|||
private static final long serialVersionUID = -1925388774073536474L;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Standard Constructor - requires initWindow
|
||||
*/
|
||||
public AWindow ()
|
||||
{
|
||||
super();
|
||||
this(null);
|
||||
} // AWindow
|
||||
|
||||
/**
|
||||
* Standard Constructor - requires initWindow
|
||||
* @param gc
|
||||
*/
|
||||
public AWindow (GraphicsConfiguration gc)
|
||||
{
|
||||
super(gc);
|
||||
// Set UI Components
|
||||
this.setIconImage(Env.getImage("mWindow.gif"));
|
||||
this.getContentPane().add(m_APanel, BorderLayout.CENTER);
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.awt.BorderLayout;
|
|||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.sql.PreparedStatement;
|
||||
|
@ -74,6 +75,7 @@ public class ProcessDialog extends CFrame
|
|||
private static final long serialVersionUID = 790447068287846414L;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Dialog to start Process
|
||||
*
|
||||
* @param AD_Process_ID process
|
||||
|
@ -81,7 +83,20 @@ public class ProcessDialog extends CFrame
|
|||
*/
|
||||
public ProcessDialog (int AD_Process_ID, boolean isSOTrx)
|
||||
{
|
||||
super();
|
||||
this(null, AD_Process_ID, isSOTrx);
|
||||
|
||||
} // ProcessDialog
|
||||
|
||||
/**
|
||||
* Dialog to start Process
|
||||
*
|
||||
* @param gc
|
||||
* @param AD_Process_ID process
|
||||
* @param isSOTrx is sales trx
|
||||
*/
|
||||
public ProcessDialog (GraphicsConfiguration gc, int AD_Process_ID, boolean isSOTrx)
|
||||
{
|
||||
super(gc);
|
||||
log.info("Process=" + AD_Process_ID + "; SOTrx=" + isSOTrx);
|
||||
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
|
||||
m_AD_Process_ID = AD_Process_ID;
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.compiere.apps.form;
|
|||
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Event;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
@ -65,12 +66,23 @@ public class FormFrame extends CFrame
|
|||
private static final long serialVersionUID = 2559005548469735515L;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Create Form.
|
||||
* Need to call openForm
|
||||
*/
|
||||
public FormFrame ()
|
||||
{
|
||||
super();
|
||||
this(null);
|
||||
} // FormFrame
|
||||
|
||||
/**
|
||||
* Create Form.
|
||||
* Need to call openForm
|
||||
* @param gc
|
||||
*/
|
||||
public FormFrame (GraphicsConfiguration gc)
|
||||
{
|
||||
super(gc);
|
||||
addWindowListener(new java.awt.event.WindowAdapter()
|
||||
{
|
||||
public void windowOpened(java.awt.event.WindowEvent evt)
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.awt.Component;
|
|||
import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Event;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
@ -130,14 +131,24 @@ public class Viewer extends CFrame
|
|||
*/
|
||||
private static final long serialVersionUID = 7306392362119021781L;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Viewer Constructor
|
||||
* @param re report engine
|
||||
*/
|
||||
public Viewer (ReportEngine re)
|
||||
{
|
||||
super();
|
||||
this(null, re);
|
||||
}
|
||||
|
||||
/**
|
||||
* Viewer Constructor
|
||||
* @param gc
|
||||
* @param re report engine
|
||||
*/
|
||||
public Viewer (GraphicsConfiguration gc, ReportEngine re)
|
||||
{
|
||||
super(gc);
|
||||
log.info("");
|
||||
m_WindowNo = Env.createWindowNo(this);
|
||||
m_reportEngine = re;
|
||||
|
|
Loading…
Reference in New Issue