Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 39 additions & 38 deletions src/core/org/apache/jmeter/gui/action/AboutCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Set<String> getActionNames() {
* the product image and the copyright notice. The dialog box is centered
* over the MainFrame.
*/
void about() {
private void about() {
JFrame mainFrame = GuiPackage.getInstance().getMainFrame();
JDialog dialog = initDialog(mainFrame);

Expand All @@ -91,52 +91,53 @@ void about() {
Dimension d1 = mainFrame.getSize();
Dimension d2 = dialog.getSize();
dialog.setLocation(p.x + (d1.width - d2.width) / 2, p.y + (d1.height - d2.height) / 2);
dialog.pack();
dialog.setVisible(true);
}

/**
* @param mainFrame {@link JFrame}
* @return {@link JDialog} initializing it if necessary
*/
private static final JDialog initDialog(JFrame mainFrame) {
if (about == null) {
about = new EscapeDialog(mainFrame, "About Apache JMeter...", false);
about.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
about.setVisible(false);
}
});
private JDialog initDialog(JFrame mainFrame) {
if (about != null) {
return about;
}
about = new EscapeDialog(mainFrame, "About Apache JMeter", false);
about.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
about.setVisible(false);
}
});

JLabel jmeter = new JLabel(JMeterUtils.getImage("jmeter.png"));
JLabel copyright = new JLabel(JMeterUtils.getJMeterCopyright(), SwingConstants.CENTER);
JLabel rights = new JLabel("All Rights Reserved.", SwingConstants.CENTER);
JLabel version = new JLabel("Apache JMeter Version " + JMeterUtils.getJMeterVersion(), SwingConstants.CENTER);
JLabel releaseNotes = new JLabel("<html><a href=\"https://jmeter.apache.org/changes.html\">Release notes</a></html>", SwingConstants.CENTER);
releaseNotes.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() > 0) {
ActionRouter.getInstance().doActionNow(
new ActionEvent(e.getSource(), e.getID(), ActionNames.LINK_RELEASE_NOTES));
}
JLabel jmeterLogo = new JLabel(JMeterUtils.getImage("jmeter.png"));
JLabel copyright = new JLabel(JMeterUtils.getJMeterCopyright(), SwingConstants.CENTER);
JLabel rights = new JLabel("All Rights Reserved.", SwingConstants.CENTER);
JLabel version = new JLabel("Apache JMeter Version " + JMeterUtils.getJMeterVersion(), SwingConstants.CENTER);
JLabel releaseNotes = new JLabel("<html><a href=\"https://jmeter.apache.org/changes.html\">Release notes</a></html>", SwingConstants.CENTER);
releaseNotes.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() > 0) {
ActionRouter.getInstance().doActionNow(
new ActionEvent(e.getSource(), e.getID(), ActionNames.LINK_RELEASE_NOTES));
}
});
JPanel infos = new JPanel();
infos.setOpaque(false);
infos.setLayout(new GridLayout(0, 1));
infos.setBorder(new EmptyBorder(5, 5, 5, 5));
infos.add(copyright);
infos.add(rights);
infos.add(version);
infos.add(releaseNotes);
Container panel = about.getContentPane();
panel.setLayout(new BorderLayout());
panel.setBackground(Color.white);
panel.add(jmeter, BorderLayout.NORTH);
panel.add(infos, BorderLayout.SOUTH);
}
}
});
JPanel infos = new JPanel();
infos.setOpaque(false);
infos.setLayout(new GridLayout(0, 1));
infos.setBorder(new EmptyBorder(5, 5, 5, 5));
infos.add(copyright);
infos.add(rights);
infos.add(version);
infos.add(releaseNotes);
Container panel = about.getContentPane();
panel.setLayout(new BorderLayout());
panel.setBackground(Color.white);
panel.add(jmeterLogo, BorderLayout.NORTH);
panel.add(infos, BorderLayout.SOUTH);
about.pack();
return about;
}
}