Some more sonar issues

This commit is contained in:
Didier Clermonté 2016-07-23 23:02:31 +02:00
parent f8d4d37e8f
commit 38b4d4fbab
3 changed files with 38 additions and 44 deletions

View File

@ -70,8 +70,8 @@ public class BackupPanel extends JPanel
JPanel helpPanel = new JPanel(); JPanel helpPanel = new JPanel();
add(helpPanel, BorderLayout.NORTH); add(helpPanel, BorderLayout.NORTH);
JLabel lblNewLabel_2 = new JLabel(BUNDLE.getString("BackupPanel.lblNewLabel_2.text")); //$NON-NLS-1$ JLabel HelpLabel = new JLabel(BUNDLE.getString("BackupPanel.lblNewLabel_2.text")); //$NON-NLS-1$
helpPanel.add(lblNewLabel_2); helpPanel.add(HelpLabel);
JPanel choosePanel = new JPanel(); JPanel choosePanel = new JPanel();
add(choosePanel); add(choosePanel);
@ -119,9 +119,9 @@ public class BackupPanel extends JPanel
choosePanel.add(this.targetDirectoryField, "4, 4"); choosePanel.add(this.targetDirectoryField, "4, 4");
this.targetDirectoryField.setColumns(10); this.targetDirectoryField.setColumns(10);
JButton btnNewButton_1 = new JButton(BUNDLE.getString("BackupPanel.btnNewButton_1.text")); //$NON-NLS-1$ JButton ButtonTarget = new JButton(BUNDLE.getString("BackupPanel.btnNewButton_1.text")); //$NON-NLS-1$
btnNewButton_1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); ButtonTarget.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
btnNewButton_1.addActionListener(new ActionListener() ButtonTarget.addActionListener(new ActionListener()
{ {
@Override @Override
public void actionPerformed(final ActionEvent e) public void actionPerformed(final ActionEvent e)
@ -135,35 +135,35 @@ public class BackupPanel extends JPanel
} }
}); });
choosePanel.add(btnNewButton_1, "6, 4"); choosePanel.add(ButtonTarget, "6, 4");
btnNewButton_1.setHorizontalAlignment(SwingConstants.RIGHT); ButtonTarget.setHorizontalAlignment(SwingConstants.RIGHT);
JPanel actionPanel = new JPanel(); JPanel actionPanel = new JPanel();
add(actionPanel, BorderLayout.SOUTH); add(actionPanel, BorderLayout.SOUTH);
actionPanel.setLayout(new BoxLayout(actionPanel, BoxLayout.Y_AXIS)); actionPanel.setLayout(new BoxLayout(actionPanel, BoxLayout.Y_AXIS));
Component verticalStrut_1 = Box.createVerticalStrut(5); Component verticalStrut1 = Box.createVerticalStrut(5);
actionPanel.add(verticalStrut_1); actionPanel.add(verticalStrut1);
JPanel panel_1 = new JPanel(); JPanel buttonActionPanel = new JPanel();
actionPanel.add(panel_1); actionPanel.add(buttonActionPanel);
panel_1.setLayout(new BoxLayout(panel_1, BoxLayout.X_AXIS)); buttonActionPanel.setLayout(new BoxLayout(buttonActionPanel, BoxLayout.X_AXIS));
Component horizontalGlue = Box.createHorizontalGlue(); Component horizontalGlue = Box.createHorizontalGlue();
panel_1.add(horizontalGlue); buttonActionPanel.add(horizontalGlue);
JButton btnNewButton_2 = new JButton(BUNDLE.getString("BackupPanel.btnNewButton_2.text")); //$NON-NLS-1$ JButton ButtonBackup = new JButton(BUNDLE.getString("BackupPanel.btnNewButton_2.text")); //$NON-NLS-1$
btnNewButton_2.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); ButtonBackup.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
panel_1.add(btnNewButton_2); buttonActionPanel.add(ButtonBackup);
Component horizontalGlue_1 = Box.createHorizontalGlue(); Component horizontalGlue1 = Box.createHorizontalGlue();
panel_1.add(horizontalGlue_1); buttonActionPanel.add(horizontalGlue1);
Component verticalStrut = Box.createVerticalStrut(20); Component verticalStrut = Box.createVerticalStrut(20);
actionPanel.add(verticalStrut); actionPanel.add(verticalStrut);
btnNewButton_2.addActionListener(new ActionListener() ButtonBackup.addActionListener(new ActionListener()
{ {
@Override @Override
public void actionPerformed(final ActionEvent e) public void actionPerformed(final ActionEvent e)

View File

@ -114,9 +114,9 @@ public class CheckPanel extends JPanel
Component horizontalGlue = Box.createHorizontalGlue(); Component horizontalGlue = Box.createHorizontalGlue();
panel.add(horizontalGlue); panel.add(horizontalGlue);
JButton btnNewButton_1 = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$ JButton ButtonCheck = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$
panel.add(btnNewButton_1); panel.add(ButtonCheck);
btnNewButton_1.addActionListener(new ActionListener() ButtonCheck.addActionListener(new ActionListener()
{ {
@Override @Override
public void actionPerformed(final ActionEvent e) public void actionPerformed(final ActionEvent e)
@ -157,12 +157,12 @@ public class CheckPanel extends JPanel
} }
} }
}); });
btnNewButton_1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); ButtonCheck.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Component horizontalGlue_1 = Box.createHorizontalGlue(); Component horizontalGlue1 = Box.createHorizontalGlue();
panel.add(horizontalGlue_1); panel.add(horizontalGlue1);
Component verticalStrut_1 = Box.createVerticalStrut(20); Component verticalStrut1 = Box.createVerticalStrut(20);
actionPanel.add(verticalStrut_1); actionPanel.add(verticalStrut1);
} }
/** /**

View File

@ -114,43 +114,37 @@ public class SibaGUI
UIManager.put("swing.boldMetal", Boolean.FALSE); UIManager.put("swing.boldMetal", Boolean.FALSE);
// Set LookAndFeel. // Set LookAndFeel.
System.out.println("System lookAndFeel property:" + System.getProperty("swing.defaultlaf")); logger.debug("System lookAndFeel property:" + System.getProperty("swing.defaultlaf"));
logger.debug("Available lookAndFeel: " + GUIToolBox.availableLookAndFeels().toString()); logger.debug("Available lookAndFeel: " + GUIToolBox.availableLookAndFeels().toString());
// System.out.println("Available lookAndFeel: " + logger.debug("System lookAndFeel: " + UIManager.getSystemLookAndFeelClassName());
// GUIToolBox.availableLookAndFeels().toString());
System.out.println("System lookAndFeel: " + UIManager.getSystemLookAndFeelClassName());
logger.debug("Current lookAndFeel: " + UIManager.getLookAndFeel().getName()); logger.debug("Current lookAndFeel: " + UIManager.getLookAndFeel().getName());
// System.out.println("Current lookAndFeel: " +
// UIManager.getLookAndFeel().getName());
if (!StringUtils.equals(UIManager.getSystemLookAndFeelClassName(), "javax.swing.plaf.metal.MetalLookAndFeel")) if (!StringUtils.equals(UIManager.getSystemLookAndFeelClassName(), "javax.swing.plaf.metal.MetalLookAndFeel"))
{ {
try try
{ {
System.out.println("Metal LAF setted and system LAF detected, try to set system LAF."); logger.debug("Metal LAF setted and system LAF detected, try to set system LAF.");
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} }
catch (final Exception exception) catch (final Exception exception)
{ {
System.out.println("Failed to set the system LookAndFeel."); logger.debug("Failed to set the system LookAndFeel.");
} }
} }
else if (GUIToolBox.availableLookAndFeels().toString().contains("GTK+")) else if (GUIToolBox.availableLookAndFeels().toString().contains("GTK+"))
{ {
try try
{ {
System.out.println("Metal LAF setted and GTK+ LAF detected, try to set GTK+ LAF."); logger.debug("Metal LAF setted and GTK+ LAF detected, try to set GTK+ LAF.");
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
} }
catch (final Exception exception) catch (final Exception exception)
{ {
System.out.println("Failed to set the system LookAndFeel."); logger.debug("Failed to set the system LookAndFeel.");
} }
} }
/* UIManager.setLookAndFeel("com.sun.java.swing.plaf.metal.MetalLookAndFeel"); */ /* UIManager.setLookAndFeel("com.sun.java.swing.plaf.metal.MetalLookAndFeel"); */
logger.debug("Activated lookAndFeel: " + UIManager.getLookAndFeel().getName()); logger.debug("Activated lookAndFeel: " + UIManager.getLookAndFeel().getName());
// System.out.println("Activated lookAndFeel: " +
// UIManager.getLookAndFeel().getName());
// Set default locale. // Set default locale.
this.locale = Locale.getDefault(); this.locale = Locale.getDefault();
@ -273,10 +267,10 @@ public class SibaGUI
mnNewMenu.setOpaque(true); mnNewMenu.setOpaque(true);
menuBar.add(mnNewMenu); menuBar.add(mnNewMenu);
JMenuItem mntmNewMenuItem_2 = new JMenuItem(BUNDLE.getString("SibaGUI.mntmNewMenuItem_2.text")); //$NON-NLS-1$ JMenuItem mntmMenuItemAbout = new JMenuItem(BUNDLE.getString("SibaGUI.mntmNewMenuItem_2.text")); //$NON-NLS-1$
mntmNewMenuItem_2.setBackground(Color.GREEN); mntmMenuItemAbout.setBackground(Color.GREEN);
mntmNewMenuItem_2.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); mntmMenuItemAbout.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
mntmNewMenuItem_2.addActionListener(new ActionListener() mntmMenuItemAbout.addActionListener(new ActionListener()
{ {
@Override @Override
public void actionPerformed(final ActionEvent e) public void actionPerformed(final ActionEvent e)
@ -284,7 +278,7 @@ public class SibaGUI
AboutDialog.view(""); AboutDialog.view("");
} }
}); });
mnNewMenu.add(mntmNewMenuItem_2); mnNewMenu.add(mntmMenuItemAbout);
} }
/** /**