Skip to content

Commit 8821b00

Browse files
alisenchungaivanov-jdk
authored andcommitted
8205137: Remove Applet support from SwingSet2
8205139: Remove Applet support from J2Ddemo Reviewed-by: aivanov, kizune
1 parent 57fe11c commit 8821b00

21 files changed

+330
-330
lines changed

src/demo/share/README

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,3 @@ deliberately simplified. Additional steps required for a
44
production-quality application, such as security checks, input
55
validation, and proper error handling, might not be present in the
66
sample code.
7-
8-
In some cases, the default security settings may block an execution
9-
of demo applets in a browser. To adjust the security settings, please
10-
refer to the following resource:
11-
12-
http://java.com/en/download/help/java_blocked.xml
13-
14-
Some demo applets need to be accessed through the HTTP or HTTPS
15-
protocols to enable access to the required resources.

src/demo/share/jfc/J2Ddemo/java2d/J2Ddemo.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
66
* modification, are permitted provided that the following conditions
@@ -109,7 +109,6 @@ public class J2Ddemo extends JPanel implements ItemListener, ActionListener, Dem
109109
{ "Paths", "Append", "CurveQuadTo", "FillStroke", "WindingRule" },
110110
{ "Transforms", "Rotate", "SelectTx", "TransformAnim" }
111111
};
112-
private final boolean demoIsInApplet;
113112
private JCheckBoxMenuItem controlsCB;
114113
private JMenuItem runMI, cloneMI, fileMI, backgMI;
115114
// private JMenuItem ccthreadMI, verboseMI;
@@ -122,8 +121,7 @@ public class J2Ddemo extends JPanel implements ItemListener, ActionListener, Dem
122121
/**
123122
* Construct the J2D Demo.
124123
*/
125-
public J2Ddemo(boolean demoIsInApplet, DemoProgress progress, RunWindowSettings runWndSetts) {
126-
this.demoIsInApplet = demoIsInApplet;
124+
public J2Ddemo(DemoProgress progress, RunWindowSettings runWndSetts) {
127125
this.runWndSetts = runWndSetts;
128126

129127
setLayout(new BorderLayout());
@@ -171,11 +169,9 @@ private JMenuBar createMenuBar() {
171169
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
172170
JMenuBar menuBar = new JMenuBar();
173171

174-
if (!demoIsInApplet) {
175-
JMenu file = menuBar.add(new JMenu("File"));
176-
fileMI = file.add(new JMenuItem("Exit"));
177-
fileMI.addActionListener(this);
178-
}
172+
JMenu file = menuBar.add(new JMenu("File"));
173+
fileMI = file.add(new JMenuItem("Exit"));
174+
fileMI.addActionListener(this);
179175

180176
JMenu options = menuBar.add(new JMenu("Options"));
181177

@@ -239,11 +235,7 @@ public void windowClosed(WindowEvent e) {
239235
rf.addWindowListener(l);
240236
rf.getContentPane().add("Center", runwindow);
241237
rf.pack();
242-
if (!demoIsInApplet) {
243-
rf.setSize(new Dimension(200, 125));
244-
} else {
245-
rf.setSize(new Dimension(200, 150));
246-
}
238+
rf.setSize(new Dimension(200, 125));
247239
rf.setVisible(true);
248240
}
249241

@@ -611,7 +603,7 @@ public Insets getInsets() {
611603

612604
frame.setVisible(true);
613605

614-
J2Ddemo demo = new J2Ddemo(false, demoProgress, runWndSetts);
606+
J2Ddemo demo = new J2Ddemo(demoProgress, runWndSetts);
615607
demoOneInstArr[0] = demo;
616608

617609
frame.getContentPane().removeAll();

src/demo/share/jfc/SwingSet2/ButtonDemo.java

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
66
* modification, are permitted provided that the following conditions
@@ -30,22 +30,30 @@
3030
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
3232

33-
34-
import javax.swing.*;
35-
import javax.swing.event.*;
36-
import javax.swing.text.*;
37-
import javax.swing.border.*;
38-
import javax.swing.colorchooser.*;
39-
import javax.swing.filechooser.*;
40-
import javax.accessibility.*;
41-
42-
import java.awt.*;
43-
import java.awt.event.*;
44-
import java.beans.*;
45-
import java.util.*;
46-
import java.io.*;
47-
import java.applet.*;
48-
import java.net.*;
33+
import javax.swing.AbstractButton;
34+
import javax.swing.Box;
35+
import javax.swing.BoxLayout;
36+
import javax.swing.ButtonGroup;
37+
import javax.swing.JButton;
38+
import javax.swing.JCheckBox;
39+
import javax.swing.JLabel;
40+
import javax.swing.JPanel;
41+
import javax.swing.JRadioButton;
42+
import javax.swing.JTabbedPane;
43+
import javax.swing.JToggleButton;
44+
import javax.swing.SingleSelectionModel;
45+
import javax.swing.border.CompoundBorder;
46+
import javax.swing.border.EmptyBorder;
47+
import javax.swing.border.TitledBorder;
48+
import javax.swing.event.ChangeEvent;
49+
import javax.swing.event.ChangeListener;
50+
51+
import java.awt.Component;
52+
import java.awt.Dimension;
53+
import java.awt.Insets;
54+
import java.awt.event.ItemEvent;
55+
import java.awt.event.ItemListener;
56+
import java.util.Vector;
4957

5058
/**
5159
* JButton, JRadioButton, JToggleButton, JCheckBox Demos

src/demo/share/jfc/SwingSet2/ColorChooserDemo.java

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
66
* modification, are permitted provided that the following conditions
@@ -30,22 +30,20 @@
3030
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
3232

33-
34-
import javax.swing.*;
35-
import javax.swing.event.*;
36-
import javax.swing.text.*;
37-
import javax.swing.border.*;
38-
import javax.swing.colorchooser.*;
39-
import javax.swing.filechooser.*;
40-
import javax.accessibility.*;
41-
42-
import java.awt.*;
43-
import java.awt.event.*;
44-
import java.beans.*;
45-
import java.util.*;
46-
import java.io.*;
47-
import java.applet.*;
48-
import java.net.*;
33+
import javax.swing.Box;
34+
import javax.swing.BoxLayout;
35+
import javax.swing.Icon;
36+
import javax.swing.JButton;
37+
import javax.swing.JColorChooser;
38+
import javax.swing.JDialog;
39+
import javax.swing.JPanel;
40+
41+
import java.awt.Color;
42+
import java.awt.Component;
43+
import java.awt.Dimension;
44+
import java.awt.Graphics;
45+
import java.awt.event.ActionEvent;
46+
import java.awt.event.ActionListener;
4947

5048
/**
5149
* JColorChooserDemo

src/demo/share/jfc/SwingSet2/ComboBoxDemo.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
66
* modification, are permitted provided that the following conditions
@@ -30,22 +30,23 @@
3030
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
3232

33-
34-
import javax.swing.*;
35-
import javax.swing.event.*;
36-
import javax.swing.text.*;
37-
import javax.swing.border.*;
38-
import javax.swing.colorchooser.*;
39-
import javax.swing.filechooser.*;
40-
import javax.accessibility.*;
41-
42-
import java.awt.*;
43-
import java.awt.event.*;
44-
import java.beans.*;
45-
import java.util.*;
46-
import java.io.*;
47-
import java.applet.*;
48-
import java.net.*;
33+
import javax.accessibility.AccessibleRelation;
34+
import javax.swing.Box;
35+
import javax.swing.BoxLayout;
36+
import javax.swing.Icon;
37+
import javax.swing.ImageIcon;
38+
import javax.swing.JComboBox;
39+
import javax.swing.JLabel;
40+
import javax.swing.JPanel;
41+
import javax.swing.border.BevelBorder;
42+
43+
import java.awt.BorderLayout;
44+
import java.awt.Component;
45+
import java.awt.Dimension;
46+
import java.awt.Graphics;
47+
import java.awt.event.ActionEvent;
48+
import java.awt.event.ActionListener;
49+
import java.util.Hashtable;
4950

5051
/**
5152
* JComboBox Demo

src/demo/share/jfc/SwingSet2/DemoModule.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,23 @@
2929
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030
*/
3131

32-
import javax.swing.*;
33-
import javax.swing.event.*;
34-
import javax.swing.text.*;
35-
import javax.swing.border.*;
36-
import javax.swing.colorchooser.*;
37-
import javax.swing.filechooser.*;
38-
import javax.accessibility.*;
39-
40-
import java.awt.*;
41-
import java.awt.event.*;
42-
import java.beans.*;
43-
import java.util.*;
44-
import java.io.*;
45-
import java.applet.*;
46-
import java.net.*;
32+
import javax.swing.BoxLayout;
33+
import javax.swing.Icon;
34+
import javax.swing.ImageIcon;
35+
import javax.swing.JFrame;
36+
import javax.swing.JPanel;
37+
import javax.swing.UIManager;
38+
import javax.swing.border.Border;
39+
import javax.swing.border.CompoundBorder;
40+
import javax.swing.border.EmptyBorder;
41+
import javax.swing.border.SoftBevelBorder;
42+
43+
import java.awt.BorderLayout;
44+
import java.awt.Dimension;
45+
import java.io.BufferedReader;
46+
import java.io.InputStream;
47+
import java.io.InputStreamReader;
48+
import java.net.URL;
4749

4850
import static java.nio.charset.StandardCharsets.UTF_8;
4951

src/demo/share/jfc/SwingSet2/FileChooserDemo.java

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
66
* modification, are permitted provided that the following conditions
@@ -30,22 +30,37 @@
3030
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
3232

33-
34-
import javax.swing.*;
35-
import javax.swing.event.*;
36-
import javax.swing.text.*;
37-
import javax.swing.border.*;
38-
import javax.swing.colorchooser.*;
39-
import javax.swing.filechooser.*;
40-
import javax.accessibility.*;
41-
42-
import java.awt.*;
43-
import java.awt.event.*;
44-
import java.beans.*;
45-
import java.util.*;
46-
import java.io.*;
47-
import java.applet.*;
48-
import java.net.*;
33+
import javax.swing.AbstractAction;
34+
import javax.swing.Action;
35+
import javax.swing.Box;
36+
import javax.swing.BoxLayout;
37+
import javax.swing.Icon;
38+
import javax.swing.ImageIcon;
39+
import javax.swing.JButton;
40+
import javax.swing.JComponent;
41+
import javax.swing.JDialog;
42+
import javax.swing.JFileChooser;
43+
import javax.swing.JLabel;
44+
import javax.swing.JOptionPane;
45+
import javax.swing.JPanel;
46+
import javax.swing.JScrollPane;
47+
import javax.swing.SwingUtilities;
48+
import javax.swing.WindowConstants;
49+
import javax.swing.border.BevelBorder;
50+
import javax.swing.filechooser.FileNameExtensionFilter;
51+
52+
import java.awt.BorderLayout;
53+
import java.awt.Color;
54+
import java.awt.Component;
55+
import java.awt.Dimension;
56+
import java.awt.Frame;
57+
import java.awt.Graphics;
58+
import java.awt.Image;
59+
import java.awt.Insets;
60+
import java.awt.event.ActionEvent;
61+
import java.beans.PropertyChangeEvent;
62+
import java.beans.PropertyChangeListener;
63+
import java.io.File;
4964

5065
/**
5166
* JFileChooserDemo

src/demo/share/jfc/SwingSet2/HtmlDemo.java

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
66
* modification, are permitted provided that the following conditions
@@ -30,23 +30,19 @@
3030
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3131
*/
3232

33+
import javax.swing.JEditorPane;
34+
import javax.swing.JScrollPane;
35+
import javax.swing.JViewport;
36+
import javax.swing.event.HyperlinkEvent.EventType;
37+
import javax.swing.event.HyperlinkEvent;
38+
import javax.swing.event.HyperlinkListener;
39+
import javax.swing.text.html.HTMLDocument;
40+
import javax.swing.text.html.HTMLFrameHyperlinkEvent;
3341

34-
import javax.swing.*;
35-
import javax.swing.event.*;
36-
import javax.swing.text.*;
37-
import javax.swing.text.html.*;
38-
import javax.swing.border.*;
39-
import javax.swing.colorchooser.*;
40-
import javax.swing.filechooser.*;
41-
import javax.accessibility.*;
42-
43-
import java.awt.*;
44-
import java.awt.event.*;
45-
import java.beans.*;
46-
import java.util.*;
47-
import java.io.*;
48-
import java.applet.*;
49-
import java.net.*;
42+
import java.awt.BorderLayout;
43+
import java.io.IOException;
44+
import java.net.MalformedURLException;
45+
import java.net.URL;
5046

5147
/**
5248
* Html Demo

0 commit comments

Comments
 (0)