Example usage for javax.swing SwingConstants RIGHT

List of usage examples for javax.swing SwingConstants RIGHT

Introduction

In this page you can find the example usage for javax.swing SwingConstants RIGHT.

Prototype

int RIGHT

To view the source code for javax.swing SwingConstants RIGHT.

Click Source Link

Document

Box-orientation constant used to specify the right side of a box.

Usage

From source file:edu.ku.brc.specify.tools.l10nios.StrLocalizerAppForiOS.java

/**
 * /*from w  w w.  java2s  .  c  o m*/
 */
private void createUI() {
    IconManager.setApplicationClass(Specify.class);
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_datamodel.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_plugins.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_disciplines.xml")); //$NON-NLS-1$

    System.setProperty("edu.ku.brc.ui.db.PickListDBAdapterFactory", //$NON-NLS-1$
            "edu.ku.brc.specify.tools.StrLocPickListFactory"); // Needed By the Auto Cosmplete UI  //$NON-NLS-1$

    CellConstraints cc = new CellConstraints();

    fileList = new JList(fileModel = new DefaultListModel());
    termList = new JList(model = new ItemModel(null));

    srcLbl = setTAReadOnly(UIHelper.createTextArea(3, 40));
    //srcLbl.setBorder(new LineBorder(srcLbl.getForeground()));
    textField = UIHelper.createTextField(40);

    comment = setTAReadOnly(UIHelper.createTextArea(3, 40));

    /*textField.getDocument().addDocumentListener(new DocumentAdaptor() {
    @Override
    protected void changed(DocumentEvent e)
    {
        hasChanged = true;
    }
    });*/

    statusBar = new JStatusBar();
    statusBar.setSectionText(1, "     "); //$NON-NLS-1$ //$NON-NLS-2$
    UIRegistry.setStatusBar(statusBar);

    srcLbl.setEditable(false);

    rsController = new ResultSetController(null, false, false, false, "", 1, true);

    transBtn = UIHelper.createButton(getResourceString("StrLocalizerApp.Translate"));
    transBtn.setVisible(false);

    PanelBuilder pbr = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p,4px,p,4px,p,4px,p,4px,p,4px,p"));

    //pbr.add(UIHelper.createLabel(getResourceString("StrLocalizerApp.FileLbl")), cc.xy(1, 1));
    //fileLbl = UIHelper.createLabel("   ");
    //pbr.add(fileLbl, cc.xy(3, 1));

    int y = 1;
    pbr.addSeparator("Item", cc.xyw(1, y, 3));
    y += 2;

    pbr.add(UIHelper.createLabel("English:", SwingConstants.RIGHT), cc.xy(1, y));
    pbr.add(srcLbl, cc.xy(3, y));
    y += 2;

    pbr.add(UIHelper.createFormLabel("Comment", SwingConstants.RIGHT), cc.xy(1, y));
    pbr.add(comment, cc.xy(3, y));
    y += 2;

    destLbl = UIHelper.createFormLabel("", SwingConstants.RIGHT);//destLanguage.getDisplayName());
    pbr.add(destLbl, cc.xy(1, y));
    pbr.add(textField, cc.xy(3, y));
    y += 2;

    pbr.add(rsController.getPanel(), cc.xyw(1, y, 3));
    y += 2;
    pbr.add(transBtn, cc.xy(1, y));

    JScrollPane sp = UIHelper.createScrollPane(termList);

    PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,4px,f:p:g,10px,p"));
    pb.addSeparator("Localize", cc.xy(1, 1));
    pb.add(sp, cc.xy(1, 3));
    pb.add(pbr.getPanel(), cc.xy(1, 5));
    pb.setDefaultDialogBorder();

    ResultSetController.setBackStopRS(rsController);

    PanelBuilder fpb = new PanelBuilder(new FormLayout("8px,f:p:g", "p,4px,f:p:g"));
    JScrollPane filesp = UIHelper.createScrollPane(fileList);
    fpb.add(UIHelper.createLabel("Files", SwingConstants.CENTER), cc.xy(2, 1));
    fpb.add(filesp, cc.xy(2, 3));

    setLayout(new BorderLayout());
    add(fpb.getPanel(), BorderLayout.WEST);
    add(pb.getPanel(), BorderLayout.CENTER);
    add(statusBar, BorderLayout.SOUTH);

    mainPane = this;

    textField.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            checkForChange();
        }
    });

    termList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                itemSelected();
            }
        }
    });

    fileList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                fileSelected();
            }
        }
    });

    transBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String txt = srcLbl.getText();
            String newText = translate(txt);
            if (StringUtils.isNotEmpty(newText)) {
                newText = newText.replace("'", "'");
                textField.setText(newText);
                L10NItem entry = (L10NItem) termList.getSelectedValue();
                entry.setValue(textField.getText());
            }
        }
    });

    rscListener = new ResultSetControllerListener() {
        @Override
        public void newRecordAdded() {
        }

        @Override
        public void indexChanged(int newIndex) {
            termList.setSelectedIndex(newIndex);
        }

        @Override
        public boolean indexAboutToChange(int oldIndex, int newIndex) {
            return true;
        }
    };

    rsController.addListener(rscListener);
}

From source file:com.mirth.connect.plugins.httpauth.HttpAuthConnectorPropertiesPanel.java

private void initComponents() {
    setBackground(UIConstants.BACKGROUND_COLOR);

    typeLabel = new JLabel("Authentication Type:");
    typeLabel.setHorizontalAlignment(SwingConstants.RIGHT);

    typeComboBox = new MirthComboBox();
    typeComboBox.setModel(new DefaultComboBoxModel<AuthType>(AuthType.values()));
    typeComboBox.addActionListener(new ActionListener() {
        @Override/*from ww  w .  ja  v a  2s  .c o m*/
        public void actionPerformed(ActionEvent evt) {
            authTypeChanged();
        }
    });
    typeComboBox.setToolTipText("Select the type of HTTP authentication to perform for incoming requests.");

    basicRealmLabel = new JLabel("Realm:");
    basicRealmField = new MirthTextField();
    basicRealmField.setToolTipText("The protection space for this server.");
    basicCredentialsLabel = new JLabel("Credentials:");

    basicCredentialsPanel = new JPanel();
    basicCredentialsPanel.setBackground(getBackground());

    basicCredentialsTable = new MirthTable();
    basicCredentialsTable.setModel(new RefreshTableModel(new String[] { "Username", "Password" }, 0));
    basicCredentialsTable.setCustomEditorControls(true);
    basicCredentialsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    basicCredentialsTable.setRowSelectionAllowed(true);
    basicCredentialsTable.setRowHeight(UIConstants.ROW_HEIGHT);
    basicCredentialsTable.setDragEnabled(false);
    basicCredentialsTable.setOpaque(true);
    basicCredentialsTable.setSortable(false);
    basicCredentialsTable.getTableHeader().setReorderingAllowed(false);
    basicCredentialsTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    basicCredentialsTable.setToolTipText(
            "<html>Username and password pairs to authenticate<br/>users with. At least one pair is required.</html>");

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        basicCredentialsTable.setHighlighters(highlighter);
    }

    CredentialsTableCellEditor basicCredentialsTableCellEditor = new CredentialsTableCellEditor(
            basicCredentialsTable);
    basicCredentialsTable.getColumnExt(0).setCellEditor(basicCredentialsTableCellEditor);
    basicCredentialsTable.getColumnExt(0).setToolTipText("The username to authenticate with.");
    basicCredentialsTable.getColumnExt(1).setCellRenderer(new PasswordCellRenderer());
    basicCredentialsTable.getColumnExt(1).setCellEditor(new DefaultCellEditor(new JPasswordField()));
    basicCredentialsTable.getColumnExt(1).setToolTipText("The password to authenticate with.");

    basicCredentialsTableScrollPane = new JScrollPane(basicCredentialsTable);

    basicCredentialsNewButton = new MirthButton("New");
    basicCredentialsNewButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int num = 0;
            String username;
            boolean found;
            do {
                num++;
                username = "user" + num;

                found = false;
                for (int row = 0; row < basicCredentialsTable.getModel().getRowCount(); row++) {
                    if (StringUtils.equals(username,
                            (String) basicCredentialsTable.getModel().getValueAt(row, 0))) {
                        found = true;
                    }
                }
            } while (found);

            ((DefaultTableModel) basicCredentialsTable.getModel()).addRow(new String[] { username, "" });
            basicCredentialsTable.setRowSelectionInterval(basicCredentialsTable.getRowCount() - 1,
                    basicCredentialsTable.getRowCount() - 1);
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
        }
    });

    basicCredentialsDeleteButton = new MirthButton("Delete");
    basicCredentialsDeleteButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int selectedRow = getSelectedRow(basicCredentialsTable);
            if (selectedRow >= 0) {
                if (basicCredentialsTable.isEditing()) {
                    basicCredentialsTable.getCellEditor().cancelCellEditing();
                }

                ((DefaultTableModel) basicCredentialsTable.getModel()).removeRow(selectedRow);

                int rowCount = basicCredentialsTable.getRowCount();
                if (selectedRow < rowCount) {
                    basicCredentialsTable.setRowSelectionInterval(selectedRow, selectedRow);
                } else if (rowCount > 0) {
                    basicCredentialsTable.setRowSelectionInterval(rowCount - 1, rowCount - 1);
                }

                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
            }
        }
    });
    basicCredentialsTableCellEditor.setDeleteButton(basicCredentialsDeleteButton);

    digestRealmLabel = new JLabel("Realm:");
    digestRealmField = new MirthTextField();
    digestRealmField.setToolTipText("The protection space for this server.");

    digestAlgorithmLabel = new JLabel("Algorithms:");
    ButtonGroup digestAlgorithmButtonGroup = new ButtonGroup();
    String toolTipText = "<html>Specifies the digest algorithms supported by this server.<br/><b>&nbsp;- MD5:</b> The security data A1 will contain the username, realm, and password.<br/><b>&nbsp;- MD5-sess:</b> The security data A1 will also contain the server and client nonces.</html>";

    digestAlgorithmMD5Radio = new MirthRadioButton(Algorithm.MD5.toString());
    digestAlgorithmMD5Radio.setBackground(getBackground());
    digestAlgorithmMD5Radio.setToolTipText(toolTipText);
    digestAlgorithmButtonGroup.add(digestAlgorithmMD5Radio);

    digestAlgorithmMD5SessRadio = new MirthRadioButton(Algorithm.MD5_SESS.toString());
    digestAlgorithmMD5SessRadio.setBackground(getBackground());
    digestAlgorithmMD5SessRadio.setToolTipText(toolTipText);
    digestAlgorithmButtonGroup.add(digestAlgorithmMD5SessRadio);

    digestAlgorithmBothRadio = new MirthRadioButton("Both");
    digestAlgorithmBothRadio.setBackground(getBackground());
    digestAlgorithmBothRadio.setToolTipText(toolTipText);
    digestAlgorithmButtonGroup.add(digestAlgorithmBothRadio);

    digestQOPLabel = new JLabel("QOP Modes:");
    toolTipText = "<html>The quality of protection modes to support.<br/><b>&nbsp;- auth:</b> Regular auth with client nonce and count in the digest.<br/><b>&nbsp;- auth-int:</b> Same as auth, but also with message integrity protection enabled.</html>";

    digestQOPAuthCheckBox = new MirthCheckBox(QOPMode.AUTH.toString());
    digestQOPAuthCheckBox.setBackground(getBackground());
    digestQOPAuthCheckBox.setToolTipText(toolTipText);

    digestQOPAuthIntCheckBox = new MirthCheckBox(QOPMode.AUTH_INT.toString());
    digestQOPAuthIntCheckBox.setBackground(getBackground());
    digestQOPAuthIntCheckBox.setToolTipText(toolTipText);

    digestOpaqueLabel = new JLabel("Opaque:");
    digestOpaqueField = new MirthTextField();
    digestOpaqueField.setToolTipText("A string of data that should be returned by the client unchanged.");
    digestCredentialsLabel = new JLabel("Credentials:");

    digestCredentialsPanel = new JPanel();
    digestCredentialsPanel.setBackground(getBackground());

    digestCredentialsTable = new MirthTable();
    digestCredentialsTable.setModel(new RefreshTableModel(new String[] { "Username", "Password" }, 0));
    digestCredentialsTable.setCustomEditorControls(true);
    digestCredentialsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    digestCredentialsTable.setRowSelectionAllowed(true);
    digestCredentialsTable.setRowHeight(UIConstants.ROW_HEIGHT);
    digestCredentialsTable.setDragEnabled(false);
    digestCredentialsTable.setOpaque(true);
    digestCredentialsTable.setSortable(false);
    digestCredentialsTable.getTableHeader().setReorderingAllowed(false);
    digestCredentialsTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    digestCredentialsTable.setToolTipText(
            "<html>Username and password pairs to authenticate<br/>users with. At least one pair is required.</html>");

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        digestCredentialsTable.setHighlighters(highlighter);
    }

    CredentialsTableCellEditor digestCredentialsTableCellEditor = new CredentialsTableCellEditor(
            digestCredentialsTable);
    digestCredentialsTable.getColumnExt(0).setCellEditor(digestCredentialsTableCellEditor);
    digestCredentialsTable.getColumnExt(0).setToolTipText("The username to authenticate with.");
    digestCredentialsTable.getColumnExt(1).setCellRenderer(new PasswordCellRenderer());
    digestCredentialsTable.getColumnExt(1).setCellEditor(new DefaultCellEditor(new JPasswordField()));
    digestCredentialsTable.getColumnExt(1).setToolTipText("The password to authenticate with.");

    digestCredentialsTableScrollPane = new JScrollPane(digestCredentialsTable);

    digestCredentialsNewButton = new MirthButton("New");
    digestCredentialsNewButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int num = 0;
            String username;
            boolean found;
            do {
                num++;
                username = "user" + num;

                found = false;
                for (int row = 0; row < digestCredentialsTable.getModel().getRowCount(); row++) {
                    if (StringUtils.equals(username,
                            (String) digestCredentialsTable.getModel().getValueAt(row, 0))) {
                        found = true;
                    }
                }
            } while (found);

            ((DefaultTableModel) digestCredentialsTable.getModel()).addRow(new String[] { username, "" });
            digestCredentialsTable.setRowSelectionInterval(digestCredentialsTable.getRowCount() - 1,
                    digestCredentialsTable.getRowCount() - 1);
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
        }
    });

    digestCredentialsDeleteButton = new MirthButton("Delete");
    digestCredentialsDeleteButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int selectedRow = getSelectedRow(digestCredentialsTable);
            if (selectedRow >= 0) {
                if (digestCredentialsTable.isEditing()) {
                    digestCredentialsTable.getCellEditor().cancelCellEditing();
                }

                ((DefaultTableModel) digestCredentialsTable.getModel()).removeRow(selectedRow);

                int rowCount = digestCredentialsTable.getRowCount();
                if (selectedRow < rowCount) {
                    digestCredentialsTable.setRowSelectionInterval(selectedRow, selectedRow);
                } else if (rowCount > 0) {
                    digestCredentialsTable.setRowSelectionInterval(rowCount - 1, rowCount - 1);
                }

                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
            }
        }
    });
    digestCredentialsTableCellEditor.setDeleteButton(digestCredentialsDeleteButton);

    jsScriptLabel = new JLabel("Script:");
    jsScriptField = new JTextField();
    jsScriptField.setEditable(false);
    jsScriptField.setBackground(getBackground());
    jsScriptField.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    jsScriptField.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent evt) {
            JavaScriptHttpAuthDialog dialog = new JavaScriptHttpAuthDialog(PlatformUI.MIRTH_FRAME, jsScript);
            if (dialog.wasSaved()) {
                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
                jsScript = dialog.getScript();
                updateJSScriptField();
            }
        }
    });
    jsScriptField.setToolTipText(
            "<html>Click here to open the JavaScript editor dialog.<br/>The return value of this script is used to accept or reject requests.</html>");

    customClassNameLabel = new JLabel("Class Name:");
    customClassNameField = new MirthTextField();
    customClassNameField
            .setToolTipText("The fully-qualified Java class name of the Authenticator class to use.");
    customPropertiesLabel = new JLabel("Properties:");

    customPropertiesPanel = new JPanel();
    customPropertiesPanel.setBackground(getBackground());

    customPropertiesTable = new MirthTable();
    customPropertiesTable.setModel(new RefreshTableModel(new String[] { "Name", "Value" }, 0));
    customPropertiesTable.setCustomEditorControls(true);
    customPropertiesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    customPropertiesTable.setRowSelectionAllowed(true);
    customPropertiesTable.setRowHeight(UIConstants.ROW_HEIGHT);
    customPropertiesTable.setDragEnabled(false);
    customPropertiesTable.setOpaque(true);
    customPropertiesTable.setSortable(false);
    customPropertiesTable.getTableHeader().setReorderingAllowed(false);
    customPropertiesTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    customPropertiesTable.setToolTipText(
            "Optional properties to pass into the Authenticator class when it is instantiated.");

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        customPropertiesTable.setHighlighters(highlighter);
    }

    CredentialsTableCellEditor customPropertiesTableCellEditor = new CredentialsTableCellEditor(
            customPropertiesTable);
    customPropertiesTable.getColumnExt(0).setCellEditor(customPropertiesTableCellEditor);
    customPropertiesTable.getColumnExt(0).setToolTipText("The name of the property to include.");
    customPropertiesTable.getColumnExt(1).setToolTipText("The value of the property to include.");

    customPropertiesTableScrollPane = new JScrollPane(customPropertiesTable);

    customPropertiesNewButton = new MirthButton("New");
    customPropertiesNewButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int num = 0;
            String name;
            boolean found;
            do {
                num++;
                name = "Property " + num;

                found = false;
                for (int row = 0; row < customPropertiesTable.getModel().getRowCount(); row++) {
                    if (StringUtils.equals(name,
                            (String) customPropertiesTable.getModel().getValueAt(row, 0))) {
                        found = true;
                    }
                }
            } while (found);

            ((DefaultTableModel) customPropertiesTable.getModel()).addRow(new String[] { name, "" });
            customPropertiesTable.setRowSelectionInterval(customPropertiesTable.getRowCount() - 1,
                    customPropertiesTable.getRowCount() - 1);
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
        }
    });

    customPropertiesDeleteButton = new MirthButton("Delete");
    customPropertiesDeleteButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            int selectedRow = getSelectedRow(customPropertiesTable);
            if (selectedRow >= 0) {
                if (customPropertiesTable.isEditing()) {
                    customPropertiesTable.getCellEditor().cancelCellEditing();
                }

                ((DefaultTableModel) customPropertiesTable.getModel()).removeRow(selectedRow);

                int rowCount = customPropertiesTable.getRowCount();
                if (selectedRow < rowCount) {
                    customPropertiesTable.setRowSelectionInterval(selectedRow, selectedRow);
                } else if (rowCount > 0) {
                    customPropertiesTable.setRowSelectionInterval(rowCount - 1, rowCount - 1);
                }

                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
            }
        }
    });
    customPropertiesTableCellEditor.setDeleteButton(customPropertiesDeleteButton);

    oauth2TokenLabel = new JLabel("Access Token Location:");

    oauth2TokenLocationComboBox = new MirthComboBox();
    oauth2TokenLocationComboBox.setModel(new DefaultComboBoxModel<TokenLocation>(TokenLocation.values()));
    oauth2TokenLocationComboBox
            .setToolTipText("Determines where the access token is located in client requests.");

    oauth2TokenField = new MirthTextField();
    oauth2TokenField
            .setToolTipText("The header or query parameter to pass along with the verification request.");

    oauth2VerificationURLLabel = new JLabel("Verification URL:");
    oauth2VerificationURLField = new MirthTextField();
    oauth2VerificationURLField.setToolTipText(
            "<html>The HTTP URL to perform a GET request to for access<br/>token verification. If the response code is >= 400,<br/>the authentication attempt is rejected by the server.</html>");

    for (ConnectorPropertiesPlugin connectorPropertiesPlugin : LoadedExtensions.getInstance()
            .getConnectorPropertiesPlugins().values()) {
        if (connectorPropertiesPlugin
                .isConnectorPropertiesPluginSupported(HttpAuthConnectorPluginProperties.PLUGIN_POINT)) {
            connectorPropertiesPanel = connectorPropertiesPlugin.getConnectorPropertiesPanel();
        }
    }
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.TemplateEditor.java

@Override
public void createUI() {
    super.createUI();

    databaseSchema = WorkbenchTask.getDatabaseSchema();

    int disciplineeId = AppContextMgr.getInstance().getClassObject(Discipline.class).getDisciplineId();
    SchemaI18NService.getInstance().loadWithLocale(SpLocaleContainer.WORKBENCH_SCHEMA, disciplineeId,
            databaseSchema, SchemaI18NService.getCurrentLocale());

    // Create the Table List
    Vector<TableInfo> tableInfoList = new Vector<TableInfo>();
    for (DBTableInfo ti : databaseSchema.getTables()) {
        if (StringUtils.isNotEmpty(ti.toString())) {
            TableInfo tableInfo = new TableInfo(ti, IconManager.STD_ICON_SIZE);
            tableInfoList.add(tableInfo);

            Vector<FieldInfo> fldList = new Vector<FieldInfo>();
            for (DBFieldInfo fi : ti.getFields()) {
                String fldTitle = fi.getTitle().replace(" ", "");
                if (fldTitle.equalsIgnoreCase(fi.getName())) {
                    //get title from mapped field
                    UploadInfo upInfo = getUploadInfo(fi);
                    DBFieldInfo mInfo = getMappedFieldInfo(fi);
                    if (mInfo != null) {
                        String title = mInfo.getTitle();
                        if (upInfo != null && upInfo.getSequence() != -1) {
                            title += " " + (upInfo.getSequence() + 1);
                        }/*www  .  j  a v  a 2s. c  o  m*/
                        //if mapped-to table is different than the container table used
                        // in the wb, add the mapped-to table's title
                        if (mInfo.getTableInfo().getTableId() != ti.getTableId()) {
                            title = mInfo.getTableInfo().getTitle() + " " + title;
                        }
                        fi.setTitle(title);
                    }
                }
                fldList.add(new FieldInfo(ti, fi));
            }
            //Collections.sort(fldList);
            tableInfo.setFieldItems(fldList);
        }
    }
    Collections.sort(tableInfoList);

    fieldModel = new DefaultModifiableListModel<FieldInfo>();
    tableModel = new DefaultModifiableListModel<TableInfo>();
    for (TableInfo ti : tableInfoList) {
        tableModel.add(ti);

        // only added for layout
        for (FieldInfo fi : ti.getFieldItems()) {
            fieldModel.add(fi);
        }
    }

    tableList = new JList(tableModel);
    tableList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tableList.setCellRenderer(tableInfoListRenderer = new TableInfoListRenderer(IconManager.STD_ICON_SIZE));
    JScrollPane tableScrollPane = new JScrollPane(tableList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    tableList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                Object selObj = tableList.getSelectedValue();
                if (selObj != null) {
                    fillFieldList((TableInfo) selObj);
                }
                updateEnabledState();
            }
        }
    });

    fieldList = new JList(fieldModel);
    fieldList.setCellRenderer(tableInfoListRenderer = new TableInfoListRenderer(IconManager.STD_ICON_SIZE));
    fieldList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    JScrollPane fieldScrollPane = new JScrollPane(fieldList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    fieldList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                updateEnabledState();
                updateFieldDescription();
            }
        }
    });

    mapModel = new DefaultModifiableListModel<FieldMappingPanel>();
    mapList = new JList(mapModel);
    mapList.setCellRenderer(new MapCellRenderer());
    mapList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    mapScrollPane = new JScrollPane(mapList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    mapList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                FieldMappingPanel fmp = (FieldMappingPanel) mapList.getSelectedValue();
                if (fmp != null) {
                    ignoreMapListUpdate = true;

                    FieldInfo fldInfo = fmp.getFieldInfo();
                    if (fldInfo != null) {
                        for (int i = 0; i < tableModel.size(); i++) {
                            TableInfo tblInfo = (TableInfo) tableModel.get(i);
                            if (fldInfo.getTableinfo() == tblInfo.getTableInfo()) {
                                tableList.setSelectedValue(tblInfo, true);
                                fillFieldList(tblInfo);
                                //System.out.println(fldInfo.hashCode()+" "+fldInfo.getFieldInfo().hashCode());
                                fieldList.setSelectedValue(fldInfo, true);
                                updateFieldDescription();
                                break;
                            }
                        }
                    }
                    ignoreMapListUpdate = false;
                    updateEnabledState();
                }
            }
        }
    });

    upBtn = createIconBtn("ReorderUp", "WB_MOVE_UP", new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            int inx = mapList.getSelectedIndex();
            FieldMappingPanel fmp = mapModel.getElementAt(inx);

            mapModel.remove(fmp);
            mapModel.insertElementAt(fmp, inx - 1);
            mapList.setSelectedIndex(inx - 1);
            updateEnabledState();
            setChanged(true);
        }
    });
    downBtn = createIconBtn("ReorderDown", "WB_MOVE_DOWN", new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            int inx = mapList.getSelectedIndex();
            FieldMappingPanel fmp = mapModel.getElementAt(inx);

            mapModel.remove(fmp);
            mapModel.insertElementAt(fmp, inx + 1);
            mapList.setSelectedIndex(inx + 1);
            updateEnabledState();
            setChanged(true);
        }
    });

    JButton dumpMappingBtn = createIconBtn("BlankIcon", IconManager.IconSize.Std16, "WB_MAPPING_DUMP",
            new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    dumpMapping();
                }
            });
    dumpMappingBtn.setEnabled(true);
    dumpMappingBtn.setFocusable(false);
    dumpMappingBtn.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseEntered(MouseEvent e) {
            ((JButton) e.getSource()).setIcon(IconManager.getIcon("Save", IconManager.IconSize.Std16));
            super.mouseEntered(e);
        }

        @Override
        public void mouseExited(MouseEvent e) {
            ((JButton) e.getSource()).setIcon(IconManager.getIcon("BlankIcon", IconManager.IconSize.Std16));
            super.mouseExited(e);
        }

    });

    mapToBtn = createIconBtn("Map", "WB_ADD_MAPPING_ITEM", new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            map();
        }
    });
    unmapBtn = createIconBtn("Unmap", "WB_REMOVE_MAPPING_ITEM", new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            unmap();
        }
    });

    // Adjust all Labels depending on whether we are creating a new template or not
    // and whether it is from a file or not
    String mapListLeftLabel;
    String mapListRightLabel;

    // Note: if workbenchTemplate is null then it is 
    String dataTypeLabel = getResourceString("WB_DATA_TYPE");
    String fieldsLabel = getResourceString("WB_FIELDS");

    mapListLeftLabel = fieldsLabel;
    mapListRightLabel = getResourceString("WB_COLUMNS");

    CellConstraints cc = new CellConstraints();

    JPanel mainLayoutPanel = new JPanel();

    PanelBuilder labelsBldr = new PanelBuilder(new FormLayout("p, f:p:g, p", "p"));
    labelsBldr.add(createLabel(mapListLeftLabel, SwingConstants.LEFT), cc.xy(1, 1));
    labelsBldr.add(createLabel(mapListRightLabel, SwingConstants.RIGHT), cc.xy(3, 1));

    PanelBuilder upDownPanel = new PanelBuilder(new FormLayout("p", "p,f:p:g, p, 2px, p, f:p:g"));
    upDownPanel.add(dumpMappingBtn, cc.xy(1, 1));
    upDownPanel.add(upBtn, cc.xy(1, 3));
    upDownPanel.add(downBtn, cc.xy(1, 5));

    PanelBuilder middlePanel = new PanelBuilder(new FormLayout("c:p:g", "p, 2px, p"));
    middlePanel.add(mapToBtn, cc.xy(1, 1));
    middlePanel.add(unmapBtn, cc.xy(1, 3));

    btnPanel = middlePanel.getPanel();
    btnPanel.setOpaque(false);

    PanelBuilder outerMiddlePanel = new PanelBuilder(new FormLayout("c:p:g", "f:p:g, p, f:p:g"));
    outerMiddlePanel.add(btnPanel, cc.xy(1, 2));
    outerMiddlePanel.getPanel().setOpaque(false);

    // Main Pane Layout
    PanelBuilder builder = new PanelBuilder(
            new FormLayout("f:max(200px;p):g, 5px, max(200px;p), 5px, p:g, 5px, f:max(250px;p):g, 2px, p",
                    "p, 2px, f:max(350px;p):g"),
            mainLayoutPanel);

    builder.add(createLabel(dataTypeLabel, SwingConstants.CENTER), cc.xy(1, 1));
    builder.add(createLabel(fieldsLabel, SwingConstants.CENTER), cc.xy(3, 1));
    builder.add(labelsBldr.getPanel(), cc.xy(7, 1));

    builder.add(tableScrollPane, cc.xy(1, 3));
    builder.add(fieldScrollPane, cc.xy(3, 3));

    builder.add(outerMiddlePanel.getPanel(), cc.xy(5, 3));

    builder.add(mapScrollPane, cc.xy(7, 3));
    builder.add(upDownPanel.getPanel(), cc.xy(9, 3));

    mainLayoutPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    JPanel megaPanel = new JPanel(new BorderLayout());
    megaPanel.add(mainLayoutPanel, BorderLayout.CENTER);
    descriptionLbl = createLabel("  ", SwingConstants.LEFT);
    //PanelBuilder descBuilder = new PanelBuilder(new FormLayout("f:p:g, 3dlu","p"));
    //descBuilder.add(descriptionLbl, cc.xy(1, 1));
    //megaPanel.add(descBuilder.getPanel(), BorderLayout.SOUTH);
    megaPanel.add(descriptionLbl, BorderLayout.SOUTH);
    //contentPanel = mainLayoutPanel;
    contentPanel = megaPanel;

    Color bgColor = btnPanel.getBackground();
    int inc = 16;
    btnPanelColor = new Color(Math.min(255, bgColor.getRed() + inc), Math.min(255, bgColor.getGreen() + inc),
            Math.min(255, bgColor.getBlue() + inc));
    btnPanel.setBackground(btnPanelColor);
    btnPanel.setBorder(BorderFactory.createEmptyBorder(4, 6, 4, 6));

    okBtn.setEnabled(false);

    HelpMgr.registerComponent(helpBtn, helpContext);

    if (dataFileInfo != null) {
        autoMapFromDataFile(dataFileInfo.getColInfo());
    }
    if (workbenchTemplate != null) {
        fillFromTemplate();
        setChanged(false);
    }

    mainPanel.add(contentPanel, BorderLayout.CENTER);

    if (dataFileInfo == null) //can't add new mappings when importing.
    {
        FieldMappingPanel fmp = addMappingItem(null,
                IconManager.getIcon("BlankIcon", IconManager.STD_ICON_SIZE), null);
        fmp.setAdded(true);
        fmp.setNew(true);
    }

    pack();

    SwingUtilities.invokeLater(new Runnable() {
        @SuppressWarnings("synthetic-access")
        public void run() {
            cancelBtn.requestFocus();
            fieldModel.clear();
            fieldList.clearSelection();
            updateFieldDescription();
            updateEnabledState();

            if (mapModel.size() > 1) {
                mapList.clearSelection();
            }
        }
    });
}

From source file:com.all.login.view.NewAccountFormPanel.java

private JLabel getNickNameLabel() {
    if (nickNameLabel == null) {
        nickNameLabel = new JLabel();
        nickNameLabel.setBounds(NICKNAME_LABEL_BOUNDS);
        nickNameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
        nickNameLabel.setName(SynthFonts.PLAIN_FONT16_GRAY100_100_100);
        nickNameLabel.setIcon(BULLET_ICON);
        nickNameLabel.setIconTextGap(REQUIRE_ICON_TEXT_GAP);
    }/* ww w  . j  a va 2s .  c o  m*/
    return nickNameLabel;
}

From source file:md.mclama.com.ModManager.java

/**
 * Create the frame.// w  w  w .  j av a  2 s  .  c  om
 */

@SuppressWarnings("serial")
public ModManager() throws MalformedURLException {
    setResizable(false);
    setTitle("McLauncher " + McVersion);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 700, 400);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(0, 0, 694, 372);
    contentPane.add(tabbedPane);

    profileListMdl = new DefaultListModel<String>();
    ModListModel = new DefaultListModel<String>();
    listModel = new DefaultListModel<String>();
    getCurrentMods();

    panelLauncher = new JPanel();
    tabbedPane.addTab("Launcher", null, panelLauncher, null);
    panelLauncher.setLayout(null);
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(556, 36, 132, 248);
    panelLauncher.add(scrollPane);
    profileList = new JList<String>(profileListMdl);
    profileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(profileList);

    btnNewProfile = new JButton("New");
    btnNewProfile.setFont(new Font("SansSerif", Font.PLAIN, 12));
    btnNewProfile.setBounds(479, 4, 76, 20);
    panelLauncher.add(btnNewProfile);
    btnNewProfile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            newProfile(txtProfile.getText());
        }
    });
    btnNewProfile.setToolTipText("Click to create a new profile.");

    JButton btnRenameProfile = new JButton("Rename");
    btnRenameProfile.setBounds(479, 25, 76, 20);
    panelLauncher.add(btnRenameProfile);
    btnRenameProfile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            renameProfile();
        }
    });
    btnRenameProfile.setToolTipText("Click to rename the selected profile");

    JButton btnDelProfile = new JButton("Delete");
    btnDelProfile.setBounds(479, 50, 76, 20);
    panelLauncher.add(btnDelProfile);
    btnDelProfile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            deleteProfile();
        }
    });
    btnDelProfile.setToolTipText("Click to delete the selected profile.");

    JButton btnLaunch = new JButton("Launch");
    btnLaunch.setBounds(605, 319, 89, 23);
    panelLauncher.add(btnLaunch);
    btnLaunch.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (selProfile != null) {
                LaunchFactorioWithSelectedMods(false); //dont ignore
            }
        }
    });
    btnLaunch.setToolTipText("Click to launch factorio with the selected mod profile.");

    lblAvailableMods = new JLabel("Available Mods");
    lblAvailableMods.setBounds(4, 155, 144, 14);
    panelLauncher.add(lblAvailableMods);
    lblAvailableMods.setFont(new Font("SansSerif", Font.PLAIN, 10));

    lblAvailableMods.setText("Available Mods: " + -1);

    txtGamePath = new JTextField();
    txtGamePath.setBounds(4, 5, 211, 23);
    panelLauncher.add(txtGamePath);
    txtGamePath.setToolTipText("Select tha path to your game!");
    txtGamePath.setFont(new Font("Tahoma", Font.PLAIN, 8));
    txtGamePath.setText("Game Path");
    txtGamePath.setColumns(10);

    JButton btnFind = new JButton("find");
    btnFind.setBounds(227, 3, 32, 23);
    panelLauncher.add(btnFind);

    txtProfile = new JTextField();
    txtProfile.setBounds(556, 2, 132, 22);
    panelLauncher.add(txtProfile);
    txtProfile.setToolTipText("The name of NEW or RENAME profiles");
    txtProfile.setText("Profile1");
    txtProfile.setColumns(10);

    lblModsEnabled = new JLabel("Mods Enabled: -1");
    lblModsEnabled.setBounds(335, 155, 95, 16);
    panelLauncher.add(lblModsEnabled);
    lblModsEnabled.setFont(new Font("SansSerif", Font.PLAIN, 10));

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(0, 167, 211, 165);
    panelLauncher.add(scrollPane_1);
    modsList = new JList<String>(listModel);
    modsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    modsList.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            String modName = util.getModVersion(modsList.getSelectedValue());
            lblModVersion.setText("Mod Version: " + modName);
            checkDependency(modsList);
            if (modName.contains(".zip")) {
                new File(System.getProperty("java.io.tmpdir") + modName.replace(".zip", "")).delete();
            }
            if (System.currentTimeMillis() - lastClickTime <= 300) { //Double click
                addMod();
            }
            lastClickTime = System.currentTimeMillis();
        }
    });
    scrollPane_1.setViewportView(modsList);
    modsList.setFont(new Font("Tahoma", Font.PLAIN, 9));

    JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setBounds(333, 167, 211, 165);
    panelLauncher.add(scrollPane_2);
    enabledModsList = new JList<String>(ModListModel);
    enabledModsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    enabledModsList.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            lblModVersion.setText("Mod Version: " + util.getModVersion(enabledModsList.getSelectedValue()));
            checkDependency(enabledModsList);
            if (System.currentTimeMillis() - lastClickTime <= 300) { //Double click
                removeMod();
            }
            lastClickTime = System.currentTimeMillis();
        }
    });
    enabledModsList.setFont(new Font("SansSerif", Font.PLAIN, 10));
    scrollPane_2.setViewportView(enabledModsList);

    JButton btnEnable = new JButton("Enable");
    btnEnable.setBounds(223, 200, 90, 28);
    panelLauncher.add(btnEnable);
    btnEnable.setToolTipText("Add mod -->");

    JButton btnDisable = new JButton("Disable");
    btnDisable.setBounds(223, 240, 90, 28);
    panelLauncher.add(btnDisable);
    btnDisable.setToolTipText("Disable mod ");

    JLabel lblModsAvailable = new JLabel("Mods available");
    lblModsAvailable.setBounds(4, 329, 89, 14);
    panelLauncher.add(lblModsAvailable);
    lblModsAvailable.setFont(new Font("SansSerif", Font.PLAIN, 10));

    JLabel lblEnabledMods = new JLabel("Enabled Mods");
    lblEnabledMods.setBounds(337, 329, 89, 16);
    panelLauncher.add(lblEnabledMods);
    lblEnabledMods.setFont(new Font("SansSerif", Font.PLAIN, 10));

    lblModVersion = new JLabel("Mod Version: (select a mod first)");
    lblModVersion.setBounds(4, 117, 183, 14);
    panelLauncher.add(lblModVersion);
    lblModVersion.setFont(new Font("SansSerif", Font.PLAIN, 10));

    lblRequiredMods = new JLabel("Required Mods: " + reqModsStr);
    lblRequiredMods.setBounds(6, 143, 538, 14);
    panelLauncher.add(lblRequiredMods);
    lblRequiredMods.setHorizontalAlignment(SwingConstants.RIGHT);
    lblRequiredMods.setFont(new Font("SansSerif", Font.PLAIN, 10));

    JButton btnNewButton = new JButton("TEST");
    btnNewButton.setVisible(testBtnEnabled);
    btnNewButton.setEnabled(testBtnEnabled);
    btnNewButton.setBounds(338, 61, 90, 28);
    panelLauncher.add(btnNewButton);
    btnUpdate.setBounds(218, 322, 103, 20);
    panelLauncher.add(btnUpdate);

    btnUpdate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            util.updateLauncher();
        }
    });
    btnUpdate.setVisible(false);
    btnUpdate.setFont(new Font("SansSerif", Font.PLAIN, 9));

    lblModRequires = new JLabel("Mod Requires: (Select a mod first)");
    lblModRequires.setBounds(4, 127, 317, 16);
    panelLauncher.add(lblModRequires);

    btnLaunchIgnore = new JButton("Launch + ignore");
    btnLaunchIgnore.setToolTipText("Ignore any errors that McLauncher may not correctly account for.");
    btnLaunchIgnore.setFont(new Font("SansSerif", Font.PLAIN, 11));
    btnLaunchIgnore.setBounds(556, 284, 133, 23);
    panelLauncher.add(btnLaunchIgnore);

    JButton btnConsole = new JButton("Console");
    btnConsole.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean changeto = !con.isVisible();
            con.setVisible(changeto);
            con.updateConsole();
        }
    });
    btnConsole.setBounds(335, 0, 90, 28);
    panelLauncher.add(btnConsole);

    JPanel panelDownloadMods = new JPanel();
    tabbedPane.addTab("Download Mods", null, panelDownloadMods, null);
    panelDownloadMods.setLayout(null);

    scrollPane_3 = new JScrollPane();
    scrollPane_3.setBounds(0, 0, 397, 303);
    panelDownloadMods.add(scrollPane_3);

    dlModel = new DefaultTableModel(new Object[][] {},
            new String[] { "Mod Name", "Author", "Version", "Tags" }) {
        Class[] columnTypes = new Class[] { String.class, String.class, String.class, Object.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }

        boolean[] columnEditables = new boolean[] { false, false, false, false };

        public boolean isCellEditable(int row, int column) {
            return columnEditables[column];
        };
    };

    tSorter = new TableRowSorter<DefaultTableModel>(dlModel);
    tableDownloads = new JTable();
    tableDownloads.setRowSorter(tSorter);
    tableDownloads.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            trow = tableDownloads.getSelectedRow();
            trow = tableDownloads.getRowSorter().convertRowIndexToModel(trow);
            getDlModData();
            canDownloadMod = true;
        }
    });
    tableDownloads.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            trow = tableDownloads.getSelectedRow();
            trow = tableDownloads.getRowSorter().convertRowIndexToModel(trow);
            getDlModData();
            canDownloadMod = true;
        }
    });
    tableDownloads.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    tableDownloads.setShowVerticalLines(true);
    tableDownloads.setShowHorizontalLines(true);
    tableDownloads.setModel(dlModel);
    tableDownloads.getColumnModel().getColumn(0).setPreferredWidth(218);
    tableDownloads.getColumnModel().getColumn(1).setPreferredWidth(97);
    tableDownloads.getColumnModel().getColumn(2).setPreferredWidth(77);
    scrollPane_3.setViewportView(tableDownloads);

    btnDownload = new JButton("Download");
    btnDownload.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (canDownloadMod && !CurrentlyDownloading) {
                String dlUrl = getModDownloadUrl();
                try {
                    if (dlUrl.equals("") || dlUrl.equals(" ") || dlUrl == null) {
                        con.log("Log", "No download link for mod, got... '" + dlUrl + "'");
                    } else {
                        CurrentlyDownloading = true;
                        CurrentDownload = new Download(new URL(dlUrl), McLauncher);
                    }
                } catch (MalformedURLException e1) {
                    con.log("Log", "Failed to download mod... No download URL?");
                }
            }
        }
    });
    btnDownload.setBounds(307, 308, 90, 28);
    panelDownloadMods.add(btnDownload);

    btnGotoMod = new JButton("Mod Page");
    btnGotoMod.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            util.openWebpage(modPageUrl);
        }
    });
    btnGotoMod.setEnabled(false);
    btnGotoMod.setBounds(134, 308, 90, 28);
    panelDownloadMods.add(btnGotoMod);

    pBarDownloadMod = new JProgressBar();
    pBarDownloadMod.setBounds(538, 308, 150, 10);
    panelDownloadMods.add(pBarDownloadMod);

    pBarExtractMod = new JProgressBar();
    pBarExtractMod.setBounds(538, 314, 150, 10);
    panelDownloadMods.add(pBarExtractMod);

    lblDownloadModInfo = new JLabel("Download progress");
    lblDownloadModInfo.setBounds(489, 326, 199, 16);
    panelDownloadMods.add(lblDownloadModInfo);
    lblDownloadModInfo.setHorizontalAlignment(SwingConstants.TRAILING);

    panelModImg = new JPanel();
    panelModImg.setBounds(566, 0, 128, 128);
    panelDownloadMods.add(panelModImg);

    txtFilterText = new JTextField();
    txtFilterText.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            if (txtFilterText.getText().equals("Filter Text")) {
                txtFilterText.setText("");
                newFilter();
            }
        }
    });
    txtFilterText.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (!txtFilterText.getText().equals("Filter Text")) {
                newFilter();
            }
        }
    });
    txtFilterText.setText("Filter Text");
    txtFilterText.setBounds(0, 308, 122, 28);
    panelDownloadMods.add(txtFilterText);
    txtFilterText.setColumns(10);

    comboBox = new JComboBox();
    comboBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            newFilter();
        }
    });
    comboBox.setModel(new DefaultComboBoxModel(new String[] { "No tag filter", "Vanilla", "Machine", "Mechanic",
            "New Ore", "Module", "Big Mod", "Power", "GUI", "Map-Gen", "Must-Have", "Equipment" }));
    comboBox.setBounds(403, 44, 150, 26);
    panelDownloadMods.add(comboBox);

    lblModDlCounter = new JLabel("Mod database: ");
    lblModDlCounter.setFont(new Font("SansSerif", Font.PLAIN, 10));
    lblModDlCounter.setBounds(403, 5, 162, 16);
    panelDownloadMods.add(lblModDlCounter);

    txtrDMModDescription = new JTextArea();
    txtrDMModDescription.setBackground(Color.LIGHT_GRAY);
    txtrDMModDescription.setBorder(new LineBorder(new Color(0, 0, 0)));
    txtrDMModDescription.setFocusable(false);
    txtrDMModDescription.setEditable(false);
    txtrDMModDescription.setLineWrap(true);
    txtrDMModDescription.setWrapStyleWord(true);
    txtrDMModDescription.setText("Mod Description: ");
    txtrDMModDescription.setBounds(403, 132, 285, 75);
    panelDownloadMods.add(txtrDMModDescription);

    lblDMModTags = new JTextArea();
    lblDMModTags.setFocusable(false);
    lblDMModTags.setEditable(false);
    lblDMModTags.setBorder(new LineBorder(new Color(0, 0, 0)));
    lblDMModTags.setWrapStyleWord(true);
    lblDMModTags.setLineWrap(true);
    lblDMModTags.setBackground(Color.LIGHT_GRAY);
    lblDMModTags.setText("Mod Tags: ");
    lblDMModTags.setBounds(403, 71, 160, 60);
    panelDownloadMods.add(lblDMModTags);

    lblDMRequiredMods = new JTextArea();
    lblDMRequiredMods.setFocusable(false);
    lblDMRequiredMods.setEditable(false);
    lblDMRequiredMods.setText("Required Mods: ");
    lblDMRequiredMods.setWrapStyleWord(true);
    lblDMRequiredMods.setLineWrap(true);
    lblDMRequiredMods.setBorder(new LineBorder(new Color(0, 0, 0)));
    lblDMRequiredMods.setBackground(Color.LIGHT_GRAY);
    lblDMRequiredMods.setBounds(403, 208, 285, 57);
    panelDownloadMods.add(lblDMRequiredMods);

    lblDLModLicense = new JLabel("");
    lblDLModLicense.setHorizontalAlignment(SwingConstants.RIGHT);
    lblDLModLicense.setBounds(403, 294, 285, 16);
    panelDownloadMods.add(lblDLModLicense);

    lblWipmod = new JLabel("");
    lblWipmod.setBounds(395, 314, 64, 16);
    panelDownloadMods.add(lblWipmod);

    JButton btnCancel = new JButton("Cancel");
    btnCancel.setToolTipText("Stop downloading");
    btnCancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            CurrentDownload.cancel();
        }
    });
    btnCancel.setBounds(230, 308, 72, 28);
    panelDownloadMods.add(btnCancel);

    panelOptions = new JPanel();
    tabbedPane.addTab("Options", null, panelOptions, null);
    panelOptions.setLayout(null);
    scrollPane_4.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane_4.setBounds(0, 0, 694, 342);
    panelOptions.add(scrollPane_4);

    panel = new JPanel();
    scrollPane_4.setViewportView(panel);
    panel.setLayout(null);

    lblCloseMclauncherAfter = new JLabel("Close McLauncher after launching Factorio?");
    lblCloseMclauncherAfter.setBounds(6, 6, 274, 16);
    panel.add(lblCloseMclauncherAfter);

    lblCloseMclauncherAfter_1 = new JLabel("Close McLauncher after updating?");
    lblCloseMclauncherAfter_1.setBounds(6, 34, 274, 16);
    panel.add(lblCloseMclauncherAfter_1);

    lblSortNewestDownloadable = new JLabel("Sort newest downloadable mods first?");
    lblSortNewestDownloadable.setBounds(6, 62, 274, 16);
    panel.add(lblSortNewestDownloadable);

    tglbtnNewModsFirst = new JToggleButton("Toggle");
    tglbtnNewModsFirst.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            lblNeedrestart.setText("McLauncher needs to restart for that to work");
            writeData();
        }
    });
    tglbtnNewModsFirst.setSelected(true);
    tglbtnNewModsFirst.setBounds(281, 56, 66, 28);
    panel.add(tglbtnNewModsFirst);

    tglbtnCloseAfterUpdate = new JToggleButton("Toggle");
    tglbtnCloseAfterUpdate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnCloseAfterUpdate.setBounds(281, 28, 66, 28);
    panel.add(tglbtnCloseAfterUpdate);

    tglbtnCloseAfterLaunch = new JToggleButton("Toggle");
    tglbtnCloseAfterLaunch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnCloseAfterLaunch.setBounds(281, 0, 66, 28);
    panel.add(tglbtnCloseAfterLaunch);

    tglbtnDisplayon = new JToggleButton("On");
    tglbtnDisplayon.setFont(new Font("SansSerif", Font.PLAIN, 10));
    tglbtnDisplayon.setSelected(true);
    tglbtnDisplayon.setBounds(588, 308, 44, 28);
    panel.add(tglbtnDisplayon);

    tglbtnDisplayoff = new JToggleButton("Off");
    tglbtnDisplayoff.setFont(new Font("SansSerif", Font.PLAIN, 10));
    tglbtnDisplayoff.setBounds(644, 308, 44, 28);
    panel.add(tglbtnDisplayoff);

    lblInfo = new JLabel("What enabled and disabled look like");
    lblInfo.setFont(new Font("SansSerif", Font.PLAIN, 10));
    lblInfo.setHorizontalAlignment(SwingConstants.TRAILING);
    lblInfo.setBounds(359, 314, 231, 16);
    panel.add(lblInfo);

    JSeparator separator = new JSeparator();
    separator.setBounds(6, 55, 676, 24);
    panel.add(separator);

    JSeparator separator_1 = new JSeparator();
    separator_1.setBounds(6, 27, 676, 18);
    panel.add(separator_1);

    JSeparator separator_2 = new JSeparator();
    separator_2.setBounds(6, 84, 676, 24);
    panel.add(separator_2);

    JSeparator separator_3 = new JSeparator();
    separator_3.setOrientation(SwingConstants.VERTICAL);
    separator_3.setBounds(346, 0, 16, 336);
    panel.add(separator_3);

    lblNeedrestart = new JLabel("");
    lblNeedrestart.setBounds(6, 314, 341, 16);
    panel.add(lblNeedrestart);

    tglbtnSendAnonData = new JToggleButton("Toggle");
    tglbtnSendAnonData.setToolTipText("Information regarding the activity of McLauncher.");
    tglbtnSendAnonData.setSelected(true); //set enabled by default.
    tglbtnSendAnonData.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnSendAnonData.setBounds(622, 0, 66, 28);
    panel.add(tglbtnSendAnonData);

    lblSendAnonymousUse = new JLabel("Send anonymous use data?");
    lblSendAnonymousUse.setBounds(359, 6, 251, 16);
    panel.add(lblSendAnonymousUse);

    lblDeleteOldMod = new JLabel("Delete old mod before updating?");
    lblDeleteOldMod.setBounds(359, 34, 251, 16);
    panel.add(lblDeleteOldMod);

    tglbtnDeleteBeforeUpdate = new JToggleButton("Toggle");
    tglbtnDeleteBeforeUpdate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnDeleteBeforeUpdate.setBounds(622, 28, 66, 28);
    panel.add(tglbtnDeleteBeforeUpdate);

    tglbtnAlertOnModUpdateAvailable = new JToggleButton("Toggle");
    tglbtnAlertOnModUpdateAvailable.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            writeData();
        }
    });
    tglbtnAlertOnModUpdateAvailable.setSelected(true);
    tglbtnAlertOnModUpdateAvailable.setBounds(281, 86, 66, 28);
    panel.add(tglbtnAlertOnModUpdateAvailable);

    separator_4 = new JSeparator();
    separator_4.setBounds(0, 112, 676, 24);
    panel.add(separator_4);

    JLabel lblAlertModHas = new JLabel("Alert mod has update on launch?");
    lblAlertModHas.setBounds(6, 92, 231, 16);
    panel.add(lblAlertModHas);

    panelChangelog = new JPanel();
    tabbedPane.addTab("Changelog", null, panelChangelog, null);
    panelChangelog.setLayout(new BoxLayout(panelChangelog, BoxLayout.X_AXIS));

    scrollPane_6 = new JScrollPane();
    panelChangelog.add(scrollPane_6);

    textChangelog = new JTextArea();
    scrollPane_6.setViewportView(textChangelog);
    textChangelog.setEditable(false);
    textChangelog.setText(
            "v0.4.6\r\n\r\n+Fix problem where config file would not save in the correct location. (Thanks Arano-kai)\r\n+McLauncher will now save when you select a path, or profile. (Thanks Arano-kai)\r\n+Fixed an issue where McLauncher could not get the version from a .zip mod. (Thanks Arano-kai)\r\n+Added a Cancel button to stop downloading the current mod. (Suggested by  Arano-kai)\r\n\r\n\r\n\r\nv0.4.5\r\n\r\n+McLauncher should now correctly warn you on failed write/read access.\r\n+McLauncher should now work when a user has both zip and installer versions of factorio. (Thanks Jeroon)\r\n+Attempt to fix an error with dependency and .zip files, With versions. (Thanks Arano-kai)\r\n+Fix only allow single selection of mods. (Thanks Arano-kai)\r\n+Fix for the Launch+Ignore button problem on linux being cut off. (Thanks Arano-kai)\r\n+Display download progress.\r\n+Fixed an error that was thrown when clicking on some mods that had a single dependency mod.\r\n+Double clicking on a mod will now enable or disable the mod. (Thanks Arano-kai)");
    btnLaunchIgnore.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (selProfile != null) {
                LaunchFactorioWithSelectedMods(true); //ignore errors, launch.
            }
        }
    });
    btnLaunchIgnore.setVisible(false);
    //This is my test button. I use this to test things then implement them into the swing.
    btnNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            testButtonCode(e);
        }
    });
    //Disable mods button. (from profile)
    btnDisable.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            removeMod();
        }
    });
    //Enable mods button. (to profile)
    btnEnable.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            addMod();
        }
    });
    //Game path button
    btnFind.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            findPath();
        }
    });
    //mouseClick event lister for when you click on a new profile
    profileList.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            selectedProfile();
        }
    });

    readData(); //Load settings

    init(); //some extra init
    getMods(); //Get the mods the user has installed
}

From source file:edu.ku.brc.af.auth.UserAndMasterPasswordMgr.java

/**
 * @return//  ww  w .  ja v a2 s. c  o  m
 */
protected String[] getUserNamePasswordKey() {
    loadAndPushResourceBundle("masterusrpwd");

    FormLayout layout = new FormLayout("p, 4dlu, p, 8px, p", "p, 2dlu, p, 2dlu, p, 16px, p, 2dlu, p, 2dlu, p");
    layout.setRowGroups(new int[][] { { 1, 3, 5 } });

    PanelBuilder pb = new PanelBuilder(layout);

    final JTextField dbUsrTxt = createTextField(30);
    final JPasswordField dbPwdTxt = createPasswordField(30);
    final JTextField usrText = createTextField(30);
    final JPasswordField pwdText = createPasswordField(30);
    final char echoChar = pwdText.getEchoChar();

    final JLabel dbUsrLbl = createI18NFormLabel("USERNAME", SwingConstants.RIGHT);
    final JLabel dbPwdLbl = createI18NFormLabel("PASSWORD", SwingConstants.RIGHT);
    final JLabel usrLbl = createI18NFormLabel("USERNAME", SwingConstants.RIGHT);
    final JLabel pwdLbl = createI18NFormLabel("PASSWORD", SwingConstants.RIGHT);

    usrText.setText(usersUserName);

    CellConstraints cc = new CellConstraints();

    int y = 1;
    pb.addSeparator(UIRegistry.getResourceString("MASTER_SEP"), cc.xyw(1, y, 5));
    y += 2;

    pb.add(dbUsrLbl, cc.xy(1, y));
    pb.add(dbUsrTxt, cc.xy(3, y));
    y += 2;

    pb.add(dbPwdLbl, cc.xy(1, y));
    pb.add(dbPwdTxt, cc.xy(3, y));
    y += 2;

    pb.addSeparator(UIRegistry.getResourceString("USER_SEP"), cc.xyw(1, y, 5));
    y += 2;

    pb.add(usrLbl, cc.xy(1, y));
    pb.add(usrText, cc.xy(3, y));
    y += 2;

    pb.add(pwdLbl, cc.xy(1, y));
    pb.add(pwdText, cc.xy(3, y));

    pb.setDefaultDialogBorder();

    final CustomDialog dlg = new CustomDialog((Frame) null, getResourceString("MASTER_INFO_TITLE"), true,
            CustomDialog.OKCANCELAPPLYHELP, pb.getPanel());
    dlg.setOkLabel(getResourceString("GENERATE_KEY"));
    dlg.setHelpContext("MASTERPWD_GEN");
    dlg.setApplyLabel(showPwdLabel);

    dlg.createUI();
    dlg.getOkBtn().setEnabled(false);

    popResourceBundle();

    DocumentListener docListener = new DocumentAdaptor() {
        @Override
        protected void changed(DocumentEvent e) {
            String dbUserStr = dbUsrTxt.getText();

            boolean enable = !dbUserStr.isEmpty() && !((JTextField) dbPwdTxt).getText().isEmpty()
                    && !usrText.getText().isEmpty() && !((JTextField) pwdText).getText().isEmpty();
            if (enable && isNotEmpty(dbUserStr) && dbUserStr.equalsIgnoreCase("root")) {
                loadAndPushResourceBundle("masterusrpwd");
                UIRegistry.showLocalizedError("MASTER_NO_ROOT");
                popResourceBundle();
                enable = false;
            }
            dlg.getOkBtn().setEnabled(enable);
        }
    };

    dbUsrTxt.getDocument().addDocumentListener(docListener);
    dbPwdTxt.getDocument().addDocumentListener(docListener);
    usrText.getDocument().addDocumentListener(docListener);
    pwdText.getDocument().addDocumentListener(docListener);

    currEcho = echoChar;

    dlg.getApplyBtn().addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            dlg.getApplyBtn().setText(currEcho == echoChar ? hidePwdLabel : showPwdLabel);
            currEcho = currEcho == echoChar ? 0 : echoChar;
            pwdText.setEchoChar(currEcho);
            dbPwdTxt.setEchoChar(currEcho);
        }
    });

    dlg.setVisible(true);
    if (!dlg.isCancelled()) {
        return new String[] { dbUsrTxt.getText(), ((JTextField) dbPwdTxt).getText(), usrText.getText(),
                ((JTextField) pwdText).getText() };
    }

    return null;
}

From source file:multiplayer.pong.client.LobbyFrame.java

/**
 * 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./*from   w ww.  ja va2 s  . c om*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jScrollPane2 = new javax.swing.JScrollPane();
    jScrollPane2.setBackground(Color.WHITE);
    usernamesT = new javax.swing.JTable();
    usernamesT.setBackground(Color.WHITE);

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setBackground(new java.awt.Color(0, 0, 0));

    usernamesT.setModel(new javax.swing.table.DefaultTableModel(
            new Object[][] { { null }, { null }, { null }, { null } }, new String[] { "Username" }) {
        boolean[] canEdit = new boolean[] { false };

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    usernamesT.setGridColor(new java.awt.Color(0, 0, 0));
    usernamesT.setInheritsPopupMenu(true);
    jScrollPane2.setViewportView(usernamesT);
    if (usernamesT.getColumnModel().getColumnCount() > 0) {
        usernamesT.getColumnModel().getColumn(0).setResizable(false);
    }

    JLabel lblUtilisateursEnligne = new JLabel("Utilisateurs en-ligne");
    lblUtilisateursEnligne.setForeground(new Color(255, 255, 255));
    lblUtilisateursEnligne.setFont(new Font("Trebuchet MS", Font.PLAIN, 14));

    commandBtn = new JButton("Envoyer");
    commandBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            commandBtnActionPerformed(e);
        }
    });

    JLabel lblLobbyPrincipal = new JLabel("Lobby Principal");
    lblLobbyPrincipal.setFont(new Font("Georgia", Font.PLAIN, 70));
    lblLobbyPrincipal.setForeground(new Color(255, 255, 255));
    lblLobbyPrincipal.setBackground(new Color(0, 0, 0));

    scrollPane = new JScrollPane();
    scrollPane.setBackground(Color.WHITE);

    cmdPrompt = new JTextField();
    cmdPrompt.setColumns(10);
    cmdPrompt.grabFocus();

    scrollPane_1 = new JScrollPane();

    lblWelcome = new JLabel("Bienvenue, " + SocketHandler.username);
    lblWelcome.setHorizontalAlignment(SwingConstants.RIGHT);
    lblWelcome.setFont(new Font("Georgia", Font.PLAIN, 18));
    lblWelcome.setForeground(Color.WHITE);

    JLabel label = new JLabel("Amis connect\u00E9s");
    label.setForeground(Color.WHITE);
    label.setFont(new Font("Trebuchet MS", Font.PLAIN, 14));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                                    .addComponent(scrollPane_1, GroupLayout.PREFERRED_SIZE, 605,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cmdPrompt, 605, 605, 605))
                            .addPreferredGap(ComponentPlacement.RELATED))
                    .addGroup(layout.createSequentialGroup()
                            .addComponent(lblLobbyPrincipal, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addGap(120)))
            .addGroup(layout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(lblUtilisateursEnligne, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 169,
                            Short.MAX_VALUE)
                    .addGroup(Alignment.LEADING,
                            layout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(lblWelcome, GroupLayout.PREFERRED_SIZE, 160,
                                            GroupLayout.PREFERRED_SIZE))
                    .addComponent(commandBtn, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(label, GroupLayout.PREFERRED_SIZE, 169, GroupLayout.PREFERRED_SIZE))
                    .addGroup(Alignment.LEADING,
                            layout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(jScrollPane2, GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE))
                    .addGroup(Alignment.LEADING,
                            layout.createSequentialGroup().addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)))
            .addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.TRAILING).addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblLobbyPrincipal, GroupLayout.PREFERRED_SIZE, 85,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblWelcome, GroupLayout.PREFERRED_SIZE, 31,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(18)
                    .addGroup(layout.createParallelGroup(Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                    .addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 164,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(lblUtilisateursEnligne, GroupLayout.PREFERRED_SIZE, 24,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(jScrollPane2, GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE))
                            .addComponent(scrollPane_1, GroupLayout.DEFAULT_SIZE, 432, Short.MAX_VALUE))
                    .addGap(9)
                    .addGroup(
                            layout.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(cmdPrompt, GroupLayout.PREFERRED_SIZE, 22,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(commandBtn))
                    .addGap(22))
                    .addGroup(layout.createSequentialGroup()
                            .addComponent(label, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
                            .addGap(492)))));

    ta = new JTextPane();
    ta.setEditable(false);
    ta.setFont(new Font("SansSerif", Font.PLAIN, 14));
    scrollPane_1.setViewportView(ta);

    friendsT = new JTable();
    friendsT.setModel(new DefaultTableModel(new Object[][] {}, new String[] { "Username" }));
    scrollPane.setViewportView(friendsT);
    getContentPane().setLayout(layout);

    pack();
}

From source file:com.sec.ose.osi.ui.frm.login.JPanLogin.java

private JPanel getJPanelProxyInfo() {

    if (jPanelProxyInfo == null) {

        jPanelProxyInfo = new JPanel();
        jPanelProxyInfo.setLayout(new GridBagLayout());

        // Proxy Host
        JLabel jLabelProxyHost = new JLabel("Proxy Host :");
        jLabelProxyHost.setHorizontalAlignment(SwingConstants.RIGHT);
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridy = 0;/*from  w  ww  . ja  v  a2s.com*/
        gridBagConstraints.gridx = 0;
        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new Insets(0, 10, 0, 0);
        jPanelProxyInfo.add(jLabelProxyHost, gridBagConstraints);

        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.fill = GridBagConstraints.BOTH;
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.gridx = 1;
        gridBagConstraints1.weightx = 0.5;
        gridBagConstraints1.insets = new Insets(5, 5, 5, 5);
        jPanelProxyInfo.add(getJTextProxyHost(), gridBagConstraints1);

        // Proxy Port
        JLabel jLabelProxyPort = new JLabel("Port :");
        jLabelProxyPort.setHorizontalAlignment(SwingConstants.RIGHT);
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridy = 0;
        gridBagConstraints2.gridx = 2;
        gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints2.insets = new Insets(0, 10, 0, 0);
        jPanelProxyInfo.add(jLabelProxyPort, gridBagConstraints2);

        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.fill = GridBagConstraints.BOTH;
        gridBagConstraints3.gridy = 0;
        gridBagConstraints3.gridx = 3;
        gridBagConstraints3.weightx = 0.5;
        gridBagConstraints3.insets = new Insets(5, 5, 5, 5);
        jPanelProxyInfo.add(getJTextProxyPort(), gridBagConstraints3);

        // Proxy Bypass
        JLabel jLabelProxyBypass = new JLabel();
        jLabelProxyBypass.setText("     Proxy Bypass :");
        jLabelProxyBypass.setHorizontalAlignment(SwingConstants.RIGHT);
        jLabelProxyBypass.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
        GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
        gridBagConstraints11.gridy = 1;
        gridBagConstraints11.gridx = 0;
        gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints11.insets = new Insets(0, 10, 5, 0);
        jPanelProxyInfo.add(jLabelProxyBypass, gridBagConstraints11);

        GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
        gridBagConstraints21.gridy = 1;
        gridBagConstraints21.gridx = 1;
        gridBagConstraints21.gridwidth = 3;
        //gridBagConstraints21.weightx = 1.0;
        gridBagConstraints21.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints21.insets = new Insets(5, 5, 10, 5);

        jPanelProxyInfo.add(getJTextProxyBypass(), gridBagConstraints21);
    }
    return jPanelProxyInfo;
}

From source file:com.all.login.view.NewAccountFormPanel.java

private JLabel getAboutUsLabel() {
    if (aboutUsLabel == null) {
        aboutUsLabel = new JLabel();
        aboutUsLabel.setBounds(ABOUT_US_LABEL_BOUNDS);
        aboutUsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
        aboutUsLabel.setName(SynthFonts.PLAIN_FONT16_GRAY100_100_100);
    }//from   www .  j  a  va2s . c o m
    return aboutUsLabel;
}

From source file:com.jwmsolutions.timeCheck.gui.TodoForm.java

private JLabel getLblMessages() {
    if (lblMessages == null) {
        lblMessages = new JLabel();
        lblMessages.setHorizontalAlignment(SwingConstants.RIGHT);
        lblMessages.setForeground(new java.awt.Color(0, 64, 128));
    }/* w  w  w. j  a v a  2 s.c o  m*/
    return lblMessages;
}