Am 23. November 2017 23:21:45 MEZ schrieb [email protected]:
>Author: pmouawad
>Date: Thu Nov 23 22:21:45 2017
>New Revision: 1816193
>
>URL: http://svn.apache.org/viewvc?rev=1816193&view=rev
>Log:
>Bug 61808 - Fix main frame position
>Contributed by by Artem Fedorov
>This closes #338
>
>Bugzilla Id: 61808
>
>Modified:
> jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
> jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ComponentUtil.java
> jmeter/trunk/xdocs/changes.xml
>
>Modified: jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
>URL:
>http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java?rev=1816193&r1=1816192&r2=1816193&view=diff
>==============================================================================
>--- jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
>+++ jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Thu Nov 23
>22:21:45 2017
>@@ -376,7 +376,9 @@ public class JMeter implements JMeterPlu
> MainFrame main = new MainFrame(treeModel, treeLis);
> splash.setProgress(100);
> ComponentUtil.centerComponentInWindow(main, 80);
>+ main.setLocationRelativeTo(splash);
> main.setVisible(true);
>+ main.toFront();
>instance.actionPerformed(new ActionEvent(main, 1,
>ActionNames.ADD_ALL));
> if (testFile != null) {
> try {
>
>Modified:
>jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ComponentUtil.java
>URL:
>http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ComponentUtil.java?rev=1816193&r1=1816192&r2=1816193&view=diff
>==============================================================================
>--- jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ComponentUtil.java
>(original)
>+++ jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ComponentUtil.java
>Thu Nov 23 22:21:45 2017
>@@ -18,8 +18,7 @@
>
> package org.apache.jorphan.gui;
>
>-import java.awt.Component;
>-import java.awt.Dimension;
>+import java.awt.*;
I would like to disallow star imports.
This is the only place in our code base, where they are (now) used.
If no one disagrees, I will add a Checkstyle rule AvoidStarImport.
Felix
>
> /**
>* This class is a Util for awt Component and could be used to place
>them in
>@@ -49,8 +48,8 @@ public final class ComponentUtil {
> return;
> }
> double percent = percentOfScreen / 100.d;
>- Dimension dimension = component.getToolkit().getScreenSize();
>- component.setSize((int) (dimension.getWidth() * percent),
>(int) (dimension.getHeight() * percent));
>+ Rectangle bounds =
>GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getBounds();
>+ component.setSize((int) (bounds.getWidth() * percent), (int)
>(bounds.getHeight() * percent));
> centerComponentInWindow(component);
> }
>
>@@ -61,10 +60,9 @@ public final class ComponentUtil {
> * the component you want to center in window
> */
> public static void centerComponentInWindow(Component component) {
>- Dimension dimension = component.getToolkit().getScreenSize();
>-
>- component.setLocation((int) ((dimension.getWidth() -
>component.getWidth()) / 2),
>- (int) ((dimension.getHeight() - component.getHeight())
>/ 2));
>+ Rectangle bounds =
>GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getBounds();
>+ component.setLocation((int) ((bounds.getWidth() -
>component.getWidth()) / 2),
>+ (int) ((bounds.getHeight() - component.getHeight()) /
>2));
> component.validate();
> component.repaint();
> }
>
>Modified: jmeter/trunk/xdocs/changes.xml
>URL:
>http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1816193&r1=1816192&r2=1816193&view=diff
>==============================================================================
>--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
>+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Nov 23 22:21:45 2017
>@@ -171,6 +171,7 @@ Summary
><li><bug>61731</bug>Enhance Test plan Backup with option to save before
>run. Based on a contribution by orimarko at gmail.com</li>
><li><bug>61640</bug>JSR223 Test Elements : Enable by default caching.
>Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
><li><bug>61785</bug>Add
><menuchoice><guimenuitem>Help</guimenuitem><guimenuitem>Useful
>links</guimenuitem></menuchoice> to create issues and download nightly
>build</li>
>+ <li><bug>61808</bug>Fix main frame position. Implemented by Artem
>Fedorov (artem at blazemeter.com) and contributed by BlazeMeter
>Ltd.</li>
> </ul>
>
> <ch_section>Non-functional changes</ch_section>