Example usage for java.awt.event MouseAdapter MouseAdapter

List of usage examples for java.awt.event MouseAdapter MouseAdapter

Introduction

In this page you can find the example usage for java.awt.event MouseAdapter MouseAdapter.

Prototype

MouseAdapter

Source Link

Usage

From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java

public JTableX<FileObject> generateFileObjectTable(final FileObjectTableModel tableModel) {
    val table = new JTableX<FileObject>();
    table.addMouseListener(new MouseAdapter() {

        @Override//  w  w  w  .ja v a2  s. c  o m
        public void mouseClicked(MouseEvent e) {
            fileTableClicked(tableModel, table, e);
        }
    });
    table.setRowSelectionAllowed(true);
    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    table.setModelAndRenderer(tableModel);
    table.getColumnModel().getColumn(0).setMaxWidth(250);
    table.getColumnModel().getColumn(0).setPreferredWidth(150);
    table.getColumnModel().getColumn(3).setPreferredWidth(150);
    table.getColumnModel().getColumn(3).setMaxWidth(250);
    table.getColumnModel().getColumn(4).setMaxWidth(150);
    table.getColumnModel().getColumn(5).setMaxWidth(150);

    return table;
}

From source file:com.sec.ose.osi.ui.frm.main.report.JPanExportReport.java

private JPanel getJPanelReportTypeInfo() {
    if (jPanelReportTypeInfo == null) {
        jPanelReportTypeInfo = new JPanel();
        jPanelReportTypeInfo.setLayout(new GridBagLayout());

        JLabel jLabelBoth = new JLabel();
        jLabelBoth.setText("Generate Both Report (Identify and SPDX)");
        jLabelBoth.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                mEventHandler.handle(EventHandler.BTN_BOTH_REPORT);
            }/*w w  w. j av a2 s. co m*/
        });

        JLabel jLabelIdentify = new JLabel();
        jLabelIdentify.setText("Generate Identify Report (*.xlsx)");
        jLabelIdentify.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                mEventHandler.handle(EventHandler.BTN_IDENTIFY_REPORT);
            }
        });

        JLabel jLabelSPDX = new JLabel();
        jLabelSPDX.setText("Generate SPDX Report (*.rdf)");
        jLabelSPDX.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                mEventHandler.handle(EventHandler.BTN_SPDX_REPORT);
            }
        });

        GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
        gridBagConstraints11.gridx = 0;
        gridBagConstraints11.gridy = 0;
        GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
        gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints12.insets = new Insets(0, 0, 0, 0);
        gridBagConstraints12.gridx = 1;
        gridBagConstraints12.gridy = 0;
        GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
        gridBagConstraints21.gridx = 0;
        gridBagConstraints21.gridy = 1;
        GridBagConstraints gridBagConstraints22 = new GridBagConstraints();
        gridBagConstraints22.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints22.insets = new Insets(0, 0, 0, 70);
        gridBagConstraints22.gridx = 1;
        gridBagConstraints22.gridy = 1;
        GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
        gridBagConstraints31.gridx = 0;
        gridBagConstraints31.gridy = 2;
        GridBagConstraints gridBagConstraints32 = new GridBagConstraints();
        gridBagConstraints32.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints32.insets = new Insets(0, 0, 0, 0);
        gridBagConstraints32.gridx = 1;
        gridBagConstraints32.gridy = 2;

        jPanelReportTypeInfo.add(getJRadioButtonBoth(), gridBagConstraints11);
        jPanelReportTypeInfo.add(jLabelBoth, gridBagConstraints12);
        jPanelReportTypeInfo.add(getJRadioButtonIdentify(), gridBagConstraints21);
        jPanelReportTypeInfo.add(jLabelIdentify, gridBagConstraints22);
        jPanelReportTypeInfo.add(getJRadioButtonSPDX(), gridBagConstraints31);
        jPanelReportTypeInfo.add(jLabelSPDX, gridBagConstraints32);

        selectedBothReport();
    }
    return jPanelReportTypeInfo;
}

From source file:de.wusel.partyplayer.gui.PartyPlayer.java

private Component createSongPanel() {
    final SongsTableModel model = new SongsTableModel(playerModel, settings, this);

    table = new JXTable(model) {

        @Override/*w  w  w  . j ava  2  s . c o m*/
        public String getToolTipText(MouseEvent event) {
            int viewRowIndex = rowAtPoint(event.getPoint());
            if (viewRowIndex != -1) {
                int modelIndex = convertRowIndexToModel(viewRowIndex);
                SongWrapper songFromList = playerModel.getSongFromList(modelIndex);
                return songFromList.getFileName();
            }
            return super.getToolTipText(event);
        }
    };

    table.setAutoCreateRowSorter(true);
    String numberColumnName = getText("table.songs.column.number.label");
    table.getColumn(numberColumnName).setMaxWidth(25);
    table.getColumn(numberColumnName).setResizable(false);
    TableSortController sorter = (TableSortController) table.getRowSorter();
    sorter.setComparator(2, new SongComparator());

    table.getColumn(numberColumnName).setCellRenderer(new SubstanceDefaultTableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row,
                    column);
            if (value != null)
                label.setText(((SongWrapper) value).getTrackNumber() + "");
            return label;
        }
    });

    table.getColumn(getText("table.songs.column.duration.label"))
            .setCellRenderer(new SubstanceDefaultTableCellRenderer() {

                @Override
                public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                        boolean hasFocus, int row, int column) {
                    JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected,
                            hasFocus, row, column);
                    if (value != null)
                        label.setText(Util.getTimeString((Double) value));
                    return label;
                }
            });

    table.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                addSongToPlaylist(
                        playerModel.getSongFromList(table.convertRowIndexToModel(table.getSelectedRow())));
            }
        }
    });

    table.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                addSongToPlaylist(
                        playerModel.getSongFromList(table.convertRowIndexToModel(table.getSelectedRow())));
            }
        }
    });

    JScrollPane scrollPane = new JScrollPane(table);
    table.setFillsViewportHeight(true);
    return scrollPane;
}

From source file:zet.gui.assignmentEditor.JAssignmentPanel.java

/**
 * Returns the panel on the left side of the {@code JAssignmentPanel} that
 * contains lists of assignments and assignment types.
 * @return the panel on the left side of the {@code JAssignmentPanel}
 *///from  www . j a va  2  s.  c  o m
private JPanel getLeftPanel() {
    final int space = 16;
    double size[][] = // Columns
            { { space, TableLayout.FILL, space, TableLayout.FILL, space },
                    //Rows
                    { space, TableLayout.PREFERRED, // Label
                            1, TableLayout.FILL, // Auswahlbox
                            space, TableLayout.PREFERRED, // Label Name
                            1, TableLayout.PREFERRED, // TextFeld
                            1, TableLayout.PREFERRED, 1, TableLayout.PREFERRED, 1, TableLayout.PREFERRED, // Button
                            space, TableLayout.PREFERRED, // Button Neu
                            5, TableLayout.PREFERRED, // Button Lschen
                            space } };

    JPanel leftPanel = new JPanel(new TableLayout(size));
    int row = 1;

    leftPanel.add(new JLabel(loc.getString("gui.AssignmentEditor.label.Assignments")), "1, " + row++);
    row++;

    assignmentSelector = new AssignmentListModel();
    lstAssignment = new JList<>();
    lstAssignment.setModel(assignmentSelector);
    lstAssignment.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lstAssignment.setCellRenderer(new AssignmentListRenderer());
    lstAssignment.setSelectionModel(new AssignmentListSelectionModel());
    lstAssignment.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            if (e.getClickCount() == 2) {
                setCurrent();
            }
        }
    });

    leftPanel.add(new JScrollPane(lstAssignment), "1, " + row++);
    row++;

    leftPanel.add(new JLabel(loc.getString("gui.AssignmentEditor.label.Name")), "1, " + row++);
    row++;

    addAssignmentText = new JTextField();
    leftPanel.add(addAssignmentText, "1, " + row++);
    row++;

    JButton assignmentChange = Button.newButton(loc.getString("gui.AssignmentEditor.button.AssignmentSave"),
            aclAssignmentSaveChanges);
    assignmentChange.setToolTipText(loc.getString("gui.AssignmentEditor.button.AssignmentSave.ToolTip"));
    leftPanel.add(assignmentChange, "1, " + row++);
    row++;

    row += 4;

    JButton assignmentAdd = Button.newButton(loc.getString("gui.AssignmentEditor.button.AssignmentAdd"),
            aclAssignmentAdd);
    assignmentAdd.setToolTipText(loc.getString("gui.AssignmentEditor.button.AssignmentSave.ToolTip"));
    leftPanel.add(assignmentAdd, "1, " + row++);
    row++;

    JButton assignmentDelete = Button.newButton(loc.getString("gui.AssignmentEditor.button.AssignmentDelete"),
            aclAssignmentDelete);
    assignmentDelete.setToolTipText(loc.getString("gui.AssignmentEditor.button.AssignmentSave.ToolTip"));
    leftPanel.add(assignmentDelete, "1, " + row++);
    row++;

    // Rechter Teil
    row = 1;
    leftPanel.add(new JLabel(loc.getString("gui.AssignmentEditor.label.AssignmentTypes")), "3, " + row++);
    row++;

    assignmentTypeSelector = new AssignmentTypeListModel();
    lstAssignmentType = new JList<>();
    lstAssignmentType.setModel(assignmentTypeSelector);
    lstAssignmentType.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lstAssignmentType.setCellRenderer(new AssignmentTypeListRenderer());
    lstAssignmentType.setSelectionModel(new AssignmentTypeListSelectionModel());

    leftPanel.add(new JScrollPane(lstAssignmentType), "3, " + row++);
    row++;

    leftPanel.add(new JLabel(loc.getString("gui.AssignmentEditor.label.Name")), "3, " + row++);
    row++;

    addAssignmentTypeText = new JTextField();
    leftPanel.add(addAssignmentTypeText, "3, " + row++);
    row++;

    leftPanel.add(new JLabel(loc.getString("gui.AssignmentEditor.label.DefaultEvacuees")), "3, " + row++);
    row++;
    txtDefaultEvacuees = new JTextField();
    txtDefaultEvacuees.addKeyListener(kylEvacuees);
    leftPanel.add(txtDefaultEvacuees, "3, " + row++);
    row++;

    JButton assignmentTypeChange = Button.newButton(
            loc.getString("gui.AssignmentEditor.button.AssignmentTypeSave"), aclAssignmentTypeSaveChanges);
    assignmentTypeChange
            .setToolTipText(loc.getString("gui.AssignmentEditor.button.AssignmentTypeSave.ToolTip"));
    leftPanel.add(assignmentTypeChange, "3, " + row++);
    row++;

    JButton assignmentTypeAdd = Button.newButton(loc.getString("gui.AssignmentEditor.button.AssignmentTypeAdd"),
            aclAssignmentTypeAdd);
    assignmentTypeAdd.setToolTipText(loc.getString("gui.AssignmentEditor.button.AssignmentTypeAdd.ToolTip"));
    leftPanel.add(assignmentTypeAdd, "3, " + row++);
    row++;

    JButton assignmentTypeDelete = Button.newButton(
            loc.getString("gui.AssignmentEditor.button.AssignmentTypeDelete"), aclAssignmentTypeDelete);
    assignmentTypeDelete
            .setToolTipText(loc.getString("gui.AssignmentEditor.button.AssignmentTypeSave.ToolTip"));
    leftPanel.add(assignmentTypeDelete, "3, " + row++);
    row++;

    return leftPanel;
}

From source file:de.tor.tribes.ui.views.DSWorkbenchChurchFrame.java

private void buildMenu() {
    JXTaskPane transferPane = new JXTaskPane();
    transferPane.setTitle("bertragen");
    JXButton transferVillageList = new JXButton(
            new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/center_ingame.png")));
    transferVillageList.setToolTipText("Zentriert das Kirchendorf im Spiel");
    transferVillageList.addMouseListener(new MouseAdapter() {
        @Override/*from w  w  w .  j  av a  2 s . c o m*/
        public void mouseReleased(MouseEvent e) {
            centerChurchInGame();
        }
    });
    transferPane.getContentPane().add(transferVillageList);

    if (!GlobalOptions.isMinimal()) {
        JXButton button = new JXButton(
                new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/center_24x24.png")));
        button.setToolTipText("Zentriert das Kirchendorf auf der Hauptkarte");
        button.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseReleased(MouseEvent e) {
                centerChurchVillage();
            }
        });

        transferPane.getContentPane().add(button);
    }
    centerPanel.setupTaskPane(transferPane);
}

From source file:de.tor.tribes.ui.views.DSWorkbenchReportFrame.java

private void buildMenu() {
    // <editor-fold defaultstate="collapsed" desc="view task pane">
    JXTaskPane viewTaskPane = new JXTaskPane();
    viewTaskPane.setTitle("Anzeigen");

    viewTaskPane.getContentPane().add(/*from ww  w .j  a va 2s. c  o  m*/
            factoryButton("/res/ui/view_report.png", "Die gew&auml;hlten Berichte ffnen", new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent e) {
                    ReportTableTab tab = getActiveTab();
                    if (tab != null) {
                        tab.viewReport();
                    }
                }
            }));
    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="transfer task pane">
    JXTaskPane transferTaskPane = new JXTaskPane();
    transferTaskPane.setTitle("bertragen");

    transferTaskPane.getContentPane().add(factoryButton("/res/ui/troop_info_add.png",
            "&Uuml;bertr&auml;gt die &uuml;berlebenden Truppen des Verteidigers", new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent e) {
                    ReportTableTab tab = getActiveTab();
                    if (tab != null) {
                        tab.transferTroopInfos();
                    }
                }
            }));

    transferTaskPane.getContentPane().add(factoryButton("/res/ui/report_toAStar.png",
            "&Uuml;bertr&auml;gt den gew&auml;hlten Berichte nach A*Star", new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent e) {
                    ReportTableTab tab = getActiveTab();
                    if (tab != null) {
                        tab.transferSelection(ReportTableTab.TRANSFER_TYPE.ASTAR);
                    }
                }
            }));
    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="misc task pane">
    JXTaskPane miscPane = new JXTaskPane();
    miscPane.setTitle("Sonstiges");

    miscPane.getContentPane()
            .add(factoryButton("/res/ui/document_new_24x24.png", "Neuen Plan erstellen", new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent e) {
                    fireCreateAttackPlanEvent(e);
                }
            }));

    miscPane.getContentPane().add(factoryButton("/res/ui/medal.png",
            "Statistiken zu den gew&auml;hlten Berichten erstellen", new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent e) {
                    ReportTableTab tab = getActiveTab();
                    if (tab != null) {
                        String[] groups = ReportManager.getSingleton().getGroups();
                        DefaultListModel model = new DefaultListModel();
                        for (String group : groups) {
                            model.addElement(group);
                        }

                        jReportSetsForStatsList.setModel(model);
                        jCreateStatsFrame.setLocationRelativeTo(DSWorkbenchReportFrame.this);
                        jCreateStatsFrame.setVisible(true);
                    }
                }
            }));

    miscPane.getContentPane().add(factoryButton("/res/ui/report_cleanup.png",
            "Veraltete und doppelte Berichte im gewhlten Berichtset l&ouml;schen", new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent e) {
                    cleanupReports();
                }
            }));

    miscPane.getContentPane().add(factoryButton("/res/ui/index_edit.png",
            "Definierte Regeln bearbeiten oder neu erstellen", new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent e) {
                    rulesDialog.rebuildRuleList();
                    rulesDialog.setLocationRelativeTo(DSWorkbenchReportFrame.this);
                    rulesDialog.setVisible(true);
                }
            }));

    miscPane.getContentPane().add(factoryButton("/res/ui/index_refresh.png",
            "Definierte Regeln jetzt auf das gew&auml;hlte Berichtset anwenden", new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent e) {
                    ReportTableTab tab = getActiveTab();
                    if (tab != null) {
                        int changed = ReportManager.getSingleton().filterNow(tab.getReportSet());
                        tab = getActiveTab();
                        if (tab != null) {
                            tab.showInfo(changed + " Berichte neu eingeordnet");
                        }
                    }
                }
            }));
    // </editor-fold>

    centerPanel.setupTaskPane(viewTaskPane, transferTaskPane, miscPane);
}

From source file:edu.ku.brc.specify.dbsupport.cleanuptools.GeoChooserDlg.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override//from  w w  w . j a  va  2  s.c  o m
public void createUI() {
    boolean doStatesOrCounties = doAllCountries[1] || doAllCountries[2] || doInvCountry[1] || doInvCountry[2];
    //this.whichBtns = doStatesOrCounties && !doInvCountry[1] && rankId > 200 ? CustomDialog.OKCANCELAPPLYHELP : CustomDialog.OKCANCELHELP;

    boolean isStCnty = true;//rankId > 200; 

    dataListModel = new DefaultListModel<GeoSearchResultsItem>();
    mainList = new JList<GeoSearchResultsItem>(dataListModel);
    JScrollPane sb = createScrollPane(mainList, true);

    String listDim;
    if (UIHelper.isWindows()) {
        listDim = "250px";
        Dimension sz = new Dimension(250, 250);
        mainList.setPreferredSize(sz);
        sb.setPreferredSize(sz);
    } else {
        listDim = "f:p:g";
    }

    CellConstraints cc = new CellConstraints();
    PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g",
            "p,2px,p,12px,p,2px," + listDim + ",8px,p,4px,p,10px,p" + (isStCnty ? ",8px,p" : "")));

    this.contentPanel = pb.getPanel();

    super.createUI();

    okBtn.setEnabled(false);

    calcProgress();

    try {
        if (coInfoList != null && coInfoList.size() > 0) {
            fillFromLuceneResults();
        } else {
            fillFromQuery();
        }

        mainList.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    getOkBtn().doClick();

                } else if (e.getClickCount() == 1 && !noMatchesFound && !mainList.isSelectionEmpty()) {
                    getOkBtn().setEnabled(true);
                }
            }
        });
        mainList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    listItemSelected();
                }
            }
        });

        updateNameCB = createCheckBox("Update the Name in the Geography tree."); // I18N
        //mergeCB      = createCheckBox("Merge all the geographies with the same name.");
        addISOCodeCB = createCheckBox("Add the ISO Code to the record");
        isoCodeTF = createTextField(8);
        isoCodeTF.setVisible(rankId < 400);

        updateNameCB.setSelected(isUpdateNamesChecked);
        //mergeCB.setSelected(true);
        addISOCodeCB.setSelected(true);

        updateNameCB.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(final ChangeEvent e) {
                isUpdateNamesChecked = updateNameCB.isSelected();
            }
        });

        DocumentListener dl = new DocumentAdaptor() {
            @Override
            protected void changed(DocumentEvent e) {
                okBtn.setEnabled(!isoCodeTF.getText().isEmpty());
            }
        };
        isoCodeTF.getDocument().addDocumentListener(dl);
        //labels.add(nameStr);// + "  (Unknown)");

        PanelBuilder lookPB = null;
        JButton lookupBtn = null;
        if (isStCnty) {
            lookPB = new PanelBuilder(new FormLayout("f:p:g,p", "p"));
            lookupBtn = createI18NButton("CLNUP_GEO_LOOK_UP_ISO");
            lookPB.add(lookupBtn, cc.xy(2, 1));
            lookupBtn.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    globalRankSearch();
                }
            });
        }

        int i = 0;
        ArrayList<String> labels = new ArrayList<String>();
        while (i < parentNames.length && parentRanks[i] > -1) {
            labels.add(i18NLabelsMap.get(parentRanks[i++]));
        }

        PanelBuilder pbTop = new PanelBuilder(
                new FormLayout("p,2px,f:p:g", UIHelper.createDuplicateJGoodiesDef("p", "2px", labels.size())));
        int y = 1;
        for (i = 0; i < labels.size(); i++) {
            JLabel lbl = createLabel(parentNames[i]);
            pbTop.add(createFormLabel(labels.get(i)), cc.xy(1, y));
            pbTop.add(lbl, cc.xy(3, y));
            lbl.setBackground(Color.WHITE);
            lbl.setOpaque(true);
            y += 2;
        }

        pb.add(pbTop.getPanel(), cc.xy(1, 3));
        pb.addSeparator("Possible standard Geography choices", cc.xy(1, 5)); // I18N
        pb.add(sb, cc.xy(1, 7));
        pb.add(updateNameCB, cc.xy(1, 9));

        PanelBuilder pbc = new PanelBuilder(new FormLayout("p,10px,p,f:p:g", "p"));
        pbc.add(addISOCodeCB, cc.xy(1, 1));
        pbc.add(isoCodeTF, cc.xy(3, 1));

        pb.add(pbc.getPanel(), cc.xy(1, 11));

        i = 13;
        if (isStCnty) {
            pb.add(lookPB.getPanel(), cc.xy(1, i));
            i += 2;
        }

        //if (doAllCountries[0])
        if (false) // hidding it for now
        {
            progressBar = new JProgressBar(0, 100);
            progressBar.setStringPainted(true);
            PanelBuilder prgPB = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p"));
            prgPB.add(createFormLabel("Progress"), cc.xy(1, 1));
            prgPB.add(progressBar, cc.xy(3, 1));
            pb.add(prgPB.getPanel(), cc.xy(1, i));
            i += 2;
        }

        mainList.setSelectedIndex(selectedIndex);
        mainList.ensureIndexIsVisible(selectedIndex);

        noMatchesFound = dataListModel.size() == 0;

        // Optional Depending on States / Countries
        if (doStatesOrCounties) {
            if (dataListModel.getSize() == 0) {
                dataListModel.addElement(new GeoSearchResultsItem("No matches found."));// I18N
            }
        }

        pb.setDefaultDialogBorder();

    } catch (Exception ex) {
        ex.printStackTrace();
    }

    if (UIHelper.isWindows()) {
        setResizable(false);
    }
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // Must be called at the end 'createUI'
}

From source file:de.tor.tribes.ui.views.DSWorkbenchAttackFrame.java

/**
 * Build the main menu for this frame//from w w w  .j a  va  2s  .com
 */
private void buildMenu() {
    // <editor-fold defaultstate="collapsed" desc="Edit task pane">
    JXTaskPane editTaskPane = new JXTaskPane();
    editTaskPane.setTitle("Bearbeiten");
    editTaskPane.getContentPane()
            .add(factoryButton("/res/ui/document_new_24x24.png", "Neuen Plan erstellen", new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent e) {
                    fireCreateAttackPlanEvent(e);
                }
            }));
    editTaskPane.getContentPane()
            .add(factoryButton("/res/ui/garbage.png", "Abgelaufene Befehle entfernen", new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent e) {
                    AttackTableTab activeTab = getActiveTab();
                    if (activeTab != null) {
                        activeTab.cleanup();
                    }
                }
            }));
    editTaskPane.getContentPane()
            .add(factoryButton("/res/ui/att_changeTime.png",
                    "Ankunfts-/Abschickzeit fr markierte Befehle &auml;ndern. "
                            + "Die Startzeit der Befehle wird dabei entsprechend der Laufzeit angepasst",
                    new MouseAdapter() {

                        @Override
                        public void mouseReleased(MouseEvent e) {
                            AttackTableTab activeTab = getActiveTab();
                            if (activeTab != null) {
                                activeTab.changeSelectionTime();
                            }
                        }
                    }));
    editTaskPane.getContentPane().add(factoryButton("/res/ui/attack_unit_unknown.png",
            "Einheit und Befehlstyp fr markierte Befehle &auml;ndern. "
                    + "Bitte beachte, dass sich beim &Auml;ndern der Einheit auch die Startzeit der Befehle &auml;ndern kann",
            new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent e) {
                    AttackTableTab activeTab = getActiveTab();
                    if (activeTab != null) {
                        activeTab.changeSelectionType();
                    }
                }
            }));
    editTaskPane.getContentPane().add(factoryButton("/res/ui/standard_attacks.png",
            "Truppen aus den Standardangriffen neu laden ", new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent e) {
                    AttackTableTab activeTab = getActiveTab();
                    if (activeTab != null) {
                        activeTab.reloadAttacksFromStd();
                    }
                }
            }));
    editTaskPane.getContentPane().add(factoryButton("/res/ui/att_browser_unsent.png",
            "'&Uuml;bertragen' Feld fr markierte Befehle l&ouml;schen", new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent e) {
                    AttackTableTab activeTab = getActiveTab();
                    if (activeTab != null) {
                        activeTab.setSelectionUnsent();
                    }
                }
            }));
    editTaskPane.getContentPane()
            .add(factoryButton("/res/ui/pencil2.png", "Markierte Befehle auf der Karte einzeichen. "
                    + "Ist ein gewhlter Befehl bereits eingezeichnet, so wird er nach Bet&auml;tigung dieses Buttons nicht mehr eingezeichnet",
                    new MouseAdapter() {

                        @Override
                        public void mouseReleased(MouseEvent e) {
                            AttackTableTab activeTab = getActiveTab();
                            if (activeTab != null) {
                                activeTab.changeSelectionDrawState();
                            }
                        }
                    }));
    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="Transfer task pane">
    JXTaskPane transferTaskPane = new JXTaskPane();
    transferTaskPane.setTitle("bertragen");
    transferTaskPane.getContentPane().add(factoryButton("/res/ui/att_clipboard.png",
            "Markierte Befehle im Klartext in die Zwischenablage kopieren. "
                    + "Der Inhalt der Zwischenablage kann dann z.B. in Excel oder OpenOffice eingef&uuml;gt werden",
            new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent e) {
                    AttackTableTab activeTab = getActiveTab();
                    if (activeTab != null) {
                        activeTab.transferSelection(AttackTableTab.TRANSFER_TYPE.CLIPBOARD_PLAIN);
                    }
                }
            }));

    transferTaskPane.getContentPane()
            .add(factoryButton("/res/ui/att_HTML.png", "Markierte Befehle in eine HTML Datei kopieren.<br/>"
                    + "Die erstellte Datei kann dann per eMail verschickt oder zum Abschicken von Befehlen ohne ge&ouml;ffnetesDS Workbench verwendet werden",
                    new MouseAdapter() {

                        @Override
                        public void mouseReleased(MouseEvent e) {
                            AttackTableTab activeTab = getActiveTab();
                            if (activeTab != null) {
                                activeTab.transferSelection(AttackTableTab.TRANSFER_TYPE.FILE_HTML);
                            }
                        }
                    }));

    transferTaskPane.getContentPane().add(factoryButton("/res/ui/toTextFile.png",
            "Markierte Befehle auf mehrere Textdateien aufteilen.<br/>"
                    + "Es werden f&uuml;r jeden Spieler mehrere Textdateien erstellt, die eine einstellbare Anzahl an Angriffe in BB-Codes enthalten.<br/>"
                    + "Diese k&ouml;nnen dann per Mail zugeschickt und weiterverarbeitet werden. Alternativ k&ouml;nnen die Textdateien f&uuml;r jeden Spieler<br/>"
                    + "auch in eine ZIP-Datei gepackt werden, um sie einfacher zu versenden.",
            new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent e) {
                    AttackTableTab activeTab = getActiveTab();
                    if (activeTab != null) {
                        activeTab.transferSelection(AttackTableTab.TRANSFER_TYPE.FILE_TEXT);
                    }
                }
            }));

    transferTaskPane.getContentPane().add(factoryButton("/res/ui/re-time.png",
            "Markierten Befehl in das Werkzeug 'Retimer' einfgen. Im Anschluss daran muss im Retimer noch die vermutete Einheit gewhlt werden.",
            new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent e) {
                    AttackTableTab activeTab = getActiveTab();
                    if (activeTab != null) {
                        activeTab.transferSelection(AttackTableTab.TRANSFER_TYPE.DSWB_RETIME);
                    }
                }
            }));
    transferTaskPane.getContentPane()
            .add(factoryButton("/res/ui/att_browser.png", "Markierte Befehle in den Browser &uuml;bertragen. "
                    + "Im Normalfall werden nur einzelne Befehle &uuml;bertragen. F&uuml;r das &Uuml;bertragen mehrerer Befehle ist zuerst das Klickkonto entsprechend zu f&uuml;llen",
                    new MouseAdapter() {

                        @Override
                        public void mouseReleased(MouseEvent e) {
                            AttackTableTab activeTab = getActiveTab();
                            if (activeTab != null) {
                                activeTab.transferSelection(AttackTableTab.TRANSFER_TYPE.BROWSER_LINK);
                            }
                        }
                    }));
    transferTaskPane.getContentPane()
            .add(factoryButton("/res/ui/export_js.png", "Markierte Befehle in ein Userscript schreiben. "
                    + "Das erstellte Userscript muss im Anschluss manuell im Browser installiert werden. "
                    + "Als Ergebnis bekommt man an verschiedenen Stellen im Spiel Informationen &uuml;ber geplante Befehle angezeigt.",
                    new MouseAdapter() {

                        @Override
                        public void mouseReleased(MouseEvent e) {
                            AttackTableTab activeTab = getActiveTab();
                            if (activeTab != null) {
                                activeTab.transferSelection(AttackTableTab.TRANSFER_TYPE.FILE_GM);
                            }
                        }
                    }));

    transferTaskPane.getContentPane().add(factoryButton("/res/ui/to_selection.png",
            "Herkunfts- oder Zield&ouml;rfer markierter Befehle in die Auswahl&uuml;bersicht bertragen.",
            new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent e) {
                    AttackTableTab activeTab = getActiveTab();
                    if (activeTab != null) {
                        activeTab.transferSelection(AttackTableTab.TRANSFER_TYPE.SELECTION_TOOL);
                    }
                }
            }));

    // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="Misc task pane">

    JXTaskPane miscTaskPane = new JXTaskPane();
    miscTaskPane.setTitle("Sonstiges");

    miscTaskPane.getContentPane().add(factoryButton("/res/ui/colorize.gif",
            "F&auml;rbt zusammengeh&ouml;rigen Befehle entsprechend der aktuellen Tabellensortierung ein<br/>"
                    + "<i>Farbalgorithmus &copy;bodhiBrute</i>",
            new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent e) {
                    AttackTableTab tab = getActiveTab();
                    if (tab != null) {
                        tab.setUseSortColoring();
                    }
                }
            }));

    miscTaskPane.getContentPane().add(factoryButton("/res/ui/att_alert_off.png",
            "Einen Alarm fr den gewhlten Befehl erstellen", new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent e) {
                    AttackTableTab tab = getActiveTab();
                    if (tab != null) {
                        tab.addAttackTimer();
                    }
                }
            }));
    // </editor-fold>

    clickAccount = new ClickAccountPanel();
    profilePanel = new ProfileQuickChangePanel();
    centerPanel.setupTaskPane(clickAccount, profilePanel, editTaskPane, transferTaskPane, miscTaskPane);
}

From source file:com.android.tools.idea.structure.MavenDependencyLookupDialog.java

public MavenDependencyLookupDialog(@NotNull Project project, @Nullable Module module) {
    super(project, true);
    myAndroidModule = module != null && AndroidFacet.getInstance(module) != null;
    myProgressIcon.suspend();/*from www .  j  av a2  s . c om*/

    mySearchField.setButtonIcon(AllIcons.Actions.Menu_find);
    mySearchField.getButton().addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            startSearch();
        }
    });

    mySearchTextField = mySearchField.getTextField();
    mySearchTextField.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            if (!isValidCoordinateSelected()) {
                startSearch();
            } else {
                close(OK_EXIT_CODE);
            }
        }
    });

    boolean isPreviewVersion = false;
    if (module != null) {
        AndroidFacet facet = AndroidFacet.getInstance(module);
        if (facet != null) {
            IdeaAndroidProject androidProject = facet.getIdeaAndroidProject();
            if (androidProject != null) {
                ApiVersion minSdkVersion = androidProject.getSelectedVariant().getMergedFlavor()
                        .getMinSdkVersion();
                if (minSdkVersion != null) {
                    isPreviewVersion = new AndroidVersion(minSdkVersion.getApiLevel(),
                            minSdkVersion.getCodename()).isPreview();
                }
            }
        }
    }
    RepositoryUrlManager manager = RepositoryUrlManager.get();
    for (String libraryId : RepositoryUrlManager.EXTRAS_REPOSITORY.keySet()) {
        String libraryCoordinate = manager.getLibraryCoordinate(libraryId, null, isPreviewVersion);
        if (libraryCoordinate != null) {
            Artifact artifact = Artifact.fromCoordinate(libraryCoordinate, libraryId);
            if (artifact != null) {
                myShownItems.add(artifact);
            }
        }
    }
    myShownItems.addAll(COMMON_LIBRARIES);
    myResultList.setModel(new CollectionComboBoxModel(myShownItems, null));
    myResultList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent listSelectionEvent) {
            Artifact value = (Artifact) myResultList.getSelectedValue();
            if (value != null) {
                mySearchTextField.setText(value.getCoordinates());
            }
        }
    });
    myResultList.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent mouseEvent) {
            if (mouseEvent.getClickCount() == 2 && isValidCoordinateSelected()) {
                close(OK_EXIT_CODE);
            }
        }
    });

    init();
}

From source file:de.tor.tribes.ui.views.DSWorkbenchWatchtowerFrame.java

private void buildMenu() {
    JXTaskPane transferPane = new JXTaskPane();
    transferPane.setTitle("bertragen");
    JXButton transferVillageList = new JXButton(
            new ImageIcon(DSWorkbenchWatchtowerFrame.class.getResource("/res/ui/center_ingame.png")));
    transferVillageList.setToolTipText("Zentriert das Wachturmndorf im Spiel");
    transferVillageList.addMouseListener(new MouseAdapter() {
        @Override/*from   w ww  . j  av  a2  s.  c om*/
        public void mouseReleased(MouseEvent e) {
            centerWatchtowerInGame();
        }
    });
    transferPane.getContentPane().add(transferVillageList);

    if (!GlobalOptions.isMinimal()) {
        JXButton button = new JXButton(
                new ImageIcon(DSWorkbenchWatchtowerFrame.class.getResource("/res/center_24x24.png")));
        button.setToolTipText("Zentriert das Wachturmndorf auf der Hauptkarte");
        button.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseReleased(MouseEvent e) {
                centerWatchtowerVillage();
            }
        });

        transferPane.getContentPane().add(button);
    }
    centerPanel.setupTaskPane(transferPane);
}