Search in sources :

Example 41 with Box

use of javax.swing.Box in project processdash by dtuma.

the class TaskScheduleDialog method buildTaskButtons.

protected Component buildTaskButtons(boolean isRollup) {
    Box result = Box.createHorizontalBox();
    result.add(Box.createHorizontalGlue());
    addTaskAction = new TSAction("Buttons.Add_Schedule", "Buttons.Add_Task") {

        public void actionPerformed(ActionEvent e) {
            addTask();
        }
    };
    if (canEdit())
        result.add(new JButton(addTaskAction));
    result.add(Box.createHorizontalGlue());
    // button margins: 2 pixels top and bottom, 14 left and right.
    deleteTaskAction = new TSAction("Buttons.Remove_Schedule", "Buttons.Remove_Task") {

        public void actionPerformed(ActionEvent e) {
            deleteTask();
        }
    };
    deleteTaskAction.setEnabled(false);
    if (canEdit())
        result.add(new JButton(deleteTaskAction));
    result.add(Box.createHorizontalGlue());
    moveUpAction = new TSAction("Buttons.Move_Schedule_Up", "Buttons.Move_Task_Up") {

        public void actionPerformed(ActionEvent e) {
            moveTaskUp();
        }
    };
    moveUpAction.setEnabled(false);
    moveUpAction.setMnemonic('U');
    if (canEdit())
        result.add(new JButton(moveUpAction));
    result.add(Box.createHorizontalGlue());
    moveDownAction = new TSAction("Buttons.Move_Schedule_Down", "Buttons.Move_Task_Down") {

        public void actionPerformed(ActionEvent e) {
            moveTaskDown();
        }
    };
    moveDownAction.setEnabled(false);
    moveDownAction.setMnemonic('D');
    if (canEdit())
        result.add(new JButton(moveDownAction));
    result.add(Box.createHorizontalGlue());
    flatViewAction = mergedViewAction = null;
    if (!isRollup) {
        flatViewAction = new TSAction("Buttons.Flat_View") {

            public void actionPerformed(ActionEvent e) {
                toggleFlatView();
            }
        };
        JCheckBox flatViewCheckbox = new JCheckBox(flatViewAction);
        flatViewCheckbox.setFocusPainted(false);
        flatViewAction.useButtonModel(flatViewCheckbox);
        flatViewAction.setSelected(false);
        result.add(flatViewCheckbox);
        result.add(Box.createHorizontalGlue());
    } else {
        mergedViewAction = new TSAction("Buttons.Merged_View") {

            public void actionPerformed(ActionEvent e) {
                toggleMergedView();
            }
        };
        JCheckBox mergedViewCheckbox = new JCheckBox(mergedViewAction);
        mergedViewCheckbox.setFocusPainted(false);
        mergedViewAction.useButtonModel(mergedViewCheckbox);
        mergedViewAction.setSelected(false);
        result.add(mergedViewCheckbox);
        result.add(Box.createHorizontalGlue());
    }
    expandAllAction = new TSAction("Buttons.Expand_All") {

        public void actionPerformed(ActionEvent e) {
            expandAllForSelectedItems();
        }
    };
    treeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            enableTaskButtons(e);
        }
    });
    return result;
}
Also used : JCheckBox(javax.swing.JCheckBox) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 42 with Box

use of javax.swing.Box in project processdash by dtuma.

the class TranslationSharer method inputBox.

private JComponent inputBox(JLabel label, JComponent inputField) {
    Box result = Box.createHorizontalBox();
    result.add(Box.createHorizontalStrut(20));
    result.add(label);
    result.add(Box.createHorizontalStrut(5));
    result.add(inputField);
    result.add(Box.createHorizontalGlue());
    return result;
}
Also used : Box(javax.swing.Box)

Example 43 with Box

use of javax.swing.Box in project processdash by dtuma.

the class TranslationSharer method promptForAuthorInfo.

private void promptForAuthorInfo() {
    JLabel authorLabel = new JLabel(resources.getString("Translation.Sharing.Author.Name_Prompt"));
    JTextField author = new JTextField(20);
    JLabel emailLabel = new JLabel(resources.getString("Translation.Sharing.Author.Email_Prompt"));
    JTextField email = new JTextField(30);
    JRadioButton yesOption = new JRadioButton(resources.getString("Translation.Sharing.Author.Yes_Option"), true);
    JRadioButton noOption = new JRadioButton(resources.getString("Translation.Sharing.Author.No_Option"));
    ButtonGroup group = new ButtonGroup();
    group.add(yesOption);
    group.add(noOption);
    ContactOptionListener l = new ContactOptionListener(yesOption, new JComponent[] { authorLabel, author, emailLabel, email });
    yesOption.addActionListener(l);
    noOption.addActionListener(l);
    Box buttonBox = Box.createHorizontalBox();
    buttonBox.add(yesOption);
    buttonBox.add(Box.createHorizontalStrut(10));
    buttonBox.add(noOption);
    buttonBox.add(Box.createHorizontalGlue());
    Object[] message = new Object[] { resources.getString("Translation.Sharing.Author.Prompt"), buttonBox, inputBox(authorLabel, author), inputBox(emailLabel, email) };
    JOptionPane.showMessageDialog(null, message, resources.getString("Translation.Sharing.Author.Title"), JOptionPane.OK_OPTION);
    if (yesOption.isSelected()) {
        prefs.put(AUTHOR_SETTING, author.getText());
        prefs.put(EMAIL_SETTING, email.getText());
        try {
            prefs.flush();
        } catch (BackingStoreException e) {
            System.out.println(resources.getString("Translation.Errors.Cant_Save_Preferences"));
            e.printStackTrace();
        }
    }
}
Also used : JRadioButton(javax.swing.JRadioButton) ButtonGroup(javax.swing.ButtonGroup) BackingStoreException(java.util.prefs.BackingStoreException) JLabel(javax.swing.JLabel) Box(javax.swing.Box) JTextField(javax.swing.JTextField)

Example 44 with Box

use of javax.swing.Box in project processdash by dtuma.

the class PreferencesDialog method getBottomSection.

private Component getBottomSection() {
    JButton okButton = new JButton(resources.getString("OK_Button"));
    okButton.addActionListener((ActionListener) EventHandler.create(ActionListener.class, this, "saveAndClose"));
    JButton cancelButton = new JButton(resources.getString("Cancel_Button"));
    cancelButton.addActionListener((ActionListener) EventHandler.create(ActionListener.class, this, "closePreferences"));
    applyButton = new JButton(resources.getString("Apply_Button"));
    applyButton.addActionListener((ActionListener) EventHandler.create(ActionListener.class, this, "applyChanges"));
    restartRequireLabel = new JLabel(resources.getString("Restart_Required"));
    restartRequireLabel.setIcon(DashboardIconFactory.getRestartRequiredIcon());
    Box bottomBox = Box.createHorizontalBox();
    bottomBox.add(restartRequireLabel);
    bottomBox.add(Box.createHorizontalGlue());
    bottomBox.add(okButton);
    bottomBox.add(Box.createHorizontalStrut(CONTROL_BUTTONS_SPACING));
    bottomBox.add(cancelButton);
    bottomBox.add(Box.createHorizontalStrut(CONTROL_BUTTONS_SPACING));
    bottomBox.add(applyButton);
    bottomBox.setBorder(new EmptyBorder(BUTTON_BOX_BORDER, BUTTON_BOX_BORDER, BUTTON_BOX_BORDER, BUTTON_BOX_BORDER));
    updateApplyButton();
    updateRestartRequired();
    return bottomBox;
}
Also used : JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Box(javax.swing.Box) EmptyBorder(javax.swing.border.EmptyBorder)

Example 45 with Box

use of javax.swing.Box in project processdash by dtuma.

the class EditImportDirectoryPanel method buildMainPanelContents.

protected void buildMainPanelContents() {
    DocumentListener listener = (DocumentListener) EventHandler.create(DocumentListener.class, this, "updateInstruction");
    if (instr.isUrlOnly()) {
        String chooseUrlPrompt = getString("Choose_URL");
        add(indentedComponent(2, new WrappingText(chooseUrlPrompt)));
        add(verticalSpace(1));
        url = new JTextField(instr.getURL());
        url.getDocument().addDocumentListener(listener);
        add(indentedComponent(4, url));
    } else {
        String chooseDirectoryPrompt = getString("Choose_Directory");
        add(indentedComponent(2, new WrappingText(chooseDirectoryPrompt)));
        add(verticalSpace(1));
        directory = new DirectoryChooser();
        directory.getDocument().addDocumentListener(listener);
        add(indentedComponent(4, directory));
    }
    add(verticalSpace(2));
    String choosePrefixPrompt = getString("Choose_Prefix");
    add(indentedComponent(2, new WrappingText(choosePrefixPrompt)));
    add(verticalSpace(1));
    prefix = new JTextField(instr.getPrefix());
    prefix.getDocument().addDocumentListener(listener);
    add(indentedComponent(4, prefix));
    if (fromManagePanel == false) {
        add(verticalSpace(2));
        String makeAutomaticPrompt = getString("Make_Automatic");
        add(indentedComponent(2, new WrappingText(makeAutomaticPrompt)));
        makeAutomatic = new ButtonGroup();
        Box autoButtonBox = Box.createHorizontalBox();
        autoButtonBox.add(createAutomaticButton("Yes"));
        autoButtonBox.add(createAutomaticButton("No"));
        add(indentedComponent(4, autoButtonBox));
    }
    add(verticalSpace(4));
    error = new WrappingText("");
    error.setForeground(Color.red);
    add(error);
}
Also used : DocumentListener(javax.swing.event.DocumentListener) ButtonGroup(javax.swing.ButtonGroup) Box(javax.swing.Box) WrappingText(net.sourceforge.processdash.ui.lib.WrappingText) JTextField(javax.swing.JTextField)

Aggregations

Box (javax.swing.Box)192 JCheckBox (javax.swing.JCheckBox)95 JLabel (javax.swing.JLabel)93 JPanel (javax.swing.JPanel)87 Dimension (java.awt.Dimension)65 BorderLayout (java.awt.BorderLayout)51 JButton (javax.swing.JButton)48 JComboBox (javax.swing.JComboBox)46 JScrollPane (javax.swing.JScrollPane)42 BoxLayout (javax.swing.BoxLayout)38 ActionEvent (java.awt.event.ActionEvent)31 ActionListener (java.awt.event.ActionListener)28 JTextField (javax.swing.JTextField)25 EmptyBorder (javax.swing.border.EmptyBorder)19 Insets (java.awt.Insets)17 SearchFilterPanel (pcgen.gui2.filter.SearchFilterPanel)14 FlippingSplitPane (pcgen.gui2.tools.FlippingSplitPane)14 TitledBorder (javax.swing.border.TitledBorder)13 FilterBar (pcgen.gui2.filter.FilterBar)13 GridBagConstraints (java.awt.GridBagConstraints)12