mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-26 07:40:09 +00:00
8073420: JFrame.EXIT_ON_CLOSE can be removed in favour of WindowConstants.EXIT_ON_CLOSE
Reviewed-by: art, azvegint, alexsch
This commit is contained in:
parent
3ca192f3b3
commit
8def2a3e45
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -61,6 +61,7 @@ import javax.swing.BoxLayout;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@ -698,7 +699,7 @@ public class J2DBench {
|
||||
}
|
||||
};
|
||||
guiFrame = f;
|
||||
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
f.getContentPane().setLayout(new BorderLayout());
|
||||
f.getContentPane().add(Group.root.getJComponent(), BorderLayout.CENTER);
|
||||
JPanel p = new JPanel();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -135,7 +135,7 @@ public final class SampleTree {
|
||||
panel.add("Center", sp);
|
||||
panel.add("South", constructOptionsPanel());
|
||||
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -410,7 +410,7 @@ public class JTop extends JPanel {
|
||||
private static void createAndShowGUI(JPanel jtop) {
|
||||
// Create and set up the window.
|
||||
JFrame frame = new JFrame("JTop");
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
|
||||
// Create and set up the content pane.
|
||||
JComponent contentPane = (JComponent) frame.getContentPane();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -127,16 +127,6 @@ public class JFrame extends Frame implements WindowConstants,
|
||||
RootPaneContainer,
|
||||
TransferHandler.HasGetTransferHandler
|
||||
{
|
||||
/**
|
||||
* The exit application default window close operation. If a window
|
||||
* has this set as the close operation and is closed in an applet,
|
||||
* a <code>SecurityException</code> may be thrown.
|
||||
* It is recommended you only use this in an application.
|
||||
*
|
||||
* @since 1.3
|
||||
*/
|
||||
public static final int EXIT_ON_CLOSE = 3;
|
||||
|
||||
/**
|
||||
* Key into the AppContext, used to check if should provide decorations
|
||||
* by default.
|
||||
@ -352,7 +342,7 @@ public class JFrame extends Frame implements WindowConstants,
|
||||
* objects.
|
||||
*
|
||||
* <li><code>EXIT_ON_CLOSE</code>
|
||||
* (defined in <code>JFrame</code>):
|
||||
* (defined in <code>WindowConstants</code>):
|
||||
* Exit the application using the <code>System</code>
|
||||
* <code>exit</code> method. Use this only in applications.
|
||||
* </ul>
|
||||
@ -393,7 +383,9 @@ public class JFrame extends Frame implements WindowConstants,
|
||||
operation != HIDE_ON_CLOSE &&
|
||||
operation != DISPOSE_ON_CLOSE &&
|
||||
operation != EXIT_ON_CLOSE) {
|
||||
throw new IllegalArgumentException("defaultCloseOperation must be one of: DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, DISPOSE_ON_CLOSE, or EXIT_ON_CLOSE");
|
||||
throw new IllegalArgumentException("defaultCloseOperation must be"
|
||||
+ " one of: DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE,"
|
||||
+ " DISPOSE_ON_CLOSE, or EXIT_ON_CLOSE");
|
||||
}
|
||||
|
||||
if (operation == EXIT_ON_CLOSE) {
|
||||
@ -861,7 +853,7 @@ public class JFrame extends Frame implements WindowConstants,
|
||||
defaultCloseOperationString = "DISPOSE_ON_CLOSE";
|
||||
} else if (defaultCloseOperation == DO_NOTHING_ON_CLOSE) {
|
||||
defaultCloseOperationString = "DO_NOTHING_ON_CLOSE";
|
||||
} else if (defaultCloseOperation == 3) {
|
||||
} else if (defaultCloseOperation == EXIT_ON_CLOSE) {
|
||||
defaultCloseOperationString = "EXIT_ON_CLOSE";
|
||||
} else defaultCloseOperationString = "";
|
||||
String rootPaneString = (rootPane != null ?
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -103,7 +103,7 @@ import java.security.PrivilegedAction;
|
||||
*
|
||||
* private static void createAndShowGUI() {
|
||||
* final JFrame frame = new JFrame();
|
||||
* frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
* frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
*
|
||||
* // work with the layer as with any other Swing component
|
||||
* frame.add(createLayer());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user