Skip to content

Commit 6cf4156

Browse files
authored
Merge pull request #39 from BobHanson/yadav1
Yadav1
2 parents 3b9f587 + 59c9513 commit 6cf4156

265 files changed

Lines changed: 64847 additions & 15635 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
271 KB
Binary file not shown.

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()) {

0 commit comments

Comments
 (0)