Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

Commit

Permalink
Improve preference GUI
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
  • Loading branch information
miurahr committed Mar 17, 2022
1 parent d0a572f commit b77f3e0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.FlowLayout;

public class OxfordApiPanel extends JPanel {
/**
Expand All @@ -34,23 +35,22 @@ public OxfordApiPanel() {
}

private void initComponents() {
setMinimumSize(new java.awt.Dimension(250, 200));
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
JLabel desc = new JLabel();
desc.setText(LStrings.getString("PREFS_OXFORD_DESC"));
add(desc);
JPanel panel1 = new JPanel();
panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));
panel1.setLayout(new FlowLayout(FlowLayout.LEFT));
JLabel appIdLabel = new JLabel();
appIdLabel.setText(LStrings.getString("PREFS_OXFORD_APPID_LABEL"));
panel1.add(appIdLabel);
appIdTextField = new JTextField();
appIdTextField = new JTextField(10);
panel1.add(appIdTextField);
JPanel panel2 = new JPanel();
panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
panel2.setLayout(new FlowLayout(FlowLayout.LEFT));
JLabel appKeyLabel = new JLabel();
appKeyLabel.setText(LStrings.getString("PREFS_OXFORD_APPKEY_LABEL"));
appKeyTextField = new JTextField();
appKeyTextField = new JTextField(30);
panel2.add(appKeyLabel);
panel2.add(appKeyTextField);
add(panel1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

import javax.swing.JDialog;
import javax.swing.JTabbedPane;
import javax.swing.border.LineBorder;
import java.awt.Color;
import java.awt.Window;

public class PreferenceController {
Expand All @@ -34,16 +36,17 @@ public class PreferenceController {
public void show(final Window parent) {
JDialog dialog = new JDialog(parent);
dialog.setTitle(LStrings.getString("PASSWORD_DIALOG_TITLE"));
dialog.setSize(400, 300);
dialog.setSize(450, 300);
dialog.setModal(true);
StaticUIUtils.setEscapeClosable(dialog);
PreferencePanel preferencePanel = new PreferencePanel();

JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.setBorder(new LineBorder(Color.DARK_GRAY));
secureStoreController = new SecureStoreController();
tabbedPane.addTab("Credentials", secureStoreController.getGui());
oxfordApiController = new OxfordApiController();
tabbedPane.addTab("Oxford dictionaries", oxfordApiController.getGui());
tabbedPane.addTab("Credentials", secureStoreController.getGui());
preferencePanel.prefsPanel.add(tabbedPane);

preferencePanel.okButton.addActionListener(e -> {
Expand All @@ -55,6 +58,8 @@ public void show(final Window parent) {
preferencePanel.cancelButton.addActionListener(e -> StaticUIUtils.closeWindowByEvent(dialog));

dialog.add(preferencePanel);
dialog.pack();
dialog.setLocationRelativeTo(parent);
dialog.setVisible(true);
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ BUTTON_CANCEL=Cancel
PASSWORD_ENTER_MESSAGE=Enter password
PASSWORD_TRY_AGAIN_MESSAGE=Try password again
PREFS_OXFORD_DESC=Please set appId and appKey of Oxford dictionaries API.
PREFS_OXFORD_APPID_LABEL=AppID
PREFS_OXFORD_APPKEY_LABEL=AppKey
PREFS_OXFORD_APPID_LABEL=Application ID :
PREFS_OXFORD_APPKEY_LABEL=Applicaiton Key:
PREFS_TITLE_SECURE_STORE=Secure Store
PREFS_SECURE_STORE_DESCRIPTION=OmegaT encrypts sensitive passwords and API keys with a master password.
PREFS_SECURE_STORE_MASTER_PASSWORD_LABEL=Master Password:
Expand Down

0 comments on commit b77f3e0

Please sign in to comment.