From d105337acd15cf6f2204f721e8927fa84f67bbbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Clermont=C3=A9?= Date: Tue, 31 May 2016 18:50:56 +0200 Subject: [PATCH] improved menu design #3 --- src/org/dclermonte/siba/gui/BackupPanel.java | 2 +- src/org/dclermonte/siba/gui/CheckPanel.java | 4 +- src/org/dclermonte/siba/gui/SibaGUI.java | 56 ++++++++++++++++--- .../dclermonte/siba/gui/messages.properties | 28 ++++++---- .../siba/gui/messages_fr_FR.properties | 5 +- 5 files changed, 72 insertions(+), 23 deletions(-) diff --git a/src/org/dclermonte/siba/gui/BackupPanel.java b/src/org/dclermonte/siba/gui/BackupPanel.java index f41d6ec..2d12d46 100644 --- a/src/org/dclermonte/siba/gui/BackupPanel.java +++ b/src/org/dclermonte/siba/gui/BackupPanel.java @@ -61,7 +61,7 @@ public class BackupPanel extends JPanel * */ static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$ - private JTextField textField; + static JTextField textField; private JTextField textField_1; /** diff --git a/src/org/dclermonte/siba/gui/CheckPanel.java b/src/org/dclermonte/siba/gui/CheckPanel.java index 8b9d3fe..5d5094a 100644 --- a/src/org/dclermonte/siba/gui/CheckPanel.java +++ b/src/org/dclermonte/siba/gui/CheckPanel.java @@ -51,8 +51,8 @@ public class CheckPanel extends JPanel { private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.dclermonte.siba.gui.messages"); //$NON-NLS-1$ private static final long serialVersionUID = -1580485684838045920L; - private JTextField textField; - private File choosenFile; + static File choosenFile; + static JTextField textField; /** * This is the constructor for this panel. diff --git a/src/org/dclermonte/siba/gui/SibaGUI.java b/src/org/dclermonte/siba/gui/SibaGUI.java index 5b40847..e3a3db1 100644 --- a/src/org/dclermonte/siba/gui/SibaGUI.java +++ b/src/org/dclermonte/siba/gui/SibaGUI.java @@ -30,6 +30,7 @@ import java.awt.Point; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.File; import java.util.Locale; import java.util.ResourceBundle; @@ -184,20 +185,61 @@ public class SibaGUI menuBar.setBackground(new Color(152, 251, 152)); this.frmSimpleBackup.setJMenuBar(menuBar); - JMenuItem mntmNewMenuItem_1 = new JMenuItem(BUNDLE.getString("SibaGUI.mntmNewMenuItem_1.text")); //$NON-NLS-1$ - mntmNewMenuItem_1.setMaximumSize(new Dimension(100, 32767)); - mntmNewMenuItem_1.setHorizontalTextPosition(SwingConstants.LEFT); - mntmNewMenuItem_1.setHorizontalAlignment(SwingConstants.LEFT); - mntmNewMenuItem_1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - mntmNewMenuItem_1.addActionListener(new ActionListener() + JMenu mnFile = new JMenu(BUNDLE.getString("SibaGUI.mnFile.text")); //$NON-NLS-1$ + mnFile.setForeground(Color.BLACK); + menuBar.add(mnFile); + + JMenuItem mntmBackup = new JMenuItem(BUNDLE.getString("SibaGUI.mntmBackup.text")); //$NON-NLS-1$ + mntmBackup.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) + { + tabbedPane.setSelectedIndex(0); + File file = SourceDirectorySelector.showSelectorDialog(null, null); + if (file == null) + { + return; + } + BackupPanel.textField.setText(file.getPath()); + // panel.setVisible(true); + } + }); + mnFile.add(mntmBackup); + + JMenuItem mntmCheck = new JMenuItem(BUNDLE.getString("SibaGUI.mntmCheck.text")); //$NON-NLS-1$ + mntmCheck.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(final ActionEvent e) + { + tabbedPane.setSelectedIndex(1); + File result; + + CheckPanel.choosenFile = CheckDirectorySelector.showSelectorDialog(null, null); + if (!(CheckPanel.choosenFile == null) && CheckPanel.choosenFile.exists()) + { + CheckPanel.textField.setText(CheckPanel.choosenFile.getName()); + result = CheckPanel.choosenFile; + } + else + { + result = null; + } + } + }); + mnFile.add(mntmCheck); + + JMenuItem mntmQuit = new JMenuItem(BUNDLE.getString("SibaGUI.mntmQuit.text")); //$NON-NLS-1$ + mntmQuit.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(final ActionEvent arg0) { SibaGUI.this.frmSimpleBackup.dispose(); } }); - menuBar.add(mntmNewMenuItem_1); + mnFile.add(mntmQuit); JMenu mnNewMenu = new JMenu(BUNDLE.getString("SibaGUI.mnNewMenu.text")); //$NON-NLS-1$ mnNewMenu.setLocation(new Point(500, 0)); diff --git a/src/org/dclermonte/siba/gui/messages.properties b/src/org/dclermonte/siba/gui/messages.properties index 005c79a..9caf3f7 100644 --- a/src/org/dclermonte/siba/gui/messages.properties +++ b/src/org/dclermonte/siba/gui/messages.properties @@ -1,30 +1,34 @@ #Field ResourceBundle: BUNDLE -#Tue Apr 26 16:39:35 CEST 2016 +#Tue May 31 16:44:12 CEST 2016 BackupPanel.TitleBackupPanel.text=Backup BackupPanel.TitleCheckPanel.text=Check +BackupPanel.TitleWarning.text=Warning BackupPanel.btnNewButton.text=\u2026 BackupPanel.btnNewButton_1.text=\u2026 BackupPanel.btnNewButton_2.text=Backup +BackupPanel.checkFileChooserButton.text=File to check +BackupPanel.confirmDialogMessage.text=Your directory has been backup \n in the file \:\n +BackupPanel.confirmDialogTitle.text=Backup done +BackupPanel.dataMissing.text=Data Missing BackupPanel.lblNewLabel_2.text=

Choose \:

- 1 \: The directory to backup

- 2 \: The directory where you want to put the backup

- 3 \: Click Backup

-BackupPanel.lblSourceDirectory.text=Source Directory : -BackupPanel.lblTargetDirectory.text=Target Directory : +BackupPanel.lblSourceDirectory.text=Source Directory \: +BackupPanel.lblTargetDirectory.text=Target Directory \: BackupPanel.sourceFileChooserButton.text=Source Directory BackupPanel.targetFileChooserButton.text=Target Directory CheckDirectorySelector.this.dialogTitle=Directory where is the backup CheckPanel.btnNewButton.text=\u2026 CheckPanel.btnNewButton_1.text=Check +CheckPanel.confirmDialogBad.text=is corrupted +CheckPanel.confirmDialogGood.text=has been check and is good +CheckPanel.confirmDialogTitle.text=Check done +CheckPanel.confirmDialogYourString.text=Your File CheckPanel.lblNewLabel.text=File to be Checked +SibaGUI.mnFile.text=File SibaGUI.mnNewMenu.text=Help +SibaGUI.mntmBackup.text=Backup +SibaGUI.mntmCheck.text=Check SibaGUI.mntmNewMenuItem_1.text=End SibaGUI.mntmNewMenuItem_2.text=About +SibaGUI.mntmQuit.text=Quit SourceDirectorySelector.this.dialogTitle=Directory to backup TargetDirectorySelector.this.dialogTitle=Directory for the backup -BackupPanel.checkFileChooserButton.text= File to check -BackupPanel.confirmDialogTitle.text = Backup done -BackupPanel.confirmDialogMessage.text = Your directory has been backup \n in the file :\n -CheckPanel.confirmDialogTitle.text = Check done -CheckPanel.confirmDialogYourString.text = Your File -CheckPanel.confirmDialogGood.text = has been check and is good -CheckPanel.confirmDialogBad.text = is corrupted -BackupPanel.dataMissing.text = Data Missing -BackupPanel.TitleWarning.text = Warning diff --git a/src/org/dclermonte/siba/gui/messages_fr_FR.properties b/src/org/dclermonte/siba/gui/messages_fr_FR.properties index 196e65f..6814f3f 100644 --- a/src/org/dclermonte/siba/gui/messages_fr_FR.properties +++ b/src/org/dclermonte/siba/gui/messages_fr_FR.properties @@ -15,7 +15,6 @@ CheckPanel.btnNewButton.text=\u2026 CheckPanel.btnNewButton_1.text=Vérifier CheckPanel.lblNewLabel.text=Sauvegarde \u00E0 v\u00E9rifier SibaGUI.mnNewMenu.text=Aide -SibaGUI.mntmNewMenuItem_1.text=Sortir SibaGUI.mntmNewMenuItem_2.text=A propos SourceDirectorySelector.this.dialogTitle=Choix du répertoire à sauvegarder TargetDirectorySelector.this.dialogTitle=Choix du répertoire de destination @@ -28,3 +27,7 @@ CheckPanel.confirmDialogGood.text = a CheckPanel.confirmDialogBad.text = comporte des erreurs BackupPanel.dataMissing.text = Données incomplètes BackupPanel.TitleWarning.text = Attention +SibaGUI.mnFile.text=Fichier +SibaGUI.mntmBackup.text=Sauvegarde +SibaGUI.mntmQuit.text=Sortir +SibaGUI.mntmCheck.text=Vérification \ No newline at end of file