Example usage for java.awt Event CTRL_MASK

List of usage examples for java.awt Event CTRL_MASK

Introduction

In this page you can find the example usage for java.awt Event CTRL_MASK.

Prototype

int CTRL_MASK

To view the source code for java.awt Event CTRL_MASK.

Click Source Link

Document

This flag indicates that the Control key was down when the event occurred.

Usage

From source file:net.jradius.client.gui.JRadiusSimulator.java

/**
 * This method initializes jMenuItem/*  www .ja  v  a 2  s .  c o m*/
 * 
 * @return javax.swing.JMenuItem
 */
private JMenuItem getOpenMenuItem() {
    if (openMenuItem == null) {
        openMenuItem = new JMenuItem();
        openMenuItem.setText("Open");
        openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK, true));
        openMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JFileChooser chooser = new JFileChooser();
                int returnVal = chooser.showOpenDialog(JRadiusSimulator.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = chooser.getSelectedFile();
                    try {
                        loadConfigFile("file:///" + file.getAbsolutePath());
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(null, ex.getMessage(), "Error",
                                JOptionPane.ERROR_MESSAGE);
                        ex.printStackTrace();
                    }
                }
            }
        });
    }
    return openMenuItem;
}

From source file:io.heming.accountbook.ui.MainFrame.java

private void initMenuBar() {
    JMenuBar menuBar = new JMenuBar();

    // File menu//  ww  w . j a  va  2s . co m
    fileMenu = new JMenu("(F)");
    fileMenu.setMnemonic('F');

    exportMenuItem = new JMenuItem("(B)...");
    exportMenuItem.setIcon(new ImageIcon(getClass().getResource("database-save.png")));
    exportMenuItem.setMnemonic('B');
    exportMenuItem.addActionListener(e -> exportRecords());
    fileMenu.add(exportMenuItem);

    importMenuItem = new JMenuItem("??(R)...");
    importMenuItem.setIcon(new ImageIcon(getClass().getResource("document-import-2.png")));
    importMenuItem.setMnemonic('R');
    importMenuItem.addActionListener(e -> importRecords());
    fileMenu.add(importMenuItem);

    fileMenu.addSeparator();

    quitMenuItem = new JMenuItem("(X)");
    quitMenuItem.setIcon(new ImageIcon(getClass().getResource("application-exit-2.png")));
    quitMenuItem.setMnemonic('X');
    quitMenuItem.addActionListener(e -> quit());
    fileMenu.add(quitMenuItem);

    // View menu
    viewMenu = new JMenu("(V)");
    viewMenu.setMnemonic('V');

    searchMenuItem = new JMenuItem("?(S)");
    searchMenuItem.setIcon(new ImageIcon(getClass().getResource("edit-find-5.png")));
    searchMenuItem.setMnemonic('S');
    searchMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));
    searchMenuItem.addActionListener(e -> searchRecords());
    viewMenu.add(searchMenuItem);

    keywordMenuItem = new JMenuItem("(K)");
    keywordMenuItem.setIcon(new ImageIcon(getClass().getResource("text-field.png")));
    keywordMenuItem.setMnemonic('K');
    keywordMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK));
    keywordMenuItem.addActionListener(e -> {
        keywordTextField.requestFocus();
        keywordTextField.selectAll();
    });
    viewMenu.add(keywordMenuItem);

    viewMenu.addSeparator();

    prevPageMenuItem = new JMenuItem("?(P)");
    prevPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-previous-2.png")));
    prevPageMenuItem.setMnemonic('P');
    prevPageMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.CTRL_MASK));
    prevPageMenuItem.addActionListener(e -> prevPage());
    viewMenu.add(prevPageMenuItem);

    nextPageMenuItem = new JMenuItem("(N)");
    nextPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-next-2.png")));
    nextPageMenuItem.setMnemonic('N');
    nextPageMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.CTRL_MASK));
    nextPageMenuItem.addActionListener(e -> nextPage());
    viewMenu.add(nextPageMenuItem);

    firstPageMenuItem = new JMenuItem("(F)");
    firstPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-first.png")));
    firstPageMenuItem.setMnemonic('F');
    firstPageMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.SHIFT_MASK + Event.CTRL_MASK));
    firstPageMenuItem.addActionListener(e -> firstPage());
    viewMenu.add(firstPageMenuItem);

    lastPageMenuItem = new JMenuItem("(L)");
    lastPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-last.png")));
    lastPageMenuItem.setMnemonic('L');
    lastPageMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.SHIFT_MASK + Event.CTRL_MASK));
    lastPageMenuItem.addActionListener(e -> lastPage());
    viewMenu.add(lastPageMenuItem);

    // Edit menu
    editMenu = new JMenu("(E)");
    editMenu.setMnemonic('E');

    addRecordMenuItem = new JMenuItem("(A)...");
    addRecordMenuItem.setIcon(new ImageIcon(getClass().getResource("edit-add-3.png")));
    addRecordMenuItem.setMnemonic('A');
    addRecordMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK));
    addRecordMenuItem.addActionListener(e -> showAddRecordDialog());
    editMenu.add(addRecordMenuItem);

    //        deleteRecordMenuItem = new JMenuItem("(D)");
    //        deleteRecordMenuItem.setIcon(new ImageIcon(getClass().getResource("edit-delete-6.png")));
    //        deleteRecordMenuItem.setMnemonic('D');
    //        deleteRecordMenuItem.addActionListener(e -> deleteRecord());
    //        editMenu.add(deleteRecordMenuItem);

    editMenu.addSeparator();

    categoryMenuItem = new JMenuItem("???(T)...");
    categoryMenuItem.setIcon(new ImageIcon(getClass().getResource("view-list-icons-2.png")));
    categoryMenuItem.setMnemonic('T');
    categoryMenuItem.addActionListener(e -> showCategoryDialog());
    editMenu.add(categoryMenuItem);

    // Help menu
    helpMenu = new JMenu("(H)");
    helpMenu.setMnemonic('H');

    helpMenuItem = new JMenuItem("(I)");
    helpMenuItem.setIcon(new ImageIcon(getClass().getResource("help-2.png")));
    helpMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
    helpMenuItem.setMnemonic('I');
    helpMenuItem.addActionListener(e -> help());
    helpMenu.add(helpMenuItem);

    aboutMenuItem = new JMenuItem("(A)");
    aboutMenuItem.setIcon(new ImageIcon(getClass().getResource("help-about-2.png")));
    aboutMenuItem.setMnemonic('A');
    aboutMenuItem.addActionListener(e -> about());
    helpMenu.add(aboutMenuItem);

    // Add menu to menu bar
    menuBar.add(fileMenu);
    menuBar.add(editMenu);
    menuBar.add(viewMenu);
    menuBar.add(helpMenu);
    setJMenuBar(menuBar);
}

From source file:com.opendoorlogistics.studio.AppFrame.java

private List<MyAction> initEditActions() {
    ArrayList<MyAction> ret = new ArrayList<>();
    ret.add(new MyAction("Undo", "Undo last action", null, "edit-undo-7-32x32.png", true,
            KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK)) {

        @Override//from  w  w  w  .j a  v  a2  s. co m
        public void actionPerformed(ActionEvent e) {
            loaded.getDs().undo();
        }

        @Override
        public void updateEnabled() {
            setEnabled(loaded != null && loaded.getDs().hasUndo());
        }
    });

    ret.add(new MyAction("Redo", "Redo last undone action", null, "edit-redo-7-32x32.png", true,
            KeyStroke.getKeyStroke(KeyEvent.VK_Y, Event.CTRL_MASK)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            loaded.getDs().redo();
        }

        @Override
        public void updateEnabled() {
            setEnabled(loaded != null && loaded.getDs().hasRedo());
        }
    });

    return ret;
}

From source file:com.opendoorlogistics.studio.AppFrame.java

@SuppressWarnings("serial")
private List<MyAction> initFileActions() {
    ArrayList<MyAction> ret = new ArrayList<>();
    ret.add(new MyAction("New", "Create new file", null, "document-new-6.png", false,
            KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK)) {

        @Override/*from   ww w.java  2 s  .  c om*/
        public void actionPerformed(ActionEvent e) {
            createNewDatastore();
        }
    });

    ret.add(new MyAction("Open", "Open file", null, "document-open-3.png", false,
            KeyStroke.getKeyStroke(KeyEvent.VK_O, java.awt.Event.CTRL_MASK)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            openDatastoreWithUserPrompt();
        }
    });

    ret.add(null);

    ret.add(new MyAction("Close", "Close file", null, "document-close-4.png", true,
            KeyStroke.getKeyStroke(KeyEvent.VK_W, java.awt.Event.CTRL_MASK)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (!canCloseDatastore()) {
                return;
            }
            closeDatastore();
        }
    });

    ret.add(null);

    ret.add(new MyAction("Save", "Save file", null, "document-save-2.png", true,
            KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            saveDatastoreWithoutUserPrompt(loaded.getLastFile());
        }

        @Override
        public void updateEnabled() {

            setEnabled(loaded != null && loaded.getLastFile() != null);
        }

    });
    ret.add(new MyAction("Save as", "Save file as", null, "document-save-as-2.png", true,
            KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK | Event.ALT_MASK)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = SupportedFileType.EXCEL.createFileChooser();
            if (loaded.getLastFile() != null) {
                chooser.setSelectedFile(loaded.getLastFile());
            } else {
                File file = PreferencesManager.getSingleton().getFile(PrefKey.LAST_IO_DIR);
                IOUtils.setFile(file, chooser);
            }
            if (chooser.showSaveDialog(AppFrame.this) == JFileChooser.APPROVE_OPTION) {
                saveDatastoreWithoutUserPrompt(chooser.getSelectedFile());
            }

        }
    });

    return ret;
}

From source file:com.opendoorlogistics.studio.AppFrame.java

private void initFileMenu(JMenu mnFile) {
    mnFile.removeAll();//from  w ww  .j a  v  a 2s .c o m

    // non-dynamic
    for (MyAction action : fileActions) {
        if (action == null) {
            mnFile.addSeparator();
        } else {
            JMenuItem item = mnFile.add(action);
            if (action.accelerator != null) {
                item.setAccelerator(action.accelerator);
            }
        }
    }

    // import (not in action list as doesn't appear on toolbar)
    mnFile.addSeparator();
    JMenu mnImport = new JMenu("Import");
    mnFile.add(mnImport);

    class ImportPair {
        String menuString;
        SupportedFileType type;

        public ImportPair(String menuString, SupportedFileType type) {
            super();
            this.menuString = menuString;
            this.type = type;
        }
    }
    for (final ImportPair type : new ImportPair[] {
            new ImportPair("Comma separated (CSV) text", SupportedFileType.CSV),
            new ImportPair("Tab separated text", SupportedFileType.TABBED),
            new ImportPair("Excel", SupportedFileType.EXCEL),
            new ImportPair("Shapefile (link geometry to original file)",
                    SupportedFileType.SHAPEFILE_LINKED_GEOM),
            new ImportPair("Shapefile (copy geometry into spreadsheet)",
                    SupportedFileType.SHAPEFILE_COPIED_GEOM), }) {
        mnImport.add(new AbstractAction(type.menuString) {

            @Override
            public void actionPerformed(ActionEvent e) {
                importFile(type.type);
            }
        });
    }

    // dynamic
    mnFile.addSeparator();
    List<File> recent = PreferencesManager.getSingleton().getRecentFiles();
    for (int i = 0; i < recent.size(); i++) {
        final File file = recent.get(i);
        String s = Integer.toString(i + 1) + ". " + file.getAbsolutePath();
        int maxLen = 100;
        if (s.length() > maxLen) {
            s = s.substring(0, maxLen) + "...";
        }
        mnFile.add(new MyAction(s, "Load file " + file.getAbsolutePath(), null, null, false, null) {

            @Override
            public void actionPerformed(ActionEvent e) {
                if (!canCloseDatastore()) {
                    return;
                }

                openFile(file);
                updateAppearance();
            }

        });
    }

    // clear recent
    mnFile.addSeparator();
    mnFile.add(new MyAction("Clear recent files", "Clear recent files", null, null, false, null) {

        @Override
        public void actionPerformed(ActionEvent e) {
            PreferencesManager.getSingleton().clearRecentFiles();
        }
    });

    // finally exit
    mnFile.addSeparator();
    JMenuItem item = mnFile.add(new MyAction("Exit", "Exit", null, null, false,
            KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.Event.CTRL_MASK)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
            System.exit(0);
        }
    });
    item.setAccelerator(((MyAction) item.getAction()).accelerator);
    mnFile.validate();
}

From source file:de.codesourcery.jasm16.ide.ui.views.SourceCodeView.java

protected final void setupKeyBindings(final JTextPane editor) {
    // 'Save' action 
    addKeyBinding(editor, KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK), new AbstractAction() {
        @Override/* ww  w  . j a v a 2 s  . c o m*/
        public void actionPerformed(ActionEvent e) {
            saveCurrentFile();
        }
    });

    // 'Underline text when pressing CTRL while hovering over an identifier' 
    editorPane.addKeyListener(new KeyAdapter() {
        private boolean isControlKey(KeyEvent e) {
            return e.getKeyCode() == KeyEvent.VK_CONTROL;
        }

        public void keyPressed(KeyEvent e) {
            if (isControlKey(e)) {
                final Point ptr = getMouseLocation();
                if (ptr != null) {
                    maybeUnderlineIdentifierAt(ptr);
                }
            }
        }

        public void keyReleased(KeyEvent e) {
            if (isControlKey(e)) {
                clearUnderlineHighlight();
            }
        };
    });

    // "Undo" action
    addKeyBinding(editor, KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK), undoAction);

    addKeyBinding(editor, KeyStroke.getKeyStroke(KeyEvent.VK_Y, Event.CTRL_MASK), redoAction);

    // 'Search' action 
    addKeyBinding(editor, KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK), new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showSearchDialog();
        }
    });

    setupKeyBindingsHook(editor);
}

From source file:Clavis.Windows.WShedule.java

public synchronized void create() {
    initComponents();/*  w ww.  j a  v  a2s .com*/
    this.setModal(true);
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            close();
        }
    });
    this.setTitle(lingua.translate("Registos de emprstimo para o recurso") + ": "
            + lingua.translate(mat.getTypeOfMaterialName()).toLowerCase() + " "
            + lingua.translate(mat.getDescription()));
    KeyQuest.addtoPropertyListener(jPanelInicial, true);
    String dat = new TimeDate.Date().toString();
    String[] auxiliar = prefs.get("datainicio", dat).split("/");
    if (auxiliar[0].length() > 1) {
        if (auxiliar[0].charAt(0) == '0') {
            auxiliar[0] = auxiliar[0].replaceFirst("0", "");
        }
    }
    if (auxiliar[1].length() > 1) {
        if (auxiliar[1].charAt(0) == '0') {
            auxiliar[1] = auxiliar[1].replaceFirst("0", "");
        }
    }
    if (auxiliar[2].length() > 1) {
        if (auxiliar[2].charAt(0) == '0') {
            auxiliar[2] = auxiliar[2].replaceFirst("0", "");
        }
    }
    inicio = new TimeDate.Date(Integer.valueOf(auxiliar[0]), Integer.valueOf(auxiliar[1]),
            Integer.valueOf(auxiliar[2]));
    auxiliar = prefs.get("datafim", dat).split("/");
    if (auxiliar[0].length() > 1) {
        if (auxiliar[0].charAt(0) == '0') {
            auxiliar[0] = auxiliar[0].replaceFirst("0", "");
        }
    }
    if (auxiliar[1].length() > 1) {
        if (auxiliar[1].charAt(0) == '0') {
            auxiliar[1] = auxiliar[1].replaceFirst("0", "");
        }
    }
    if (auxiliar[2].length() > 1) {
        if (auxiliar[2].charAt(0) == '0') {
            auxiliar[2] = auxiliar[2].replaceFirst("0", "");
        }
    }
    fim = new TimeDate.Date(Integer.valueOf(auxiliar[0]), Integer.valueOf(auxiliar[1]),
            Integer.valueOf(auxiliar[2]));

    SimpleDateFormat sdf = new SimpleDateFormat("dd/M/yyyy");
    Date date;
    try {
        date = sdf.parse(fim.toString());
    } catch (ParseException ex) {
        date = new Date();

    }
    jXDatePickerFim.setDate(date);
    try {
        date = sdf.parse(inicio.toString());
    } catch (ParseException ex) {
        date = new Date();
    }
    jXDatePickerInicio.setDate(date);
    andamento = 0;
    if (DataBase.DataBase.testConnection(url)) {
        DataBase.DataBase db = new DataBase.DataBase(url);
        java.util.List<Keys.Request> requisicoes = Clavis.RequestList
                .simplifyRequests(db.getRequestsByMaterialByDateInterval(mat, inicio, fim));
        db.close();
        estado = lingua.translate("Todos");
        DefaultTableModel modelo = (DefaultTableModel) jTable1.getModel();
        if (requisicoes.size() > 0) {
            valores = new String[requisicoes.size()][4];
            lista = new java.util.ArrayList<>();
            requisicoes.stream().map((req) -> {
                if (mat.getMaterialTypeID() == 1) {
                    valores[andamento][0] = req.getPerson().getName();
                    valores[andamento][1] = req.getTimeBegin().toString(0) + " - "
                            + req.getTimeEnd().toString(0);
                    valores[andamento][2] = req.getBeginDate().toString();
                    String[] multipla = req.getActivity().split(":::");
                    if (multipla.length > 1) {
                        Components.PopUpMenu pop = new Components.PopUpMenu(multipla, lingua);
                        pop.create();
                        jTable1.addMouseListener(new MouseAdapter() {
                            int x = andamento;
                            int y = 3;

                            @Override
                            public void mousePressed(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    int row = jTable1.rowAtPoint(e.getPoint());
                                    int col = jTable1.columnAtPoint(e.getPoint());
                                    if ((row == x) && (col == y)) {
                                        pop.show(e.getComponent(), e.getX(), e.getY());
                                    }
                                }
                            }

                            @Override
                            public void mouseReleased(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    if (pop.isShowing()) {
                                        pop.setVisible(false);
                                    }
                                }
                            }
                        });
                        valores[andamento][3] = lingua.translate(multipla[0]) + "";
                    } else {
                        valores[andamento][3] = lingua.translate(req.getActivity());
                    }
                    if (valores[andamento][3].equals("")) {
                        valores[andamento][3] = lingua.translate("Sem descrio");
                    }
                    Object[] ob = { req.getPerson().getName(),
                            req.getTimeBegin().toString(0) + " - " + req.getTimeEnd().toString(0),
                            req.getBeginDate().toString(), valores[andamento][3], req.getSubject().getName() };
                    modelo.addRow(ob);
                } else {
                    valores[andamento][0] = req.getPerson().getName();
                    valores[andamento][1] = req.getBeginDate().toString();
                    valores[andamento][2] = req.getEndDate().toString();
                    String[] multipla = req.getActivity().split(":::");
                    if (multipla.length > 1) {
                        Components.PopUpMenu pop = new Components.PopUpMenu(multipla, lingua);
                        pop.create();
                        jTable1.addMouseListener(new MouseAdapter() {
                            int x = andamento;
                            int y = 3;

                            @Override
                            public void mousePressed(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    int row = jTable1.rowAtPoint(e.getPoint());
                                    int col = jTable1.columnAtPoint(e.getPoint());
                                    if ((row == x) && (col == y)) {
                                        pop.show(e.getComponent(), e.getX(), e.getY());
                                    }
                                }
                            }

                            @Override
                            public void mouseReleased(MouseEvent e) {
                                if (e.getButton() == MouseEvent.BUTTON1) {
                                    if (pop.isShowing()) {
                                        pop.setVisible(false);
                                    }
                                }
                            }
                        });
                        valores[andamento][3] = multipla[0];
                    } else {
                        valores[andamento][3] = lingua.translate(req.getActivity());
                    }
                    if (valores[andamento][3].equals("")) {
                        valores[andamento][3] = lingua.translate("Sem descrio");
                    }
                    Object[] ob = { req.getPerson().getName(), req.getBeginDate().toString(),
                            req.getEndDate().toString(), valores[andamento][3] };
                    modelo.addRow(ob);
                }
                return req;
            }).map((req) -> {
                lista.add(req);
                return req;
            }).forEach((_item) -> {
                andamento++;
            });
        }
    }
    jComboBoxEstado.setSelectedIndex(prefs.getInt("comboboxvalue", 0));
    String[] opcoes = { lingua.translate("Ver detalhes da requisio"),
            lingua.translate("Ver requisices com a mesma data"),
            lingua.translate("Ver requisices com o mesmo estado") };
    ActionListener[] eventos = new ActionListener[opcoes.length];
    eventos[0] = (ActionEvent r) -> {
        Border border = BorderFactory.createCompoundBorder(
                BorderFactory.createCompoundBorder(new org.jdesktop.swingx.border.DropShadowBorder(Color.BLACK,
                        3, 0.5f, 6, false, false, true, true), BorderFactory.createLineBorder(Color.BLACK, 1)),
                BorderFactory.createEmptyBorder(0, 10, 0, 10));
        int val = jTable1.getSelectedRow();
        Keys.Request req = lista.get(val);
        javax.swing.JPanel pan = new javax.swing.JPanel(null);
        pan.setPreferredSize(new Dimension(500, 300));
        pan.setBounds(0, 20, 500, 400);
        pan.setBackground(Components.MessagePane.BACKGROUND_COLOR);
        javax.swing.JLabel lrecurso1 = new javax.swing.JLabel(lingua.translate("Recurso") + ": ");
        lrecurso1.setBounds(10, 20, 120, 26);
        lrecurso1.setFocusable(true);
        lrecurso1.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso1);
        javax.swing.JLabel lrecurso11 = new javax.swing.JLabel(
                lingua.translate(req.getMaterial().getTypeOfMaterialName()) + " "
                        + lingua.translate(req.getMaterial().getDescription()));
        lrecurso11.setBounds(140, 20, 330, 26);
        lrecurso11.setBorder(border);
        pan.add(lrecurso11);
        javax.swing.JLabel lrecurso2 = new javax.swing.JLabel(lingua.translate("Utilizador") + ": ");
        lrecurso2.setBounds(10, 50, 120, 26);
        lrecurso2.setFocusable(true);
        lrecurso2.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso2);
        javax.swing.JLabel lrecurso22 = new javax.swing.JLabel(req.getPerson().getName());
        lrecurso22.setBounds(140, 50, 330, 26);
        lrecurso22.setBorder(border);
        pan.add(lrecurso22);
        javax.swing.JLabel lrecurso3 = new javax.swing.JLabel(lingua.translate("Data inicial") + ": ");
        lrecurso3.setBounds(10, 80, 120, 26);
        lrecurso3.setFocusable(true);
        lrecurso3.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso3);
        javax.swing.JLabel lrecurso33 = new javax.swing.JLabel(
                req.getBeginDate().toStringWithMonthWord(lingua));
        lrecurso33.setBounds(140, 80, 330, 26);
        lrecurso33.setBorder(border);
        pan.add(lrecurso33);
        javax.swing.JLabel lrecurso4 = new javax.swing.JLabel(lingua.translate("Data final") + ": ");
        lrecurso4.setBounds(10, 110, 120, 26);
        lrecurso4.setFocusable(true);
        lrecurso4.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso4);
        javax.swing.JLabel lrecurso44 = new javax.swing.JLabel(req.getEndDate().toStringWithMonthWord(lingua));
        lrecurso44.setBounds(140, 110, 330, 26);
        lrecurso44.setBorder(border);
        pan.add(lrecurso44);

        javax.swing.JLabel lrecurso5 = new javax.swing.JLabel(lingua.translate("Atividade") + ": ");
        lrecurso5.setBounds(10, 140, 120, 26);
        lrecurso5.setFocusable(true);
        lrecurso5.setHorizontalAlignment(javax.swing.JLabel.LEFT);
        pan.add(lrecurso5);
        javax.swing.JLabel lrecurso55;
        if (req.getActivity().equals("")) {
            lrecurso55 = new javax.swing.JLabel(lingua.translate("Sem descrio"));
        } else {
            String[] saux = req.getActivity().split(":::");
            String atividade;
            boolean situacao = false;
            if (saux.length > 1) {
                situacao = true;
                atividade = saux[0];
            } else {
                atividade = req.getActivity();
            }
            if (req.getSubject().getId() > 0) {
                lrecurso55 = new javax.swing.JLabel(
                        lingua.translate(atividade) + ": " + req.getSubject().getName());
            } else {
                lrecurso55 = new javax.swing.JLabel(lingua.translate(atividade));
            }
            if (situacao) {
                Components.PopUpMenu pop = new Components.PopUpMenu(saux, lingua);
                pop.create();
                lrecurso55.addMouseListener(new MouseAdapter() {

                    @Override
                    public void mouseEntered(MouseEvent e) {
                        pop.show(e.getComponent(), e.getX(), e.getY());
                    }

                    @Override
                    public void mouseExited(MouseEvent e) {
                        pop.setVisible(false);
                    }

                });
            }
        }
        lrecurso55.setBounds(140, 140, 330, 26);
        lrecurso55.setBorder(border);
        pan.add(lrecurso55);
        int distancia = 170;
        if (req.getBeginDate().isBigger(req.getEndDate()) == 0) {
            javax.swing.JLabel lrecurso6 = new javax.swing.JLabel(lingua.translate("Horrio") + ": ");
            lrecurso6.setBounds(10, distancia, 120, 26);
            lrecurso6.setFocusable(true);
            lrecurso6.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso6);
            javax.swing.JLabel lrecurso66 = new javax.swing.JLabel(
                    req.getTimeBegin().toString(0) + " - " + req.getTimeEnd().toString(0));
            lrecurso66.setBounds(140, distancia, 330, 26);
            lrecurso66.setBorder(border);
            pan.add(lrecurso66);
            distancia = 200;
        }
        if (req.getBeginDate().isBigger(req.getEndDate()) == 0) {
            javax.swing.JLabel lrecurso7 = new javax.swing.JLabel(lingua.translate("Dia da semana") + ": ");
            lrecurso7.setBounds(10, distancia, 120, 26);
            lrecurso7.setFocusable(true);
            lrecurso7.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso7);
            javax.swing.JLabel lrecurso77 = new javax.swing.JLabel(
                    lingua.translate(req.getWeekDay().perDayName()));
            lrecurso77.setBounds(140, distancia, 330, 26);
            lrecurso77.setBorder(border);
            pan.add(lrecurso77);
            if (distancia == 200) {
                distancia = 230;
            } else {
                distancia = 200;
            }
        }
        if (req.isTerminated() || req.isActive()) {
            javax.swing.JLabel lrecurso8 = new javax.swing.JLabel(lingua.translate("Levantamento") + ": ");
            lrecurso8.setBounds(10, distancia, 120, 26);
            lrecurso8.setFocusable(true);
            lrecurso8.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso8);
            javax.swing.JLabel lrecurso88;
            if ((req.getLiftDate() != null) && (req.getLiftTime() != null)) {
                lrecurso88 = new javax.swing.JLabel(req.getLiftDate().toString() + " " + lingua.translate("s")
                        + " " + req.getLiftTime().toString(0));
            } else {
                lrecurso88 = new javax.swing.JLabel(lingua.translate("sem dados para apresentar"));
            }
            lrecurso88.setBounds(140, distancia, 330, 26);
            lrecurso88.setBorder(border);
            pan.add(lrecurso88);
            switch (distancia) {
            case 200:
                distancia = 230;
                break;
            case 230:
                distancia = 260;
                break;
            default:
                distancia = 200;
                break;
            }
        }
        if (req.isTerminated()) {
            javax.swing.JLabel lrecurso9 = new javax.swing.JLabel(lingua.translate("Entrega") + ": ");
            lrecurso9.setBounds(10, distancia, 120, 26);
            lrecurso9.setFocusable(true);
            lrecurso9.setHorizontalAlignment(javax.swing.JLabel.LEFT);
            pan.add(lrecurso9);
            javax.swing.JLabel lrecurso99;
            if ((req.getDeliveryDate() != null) && (req.getDeliveryTime() != null)) {
                lrecurso99 = new javax.swing.JLabel(req.getDeliveryDate().toString() + " "
                        + lingua.translate("s") + " " + req.getDeliveryTime().toString(0));
            } else {
                lrecurso99 = new javax.swing.JLabel(lingua.translate("sem dados para apresentar"));
            }
            lrecurso99.setBounds(140, distancia, 330, 26);
            lrecurso99.setBorder(border);
            pan.add(lrecurso99);
            switch (distancia) {
            case 200:
                distancia = 230;
                break;
            case 230:
                distancia = 260;
                break;
            case 260:
                distancia = 290;
                break;
            default:
                distancia = 200;
                break;
            }
        }
        Components.MessagePane mensagem = new Components.MessagePane(this, Components.MessagePane.INFORMACAO,
                Clavis.KeyQuest.getSystemColor(), lingua.translate(""), 500, 400, pan, "",
                new String[] { lingua.translate("Voltar") });
        mensagem.showMessage();
    };
    eventos[1] = (ActionEvent r) -> {
        String val = jTable1.getModel().getValueAt(jTable1.getSelectedRow(), 2).toString();
        SimpleDateFormat sdf_auxiliar = new SimpleDateFormat("dd/MM/yyyy");
        Date data_auxiliar;
        try {
            data_auxiliar = sdf_auxiliar.parse(val);
            Calendar cal = Calendar.getInstance();
            cal.setTime(data_auxiliar);
            int dia = cal.get(Calendar.DAY_OF_MONTH);
            int mes = cal.get(Calendar.MONTH) + 1;
            int ano = cal.get(Calendar.YEAR);
            inicio = new TimeDate.Date(dia, mes, ano);
            fim = new TimeDate.Date(dia, mes, ano);
        } catch (ParseException ex) {
            data_auxiliar = new Date();
        }
        jXDatePickerFim.setDate(data_auxiliar);
        jXDatePickerInicio.setDate(data_auxiliar);
        refreshTable(jComboBoxEstado.getSelectedIndex());
    };
    eventos[2] = (ActionEvent r) -> {
        String val = jTable1.getModel().getValueAt(jTable1.getSelectedRow(), 3).toString();
        for (int i = 0; i < jComboBoxEstado.getItemCount(); i++) {
            if (jComboBoxEstado.getItemAt(i).equals(val)) {
                jComboBoxEstado.setSelectedIndex(i);
            }
        }
    };
    KeyStroke[] strokes = new KeyStroke[opcoes.length];
    strokes[0] = KeyStroke.getKeyStroke(KeyEvent.VK_R, Event.CTRL_MASK);
    strokes[1] = KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK);
    strokes[2] = KeyStroke.getKeyStroke(KeyEvent.VK_E, Event.CTRL_MASK);
    Components.PopUpMenu pop = new Components.PopUpMenu(opcoes, eventos, strokes);
    pop.create();
    mouseaction = new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            java.awt.Point ponto = new java.awt.Point(e.getX(), e.getY());
            if (jTable1.rowAtPoint(ponto) > -1) {
                jTable1.setRowSelectionInterval(jTable1.rowAtPoint(ponto),
                        jTable1.rowAtPoint(new java.awt.Point(e.getX(), e.getY())));
            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
                if (jTable1.getSelectedRow() >= 0) {
                    java.awt.Point ponto = new java.awt.Point(e.getX(), e.getY());
                    if (jTable1.rowAtPoint(ponto) > -1) {
                        pop.show(e.getComponent(), e.getX(), e.getY());
                    }
                }
            }
        }

    };
    jTable1.addMouseListener(mouseaction);
}

From source file:src.gui.ItSIMPLE.java

/**
* This method initializes newMenuItem/*from   www.j  av a 2  s.  com*/
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getNewUMLMenuItem() {
    if (newUMLMenuItem == null) {
        newUMLMenuItem = new JMenuItem(newProjectAction);
        //newMenuItem.setIcon(new ImageIcon("resources/images/new24.png"));
        newUMLMenuItem.setMnemonic(KeyEvent.VK_N);
        newUMLMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK, true));
    }
    return newUMLMenuItem;
}

From source file:src.gui.ItSIMPLE.java

/**
* This method initializes newMenuItem//from www  . j  a  va  2  s. co m
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getNewPDDLMenuItem() {
    if (newPDDLMenuItem == null) {
        newPDDLMenuItem = new JMenuItem(newPddlProjectAction);
        //newMenuItem.setIcon(new ImageIcon("resources/images/new24.png"));
        newPDDLMenuItem.setMnemonic(KeyEvent.VK_P);
        newPDDLMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.CTRL_MASK, true));
    }
    return newPDDLMenuItem;
}

From source file:src.gui.ItSIMPLE.java

/**
 * This method initializes openMenuItem/*from   w  w  w  .  j a  va  2 s .  com*/
 *
 * @return javax.swing.JMenuItem
 */
private JMenuItem getOpenMenuItem() {
    if (openMenuItem == null) {
        openMenuItem = new JMenuItem(openProjectAction);
        openMenuItem.setMnemonic(KeyEvent.VK_O);
        openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK, true));
    }
    return openMenuItem;
}