all windows and dialogs through the gui which extend the SIPCommDialog and the SIPCommFrame should not set explicetly the center location as it is already set in the parent.

cusax-fix
Yana Stamcheva 20 years ago
parent 89482544b5
commit 4e43468f28

@ -89,7 +89,7 @@ public void start(BundleContext bundleContext) throws Exception {
WelcomeWindow welcomeWindow = new WelcomeWindow(communicatorMain,
loginManager);
welcomeWindow.showWindow();
welcomeWindow.setVisible(true);
} finally {
logger.logExit();

@ -66,8 +66,6 @@ public class MessageDialog
public MessageDialog(Frame owner) {
super(owner);
this.setLocationRelativeTo(owner);
this.setTitle(Messages.getString("removeContact"));
this.setSize(Constants.MSG_DIALOG_WIDTH, Constants.MSG_DIALOG_HEIGHT);

@ -28,7 +28,7 @@ public SIPCommDialog(Dialog owner)
this.addWindowListener(new DialogWindowAdapter());
this.initInputMap();
this.initInputMap();
}
public SIPCommDialog(Frame owner)
@ -37,7 +37,7 @@ public SIPCommDialog(Frame owner)
this.addWindowListener(new DialogWindowAdapter());
this.initInputMap();
this.initInputMap();
}
private void initInputMap()
@ -129,7 +129,8 @@ private void saveSizeAndLocation()
/**
* Sets window size and position.
*/
private void setSizeAndLocation() {
private void setSizeAndLocation()
{
ConfigurationService configService
= GuiActivator.getConfigurationService();
@ -154,8 +155,9 @@ private void setSizeAndLocation() {
if(x != null && y != null)
this.setLocation(new Integer(x).intValue(),
new Integer(y).intValue());
else
else {
this.setCenterLocation();
}
}
/**

@ -37,7 +37,8 @@ public SIPCommFrame()
imap = this.getRootPane().getInputMap(
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "close");
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "close");
}
/**

@ -111,33 +111,7 @@ public void windowClosing(WindowEvent e) {
private void setTransparent(boolean transparent) {
this.buttonPanel.setOpaque(!transparent);
}
/**
* Shows this window.
*/
public void showWindow() {
this.pack();
this.setWindowLocation();
this.setVisible(true);
}
/**
* Sets the location of this window.
*/
private void setWindowLocation() {
int x = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth()
- this.getWidth()) / 2;
int y = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight()
- this.getHeight()) / 2;
this.setLocation(x, y);
}
/**
* Constructs the window background in order to have a background image.
*/

@ -149,14 +149,7 @@ public AuthorizationRequestedDialog(MainFrame mainFrame, Contact contact,
this.getContentPane().add(mainPanel);
this.setSize(new Dimension(550, 400));
this.setLocation(
Toolkit.getDefaultToolkit().getScreenSize().width/2
- this.getWidth()/2,
Toolkit.getDefaultToolkit().getScreenSize().height/2
- this.getHeight()/2
);
this.setSize(new Dimension(550, 400));
}
/**

@ -116,14 +116,7 @@ else if(responseCode.equals(AuthorizationResponse.REJECT)) {
this.getContentPane().add(mainPanel);
this.setSize(new Dimension(400, 200));
this.setLocation(
Toolkit.getDefaultToolkit().getScreenSize().width/2
- this.getWidth()/2,
Toolkit.getDefaultToolkit().getScreenSize().height/2
- this.getHeight()/2
);
this.setSize(new Dimension(400, 200));
}
/**

@ -125,14 +125,7 @@ public RequestAuthorizationDialog(MainFrame mainFrame, Contact contact,
this.getContentPane().add(mainPanel);
this.setSize(new Dimension(400, 300));
this.setLocation(
Toolkit.getDefaultToolkit().getScreenSize().width/2
- this.getWidth()/2,
Toolkit.getDefaultToolkit().getScreenSize().height/2
- this.getHeight()/2
);
this.setSize(new Dimension(400, 300));
}
/**

@ -220,13 +220,6 @@ public void actionPerformed(ActionEvent evt) {
wizard.setTitle(
Messages.getString("accountRegistrationWizard"));
wizard.setLocation(
Toolkit.getDefaultToolkit().getScreenSize().width/2
- 250,
Toolkit.getDefaultToolkit().getScreenSize().height/2
- 100
);
wizard.newAccount();
wizard.showDialog(false);
@ -241,13 +234,6 @@ else if (sourceButton.equals(modifyButton)) {
wizard.setTitle(
Messages.getString("accountRegistrationWizard"));
wizard.setLocation(
Toolkit.getDefaultToolkit().getScreenSize().width/2
- 250,
Toolkit.getDefaultToolkit().getScreenSize().height/2
- 100
);
ProtocolProviderService protocolProvider
= (ProtocolProviderService)tableModel.getValueAt(
accountsTable.getSelectedRow(), 0);

@ -80,14 +80,7 @@ public void actionPerformed(ActionEvent e)
}
});
this.getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
this.setLocation(
Toolkit.getDefaultToolkit().getScreenSize().width/2
- this.getWidth()/2,
Toolkit.getDefaultToolkit().getScreenSize().height/2
- this.getHeight()/2
);
this.getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
}
/**

@ -34,7 +34,7 @@ public class MoveSubcontactMessageDialog
= new JLabel(Messages.getString("moveSubcontact"));
private JLabel iconLabel = new JLabel(
new ImageIcon(ImageLoader.getImage(ImageLoader.WARNING_ICON)));
new ImageIcon(ImageLoader.getImage(ImageLoader.INFO_ICON)));
private JButton cancelButton = new JButton(Messages.getString("cancel"));
@ -65,8 +65,6 @@ public MoveSubcontactMessageDialog(MainFrame parentWindow,
this.mainPanel.setPreferredSize(
new Dimension(dialogWidth, dialogHeight));
this.computeDialogLocation(mainFrame);
this.cancelButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
dispose();
@ -105,7 +103,7 @@ public void actionPerformed(ActionEvent e) {
* or the right side of the main application window.
* @param parentWindow the main application window
*/
private void computeDialogLocation(JFrame parentWindow)
private void setDialogLocation(JFrame parentWindow)
{
int dialogY = (int) Toolkit.getDefaultToolkit()
.getScreenSize().getHeight()/2 - dialogHeight/2;
@ -126,4 +124,11 @@ protected void close(boolean isEscaped)
{
this.cancelButton.doClick();
}
public void setVisible(boolean isVisible)
{
super.setVisible(isVisible);
this.setDialogLocation(mainFrame);
}
}

@ -62,25 +62,9 @@ public AddContactWizard(MainFrame mainFrame)
this.setCurrentPage(AddContactWizardPage1.IDENTIFIER);
this.centerWizard();
this.mainFrame.getContactList().addMetaContactListListener(this);
}
/**
* Sets the location of the wizard at the center of the screen.
*/
public void centerWizard()
{
this.setLocation(
Toolkit.getDefaultToolkit().getScreenSize().width/2
- 250,
Toolkit.getDefaultToolkit().getScreenSize().height/2
- 100
);
}
/**
* Overrides the Wizard.showModalDialog method.
*/

@ -57,9 +57,6 @@ public CreateGroupDialog(MainFrame mainFrame) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setSize(520, 250);
this.setLocation((int)screenSize.getWidth()/2 - getWidth()/2,
(int)screenSize.getHeight()/2 - getHeight()/2);
this.init();
}

@ -187,10 +187,6 @@ private void showAccountRegistrationWizard()
wizard.setTitle(Messages.getString("accountRegistrationWizard"));
wizard.setLocation(
Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 250,
Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 100);
wizard.newAccount(noAccountFoundPage.getIdentifier());
wizard.showDialog(true);

@ -112,13 +112,6 @@ public void actionPerformed(ActionEvent e) {
wizard.setTitle(
Messages.getString("accountRegistrationWizard"));
wizard.setLocation(
Toolkit.getDefaultToolkit().getScreenSize().width/2
- 250,
Toolkit.getDefaultToolkit().getScreenSize().height/2
- 100
);
wizard.newAccount();
wizard.showDialog(false);

@ -130,18 +130,7 @@ public void init()
{
this.getContentPane().add(menusPanel, BorderLayout.NORTH);
}
/**
* Positions this window in the center of the screen.
*/
private void setCenterLocation()
{
this.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2
- this.getWidth() / 2,
Toolkit.getDefaultToolkit().getScreenSize().height / 2
- this.getHeight() / 2);
}
/**
* Returns the main application widnow.
*

Loading…
Cancel
Save