Example usage for com.jgoodies.forms.builder DefaultFormBuilder appendI15d

List of usage examples for com.jgoodies.forms.builder DefaultFormBuilder appendI15d

Introduction

In this page you can find the example usage for com.jgoodies.forms.builder DefaultFormBuilder appendI15d.

Prototype

public JLabel appendI15d(String resourceKey, Component component) 

Source Link

Document

Adds an internationalized (i15d) text label and component to the panel.

Usage

From source file:org.openthinclient.console.wizards.newdirobject.SelectObjectTypePanel.java

License:Open Source License

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor./*  w  w  w  . j av  a 2 s .c o  m*/
 */
private void initComponents() {
    final DefaultFormBuilder dfb = new DefaultFormBuilder(new FormLayout("r:p,3dlu,f:p:g,3dlu,p,3dlu,p"), //$NON-NLS-1$
            Messages.getBundle(), this);

    final String[] types = Messages.getString("NewDirObject.SelectObjectTypePanel.type_dropdown_types") //$NON-NLS-1$
            .split("\\s*,\\s*"); //$NON-NLS-1$
    final Class classes[] = new Class[types.length];
    for (int i = 0; i < types.length; i++)
        try {
            classes[i] = Class.forName(types[i]);
        } catch (final ClassNotFoundException e1) {
            // should not happen.
            throw new RuntimeException(e1);
        }

    typeComboBox = new JComboBox(types);
    typeComboBox.setRenderer(new DefaultListCellRenderer() {
        /*
         * @see javax.swing.DefaultListCellRenderer#getListCellRendererComponent(javax.swing.JList,
         *      java.lang.Object, int, boolean, boolean)
         */
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            String v = value.toString();
            v = v.substring(v.lastIndexOf('.') + 1);
            return super.getListCellRendererComponent(list,
                    Messages.getString("NewDirObject.SelectObjectTypePanel.dropdown_item." + v), index, //$NON-NLS-1$
                    isSelected, cellHasFocus);
        }
    });
    typeComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            fireChangeEvent();
        }
    });

    realmComboBox = new JComboBox(realms.toArray());
    realmComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            fireChangeEvent();
        }
    });

    dfb.appendI15d("NewDirObject.SelectObjectTypePanel.realm_label", realmComboBox); //$NON-NLS-1$
    dfb.nextLine();

    dfb.appendI15d("NewDirObject.SelectObjectTypePanel.type_label", typeComboBox); //$NON-NLS-1$
    dfb.nextLine();

}

From source file:org.openthinclient.console.wizards.newdirobject.SelectSchemaPanel.java

License:Open Source License

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor./*w w w  . jav  a2 s  .c om*/
 */
private void initComponents() {
    final DocumentListener dl = new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            fireChangeEvent();
        }

        public void insertUpdate(DocumentEvent e) {
            fireChangeEvent();
        }

        public void removeUpdate(DocumentEvent e) {
            fireChangeEvent();
        }
    };
    final DefaultFormBuilder dfb = new DefaultFormBuilder(new FormLayout("r:p,3dlu,f:p:g,3dlu,p,3dlu,p"), //$NON-NLS-1$
            Messages.getBundle(), this);

    nameField = new javax.swing.JTextField();
    nameField.getDocument().addDocumentListener(dl);
    dfb.appendI15d("NewDirObject.SelectSchemaPanel.name_label", nameField); //$NON-NLS-1$
    dfb.nextLine();

    descriptionTextField = new javax.swing.JTextField();
    descriptionTextField.getDocument().addDocumentListener(dl);
    dfb.appendI15d("NewDirObject.SelectSchemaPanel.description_label", descriptionTextField); //$NON-NLS-1$
    dfb.nextLine();

    typeComboBox = new javax.swing.JComboBox();
    typeComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            fireChangeEvent();
        }
    });

    dfb.appendI15d("NewDirObject.SelectSchemaPanel.type_label", typeComboBox); //$NON-NLS-1$
    dfb.nextLine();
}