Skip to content

Commit 1172206

Browse files
hansonrhansonr
authored andcommitted
Java 8 upgrade -- java.lang, java.util; adds JTabbedPane
1 parent 9727e38 commit 1172206

File tree

257 files changed

+51916
-13193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+51916
-13193
lines changed

sources/net.sf.j2s.java.core/doc/Differences.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Notes
22
=====
3-
updaetd 6/28/18 -- arrays do not inherit Object
3+
updated 7/24/18 -- most classes replaced with https://github.com/frohoff/jdk8u-jdk
4+
updated 6/28/18 -- arrays do not inherit Object
45
updated 2/26/18
56
updated 6/5/17 -- reserved package name "window"
67
updated 3/11/17 -- myClass.getField
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
/*
2+
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
*
8+
* - Redistributions of source code must retain the above copyright
9+
* notice, this list of conditions and the following disclaimer.
10+
*
11+
* - Redistributions in binary form must reproduce the above copyright
12+
* notice, this list of conditions and the following disclaimer in the
13+
* documentation and/or other materials provided with the distribution.
14+
*
15+
* - Neither the name of Oracle or the names of its
16+
* contributors may be used to endorse or promote products derived
17+
* from this software without specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
package components;
33+
34+
/*
35+
* TabbedPaneDemo.java requires one additional file:
36+
* images/middle.gif.
37+
*/
38+
39+
import javax.swing.JTabbedPane;
40+
import javax.swing.ImageIcon;
41+
import javax.swing.JLabel;
42+
import javax.swing.JPanel;
43+
import javax.swing.JFrame;
44+
import javax.swing.JComponent;
45+
import javax.swing.SwingUtilities;
46+
import javax.swing.UIManager;
47+
import java.awt.BorderLayout;
48+
import java.awt.Dimension;
49+
import java.awt.GridLayout;
50+
import java.awt.event.KeyEvent;
51+
52+
public class TabbedPaneDemo extends JPanel {
53+
public TabbedPaneDemo() {
54+
super(new GridLayout(1, 1));
55+
56+
JTabbedPane tabbedPane = new JTabbedPane();
57+
ImageIcon icon = createImageIcon("images/middle.gif");
58+
59+
JComponent panel1 = makeTextPanel("Panel #1");
60+
tabbedPane.addTab("Tab 1", icon, panel1,
61+
"Does nothing");
62+
tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
63+
64+
JComponent panel2 = makeTextPanel("Panel #2");
65+
tabbedPane.addTab("This is Tab 2", icon, panel2,
66+
"Does twice as much nothing");
67+
tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);
68+
69+
JComponent panel3 = makeTextPanel("Panel #3");
70+
tabbedPane.addTab("Tab 3", icon, panel3,
71+
"Still does nothing");
72+
tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);
73+
74+
JComponent panel3b = makeTextPanel("Panel #3");
75+
tabbedPane.addTab("Tab 3b", icon, panel3b,
76+
"Still does nothing");
77+
tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);
78+
79+
JComponent panel3c = makeTextPanel("Panel #3");
80+
tabbedPane.addTab("Tab 3", icon, panel3c,
81+
"Still does nothing");
82+
tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);
83+
84+
JComponent panel3d = makeTextPanel("Panel #3");
85+
tabbedPane.addTab("Tab 3", icon, panel3d,
86+
"Still does nothing");
87+
tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);
88+
89+
JComponent panel3e = makeTextPanel("Panel #3");
90+
tabbedPane.addTab("Tab 3", icon, panel3e,
91+
"Still does nothing");
92+
tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);
93+
94+
JComponent panel3f = makeTextPanel("Panel #3");
95+
tabbedPane.addTab("Tab 3", icon, panel3f,
96+
"Still does nothing");
97+
tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);
98+
99+
100+
101+
JComponent panel4 = makeTextPanel(
102+
"Panel #4 (has a preferred size of 410 x 50).");
103+
panel4.setPreferredSize(new Dimension(410, 50));
104+
tabbedPane.addTab("Tab 4", icon, panel4,
105+
"Does nothing at all");
106+
tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);
107+
108+
//Add the tabbed pane to this panel.
109+
add(tabbedPane);
110+
111+
//The following line enables to use scrolling tabs.
112+
// tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
113+
tabbedPane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT);
114+
}
115+
116+
protected JComponent makeTextPanel(String text) {
117+
JPanel panel = new JPanel(false);
118+
JLabel filler = new JLabel(text);
119+
filler.setHorizontalAlignment(JLabel.CENTER);
120+
panel.setLayout(new GridLayout(1, 1));
121+
panel.add(filler);
122+
return panel;
123+
}
124+
125+
/** Returns an ImageIcon, or null if the path was invalid. */
126+
protected static ImageIcon createImageIcon(String path) {
127+
java.net.URL imgURL = TabbedPaneDemo.class.getResource(path);
128+
if (imgURL != null) {
129+
return new ImageIcon(imgURL);
130+
} else {
131+
System.err.println("Couldn't find file: " + path);
132+
return null;
133+
}
134+
}
135+
136+
/**
137+
* Create the GUI and show it. For thread safety,
138+
* this method should be invoked from
139+
* the event dispatch thread.
140+
*/
141+
private static void createAndShowGUI() {
142+
//Create and set up the window.
143+
JFrame frame = new JFrame("TabbedPaneDemo");
144+
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
145+
146+
//Add content to the window.
147+
frame.add(new TabbedPaneDemo(), BorderLayout.CENTER);
148+
149+
//Display the window.
150+
frame.pack();
151+
frame.setVisible(true);
152+
}
153+
154+
public static void main(String[] args) {
155+
//Schedule a job for the event dispatch thread:
156+
//creating and showing this application's GUI.
157+
SwingUtilities.invokeLater(new Runnable() {
158+
public void run() {
159+
//Turn off metal's use of bold fonts
160+
UIManager.put("swing.boldMetal", Boolean.FALSE);
161+
createAndShowGUI();
162+
}
163+
});
164+
}
165+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/*
4+
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions
8+
* are met:
9+
*
10+
* - Redistributions of source code must retain the above copyright
11+
* notice, this list of conditions and the following disclaimer.
12+
*
13+
* - Redistributions in binary form must reproduce the above copyright
14+
* notice, this list of conditions and the following disclaimer in the
15+
* documentation and/or other materials provided with the distribution.
16+
*
17+
* - Neither the name of Oracle or the names of its
18+
* contributors may be used to endorse or promote products derived
19+
* from this software without specific prior written permission.
20+
*
21+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
25+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
*/
33+
-->
34+
35+
<!-- JNLP File for TabbedPaneDemo -->
36+
<jnlp
37+
spec="1.0+"
38+
codebase="https://docs.oracle.com/javase/tutorialJWS/samples/uiswing/TabbedPaneDemoProject"
39+
href="TabbedPaneDemo.jnlp">
40+
<information>
41+
<title>TabbedPaneDemo</title>
42+
<vendor>The Java(tm) Tutorial</vendor>
43+
<homepage href="https://docs.oracle.com/javase/tutorial/uiswing/examples/components/index.html#TabbedPaneDemo"/>
44+
<description>TabbedPaneDemo</description>
45+
<description kind="short">Demonstrates a few tabbed pane features,
46+
such as tool tips, icons, scrollable layout, and mnemonics.</description>
47+
<offline-allowed/>
48+
</information>
49+
<resources>
50+
<j2se version="1.7+"/>
51+
<jar href="TabbedPaneDemo.jar"/>
52+
</resources>
53+
<application-desc main-class="components.TabbedPaneDemo"/>
54+
</jnlp>
235 Bytes
Loading

sources/net.sf.j2s.java.core/src/java/awt/CardLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ public void next(Container parent) {
472472
* currently visible card is the first one, this method flips to the
473473
* last card in the layout.
474474
* @param parent the parent container in which to do the layout
475-
* @see java.awt.CardLayout#next
475+
* @see java.awt.CardLayout#nextItem
476476
*/
477477
public void previous(Container parent) {
478478
synchronized (parent.getTreeLock()) {

sources/net.sf.j2s.java.core/src/java/awt/ContainerOrderFocusTraversalPolicy.java

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
/*
22
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
3-
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4-
*
5-
*
6-
*
7-
*
8-
*
9-
*
10-
*
11-
*
12-
*
13-
*
14-
*
15-
*
16-
*
17-
*
18-
*
19-
*
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
204
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
2110
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
2216
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2320
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
2424
*/
2525
package java.awt;
2626

@@ -504,10 +504,7 @@ public Component getLastComponent(Container aContainer) {
504504
} else if (comp instanceof Container && comp != aContainer) {
505505
Container cont = (Container)comp;
506506
if (cont.isFocusTraversalPolicyProvider()) {
507-
Component retComp = cont.getFocusTraversalPolicy().getLastComponent(cont);
508-
if (retComp != null) {
509-
return retComp;
510-
}
507+
return cont.getFocusTraversalPolicy().getLastComponent(cont);
511508
}
512509
}
513510
}

sources/net.sf.j2s.java.core/src/java/awt/DefaultFocusTraversalPolicy.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
/*
22
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
3-
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4-
*
5-
*
6-
*
7-
*
8-
*
9-
*
10-
*
11-
*
12-
*
13-
*
14-
*
15-
*
16-
*
17-
*
18-
*
19-
*
20-
*
21-
*
22-
*
23-
*
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
2424
*/
2525
package java.awt;
2626

0 commit comments

Comments
 (0)