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

View File

@ -114,9 +114,9 @@ public class CheckPanel extends JPanel
Component horizontalGlue = Box.createHorizontalGlue();
panel.add(horizontalGlue);
JButton btnNewButton_1 = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$
panel.add(btnNewButton_1);
btnNewButton_1.addActionListener(new ActionListener()
JButton ButtonCheck = new JButton(BUNDLE.getString("CheckPanel.btnNewButton_1.text")); //$NON-NLS-1$
panel.add(ButtonCheck);
ButtonCheck.addActionListener(new ActionListener()
{
@Override
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();
panel.add(horizontalGlue_1);
Component verticalStrut_1 = Box.createVerticalStrut(20);
actionPanel.add(verticalStrut_1);
Component horizontalGlue1 = Box.createHorizontalGlue();
panel.add(horizontalGlue1);
Component verticalStrut1 = Box.createVerticalStrut(20);
actionPanel.add(verticalStrut1);
}
/**

View File

@ -114,43 +114,37 @@ public class SibaGUI
UIManager.put("swing.boldMetal", Boolean.FALSE);
// 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());
// System.out.println("Available lookAndFeel: " +
// GUIToolBox.availableLookAndFeels().toString());
System.out.println("System lookAndFeel: " + UIManager.getSystemLookAndFeelClassName());
logger.debug("System lookAndFeel: " + UIManager.getSystemLookAndFeelClassName());
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"))
{
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());
}
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+"))
{
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");
}
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"); */
logger.debug("Activated lookAndFeel: " + UIManager.getLookAndFeel().getName());
// System.out.println("Activated lookAndFeel: " +
// UIManager.getLookAndFeel().getName());
// Set default locale.
this.locale = Locale.getDefault();
@ -273,10 +267,10 @@ public class SibaGUI
mnNewMenu.setOpaque(true);
menuBar.add(mnNewMenu);
JMenuItem mntmNewMenuItem_2 = new JMenuItem(BUNDLE.getString("SibaGUI.mntmNewMenuItem_2.text")); //$NON-NLS-1$
mntmNewMenuItem_2.setBackground(Color.GREEN);
mntmNewMenuItem_2.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
mntmNewMenuItem_2.addActionListener(new ActionListener()
JMenuItem mntmMenuItemAbout = new JMenuItem(BUNDLE.getString("SibaGUI.mntmNewMenuItem_2.text")); //$NON-NLS-1$
mntmMenuItemAbout.setBackground(Color.GREEN);
mntmMenuItemAbout.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
mntmMenuItemAbout.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(final ActionEvent e)
@ -284,7 +278,7 @@ public class SibaGUI
AboutDialog.view("");
}
});
mnNewMenu.add(mntmNewMenuItem_2);
mnNewMenu.add(mntmMenuItemAbout);
}
/**