Example usage for javax.swing ListSelectionModel SINGLE_SELECTION

List of usage examples for javax.swing ListSelectionModel SINGLE_SELECTION

Introduction

In this page you can find the example usage for javax.swing ListSelectionModel SINGLE_SELECTION.

Prototype

int SINGLE_SELECTION

To view the source code for javax.swing ListSelectionModel SINGLE_SELECTION.

Click Source Link

Document

A value for the selectionMode property: select one list index at a time.

Usage

From source file:forge.itemmanager.views.ItemListView.java

@Override
public void setAllowMultipleSelections(final boolean allowMultipleSelections) {
    this.table.setSelectionMode(allowMultipleSelections ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
            : ListSelectionModel.SINGLE_SELECTION);
}

From source file:edu.ku.brc.af.ui.forms.formatters.UIFormatterEditorDlg.java

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

    CellConstraints cc = new CellConstraints();

    orderUpBtn = createIconBtn("ReorderUp", "TCGD_MOVE_UP", new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            int inx = fieldsTbl.getSelectedRow();
            UIFieldFormatterField item = (UIFieldFormatterField) fields.get(inx);

            fields.remove(inx);//from w w  w . j a  v  a  2 s  .co m
            fields.insertElementAt(item, inx - 1);
            fieldsTbl.getSelectionModel().setSelectionInterval(inx - 1, inx - 1);
            selectedFormat.resetLength();

            updateEnabledState();
            updateUIEnabled();
        }
    });
    orderDwnBtn = createIconBtn("ReorderDown", "TCGD_MOVE_DOWN", new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            int inx = fieldsTbl.getSelectedRow();
            UIFieldFormatterField item = (UIFieldFormatterField) fields.get(inx);

            fields.remove(inx);
            fields.insertElementAt(item, inx + 1);
            fieldsTbl.getSelectionModel().setSelectionInterval(inx + 1, inx + 1);
            selectedFormat.resetLength();

            updateEnabledState();
            updateUIEnabled();
        }
    });

    // get formatters for field
    List<UIFieldFormatterIFace> fmtrs = new Vector<UIFieldFormatterIFace>(uiFieldFormatterMgrCache
            .getFormatterList(fieldInfo.getTableInfo().getClassObj(), fieldInfo.getName()));
    Collections.sort(fmtrs, new Comparator<UIFieldFormatterIFace>() {
        public int compare(UIFieldFormatterIFace o1, UIFieldFormatterIFace o2) {
            return o1.toPattern().compareTo(o2.toPattern());
        }
    });

    // table and field titles
    PanelBuilder tblInfoPB = new PanelBuilder(
            new FormLayout("r:p,2px,f:p:g", "p,2px,p,2px,p,10px")/*, new FormDebugPanel()*/);

    String typeStr = fieldInfo.getType();
    typeStr = typeStr.indexOf('.') > -1 ? StringUtils.substringAfterLast(fieldInfo.getType(), ".") : typeStr;

    JLabel tableTitleLbl = createI18NFormLabel("FFE_TABLE");
    JLabel tableTitleValueLbl = createLabel(fieldInfo.getTableInfo().getTitle());
    tableTitleValueLbl.setBackground(Color.WHITE);
    tableTitleValueLbl.setOpaque(true);

    JLabel fieldTitleLbl = createI18NFormLabel("FFE_FIELD");
    JLabel fieldTitleValueLbl = createLabel(fieldInfo.getTitle());
    fieldTitleValueLbl.setBackground(Color.WHITE);
    fieldTitleValueLbl.setOpaque(true);

    JLabel fieldLengthLbl = createI18NFormLabel("FFE_LENGTH");
    JLabel fieldLengthValueLbl = createLabel(Integer.toString(fieldInfo.getLength()));
    fieldLengthValueLbl.setBackground(Color.WHITE);
    fieldLengthValueLbl.setOpaque(true);

    int y = 1;
    tblInfoPB.add(tableTitleLbl, cc.xy(1, y));
    tblInfoPB.add(tableTitleValueLbl, cc.xy(3, y));
    y += 2;
    tblInfoPB.add(fieldTitleLbl, cc.xy(1, y));
    tblInfoPB.add(fieldTitleValueLbl, cc.xy(3, y));
    y += 2;
    tblInfoPB.add(fieldLengthLbl, cc.xy(1, y));
    tblInfoPB.add(fieldLengthValueLbl, cc.xy(3, y));
    y += 2;

    // sample panel
    sampleLabel = createLabel("", SwingConstants.LEFT);
    JPanel samplePanel = new JPanel();
    samplePanel.setBorder(BorderFactory.createTitledBorder(getResourceString("FFE_SAMPLE"))); //$NON-NLS-1$ 
    samplePanel.add(sampleLabel);

    // name text field
    nameTF = createTextField(20);

    // title text field
    titleTF = createTextField(20);

    byYearCB = createCheckBox(getResourceString("FFE_BY_YEAR_CHECKBOX")); //$NON-NLS-1$ 
    hookByYearCheckBoxListener();

    fieldsPanel = new EditDeleteAddPanel(getSaveAL(), getDelAL(), getAddAL());
    fieldsTbl = new JTable(fieldsModel = new FieldsTableModel());
    fieldTypeCbx = new JComboBox(FieldType.values()); // I18N
    fieldTxt = createTextField(20);
    fieldsPanel.getAddBtn().setEnabled(true);
    fieldsPanel.getEditBtn().setIcon(IconManager.getIcon("Green Arrow Up", IconManager.IconSize.Std16));
    UIHelper.makeTableHeadersCentered(fieldsTbl, true);

    fieldTxt.setDocument(new FieldDocument());

    fieldsTbl.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    int width = fieldTypeCbx.getPreferredSize().width;

    y = 1;
    PanelBuilder subPB = new PanelBuilder(new FormLayout("r:p,2px,p", "p,4px, p,4px, p,4px, p,4px"));

    subPB.add(createI18NFormLabel("FFE_NAME"), cc.xy(1, y));
    subPB.add(nameTF, cc.xy(3, y));
    y += 2;

    subPB.add(createI18NFormLabel("FFE_TITLE"), cc.xy(1, y));
    subPB.add(titleTF, cc.xy(3, y));
    y += 2;

    subPB.add(byYearCB, cc.xy(3, y));
    y += 2;

    // CardLayout for Editor Panels

    SpinnerModel retModel = new SpinnerNumberModel(1, //initial value
            1, //min
            fieldInfo.getLength(), //max
            1); //step
    sizeSpinner = new JSpinner(retModel);
    isIncChk = new JCheckBox("Is Incrementer"); // I18N

    String colDefs = "f:p:g,p,2px," + width + "px,2px,p";

    closeBtn = createClose(0);
    PanelBuilder numPB = new PanelBuilder(new FormLayout(colDefs, "p,2px,p,2px,p"));
    numPB.add(createI18NFormLabel("FFE_LENGTH"), cc.xy(2, 1));
    numPB.add(sizeSpinner, cc.xy(4, 1));
    //numPB.add(closeBtn,    cc.xy(6, 1));
    numPB.add(isIncChk, cc.xy(4, 3));

    sepCbx = new JComboBox(new String[] { "-", ".", "/", "(space)", "_" });
    closeBtn = createClose(1);
    PanelBuilder sepPB = new PanelBuilder(new FormLayout(colDefs, "p,2px,p"));
    sepPB.add(createI18NFormLabel("FFE_SEP"), cc.xy(2, 1));
    sepPB.add(sepCbx, cc.xy(4, 1));
    //sepPB.add(closeBtn, cc.xy(6, 1));

    closeBtn = createClose(2);
    PanelBuilder txtPB = new PanelBuilder(new FormLayout(colDefs, "p,2px,p"));
    txtPB.add(createI18NFormLabel("FFE_TEXT"), cc.xy(2, 1));
    txtPB.add(fieldTxt, cc.xy(4, 1));

    cardPanel = new JPanel(cardLayout);
    cardPanel.add("size", numPB.getPanel());
    cardPanel.add("text", txtPB.getPanel());
    cardPanel.add("sep", sepPB.getPanel());
    cardPanel.add("none", new JLabel(" "));

    y = 1;
    PanelBuilder leftPB = new PanelBuilder(new FormLayout("f:p:g", "t:p,10px,p,f:p:g"));
    leftPB.add(tblInfoPB.getPanel(), cc.xy(1, y));
    y += 2;
    leftPB.add(subPB.getPanel(), cc.xy(1, y));
    y += 2;

    PanelBuilder upDownPanel = new PanelBuilder(new FormLayout("p", "f:p:g, p, 2px, p, f:p:g"));
    upDownPanel.add(orderUpBtn, cc.xy(1, 2));
    upDownPanel.add(orderDwnBtn, cc.xy(1, 4));

    totLenLbl = createLabel("XXXXX");

    y = 1;
    PanelBuilder rightPB = new PanelBuilder(new FormLayout("p:g,2px,p,2px,p", "200px,2px,p,2px,p,2px,p"));
    rightPB.add(createScrollPane(fieldsTbl), cc.xywh(1, y, 3, 1));
    rightPB.add(upDownPanel.getPanel(), cc.xywh(5, y, 1, 1));
    y += 2;
    rightPB.add(totLenLbl, cc.xy(1, y));
    rightPB.add(fieldsPanel, cc.xywh(3, y, 1, 1));
    y += 2;
    rightPB.add(fieldTypeLbl = createI18NFormLabel("FFE_TYPE"), cc.xy(1, y));
    rightPB.add(fieldTypeCbx, cc.xy(3, y));
    rightPB.add(closeBtn, cc.xy(5, y));
    y += 2;
    rightPB.add(cardPanel, cc.xyw(1, y, 3));
    y += 2;

    y = 1;
    PanelBuilder pb = new PanelBuilder(new FormLayout("p:g,10px,p,10px,p:g,10px,p", "f:p:g,10px,p"));
    Color bg = getBackground();
    pb.add(new VerticalSeparator(bg.darker(), bg.brighter()), cc.xywh(3, 1, 1, 1));

    pb.add(leftPB.getPanel(), cc.xy(1, y));
    pb.add(rightPB.getPanel(), cc.xy(5, y));
    //pb.add(keyPanel,             cc.xy(7, y));     
    y += 2;
    pb.add(samplePanel, cc.xyw(1, y, 7));
    y += 2;

    setByYearSelected(selectedFormat);

    nameTF.setEditable(isNew);
    nameTF.setText(selectedFormat.getName());
    titleTF.setText(selectedFormat.getTitle());
    updateSample();

    hookTextChangeListener(nameTF, "FFE_NO_NAME", 32);
    hookTextChangeListener(titleTF, "FFE_NO_TITLE", 32);

    pb.setDefaultDialogBorder();

    contentPanel = pb.getPanel();
    mainPanel.add(contentPanel, BorderLayout.CENTER);

    updateUIEnabled();

    pack();

    enabledEditorUI(false);

    hookFieldsTblSelectionListener();

    fieldTypeCbx.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            typeChanged();
        }
    });

    sepCbx.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            fieldHasChanged = true;
            updateEnabledState();
            hasChanged = true;
            updateUIEnabled();
        }
    });

    fieldTxt.getDocument().addDocumentListener(new DocumentAdaptor() {
        @Override
        protected void changed(DocumentEvent e) {
            fieldHasChanged = true;
            updateEnabledState();
            hasChanged = true;
            updateUIEnabled();
        }
    });

    sizeSpinner.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            fieldHasChanged = true;
            updateEnabledState();
            hasChanged = true;
            updateUIEnabled();

        }
    });

    isIncChk.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            fieldHasChanged = true;
            if (!isIncChk.isSelected()) {
                byYearCB.setSelected(false);
            }
            updateEntry();
            updateUIEnabled();
            updateEnabledState();
            fieldsTbl.repaint();
        }
    });

    fieldTypeCbx.setSelectedIndex(-1);
    fieldHasChanged = false;
    updateEnabledState();
}

From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java

private final JPanel buildProjectPanel() {
    JPanel projectPanel = new JPanel(new BorderLayout());
    projectPanel.setBorder(new TitledBorder("Projects"));

    // --- left-side -------------------------------------------------
    JPanel sidePanel = new JPanel(new BorderLayout());
    sidePanel.setPreferredSize(new Dimension(WINDOW_WIDTH / 3, SIZE_IGNORED));

    projectList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    projectList.addListSelectionListener(new ProjectListSelectionListener());

    sidePanel.add(new JScrollPane(projectList), BorderLayout.CENTER);
    projectPanel.add(sidePanel, BorderLayout.WEST);

    // --- right-side ------------------------------------------------
    sidePanel = new JPanel(new BorderLayout());
    sidePanel.setPreferredSize(new Dimension(310, SIZE_IGNORED));

    JPanel rsTopPanel = new JPanel(new BorderLayout());
    rsTopPanel.setPreferredSize(new Dimension(SIZE_IGNORED, 50));

    JPanel labelPanel = new JPanel(new GridLayout(2, 1, 0, 5));
    labelPanel.add(new JLabel("Name:  "));
    labelPanel.add(new JLabel("Description:  "));

    JPanel infoPanel = new JPanel(new GridLayout(2, 1, 0, 5));
    infoPanel.add(projectName);//from  www  .jav  a2  s  .  c o m
    projectName.setEditable(false);

    infoPanel.add(projectDescription);
    projectDescription.setEditable(false);

    rsTopPanel.add(labelPanel, BorderLayout.WEST);
    rsTopPanel.add(infoPanel, BorderLayout.CENTER);

    sidePanel.add(rsTopPanel, BorderLayout.NORTH);

    projectPanel.add(sidePanel, BorderLayout.EAST);

    return projectPanel;
}

From source file:edu.ku.brc.ui.ChooseFromListDlg.java

/**
 * Create the UI for the dialog./*from   w w  w .  j  a v a2s .  c  o  m*/
 * 
 * @param altName title for dialog
 * @param desc the list to be selected from
 * @param includeCancelBtn  indicates whether to create and display a cancel btn
 * @param includeHelpBtn indicates whether to create and display a help btn
 * @param helpContext help context identifier
 * @param titleArg title for dialog
 * @param desc the list to be selected from
 * @param includeCancelBtn indicates whether to create and display a cancel btn
 */
public void createUI() {
    setTitle(title);

    boolean hasDesc = StringUtils.isNotEmpty(desc);
    PanelBuilder builder = new PanelBuilder(
            new FormLayout("f:max(300px;p):g", "p," + (hasDesc ? "2px,p," : "") + "5px,p"));
    CellConstraints cc = new CellConstraints();
    //builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 10));
    builder.setDefaultDialogBorder();

    int y = 1;
    if (hasDesc) {
        JLabel lbl = createLabel(desc, SwingConstants.CENTER);
        builder.add(lbl, cc.xy(1, y));
        y += 2;
    }

    try {
        ListModel listModel = new AbstractListModel() {
            public int getSize() {
                return items.size();
            }

            public Object getElementAt(int index) {
                return items.get(index).toString();
            }
        };

        list = new JList(listModel);
        if (icon != null) {
            list.setCellRenderer(getListCellRenderer()); // icon comes from the base
            // class (it's probably size
            // 16)
        }
        list.setSelectionMode(isMultiSelect ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
                : ListSelectionModel.SINGLE_SELECTION);
        list.setVisibleRowCount(10);

        if (selectedIndices != null) {
            list.setSelectedIndices(selectedIndices);
        }

        list.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    okBtn.doClick(); // emulate button click
                }
            }
        });
        list.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    updateUIState();
                }
            }
        });
        JScrollPane listScroller = new JScrollPane(list);
        builder.add(listScroller, cc.xy(1, y));
        y += 2;

        // Bottom Button UI
        okBtn = createButton(StringUtils.isNotEmpty(okLabel) ? okLabel : getResourceString("OK"));
        okBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                isCancelled = false;
                btnPressed = OK_BTN;
                setVisible(false);
            }
        });
        getRootPane().setDefaultButton(okBtn);

        if ((whichBtns & CANCEL_BTN) == CANCEL_BTN) {
            cancelBtn = createButton(
                    StringUtils.isNotEmpty(cancelLabel) ? cancelLabel : getResourceString("CANCEL"));
            cancelBtn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    isCancelled = true;
                    btnPressed = CANCEL_BTN;
                    setVisible(false);
                }
            });
        }

        if ((whichBtns & HELP_BTN) == HELP_BTN) {
            helpBtn = createButton(
                    StringUtils.isNotEmpty(cancelLabel) ? cancelLabel : getResourceString("HELP"));
            if (StringUtils.isNotEmpty(helpContext)) {
                HelpMgr.registerComponent(helpBtn, helpContext);
            } else {
                helpBtn.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent ae) {
                        btnPressed = HELP_BTN;
                    }
                });
            }
        }

        if ((whichBtns & APPLY_BTN) == APPLY_BTN) {
            applyBtn = createButton(
                    StringUtils.isNotEmpty(applyLabel) ? applyLabel : getResourceString("Apply"));
            applyBtn.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    btnPressed = APPLY_BTN;
                    if (isCloseOnApply) {
                        isCancelled = false;
                        setVisible(false);
                    }
                }
            });
        }

        JPanel bb;
        if (whichBtns == OK_BTN) {
            bb = ButtonBarFactory.buildOKBar(okBtn);

        } else if (whichBtns == OKCANCEL) {
            bb = ButtonBarFactory.buildOKCancelBar(okBtn, cancelBtn);

        } else if (whichBtns == OKCANCELAPPLY) {
            bb = ButtonBarFactory.buildOKCancelApplyBar(okBtn, cancelBtn, applyBtn);

        } else if (whichBtns == OKHELP) {
            bb = ButtonBarFactory.buildOKHelpBar(okBtn, helpBtn);

        } else if (whichBtns == OKCANCELHELP) {
            bb = ButtonBarFactory.buildOKCancelHelpBar(okBtn, cancelBtn, helpBtn);

        } else if (whichBtns == OKCANCELAPPLYHELP) {
            bb = ButtonBarFactory.buildOKCancelApplyHelpBar(okBtn, cancelBtn, applyBtn, helpBtn);

        } else {
            bb = ButtonBarFactory.buildOKBar(okBtn);
        }

        builder.add(bb, cc.xy(1, y));
        y += 2;

        updateUIState();

    } catch (Exception ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ChooseFromListDlg.class, ex);
        log.error(ex);
    }

    setContentPane(builder.getPanel());
    pack();
    // setLocationRelativeTo(locationComp);
}

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);
                        }/*from  www . jav a2  s  .com*/
                        //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:edu.ku.brc.specify.config.ResourceImportExportDlg.java

@Override
public void createUI() {
    this.setHelpContext("Import");

    super.createUI();

    CellConstraints cc = new CellConstraints();

    levelCBX = createComboBox();/*from  ww w. ja  va 2 s . c o m*/

    DataProviderSessionIFace session = null;
    try {
        session = DataProviderFactory.getInstance().createSession();

        for (SpAppResourceDir curDir : contextMgr.getSpAppResourceList()) {
            SpAppResourceDir dir;
            if (curDir.getId() != null) {
                dir = session.get(SpAppResourceDir.class, curDir.getId());
                dir.setTitle(curDir.getTitle());

                // Force Load
                dir.getSpAppResources().size();
                dir.getSpPersistedAppResources().size();
                dir.getSpPersistedViewSets().size();

                for (SpAppResource appRes : curDir.getSpAppResources()) {
                    if (appRes.getId() == null) {
                        dir.getSpAppResources().add(appRes);
                    }
                }
                for (SpViewSetObj vso : curDir.getSpViewSets()) {
                    if (vso.getId() == null) {
                        dir.getSpViewSets().add(vso);
                    }
                }

            } else {
                dir = (SpAppResourceDir) curDir.clone();
            }
            dirs.add(dir);

            levelCBX.addItem(dir);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ResourceImportExportDlg.class, ex);

    } finally {
        if (session != null) {
            session.close();
        }
    }

    PanelBuilder centerPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p,10px,p"));
    centerPB.add(createLabel(UIRegistry.getLocalizedMessage("RIE_USR_LBL", userName)), cc.xy(2, 1));
    centerPB.add(levelCBX, cc.xy(2, 3));

    tabbedPane = new JTabbedPane();

    PanelBuilder viewPanel = new PanelBuilder(new FormLayout("f:p:g,10px,f:p:g", "p,2px,f:p:g"));
    viewPanel.add(createLabel(getResourceString("RIE_VIEWSETS"), SwingConstants.CENTER), cc.xy(1, 1));
    viewSetsList = new JList(viewSetsModel);
    viewSetsList.setCellRenderer(new ARListRenderer());
    JScrollPane sp = new JScrollPane(viewSetsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    viewPanel.add(sp, cc.xy(1, 3));

    viewPanel.add(createLabel(getResourceString("RIE_VIEWS"), SwingConstants.CENTER), cc.xy(3, 1));
    viewsList = new JList(viewsModel);
    viewsList.setCellRenderer(new ViewRenderer());
    sp = new JScrollPane(viewsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    viewPanel.add(sp, cc.xy(3, 3));
    viewsList.setEnabled(false);

    PanelBuilder resPane = new PanelBuilder(new FormLayout("f:p:g", "p,2px,p"));
    resPane.add(createLabel(getResourceString("RIE_OTHER_RES"), SwingConstants.CENTER), cc.xy(1, 1));
    resList = new JList(resModel);
    resList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    resList.setCellRenderer(new ARListRenderer());
    sp = new JScrollPane(resList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    resPane.add(sp, cc.xy(1, 3));

    PanelBuilder repPane = new PanelBuilder(new FormLayout("f:p:g", "p,2px,f:p:g"));
    repPane.add(createLabel(getResourceString("RIE_REPORT_RES"), SwingConstants.CENTER), cc.xy(1, 1));
    repList = new JList(repModel);
    repList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    repList.setCellRenderer(new ARListRenderer());
    sp = new JScrollPane(repList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    repPane.add(sp, cc.xy(1, 3));

    boolean addResourcesPanel = AppPreferences.getLocalPrefs().getBoolean("ADD_IMP_RES", false);

    viewsPanel = viewPanel.getPanel();
    tabbedPane.addTab(getResourceString("RIE_VIEWSETS"), viewsPanel);
    if (addResourcesPanel) {
        resPanel = resPane.getPanel();
        tabbedPane.addTab(getResourceString("RIE_OTHER_RES"), resPanel);
    }
    repPanel = repPane.getPanel();
    tabbedPane.addTab(getResourceString("RIE_REPORT_RES"), repPanel);

    PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "p,4px,f:p:g,2px,p"));
    pb.add(centerPB.getPanel(), cc.xy(1, 1));
    pb.add(tabbedPane, cc.xy(1, 3));

    exportBtn = createButton(getResourceString("RIE_EXPORT"));
    importBtn = createButton(getResourceString("RIE_IMPORT"));
    revertBtn = createButton(getResourceString("RIE_REVERT"));
    PanelBuilder btnPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g,p,f:p:g,p,f:p:g", "p,10px"));
    btnPB.add(exportBtn, cc.xy(2, 1));
    btnPB.add(importBtn, cc.xy(4, 1));
    btnPB.add(revertBtn, cc.xy(6, 1));

    pb.add(btnPB.getPanel(), cc.xy(1, 5));

    pb.getPanel().setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    contentPanel = pb.getPanel();
    mainPanel.add(contentPanel, BorderLayout.CENTER);

    tabbedPane.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            Component selectedComp = tabbedPane.getSelectedComponent();
            if (selectedComp != null) {
                if (selectedComp == viewsPanel) {
                    viewSetsList.setSelectedIndex(-1);

                } else if (selectedComp == resPanel) {
                    resList.setSelectedIndex(-1);
                } else {
                    repList.setSelectedIndex(-1);
                }
                //revertBtn.setVisible(selectedComp != repPanel);
            }
            enableUI();

            // JGoodies Resizes the panel in the Dialog and 
            // partially hides the buttons, this fixes that.
            Dimension size = ResourceImportExportDlg.this.getSize();
            //ResourceImportExportDlg.this.pack();
            //Dimension newSize = ResourceImportExportDlg.this.getSize();
            Dimension newSize = ResourceImportExportDlg.this.getPreferredSize();
            size.height = newSize.height;
            ResourceImportExportDlg.this.setSize(size);
        }
    });

    levelCBX.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    levelSelected();
                }
            });
        }
    });

    levelCBX.setSelectedIndex(0);

    pack();

    exportBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            exportResource();
        }
    });

    importBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            importResource();
        }
    });

    revertBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            revertResource();
        }
    });

    viewSetsList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                if (viewSetsList.getSelectedIndex() > -1) {
                    resList.clearSelection();
                    repList.clearSelection();
                }
                fillViewsList();
                enableUI();
            }
        }
    });

    resList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                if (resList.getSelectedIndex() > -1) {
                    viewSetsList.clearSelection();
                    repList.clearSelection();
                }
                enableUI();
            }
        }
    });

    repList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                if (resList.getSelectedIndex() > -1) {
                    viewSetsList.clearSelection();
                    resList.clearSelection();
                }
                enableUI();
            }
        }
    });

    pack();
}

From source file:eu.europeana.sip.gui.SipCreatorGUI.java

private JComponent createList() {
    dataSetList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataSetList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override//from   ww  w.  ja  va2  s .  co m
        public void valueChanged(ListSelectionEvent event) {
            if (event.getValueIsAdjusting())
                return;
            int selected = dataSetList.getSelectedIndex();
            DataSetListModel.Entry selectedEntry = selected >= 0 ? dataSetListModel.getEntry(selected) : null;
            dataSetActions.setEntry(selectedEntry);
        }
    });
    dataSetList.setCellRenderer(new DataSetListModel.Cell());
    dataSetList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    dataSetList.setBackground(getBackground());
    JScrollPane scroll = new JScrollPane(dataSetList);
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    return scroll;
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSwing.CFAsteriskSwingSysClusterFinderJPanel.java

public CFAsteriskSwingSysClusterFinderJPanel(ICFAsteriskSwingSchema argSchema) {
    super();//from  w  w  w . ja  v a  2 s. c o m
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    swingSchema = argSchema;
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    add(dataScrollPane);
    loadData(true);
    doLayout();
    swingIsInitializing = false;
}

From source file:com.peterbochs.sourceleveldebugger.SourceLevelDebugger3.java

private void initGUI() {
    try {/*from   ww  w.  j  a  v  a 2  s. co  m*/
        this.setPreferredSize(new java.awt.Dimension(975, 563));
        {
            jMainSplitPane = new JSplitPane();
            this.add(getJErrorLabel(), "errorLabel");
            this.add(jMainSplitPane, "MAIN");
            jMainSplitPane.setDividerLocation(200);
            {
                jPanel4 = new JPanel();
                jMainSplitPane.add(jPanel4, JSplitPane.RIGHT);
                BorderLayout jPanel4Layout = new BorderLayout();
                jPanel4.setLayout(jPanel4Layout);
                {
                    jSplitPane3 = new JSplitPane();
                    jPanel4.add(jSplitPane3, BorderLayout.CENTER);
                    jSplitPane3.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    jSplitPane3.setDividerLocation(500);
                    {
                        jPanel6 = new JPanel();
                        jSplitPane3.add(jPanel6, JSplitPane.TOP);
                        jSplitPane3.add(getJInfoTabbedPane(), JSplitPane.BOTTOM);
                        BorderLayout jPanel6Layout = new BorderLayout();
                        jPanel6.setLayout(jPanel6Layout);
                        {
                            jMainTabbedPane = new JMaximizableTabbedPane();
                            jPanel6.add(jMainTabbedPane, BorderLayout.CENTER);
                            {
                                jASMPanel = new JPanel();
                                jMainTabbedPane.addTab(MyLanguage.getString("ASM/C"), null, jASMPanel, null);
                                jMainTabbedPane.addTab("Dwarf", null, getJDwarfPanel(), null);
                                jMainTabbedPane.addTab("Code base", null, getCodeBasePanel(), null);
                                jMainTabbedPane.addTab("Call Graph", null, getCallGraphPanel(), null);
                                BorderLayout jASMPanelLayout = new BorderLayout();
                                jASMPanel.setLayout(jASMPanelLayout);
                                {
                                    instructionTableScrollPane = new JScrollPane();
                                    instructionTableScrollPane.getVerticalScrollBar()
                                            .addAdjustmentListener(new AdjustmentListener() {
                                                boolean isRunning;

                                                public void adjustmentValueChanged(AdjustmentEvent evt) {
                                                    /*   JScrollBar vbar = (JScrollBar) evt.getSource();
                                                            
                                                       if (evt.getValueIsAdjusting()) {
                                                          return;
                                                       }
                                                       if ((vbar.getValue() + vbar.getVisibleAmount()) == vbar.getMaximum()) {
                                                          if (!isRunning) {
                                                             try {
                                                                isRunning = true;
                                                                final CardLayout cl = (CardLayout) (peterBochsDebugger.jMainPanel.getLayout());
                                                                cl.show(peterBochsDebugger.jMainPanel, "Running Label");
                                                                //                                             new Thread("update instruction thread") {
                                                                //                                                public void run() {
                                                                //                                                   long address = Long.parseLong(instructionTable.getValueAt(instructionTable.getRowCount() - 1, 1).toString()
                                                                //                                                         .substring(2), 16);
                                                                //                                                   peterBochsDebugger.updateInstruction(address, true);
                                                                //                                                   peterBochsDebugger.updateBreakpointTableColor();
                                                                ////                                                   cl.show(peterBochsDebugger.jMainPanel, peterBochsDebugger.currentPanel);
                                                                //
                                                                //                                                   isRunning = false;
                                                                //                                                }
                                                                //                                             }.start();
                                                            
                                                             } catch (Exception ex) {
                                                             }
                                                          }
                                                            
                                                       }*/
                                                }

                                            });
                                    jASMPanel.add(instructionTableScrollPane, BorderLayout.CENTER);
                                    {
                                        instructionTable = new JTable();
                                        instructionTableScrollPane.setViewportView(instructionTable);
                                        instructionTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                                        instructionTable
                                                .setModel(PeterBochsDebugger.instructionTable.getModel());
                                        instructionTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
                                        instructionTable.getTableHeader().setReorderingAllowed(false);
                                        instructionTable.getColumnModel().getColumn(0).setMaxWidth(20);
                                        instructionTable.getColumnModel().getColumn(1).setPreferredWidth(40);
                                        instructionTable.getColumnModel().getColumn(2).setPreferredWidth(200);
                                        instructionTable.getColumnModel().getColumn(3).setPreferredWidth(40);
                                        instructionTable.setShowGrid(false);
                                        instructionTable.setDefaultRenderer(String.class,
                                                new InstructionTableCellRenderer());
                                        instructionTable.addMouseListener(new MouseAdapter() {
                                            public void mouseClicked(MouseEvent evt) {
                                                instructionTableMouseClicked(evt);
                                            }
                                        });
                                    }
                                }
                                {
                                    jInstructionControlPanel = new JPanel();
                                    jASMPanel.add(jInstructionControlPanel, BorderLayout.NORTH);
                                    {
                                        jInstructionComboBox = new JComboBox();
                                        jInstructionControlPanel.add(jInstructionComboBox);
                                        jInstructionComboBox.setEditable(true);
                                        jInstructionComboBox.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jInstructionComboBoxActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        disassembleButton = new JButton();
                                        jInstructionControlPanel.add(disassembleButton);
                                        disassembleButton.setText(MyLanguage.getString("Disassemble"));
                                        disassembleButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                disassembleButtonActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        disassembleCSEIPButton = new JButton();
                                        jInstructionControlPanel.add(disassembleCSEIPButton);
                                        disassembleCSEIPButton
                                                .setText(MyLanguage.getString("Disassemble") + " cs:eip");
                                        disassembleCSEIPButton.setEnabled(true);
                                        disassembleCSEIPButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                disassembleCSEIPButtonActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        jInstructionUpTenButton = new JButton();
                                        jInstructionControlPanel.add(jInstructionUpTenButton);
                                        jInstructionUpTenButton
                                                .setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                                        "com/peterbochs/icons/famfam_icons/arrow_up10.png")));
                                        jInstructionUpTenButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jInstructionUpTenButtonActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        jInstructionUpButton = new JButton();
                                        jInstructionControlPanel.add(jInstructionUpButton);
                                        jInstructionUpButton
                                                .setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                                        "com/peterbochs/icons/famfam_icons/arrow_up1.png")));
                                        jInstructionUpButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jInstructionUpButtonActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        jInstructionDownButton = new JButton();
                                        jInstructionControlPanel.add(jInstructionDownButton);
                                        jInstructionDownButton
                                                .setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                                        "com/peterbochs/icons/famfam_icons/arrow_down.png")));
                                        jInstructionDownButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jInstructionDownButtonActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        jDiskButton = new JButton();
                                        jInstructionControlPanel.add(jDiskButton);
                                        jDiskButton.setIcon(new ImageIcon(getClass().getClassLoader()
                                                .getResource("com/peterbochs/icons/famfam_icons/disk.png")));
                                        jDiskButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jButton3ActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        jExcelButton = new JButton();
                                        jInstructionControlPanel.add(jExcelButton);
                                        jInstructionControlPanel.add(getJSearchTextField());
                                        jExcelButton.setIcon(new ImageIcon(getClass().getClassLoader()
                                                .getResource("com/peterbochs/icons/famfam_icons/excel.gif")));
                                        {
                                            btnSearch = new JButton("Search");
                                            jInstructionControlPanel.add(btnSearch);
                                            btnSearch.addActionListener(new ActionListener() {
                                                public void actionPerformed(ActionEvent evt) {
                                                    btnSearchActionPerformed(evt);
                                                }
                                            });
                                        }
                                        {
                                            onOffButton = new OnOffButton();
                                            onOffButton.setSelected(true);
                                            onOffButton.addItemListener(new ItemListener() {
                                                public void itemStateChanged(ItemEvent e) {
                                                    InstructionTableModel model = (InstructionTableModel) PeterBochsDebugger.instructionTable
                                                            .getModel();
                                                    if (e.getStateChange() == ItemEvent.SELECTED) {
                                                        model.showAsmLevel = true;
                                                    } else {
                                                        model.showAsmLevel = false;
                                                    }
                                                    model.fireTableDataChanged();
                                                }
                                            });
                                            onOffButton.setPreferredSize(new Dimension(53, 18));
                                            jInstructionControlPanel.add(onOffButton);
                                        }
                                        jExcelButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jButton12ActionPerformed(evt);
                                            }
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
            }
            {
                jPanel1 = new JPanel();
                jMainSplitPane.add(jPanel1, JSplitPane.LEFT);
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                {
                    jTabbedPane1 = new JMaximizableTabbedPane();
                    jPanel1.add(jTabbedPane1, BorderLayout.CENTER);
                    jTabbedPane1.addChangeListener(new ChangeListener() {
                        public void stateChanged(ChangeEvent evt) {
                            jTabbedPane1StateChanged(evt);
                        }
                    });
                    {
                        jPanel3 = new JPanel();
                        BorderLayout jPanel3Layout = new BorderLayout();
                        jPanel3.setLayout(jPanel3Layout);
                        jTabbedPane1.addTab("Symbol", null, getSymbolTablePanel(), null);
                        jTabbedPane1.addTab(MyLanguage.getString("Project"), null, jPanel3, null);
                        {
                            jScrollPane1 = new JScrollPane();
                            jPanel3.add(jScrollPane1, BorderLayout.CENTER);
                            jPanel3.add(getJProjectToolBar(), BorderLayout.NORTH);
                            {
                                projectTree = new JTree();
                                jScrollPane1.setViewportView(projectTree);
                                projectTree.setModel(projectFilterTreeModel);
                                projectTree.setShowsRootHandles(true);
                                projectTree.setCellRenderer(new ProjectTreeRenderer());
                                projectTree.addMouseListener(new MouseAdapter() {
                                    public void mouseClicked(MouseEvent evt) {
                                        projectTreeMouseClicked(evt);
                                    }
                                });
                            }
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmSwing.CFCrmSwingTldFinderJPanel.java

public CFCrmSwingTldFinderJPanel(ICFCrmSwingSchema argSchema) {
    super();/*from  w w w  .  j ava 2 s  . c  o m*/
    final String S_ProcName = "construct-schema-focus";
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "argSchema");
    }
    swingSchema = argSchema;
    dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
    dataTable.addMouseListener(getDataListMouseAdapter());
    dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    dataTable.setUpdateSelectionOnSort(true);
    dataTable.setRowHeight(25);
    getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
    dataScrollPane = new JScrollPane(dataTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    dataScrollPane.setColumnHeader(new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension sz = super.getPreferredSize();
            sz.height = 25;
            return (sz);
        }
    });
    dataTable.setFillsViewportHeight(true);
    add(dataScrollPane);
    loadData(true);
    doLayout();
    swingIsInitializing = false;
}