Example usage for com.jgoodies.forms.factories Borders createEmptyBorder

List of usage examples for com.jgoodies.forms.factories Borders createEmptyBorder

Introduction

In this page you can find the example usage for com.jgoodies.forms.factories Borders createEmptyBorder.

Prototype

public static Border createEmptyBorder(String encodedSizes) 

Source Link

Document

Creates and returns a Border using sizes as specified by the given string.

Usage

From source file:kr.pe.sinnori.gui.screen.DBCPConnPoolNamePopup.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    mainProjectLinePanel = new JPanel();
    mainProjectNameTitleLabel = new JLabel();
    mainProjectNameValueLabel = new JLabel();
    dbcpConnPoolNameLinePanel = new JPanel();
    dbcpConnPoolNameTitleLabel = new JLabel();
    dbcpConnPoolNameValueLabel = new JLabel();
    /** Post-Creation Code Start */
    dbcpConnPoolNameValueLabel.setText(selectedDBCPConnPoolName);
    /** Post-Creation Code End */
    dbcpPartIntroductionLable = new JLabel();
    dbcpConnPoolNamePartScrollPane = new JScrollPane();
    dbcpConnPoolNamePartTable = new JTable();
    buttonBar = new JPanel();
    okButton = new JButton();

    //======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {/*  w  w  w .  j  a  v  a 2s  .c o  m*/
        dialogPane.setBorder(Borders.createEmptyBorder("7dlu, 7dlu, 7dlu, 7dlu"));
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setLayout(new FormLayout("394dlu:grow", "3*(default, $lgap), default"));

            //======== mainProjectLinePanel ========
            {
                mainProjectLinePanel.setLayout(new FormLayout("110dlu, $lcgap, 168dlu", "default"));

                //---- mainProjectNameTitleLabel ----
                mainProjectNameTitleLabel.setText("Main Project Name :");
                mainProjectLinePanel.add(mainProjectNameTitleLabel, CC.xy(1, 1));
                mainProjectLinePanel.add(mainProjectNameValueLabel, CC.xy(3, 1));
            }
            contentPanel.add(mainProjectLinePanel, CC.xy(1, 1));

            //======== dbcpConnPoolNameLinePanel ========
            {
                dbcpConnPoolNameLinePanel.setLayout(new FormLayout("110dlu, $lcgap, 200dlu", "default"));

                //---- dbcpConnPoolNameTitleLabel ----
                dbcpConnPoolNameTitleLabel.setText("DBCP Connection Pool Name :");
                dbcpConnPoolNameLinePanel.add(dbcpConnPoolNameTitleLabel, CC.xy(1, 1));
                dbcpConnPoolNameLinePanel.add(dbcpConnPoolNameValueLabel, CC.xy(3, 1));
            }
            contentPanel.add(dbcpConnPoolNameLinePanel, CC.xy(1, 3));

            //---- dbcpPartIntroductionLable ----
            dbcpPartIntroductionLable.setText("DBCP Part Config");
            contentPanel.add(dbcpPartIntroductionLable, CC.xy(1, 5));

            //======== dbcpConnPoolNamePartScrollPane ========
            {

                //---- dbcpConnPoolNamePartTable ----
                dbcpConnPoolNamePartTable.setModel(new DefaultTableModel(new Object[][] { { null, null }, },
                        new String[] { "key", "value" }) {
                    Class<?>[] columnTypes = new Class<?>[] { String.class, Object.class };
                    boolean[] columnEditable = new boolean[] { false, false };

                    @Override
                    public Class<?> getColumnClass(int columnIndex) {
                        return columnTypes[columnIndex];
                    }

                    @Override
                    public boolean isCellEditable(int rowIndex, int columnIndex) {
                        return columnEditable[columnIndex];
                    }
                });
                {
                    TableColumnModel cm = dbcpConnPoolNamePartTable.getColumnModel();
                    cm.getColumn(1).setMinWidth(150);
                }
                dbcpConnPoolNamePartTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                dbcpConnPoolNamePartTable.setAutoCreateColumnsFromModel(false);
                dbcpConnPoolNamePartScrollPane.setViewportView(dbcpConnPoolNamePartTable);
            }
            contentPanel.add(dbcpConnPoolNamePartScrollPane, CC.xy(1, 7));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.createEmptyBorder("5dlu, 0dlu, 0dlu, 0dlu"));
            buttonBar.setLayout(new FormLayout("$glue, $button", "pref"));

            //---- okButton ----
            okButton.setText("Close");
            okButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    okButtonActionPerformed(e);
                }
            });
            buttonBar.add(okButton, CC.xy(2, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:kr.pe.sinnori.gui.screen.DBCPPartConfigPopup.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    mainProjectLinePanel = new JPanel();
    mainProjectNameTitleLabel = new JLabel();
    mainProjectNameValueLabel = new JLabel();
    dbcpConnPoolNameLinePanel = new JPanel();
    dbcpConnPoolNameTitleLabel = new JLabel();
    dbcpConnPoolNameValueLabel = new JLabel();
    dbcpPartIntroductionLable = new JLabel();
    dbcpPartScrollPane = new JScrollPane();
    dbcpPartTable = new JTable();
    buttonBar = new JPanel();
    okButton = new JButton();

    //======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {//w w  w .j av a2s  .  c om
        dialogPane.setBorder(Borders.createEmptyBorder("7dlu, 7dlu, 7dlu, 7dlu"));
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setLayout(new FormLayout("394dlu:grow", "3*(default, $lgap), default"));

            //======== mainProjectLinePanel ========
            {
                mainProjectLinePanel.setLayout(new FormLayout("110dlu, $lcgap, 168dlu", "default"));

                //---- mainProjectNameTitleLabel ----
                mainProjectNameTitleLabel.setText("Main Project Name :");
                mainProjectLinePanel.add(mainProjectNameTitleLabel, CC.xy(1, 1));
                mainProjectLinePanel.add(mainProjectNameValueLabel, CC.xy(3, 1));
            }
            contentPanel.add(mainProjectLinePanel, CC.xy(1, 1));

            //======== dbcpConnPoolNameLinePanel ========
            {
                dbcpConnPoolNameLinePanel.setLayout(new FormLayout("110dlu, $lcgap, 200dlu", "default"));

                //---- dbcpConnPoolNameTitleLabel ----
                dbcpConnPoolNameTitleLabel.setText("DBCP Connection Pool Name :");
                dbcpConnPoolNameLinePanel.add(dbcpConnPoolNameTitleLabel, CC.xy(1, 1));
                dbcpConnPoolNameLinePanel.add(dbcpConnPoolNameValueLabel, CC.xy(3, 1));
            }
            contentPanel.add(dbcpConnPoolNameLinePanel, CC.xy(1, 3));

            //---- dbcpPartIntroductionLable ----
            dbcpPartIntroductionLable.setText("DBCP Part Config");
            contentPanel.add(dbcpPartIntroductionLable, CC.xy(1, 5));

            //======== dbcpPartScrollPane ========
            {

                //---- dbcpPartTable ----
                dbcpPartTable.setModel(new DefaultTableModel(new Object[][] { { null, null }, },
                        new String[] { "key", "value" }) {
                    Class<?>[] columnTypes = new Class<?>[] { String.class, Object.class };
                    boolean[] columnEditable = new boolean[] { false, false };

                    @Override
                    public Class<?> getColumnClass(int columnIndex) {
                        return columnTypes[columnIndex];
                    }

                    @Override
                    public boolean isCellEditable(int rowIndex, int columnIndex) {
                        return columnEditable[columnIndex];
                    }
                });
                {
                    TableColumnModel cm = dbcpPartTable.getColumnModel();
                    cm.getColumn(1).setMinWidth(150);
                }
                dbcpPartTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                dbcpPartTable.setAutoCreateColumnsFromModel(false);
                dbcpPartScrollPane.setViewportView(dbcpPartTable);
            }
            contentPanel.add(dbcpPartScrollPane, CC.xy(1, 7));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.createEmptyBorder("5dlu, 0dlu, 0dlu, 0dlu"));
            buttonBar.setLayout(new FormLayout("$glue, $button", "pref"));

            //---- okButton ----
            okButton.setText("Close");
            okButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    okButtonActionPerformed(e);
                }
            });
            buttonBar.add(okButton, CC.xy(2, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:kr.pe.sinnori.gui.screen.SubProjectPartConfigPopup.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    mainProjectNameLinePanel = new JPanel();
    mainProjectNameTitleLabel = new JLabel();
    mainProjectNameValueLabel = new JLabel();
    subProjectNameLinePanel = new JPanel();
    subProjectNameTitleLabel = new JLabel();
    subProjectNameValueLabel = new JLabel();
    subProjectPartScrollPane = new JScrollPane();
    subProjectPartTable = new JTable();
    buttonBar = new JPanel();
    okButton = new JButton();

    //======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {//from ww w. jav  a2  s. co m
        dialogPane.setBorder(Borders.createEmptyBorder("7dlu, 7dlu, 7dlu, 7dlu"));
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setLayout(new FormLayout("${growing-button}", "2*(default, $lgap), 90dlu:grow"));

            //======== mainProjectNameLinePanel ========
            {
                mainProjectNameLinePanel.setLayout(new FormLayout("default, $lcgap, default:grow", "default"));

                //---- mainProjectNameTitleLabel ----
                mainProjectNameTitleLabel.setText("\uc8fc \ud504\ub85c\uc81d\ud2b8 \uc774\ub984 :");
                mainProjectNameLinePanel.add(mainProjectNameTitleLabel, CC.xy(1, 1));

                //---- mainProjectNameValueLabel ----
                mainProjectNameValueLabel.setText("sample_test");
                mainProjectNameLinePanel.add(mainProjectNameValueLabel, CC.xy(3, 1));
            }
            contentPanel.add(mainProjectNameLinePanel, CC.xy(1, 1));

            //======== subProjectNameLinePanel ========
            {
                subProjectNameLinePanel.setLayout(new FormLayout("default, $lcgap, default:grow", "default"));

                //---- subProjectNameTitleLabel ----
                subProjectNameTitleLabel.setText("\uc11c\ube0c \ud504\ub85c\uc81d\ud2b8 \uc774\ub984 :");
                subProjectNameLinePanel.add(subProjectNameTitleLabel, CC.xy(1, 1));

                //---- subProjectNameValueLabel ----
                subProjectNameValueLabel.setText("sample_test_sub1");
                subProjectNameLinePanel.add(subProjectNameValueLabel, CC.xy(3, 1));
            }
            contentPanel.add(subProjectNameLinePanel, CC.xy(1, 3));

            //======== subProjectPartScrollPane ========
            {

                //---- subProjectPartTable ----
                subProjectPartTable
                        .setModel(new DefaultTableModel(new Object[][] { { null, null }, { null, null }, },
                                new String[] { "\ud0a4", "\uac12" }) {
                            Class<?>[] columnTypes = new Class<?>[] { String.class, Object.class };

                            @Override
                            public Class<?> getColumnClass(int columnIndex) {
                                return columnTypes[columnIndex];
                            }
                        });
                subProjectPartScrollPane.setViewportView(subProjectPartTable);
            }
            contentPanel.add(subProjectPartScrollPane, CC.xy(1, 5));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.createEmptyBorder("5dlu, 0dlu, 0dlu, 0dlu"));
            buttonBar.setLayout(new FormLayout("$glue, $button", "pref"));

            //---- okButton ----
            okButton.setText("Close");
            okButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    okButtonActionPerformed(e);
                }
            });
            buttonBar.add(okButton, CC.xy(2, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:net.sourceforge.marathon.display.FixtureSelectionDialog.java

License:Open Source License

public FixtureSelectionDialog(JFrame parent, String[] fixtures, final String selectedFixture) {
    super(parent, "Select", true);
    setTitle("Marathon - Select Fixture");
    BannerPanel bannerPanel = new BannerPanel();
    String[] lines = { "Fixtures allows to customize the setup to be done for a test case",
            "Note that you need to create a new testcase for this fixture to be used", "for recording" };
    BannerPanel.Sheet sheet = new BannerPanel.Sheet("Select Fixture", lines);
    bannerPanel.addSheet(sheet, "main");
    getContentPane().add(bannerPanel, BorderLayout.NORTH);

    getContentPane().add(getFixturePanel(fixtures), BorderLayout.CENTER);
    this.selectedFixture = selectedFixture;
    fixtureList.setSelectedValue(selectedFixture, true);

    JPanel buttonPanel = ButtonBarFactory.buildRightAlignedBar(new JButton[] { okButton, cancelButton });
    buttonPanel.setBorder(Borders.createEmptyBorder("0dlu, 0dlu, 3dlu, 7dlu"));
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setSelectedFixture((String) fixtureList.getSelectedValue());
            dispose();//from   w ww . jav a2 s .  c o m
        }
    });
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
    pack();
    setWindowInCenter();
}

From source file:net.sourceforge.marathon.display.PreferencesDialog.java

License:Open Source License

public PreferencesDialog(JFrame parent) {
    super(parent, "Preferences", true);
    this.parent = parent;
    setTitle("Preferences");
    setModal(true);//w  w w  .  j  a  va2s  . c  o m
    BannerPanel bannerPanel = new BannerPanel();
    String[] lines = { "Set marathon preferences" };
    BannerPanel.Sheet sheet = new BannerPanel.Sheet("Preferences", lines);
    bannerPanel.addSheet(sheet, "main");
    getContentPane().add(bannerPanel, BorderLayout.NORTH);
    getContentPane().add(getPreferencesPanel());
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            needRefresh = false;
            dispose();
        }
    });
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            prefs.put(Constants.PREF_RECORDER_MOUSE_TRIGGER, mouseTrigger.getText());
            prefs.put(Constants.PREF_RECORDER_KEYBOARD_TRIGGER, keyTrigger.getText());
            prefs.put(Constants.PREF_NAVIGATOR_HIDEFILES, hideFilesNavigator.getText());
            prefs.put(Constants.PREF_JUNIT_HIDEFILES, hideFilesJUnit.getText());
            try {
                prefs.flush();
            } catch (BackingStoreException e1) {
                JOptionPane.showMessageDialog(PreferencesDialog.this, e1.getMessage(), "Error",
                        JOptionPane.ERROR_MESSAGE);
                e1.printStackTrace();
            }
            System.setProperty(Constants.PROP_RECORDER_KEYTRIGGER, keyTrigger.getText());
            System.setProperty(Constants.PROP_RECORDER_MOUSETRIGGER, mouseTrigger.getText());
            ContextMenuTriggers.setContextMenuKey();
            ContextMenuTriggers.setContextMenuModifiers();
            Navigator.setHideFilePattern(hideFilesNavigator.getText());
            TestCreator.setHideFilePattern(hideFilesJUnit.getText());
            dispose();
        }
    });
    defaultsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                prefs.clear();
                prefs.flush();
            } catch (BackingStoreException e1) {
                JOptionPane.showMessageDialog(PreferencesDialog.this, e1.getMessage(), "Error",
                        JOptionPane.ERROR_MESSAGE);
                e1.printStackTrace();
            }
            mouseTrigger.setText(
                    OSUtils.inputEventGetModifiersExText(ContextMenuTriggers.getContextMenuModifiers()));
            keyTrigger.setText(
                    OSUtils.inputEventGetModifiersExText(ContextMenuTriggers.getContextMenuKeyModifiers()) + "+"
                            + OSUtils.keyEventGetKeyText(ContextMenuTriggers.getContextMenuKeyCode()));
            System.setProperty(Constants.PROP_RECORDER_KEYTRIGGER, keyTrigger.getText());
            System.setProperty(Constants.PROP_RECORDER_MOUSETRIGGER, mouseTrigger.getText());
            ContextMenuTriggers.setContextMenuKey();
            ContextMenuTriggers.setContextMenuModifiers();
            Navigator.setHideFilePattern(null);
            TestCreator.setHideFilePattern(null);
            hideFilesJUnit.setText(TestCreator.getHideFilePattern());
            hideFilesNavigator.setText(Navigator.getHideFilePattern());
        }
    });
    JPanel buttonPanel = ButtonBarFactory
            .buildRightAlignedBar(new JButton[] { defaultsButton, okButton, cancelButton });
    buttonPanel.setBorder(Borders.createEmptyBorder("0dlu, 0dlu, 3dlu, 7dlu"));
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    setResizable(false);
    pack();
    setWindowInCenter();
}

From source file:net.sourceforge.marathon.mpf.MPFConfigurationUI.java

License:Open Source License

private void initConfigurationUI(String dirName) {
    this.dirName = dirName;
    applicationPanel = new ApplicationPanel(this);
    panels = new IPropertiesPanel[] { new ProjectPanel(this), applicationPanel, new ScriptPanel(this),
            new VariablePanel(this), new AssertionsPanel(this), new IgnoreComponentsPanel(this),
            new ResolverPanel(this) };
    BannerPanel bannerPanel = new BannerPanel();
    String[] lines;//  w  w w.  jav  a 2  s.  c  om
    if (dirName != null)
        lines = new String[] { "Update a Marathon Project" };
    else
        lines = new String[] { "Create a Marathon Project" };
    BannerPanel.Sheet sheet = new BannerPanel.Sheet("Create and manage configuration", lines, BANNER);
    bannerPanel.addSheet(sheet, "main");
    getContentPane().add(bannerPanel, BorderLayout.NORTH);
    tabbedPane = new JTabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    tabbedPane.putClientProperty("jgoodies.noContentBorder", Boolean.TRUE);
    for (int i = 0; i < panels.length; i++) {
        tabbedPane.addTab(panels[i].getName(), panels[i].getIcon(), panels[i].getPanel());
    }
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_P);
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_A);
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_R);
    tabbedPane.setMnemonicAt(3, KeyEvent.VK_L);
    tabbedPane.setMnemonicAt(4, KeyEvent.VK_S);
    tabbedPane.setMnemonicAt(5, KeyEvent.VK_I);
    tabbedPane.setMnemonicAt(6, KeyEvent.VK_E);
    getContentPane().add(tabbedPane);
    JButton testButton = UIUtils.createTestButton();
    testButton.setMnemonic(KeyEvent.VK_T);
    testButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (!validateInput())
                return;
            ITestApplication application = getApplicationTester();
            try {
                application.launch();
            } catch (Exception e1) {
                JOptionPane.showMessageDialog(MPFConfigurationUI.this, "Unable to launch application " + e1);
                e1.printStackTrace();
            }
        }
    });
    cancelButton = UIUtils.createCancelButton();
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            MPFConfigurationUI.this.dispose();
        }
    });
    JPanel buttonPanel;
    saveButton = UIUtils.createSaveButton();
    saveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (validateInput()) {
                saveProjectFile();
                dispose();
            }
        }
    });
    buttonPanel = ButtonBarFactory.buildOKCancelApplyBar(saveButton, cancelButton, testButton);
    buttonPanel.setBorder(Borders.createEmptyBorder("0dlu, 0dlu, 3dlu, 9dlu"));
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    Properties properties = new Properties();
    if (dirName != null) {
        FileInputStream fileInputStream = null;
        try {
            fileInputStream = new FileInputStream(new File(dirName, Constants.PROJECT_FILE));
            properties.load(fileInputStream);
        } catch (FileNotFoundException e) {
            return;
        } catch (IOException e) {
            return;
        } finally {
            if (fileInputStream != null) {
                try {
                    fileInputStream.close();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
        }
        properties.setProperty(Constants.PROP_PROJECT_DIR, dirName);
        String name = properties.getProperty(Constants.PROP_PROJECT_NAME);
        if (name != null)
            setTitle("Configure - " + name);
    } else {
        properties = getDefaultProperties();
    }
    setProperties(properties);
    setSize(800, 600);
}

From source file:net.sourceforge.marathon.mpf.MPFSelection.java

License:Open Source License

/**
 * Construct a MPFSelection frame./*from  w  w w. ja v a2s. c  om*/
 */
public MPFSelection() {
    setModal(true);
    setTitle("Marathon - Select Directory");
    BannerPanel bannerPanel = new BannerPanel();
    String[] lines = { "Select a Marathon Project Directory" };
    BannerPanel.Sheet sheet = new BannerPanel.Sheet("Create and manage configuration", lines, BANNER);
    bannerPanel.addSheet(sheet, "main");
    getContentPane().add(bannerPanel, BorderLayout.NORTH);
    getContentPane().add(getSelectionPanel());
    dirName.setRenderer(new DefaultListCellRenderer() {
        private static final long serialVersionUID = 1L;

        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected,
                    cellHasFocus);
            if (comp.getText().equals(""))
                return comp;
            File file = new File(comp.getText());
            String fileName = file.getName() + " - " + (file.getParent() == null ? "." : file.getParent());
            comp.setText(fileName);
            comp.setToolTipText(file.toString());
            return comp;
        }
    });
    newButton.setMnemonic(KeyEvent.VK_N);
    newButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            MPFConfigurationUI configurationUI = new MPFConfigurationUI(MPFSelection.this);
            String fname = configurationUI.getProjectDirectory();
            if (fname != null)
                filesSelected(new File[] { new File(fname) }, null);
        }
    });
    modifyButton.setMnemonic(KeyEvent.VK_E);
    if (dirName.getSelectedIndex() == -1)
        modifyButton.setEnabled(false);
    modifyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String fname = (String) dirName.getSelectedItem();
            MPFConfigurationUI configurationUI = new MPFConfigurationUI(fname, MPFSelection.this);
            fname = configurationUI.getProjectDirectory();
            if (fname != null)
                filesSelected(new File[] { new File(fname) }, null);
        }
    });
    if (dirName.getSelectedIndex() == -1)
        okButton.setEnabled(false);
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            isOKSelected = true;
            dispose();
        }
    });
    dirName.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            modifyButton.setEnabled(true);
            okButton.setEnabled(true);
        }
    });
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
    ButtonBarBuilder2 bbb = new ButtonBarBuilder2();
    bbb.addGlue();
    bbb.addButton(newButton);
    bbb.addButton(modifyButton);
    bbb.addUnrelatedGap();
    bbb.addButton(cancelButton);
    bbb.addButton(okButton);
    JPanel buttonPanel = bbb.getPanel();
    buttonPanel.setBorder(Borders.createEmptyBorder("0dlu, 0dlu, 3dlu, 7dlu"));
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
}

From source file:org.deegree.igeo.views.swing.style.AnchorPointDefinitionPanel.java

License:Open Source License

private JPanel getAnchorPointDefinitionPanel() {

    this.rbList.add(this.tl);
    this.rbList.add(this.tc);
    this.rbList.add(this.tr);
    this.rbList.add(this.ml);
    this.rbList.add(this.mc);
    this.rbList.add(this.mr);
    this.rbList.add(this.dl);
    this.rbList.add(this.dc);
    this.rbList.add(this.dr);

    // init/*  www  .ja  v  a 2  s  .com*/
    ButtonGroup bg = new ButtonGroup();
    for (JRadioButton rb : this.rbList) {
        rb.setPreferredSize(new Dimension(12, 12));
        bg.add(rb);
        rb.addActionListener(this);
    }

    // invisible RadioButton to 'deselect' visible RadioButtons
    this.rbToDeselectOther.setVisible(false);
    bg.add(rbToDeselectOther);

    // layout
    FormLayout fl = new FormLayout("5px, left:30px, 10px, center:40px:grow(1.0), 10px, right:30px, 5px",
            "5px, top:17px,  center:16px:grow(1.0), bottom:17px, 5px");
    DefaultFormBuilder builder = new DefaultFormBuilder(fl);
    builder.setBorder(Borders.createEmptyBorder("0dlu, 0dlu, 0dlu, 0dlu"));

    builder.nextLine();
    builder.nextColumn();
    builder.append(this.tl);
    builder.append(this.tc);
    builder.append(this.tr);
    builder.nextLine();

    builder.nextColumn();
    builder.append(this.ml);
    builder.append(this.mc);
    builder.append(this.mr);
    builder.nextLine();

    builder.nextColumn();
    builder.append(this.dl);
    builder.append(this.dc);
    builder.append(this.dr);

    return builder.getPanel();
}

From source file:org.deegree.igeo.views.swing.style.RotationDefinitionPanel.java

License:Open Source License

private JPanel getRotationDefinitionPanel() {

    this.rbList.add(this.tl);
    this.rbList.add(this.tc);
    this.rbList.add(this.tr);
    this.rbList.add(this.ml);
    this.rbList.add(this.mr);
    this.rbList.add(this.dl);
    this.rbList.add(this.dc);
    this.rbList.add(this.dr);

    // init//from w  ww.ja va 2 s  . com
    ButtonGroup bg = new ButtonGroup();
    for (JRadioButton rb : this.rbList) {
        rb.setPreferredSize(new Dimension(12, 12));
        bg.add(rb);
        rb.addActionListener(this);
    }

    // invisible RadioButton to 'deselect' visible RadioButtons
    this.rbToDeselectOther.setVisible(false);
    bg.add(rbToDeselectOther);

    // layout
    FormLayout fl = new FormLayout("5px, left:30px, 10px, center:40px:grow(1.0), 10px, right:30px, 5px",
            "5px, top:17px,  center:16px:grow(1.0), bottom:17px, 5px");
    DefaultFormBuilder builder = new DefaultFormBuilder(fl);
    builder.setBorder(Borders.createEmptyBorder("0dlu, 0dlu, 0dlu, 0dlu"));

    builder.nextLine();
    builder.nextColumn();
    builder.append(tl);
    builder.append(tc);
    builder.append(tr);
    builder.nextLine();

    builder.nextColumn();
    builder.append(ml);
    builder.nextColumn(2);
    builder.append(mr);
    builder.nextLine();

    builder.nextColumn();
    builder.append(dl);
    builder.append(dc);
    builder.append(dr);

    return builder.getPanel();
}

From source file:org.openpythia.maindialog.MainDialogView.java

License:Apache License

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    menuBar = new JMenuBar();
    menu1 = new JMenu();
    miQuit = new JMenuItem();
    menu2 = new JMenu();
    miOnlineHelp = new JMenuItem();
    miAbout = new JMenuItem();
    panelGlobalLayout = new JPanel();
    scrollPaneOverview = new JScrollPane();
    panelOverview = new JPanel();
    scrollPaneDetail = new JScrollPane();
    panelDetails = new JPanel();
    panelMemory = new JPanel();
    lblMemoryUsed = new JLabel();
    progressBarMemory = new JProgressBar();
    lblTotalMemory = new JLabel();

    //======== this ========
    setTitle("Pythia");
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== menuBar ========
    {/*  w w  w  .j a v a 2  s .  com*/

        //======== menu1 ========
        {
            menu1.setText("File");

            //---- miQuit ----
            miQuit.setText("Quit");
            menu1.add(miQuit);
        }
        menuBar.add(menu1);

        //======== menu2 ========
        {
            menu2.setText("Help");

            //---- miOnlineHelp ----
            miOnlineHelp.setText("Open Online Help");
            menu2.add(miOnlineHelp);
            menu2.addSeparator();

            //---- miAbout ----
            miAbout.setText("About");
            menu2.add(miAbout);
        }
        menuBar.add(menu2);
    }
    setJMenuBar(menuBar);

    //======== panelGlobalLayout ========
    {
        panelGlobalLayout.setLayout(new FormLayout("$lcgap, default, $lcgap, default:grow, $lcgap",
                "$lgap, fill:100dlu, $lgap, fill:default:grow, $lgap, default, $lgap"));

        //======== scrollPaneOverview ========
        {

            //======== panelOverview ========
            {
                panelOverview.setBorder(new EmptyBorder(5, 5, 5, 5));
                panelOverview.setLayout(new GridBagLayout());
                ((GridBagLayout) panelOverview.getLayout()).columnWidths = new int[] { 0, 0 };
                ((GridBagLayout) panelOverview.getLayout()).rowHeights = new int[] { 0, 0 };
                ((GridBagLayout) panelOverview.getLayout()).columnWeights = new double[] { 1.0, 1.0E-4 };
                ((GridBagLayout) panelOverview.getLayout()).rowWeights = new double[] { 0.0, 1.0E-4 };
            }
            scrollPaneOverview.setViewportView(panelOverview);
        }
        panelGlobalLayout.add(scrollPaneOverview, CC.xywh(2, 2, 1, 3));

        //======== scrollPaneDetail ========
        {

            //======== panelDetails ========
            {
                panelDetails.setBorder(Borders.createEmptyBorder("0dlu, 0dlu, 0dlu, 0dlu"));
                panelDetails.setLayout(new BorderLayout());
            }
            scrollPaneDetail.setViewportView(panelDetails);
        }
        panelGlobalLayout.add(scrollPaneDetail, CC.xywh(4, 2, 1, 3));

        //======== panelMemory ========
        {
            panelMemory.setLayout(
                    new FormLayout("default:grow, $lcgap, default, $lcgap, 30dlu, $lcgap, default", "default"));

            //---- lblMemoryUsed ----
            lblMemoryUsed.setText("Memory used");
            panelMemory.add(lblMemoryUsed, CC.xy(3, 1));
            panelMemory.add(progressBarMemory, CC.xy(5, 1));

            //---- lblTotalMemory ----
            lblTotalMemory.setText("MB");
            panelMemory.add(lblTotalMemory, CC.xy(7, 1));
        }
        panelGlobalLayout.add(panelMemory, CC.xywh(2, 6, 3, 1));
    }
    contentPane.add(panelGlobalLayout, BorderLayout.NORTH);
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}