This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jtimer. See https://gitlab.nuiton.org/chorem/jtimer.git commit f1755662898d4e7614c99605b9526c5aee521e9a Author: Eric Chatellier <chatellier@codelutin.com> Date: Thu Mar 24 15:47:39 2016 +0100 refs #1319: Set button the same size --- src/main/java/org/chorem/jtimer/ui/NewTaskView.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/chorem/jtimer/ui/NewTaskView.java b/src/main/java/org/chorem/jtimer/ui/NewTaskView.java index 9b6f9c8..9ef684e 100644 --- a/src/main/java/org/chorem/jtimer/ui/NewTaskView.java +++ b/src/main/java/org/chorem/jtimer/ui/NewTaskView.java @@ -23,6 +23,7 @@ package org.chorem.jtimer.ui; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; +import java.awt.GridLayout; import java.awt.Insets; import java.util.Date; import java.util.Map; @@ -90,10 +91,10 @@ public class NewTaskView extends DialogView { // task name JLabel newTaskLabel = new JLabel(getResourceMap().getString("input.newTaskMessage", selectedTask.getName())); - panel.add(newTaskLabel, new GridBagConstraints(1, 0, 2, 1, 0, 0, + panel.add(newTaskLabel, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); newTaskField = new JTextField(); - panel.add(newTaskField, new GridBagConstraints(1, 1, 2, 1, 0, 0, + panel.add(newTaskField, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(3, 5, 0, 5), 0, 0)); // Task template @@ -110,29 +111,31 @@ public class NewTaskView extends DialogView { newTaskTemplateBox.setSelectedItem(null); // empty option JLabel newTaskTemplateLabel = new JLabel(getResourceMap().getString("input.newTaskTemplate")); - panel.add(newTaskTemplateLabel, new GridBagConstraints(1, 2, 2, 1, 0, 0, + panel.add(newTaskTemplateLabel, new GridBagConstraints(1, 2, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); - panel.add(newTaskTemplateBox, new GridBagConstraints(1, 3, 2, 1, 0, 0, + panel.add(newTaskTemplateBox, new GridBagConstraints(1, 3, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(3, 5, 0, 5), 0, 0)); } // ok cancel buttons + JPanel buttonPanel = new JPanel(new GridLayout(0, 2, 5, 0)); JButton okButton = new JButton(); okButton.setAction(actionMap.get("valid")); - panel.add(okButton, new GridBagConstraints(1, 4, 1, 1, 1, 0, - GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 1), 0, 0)); + buttonPanel.add(okButton); // default enter getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ENTER"), "ENTER"); getRootPane().getActionMap().put("ENTER", okButton.getAction()); JButton cancelButton = new JButton(); cancelButton.setAction(actionMap.get("cancel")); - panel.add(cancelButton, new GridBagConstraints(2, 4, 1, 1, 1, 0, - GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 1, 5, 5), 0, 0)); + buttonPanel.add(cancelButton); // default escape getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE"); getRootPane().getActionMap().put("ESCAPE", cancelButton.getAction()); + + panel.add(buttonPanel, new GridBagConstraints(0, 4, 2, 1, 0, 0, + GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); return panel; } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.