Skip to content
Permalink
Browse files
8237746: Fixing compiler warnings in src/demo/share/jfc
Reviewed-by: kizune, aivanov
  • Loading branch information
marchof authored and mrserb committed Mar 12, 2020
1 parent f3ef972 commit afe70e69853b9ed5414f78c76c29ade426104de5
Showing with 298 additions and 535 deletions.
  1. +4 −4 src/demo/share/jfc/FileChooserDemo/FileChooserDemo.java
  2. +22 −23 src/demo/share/jfc/Font2DTest/Font2DTest.java
  3. +0 −91 src/demo/share/jfc/Font2DTest/Font2DTestApplet.java
  4. +12 −14 src/demo/share/jfc/Font2DTest/FontPanel.java
  5. +4 −4 src/demo/share/jfc/Font2DTest/RangeMenu.java
  6. +1 −1 src/demo/share/jfc/J2Ddemo/java2d/DemoPanel.java
  7. +2 −2 src/demo/share/jfc/J2Ddemo/java2d/GlobalControls.java
  8. +2 −2 src/demo/share/jfc/J2Ddemo/java2d/Tools.java
  9. +0 −1 src/demo/share/jfc/J2Ddemo/java2d/demos/Clipping/Areas.java
  10. +5 −5 src/demo/share/jfc/J2Ddemo/java2d/demos/Fonts/Tree.java
  11. +3 −3 src/demo/share/jfc/J2Ddemo/java2d/demos/Images/ImageOps.java
  12. +2 −2 src/demo/share/jfc/J2Ddemo/java2d/demos/Mix/Balls.java
  13. +0 −2 src/demo/share/jfc/J2Ddemo/java2d/demos/Mix/BezierScroller.java
  14. +2 −2 src/demo/share/jfc/J2Ddemo/java2d/demos/Paint/GradAnim.java
  15. +2 −2 src/demo/share/jfc/J2Ddemo/java2d/demos/Paint/TextureAnim.java
  16. +2 −2 src/demo/share/jfc/Metalworks/MetalworksPrefs.java
  17. +1 −1 src/demo/share/jfc/Notepad/ElementTreePanel.java
  18. +2 −2 src/demo/share/jfc/Stylepad/Stylepad.java
  19. +10 −10 src/demo/share/jfc/SwingSet2/ButtonDemo.java
  20. +1 −1 src/demo/share/jfc/SwingSet2/ColorChooserDemo.java
  21. +26 −23 src/demo/share/jfc/SwingSet2/ComboBoxDemo.java
  22. +2 −2 src/demo/share/jfc/SwingSet2/DemoModule.java
  23. +3 −6 src/demo/share/jfc/SwingSet2/DirectionPanel.java
  24. +6 −6 src/demo/share/jfc/SwingSet2/ExampleFileView.java
  25. +1 −1 src/demo/share/jfc/SwingSet2/FileChooserDemo.java
  26. +3 −3 src/demo/share/jfc/SwingSet2/InternalFrameDemo.java
  27. +4 −4 src/demo/share/jfc/SwingSet2/LayoutControlPanel.java
  28. +8 −8 src/demo/share/jfc/SwingSet2/ListDemo.java
  29. +1 −1 src/demo/share/jfc/SwingSet2/OptionPaneDemo.java
  30. +3 −1 src/demo/share/jfc/SwingSet2/SliderDemo.java
  31. +1 −1 src/demo/share/jfc/SwingSet2/SplitPaneDemo.java
  32. +51 −109 src/demo/share/jfc/SwingSet2/SwingSet2.java
  33. +0 −78 src/demo/share/jfc/SwingSet2/SwingSet2Applet.java
  34. +59 −59 src/demo/share/jfc/SwingSet2/TableDemo.java
  35. +0 −6 src/demo/share/jfc/TableExample/JDBCAdapter.java
  36. +5 −5 src/demo/share/jfc/TableExample/OldJTable.java
  37. +22 −22 src/demo/share/jfc/TableExample/TableExample3.java
  38. +23 −23 src/demo/share/jfc/TableExample/TableExample4.java
  39. +1 −1 src/demo/share/jfc/TableExample/TableMap.java
  40. +2 −2 src/demo/share/jfc/TableExample/TableSorter.java
@@ -136,7 +136,7 @@ public String toString() {
private JRadioButton openRadioButton;
private JRadioButton saveRadioButton;
private JRadioButton customButton;
private JComboBox lafComboBox;
private JComboBox<SupportedLaF> lafComboBox;
private JRadioButton justFilesRadioButton;
private JRadioButton justDirectoriesRadioButton;
private JRadioButton bothFilesAndDirectoriesRadioButton;
@@ -158,7 +158,7 @@ public FileChooserDemo() {
for (UIManager.LookAndFeelInfo lafInfo : installedLafs) {
try {
Class<?> lnfClass = Class.forName(lafInfo.getClassName());
LookAndFeel laf = (LookAndFeel) (lnfClass.newInstance());
LookAndFeel laf = (LookAndFeel) (lnfClass.getDeclaredConstructor().newInstance());
if (laf.isSupportedLookAndFeel()) {
String name = lafInfo.getName();
SupportedLaF supportedLaF = new SupportedLaF(name, laf);
@@ -292,7 +292,7 @@ public Dimension getMaximumSize() {
showButton.setMnemonic('s');

// Create laf combo box
lafComboBox = new JComboBox(supportedLaFs.toArray());
lafComboBox = new JComboBox<>(supportedLaFs.toArray(new SupportedLaF[0]));
lafComboBox.setSelectedItem(nimbusLaF);
lafComboBox.setEditable(false);
lafComboBox.addActionListener(optionListener);
@@ -729,7 +729,7 @@ public void actionPerformed(ActionEvent e) {
frame.pack();
} catch (UnsupportedLookAndFeelException exc) {
// This should not happen because we already checked
((DefaultComboBoxModel) lafComboBox.getModel()).
((DefaultComboBoxModel<?>) lafComboBox.getModel()).
removeElement(supportedLaF);
}
}
@@ -67,7 +67,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.EnumSet;
import java.util.StringTokenizer;
import java.util.BitSet;
import javax.swing.*;
@@ -101,8 +100,8 @@
private final ChoiceV2 transformMenu;
private final ChoiceV2 transformMenuG2;
private final ChoiceV2 methodsMenu;
private final JComboBox antiAliasMenu;
private final JComboBox fracMetricsMenu;
private final JComboBox<FontPanel.AAValues> antiAliasMenu;
private final JComboBox<FontPanel.FMValues> fracMetricsMenu;

private final JSlider contrastSlider;

@@ -151,10 +150,10 @@ public Font2DTest( JFrame f, boolean isApplet ) {
methodsMenu = new ChoiceV2( this );

antiAliasMenu =
new JComboBox(EnumSet.allOf(FontPanel.AAValues.class).toArray());
new JComboBox<>(FontPanel.AAValues.values());
antiAliasMenu.addActionListener(this);
fracMetricsMenu =
new JComboBox(EnumSet.allOf(FontPanel.FMValues.class).toArray());
new JComboBox<>(FontPanel.FMValues.values());
fracMetricsMenu.addActionListener(this);

contrastSlider = new JSlider(JSlider.HORIZONTAL, 100, 250,
@@ -359,7 +358,7 @@ private void setupDialog( boolean isApplet ) {
userTextDialog.pack();
userTextDialog.addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
userTextDialog.hide();
userTextDialog.setVisible(false);
}
});

@@ -385,7 +384,7 @@ public void windowClosing( WindowEvent e ) {
printDialog.setResizable( false );
printDialog.addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
printDialog.hide();
printDialog.setVisible(false);
}
});
printDialog.getContentPane().setLayout( new GridLayout( printModeCBs.length + 2, 1 ));
@@ -402,7 +401,7 @@ public void windowClosing( WindowEvent e ) {
fontInfoDialog.setResizable( false );
fontInfoDialog.addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
fontInfoDialog.hide();
fontInfoDialog.setVisible(false);
showFontInfoCBMI.setState( false );
}
});
@@ -467,7 +466,7 @@ private void setupFontList(int rangeStart, int rangeEnd) {
int style = fontStyles[styleMenu.getSelectedIndex()];
Font f;
for (int i = 0; i < listCount; i++) {
String fontName = (String)fontMenu.getItemAt(i);
String fontName = fontMenu.getItemAt(i);
f = new Font(fontName, style, size);
if ((rm.getSelectedIndex() != RangeMenu.SURROGATES_AREA_INDEX) &&
canDisplayRange(f, rangeStart, rangeEnd)) {
@@ -673,9 +672,9 @@ private void updateGUI() {

/// Set the visibility of User Text dialog
if ( selectedText == fp.USER_TEXT )
userTextDialog.show();
userTextDialog.setVisible(true);
else
userTextDialog.hide();
userTextDialog.setVisible(false);
/// Change the visibility/status/availability of Print JDialog buttons
printModeCBs[ fp.ONE_PAGE ].setSelected( true );
if ( selectedText == fp.FILE_TEXT || selectedText == fp.USER_TEXT ) {
@@ -793,10 +792,10 @@ private void loadOptions( String fileName ) {
lcdContrast, userTextOpt );
if ( showFontInfoOpt ) {
fireUpdateFontInfo();
fontInfoDialog.show();
fontInfoDialog.setVisible(true);
}
else
fontInfoDialog.hide();
fontInfoDialog.setVisible(false);
}
catch ( Exception ex ) {
fireChangeStatus( "ERROR: Failed to Load Options File; See Stack Trace", true );
@@ -819,7 +818,7 @@ public void windowClosing( WindowEvent e ) {
}
});
f.pack();
f.show();
f.setVisible(true);
}
catch ( Exception ex ) {
fireChangeStatus( "ERROR: Failed to Load PNG File; See Stack Trace", true );
@@ -861,7 +860,7 @@ else if ( itemName.equals( "Load PNG File to Compare..." )) {
else if ( itemName.equals( "Page Setup..." ))
fp.doPageSetup();
else if ( itemName.equals( "Print..." ))
printDialog.show();
printDialog.setVisible(true);
else if ( itemName.equals( "Close" ))
parent.dispose();
else if ( itemName.equals( "Exit" ))
@@ -893,19 +892,19 @@ else if ( source instanceof JButton ) {
if ( itemName.equals( "Print" )) {
for ( int i = 0; i < printModeCBs.length; i++ )
if ( printModeCBs[i].isSelected() ) {
printDialog.hide();
printDialog.setVisible(false);
fp.doPrint( i );
}
}
else if ( itemName.equals( "Cancel" ))
printDialog.hide();
printDialog.setVisible(false);
/// Update button from Usert Text JDialog...
else if ( itemName.equals( "Update" ))
fp.setTextToDraw( fp.USER_TEXT, null,
parseUserText( userTextArea.getText() ), null );
}
else if ( source instanceof JComboBox ) {
JComboBox c = (JComboBox) source;
JComboBox<?> c = (JComboBox<?>) source;

/// RangeMenu handles actions by itself and then calls fireRangeChanged,
/// so it is not listed or handled here
@@ -996,10 +995,10 @@ else if ( cbmi == force16ColsCBMI )
else if ( cbmi == showFontInfoCBMI ) {
if ( showFontInfoCBMI.getState() ) {
fireUpdateFontInfo();
fontInfoDialog.show();
fontInfoDialog.setVisible(true);
}
else
fontInfoDialog.hide();
fontInfoDialog.setVisible(false);
}
}
}
@@ -1039,7 +1038,7 @@ public static void main(String[] argv) {

f.getContentPane().add( f2dt );
f.pack();
f.show();
f.setVisible(true);
}

/// Inner class definitions...
@@ -1070,7 +1069,7 @@ public ButtonV2( String name, ActionListener al ) {
}
}

private final class ChoiceV2 extends JComboBox {
private final class ChoiceV2 extends JComboBox<String> {

private BitSet bitSet = null;

@@ -1141,7 +1140,7 @@ public ChoiceV2Renderer(ChoiceV2 choice) {
this.choice = choice;
}

public Component getListCellRendererComponent(JList list,
public Component getListCellRendererComponent(JList<?> list,
Object value,
int index,
boolean isSelected,

This file was deleted.

0 comments on commit afe70e6

Please sign in to comment.