Example usage for java.awt.event InputEvent CTRL_MASK

List of usage examples for java.awt.event InputEvent CTRL_MASK

Introduction

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

Prototype

int CTRL_MASK

To view the source code for java.awt.event InputEvent CTRL_MASK.

Click Source Link

Document

The Control key modifier constant.

Usage

From source file:edu.harvard.mcz.imagecapture.BulkMediaFrame.java

private void init() {
    thisFrame = this;
    setTitle("BulkMedia Preparation");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 902, 174);/*w w w . j a  va2s .  c om*/

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu mnFile = new JMenu("File");
    mnFile.setMnemonic(KeyEvent.VK_F);
    menuBar.add(mnFile);

    JMenuItem mntmPrepareDirectory = new JMenuItem("Prepare Directory");
    mntmPrepareDirectory.setMnemonic(KeyEvent.VK_D);
    mntmPrepareDirectory.addActionListener(new PrepareDirectoryAction());
    mnFile.add(mntmPrepareDirectory);

    JMenuItem mntmNewMenuItem = new JMenuItem("Exit");
    mntmNewMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            done();
        }
    });

    JMenuItem mntmNewMenuItem_1 = new JMenuItem("Edit Properties");
    mntmNewMenuItem_1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            PropertiesEditor p = new PropertiesEditor();
            p.pack();
            p.setVisible(true);
        }
    });
    mnFile.add(mntmNewMenuItem_1);
    mntmNewMenuItem.setMnemonic(KeyEvent.VK_X);
    mntmNewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK));
    mnFile.add(mntmNewMenuItem);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new BorderLayout(0, 0));

    JPanel panel = new JPanel();
    contentPane.add(panel, BorderLayout.CENTER);
    panel.setLayout(new GridLayout(3, 2, 0, 0));

    JLabel lblBaseUri = new JLabel("Base URI (first part of path to images on the web)");
    lblBaseUri.setHorizontalAlignment(SwingConstants.TRAILING);
    panel.add(lblBaseUri, "2, 2");

    textField = new JTextField();
    textField.setEditable(false);
    textField.setText(Singleton.getSingletonInstance().getProperties().getProperties()
            .getProperty(ImageCaptureProperties.KEY_IMAGEBASEURI));
    panel.add(textField);
    textField.setColumns(10);

    JLabel lblNewLabel = new JLabel("Local Path To Base (local mount path that maps to base URI)");
    lblNewLabel.setHorizontalAlignment(SwingConstants.TRAILING);
    panel.add(lblNewLabel);

    textField_1 = new JTextField();
    textField_1.setEditable(false);
    textField_1.setText(Singleton.getSingletonInstance().getProperties().getProperties()
            .getProperty(ImageCaptureProperties.KEY_IMAGEBASE));
    panel.add(textField_1);
    textField_1.setColumns(10);

    JLabel lblBeforeExitingWait = new JLabel(
            "Before exiting wait for both the Done and Thumbnails Built messages.");
    panel.add(lblBeforeExitingWait);

    JLabel lblThumbnailGenerationIs = new JLabel("Thumbnail generation is not reported on the progress bar.");
    panel.add(lblThumbnailGenerationIs);

    progressBar = new JProgressBar();
    progressBar.setStringPainted(false);
    contentPane.add(progressBar, BorderLayout.NORTH);

    JPanel panel_1 = new JPanel();
    contentPane.add(panel_1, BorderLayout.SOUTH);

    JButton btnPrepareDirectory = new JButton("Run");
    btnPrepareDirectory.setToolTipText("Select a directory and prepare a bulk media file for images therein.");
    panel_1.add(btnPrepareDirectory);
    btnPrepareDirectory.addActionListener(new PrepareDirectoryAction());
    btnPrepareDirectory.setPreferredSize(new Dimension(80, 25));

    JButton btnExit = new JButton("Exit");
    btnExit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            done();
        }
    });
    panel_1.add(btnExit);
}

From source file:com.mirth.connect.client.ui.components.MirthTreeTable.java

public MirthTreeTable(String prefix, Set<String> defaultVisibleColumns) {
    customHiddenColumnMap = new HashMap<String, Set<String>>();

    this.prefix = prefix;
    this.defaultVisibleColumns = defaultVisibleColumns;

    columnOrderMap = new HashMap<String, Integer>();
    sortOrderColumn = -1;/*from  ww  w . j  a  va  2 s. c o m*/
    sortOrder = null;

    if (StringUtils.isNotEmpty(prefix)) {
        try {
            userPreferences = Preferences.userNodeForPackage(Mirth.class);
            String columns = userPreferences.get(prefix + "ColumnOrderMap", "");

            if (StringUtils.isNotEmpty(columns)) {
                columnOrderMap = (Map<String, Integer>) ObjectXMLSerializer.getInstance().deserialize(columns,
                        Map.class);
            }
        } catch (Exception e) {
        }

        try {
            String order = userPreferences.get(prefix + "SortOrder", "");

            if (StringUtils.isNotEmpty(order)) {
                sortOrder = ObjectXMLSerializer.getInstance().deserialize(order, SortOrder.class);
                sortOrderColumn = userPreferences.getInt(prefix + "SortOrderColumn", -1);
            }
        } catch (Exception e) {
        }
    }

    addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
            boolean isAccelerated = (((e.getModifiers()
                    & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) > 0)
                    || ((e.getModifiers() & InputEvent.CTRL_MASK) > 0));
            if ((e.getKeyCode() == KeyEvent.VK_S) && isAccelerated) {
                PlatformUI.MIRTH_FRAME.doContextSensitiveSave();
            }
        }

        public void keyReleased(KeyEvent e) {
        }

        public void keyTyped(KeyEvent e) {
        }
    });

    /*
     * Swingx 1.0 has this set to true by default, which doesn't allow dragging and dropping
     * into tables. Swingx 0.8 had this set to false. Tables that want it set to true can
     * override it.
     */
    putClientProperty("terminateEditOnFocusLost", Boolean.FALSE);

    JTableHeader header = getTableHeader();
    header.addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent e) {
            saveColumnOrder();
        }
    });
    header.setDefaultRenderer(new SortableHeaderCellRenderer(header.getDefaultRenderer()));

    final JButton columnControlButton = new JButton(new ColumnControlButton(this).getIcon());

    columnControlButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JPopupMenu columnMenu = getColumnMenu();
            Dimension buttonSize = columnControlButton.getSize();
            int xPos = columnControlButton.getComponentOrientation().isLeftToRight()
                    ? buttonSize.width - columnMenu.getPreferredSize().width
                    : 0;
            columnMenu.show(columnControlButton, xPos, columnControlButton.getHeight());
        }

    });

    setColumnControl(columnControlButton);
}

From source file:edu.ku.brc.ui.tmanfe.SearchReplacePanel.java

/**
 * sets up the keystroke mappings for "Ctrl-F" firing the find/replace panel
 * Escape making it disappear, and enter key firing a search
 *//*from w  ww . j  av a 2s. co  m*/
private void setupKeyStrokeMappings() {
    //table.getActionMap().clear();

    //override the "Ctrl-F" function for launching the find dialog shipped with JXTable
    table.getInputMap().put(
            KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()),
            UIRegistry.getResourceString(FIND));
    table.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK),
            UIRegistry.getResourceString(FIND));

    //create action that will display the find/replace dialog
    launchFindAction = new LaunchFindAction();
    table.getActionMap().put(FIND, launchFindAction);

    //Allow ESC buttun to call DisablePanelAction   
    String CANCEL_KEY = "CANCELKEY"; // i18n
    //Allow ENTER button to SearchAction
    String ENTER_KEY = "ENTERKEY"; // i18n
    String REPLACE_KEY = "REPLACEKEY"; // i18n

    KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false);
    KeyStroke escapeKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);

    InputMap textFieldInputMap = findField.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    textFieldInputMap.put(enterKey, ENTER_KEY);
    textFieldInputMap.put(escapeKey, CANCEL_KEY);

    ActionMap textFieldActionMap = findField.getActionMap();
    textFieldActionMap.put(ENTER_KEY, searchAction);
    textFieldActionMap.put(CANCEL_KEY, hideFindPanelAction);

    if (!table.isReadOnly()) {
        InputMap replaceFieldInputMap = replaceField.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
        replaceFieldInputMap.put(enterKey, REPLACE_KEY);
        replaceFieldInputMap.put(escapeKey, CANCEL_KEY);

        ActionMap replaceFieldActionMap = replaceField.getActionMap();
        replaceFieldActionMap.put(REPLACE_KEY, replaceAction);
        replaceFieldActionMap.put(CANCEL_KEY, hideFindPanelAction);
    }
}

From source file:com.mirth.connect.client.ui.components.rsta.RSTAPreferences.java

private void setDefaultKeyStrokeMap() {
    keyStrokeMap = new HashMap<String, KeyStroke>();

    boolean isOSX = RTextArea.isOSX();
    int defaultModifier = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
    int ctrl = InputEvent.CTRL_MASK;
    int alt = InputEvent.ALT_MASK;
    int shift = InputEvent.SHIFT_MASK;
    int defaultShift = defaultModifier | shift;
    int moveByWordMod = isOSX ? alt : defaultModifier;
    int moveByWordModShift = moveByWordMod | shift;

    putKeyStroke(ActionInfo.UNDO, KeyEvent.VK_Z, defaultModifier);

    if (isOSX) {//  w  ww  .jav a 2s .  c o m
        putKeyStroke(ActionInfo.REDO, KeyEvent.VK_Z, defaultShift);
    } else {
        putKeyStroke(ActionInfo.REDO, KeyEvent.VK_Y, defaultModifier);
    }

    putKeyStroke(ActionInfo.CUT, KeyEvent.VK_X, defaultModifier);
    putKeyStroke(ActionInfo.COPY, KeyEvent.VK_C, defaultModifier);
    putKeyStroke(ActionInfo.PASTE, KeyEvent.VK_V, defaultModifier);
    putKeyStroke(ActionInfo.DELETE, KeyEvent.VK_DELETE, 0);
    putKeyStroke(ActionInfo.DELETE_REST_OF_LINE, KeyEvent.VK_DELETE, defaultModifier);
    putKeyStroke(ActionInfo.DELETE_LINE, KeyEvent.VK_D, defaultModifier);
    putKeyStroke(ActionInfo.JOIN_LINE, KeyEvent.VK_J, defaultModifier);
    putKeyStroke(ActionInfo.SELECT_ALL, KeyEvent.VK_A, defaultModifier);
    putKeyStroke(ActionInfo.FIND_REPLACE, KeyEvent.VK_F, defaultModifier);
    putKeyStroke(ActionInfo.FIND_NEXT, KeyEvent.VK_G, defaultModifier);
    putKeyStroke(ActionInfo.CLEAR_MARKED_OCCURRENCES, KeyEvent.VK_ESCAPE, 0);
    putKeyStroke(ActionInfo.FOLD_COLLAPSE, KeyEvent.VK_SUBTRACT, defaultModifier);
    putKeyStroke(ActionInfo.FOLD_EXPAND, KeyEvent.VK_ADD, defaultModifier);
    putKeyStroke(ActionInfo.FOLD_COLLAPSE_ALL, KeyEvent.VK_DIVIDE, defaultModifier);
    putKeyStroke(ActionInfo.FOLD_COLLAPSE_ALL_COMMENTS, KeyEvent.VK_DIVIDE, defaultShift);
    putKeyStroke(ActionInfo.FOLD_EXPAND_ALL, KeyEvent.VK_MULTIPLY, defaultModifier);
    putKeyStroke(ActionInfo.GO_TO_MATCHING_BRACKET, KeyEvent.VK_OPEN_BRACKET, defaultModifier);
    putKeyStroke(ActionInfo.TOGGLE_COMMENT, KeyEvent.VK_SLASH, defaultModifier);
    putKeyStroke(ActionInfo.AUTO_COMPLETE, KeyEvent.VK_SPACE, ctrl);

    if (isOSX) {
        putKeyStroke(ActionInfo.DOCUMENT_START, KeyEvent.VK_HOME, 0);
        putKeyStroke(ActionInfo.DOCUMENT_END, KeyEvent.VK_END, 0);
        putKeyStroke(ActionInfo.DOCUMENT_SELECT_START, KeyEvent.VK_HOME, shift);
        putKeyStroke(ActionInfo.DOCUMENT_SELECT_END, KeyEvent.VK_END, shift);
        putKeyStroke(ActionInfo.LINE_START, KeyEvent.VK_LEFT, defaultModifier);
        putKeyStroke(ActionInfo.LINE_END, KeyEvent.VK_RIGHT, defaultModifier);
        putKeyStroke(ActionInfo.LINE_SELECT_START, KeyEvent.VK_LEFT, defaultShift);
        putKeyStroke(ActionInfo.LINE_SELECT_END, KeyEvent.VK_RIGHT, defaultShift);
    } else {
        putKeyStroke(ActionInfo.DOCUMENT_START, KeyEvent.VK_HOME, defaultModifier);
        putKeyStroke(ActionInfo.DOCUMENT_END, KeyEvent.VK_END, defaultModifier);
        putKeyStroke(ActionInfo.DOCUMENT_SELECT_START, KeyEvent.VK_HOME, defaultShift);
        putKeyStroke(ActionInfo.DOCUMENT_SELECT_END, KeyEvent.VK_END, defaultShift);
        putKeyStroke(ActionInfo.LINE_START, KeyEvent.VK_HOME, 0);
        putKeyStroke(ActionInfo.LINE_END, KeyEvent.VK_END, 0);
        putKeyStroke(ActionInfo.LINE_SELECT_START, KeyEvent.VK_HOME, shift);
        putKeyStroke(ActionInfo.LINE_SELECT_END, KeyEvent.VK_END, shift);
    }

    putKeyStroke(ActionInfo.MOVE_LEFT, KeyEvent.VK_LEFT, 0);
    putKeyStroke(ActionInfo.MOVE_LEFT_SELECT, KeyEvent.VK_LEFT, shift);
    putKeyStroke(ActionInfo.MOVE_LEFT_WORD, KeyEvent.VK_LEFT, moveByWordMod);
    putKeyStroke(ActionInfo.MOVE_LEFT_WORD_SELECT, KeyEvent.VK_LEFT, moveByWordModShift);
    putKeyStroke(ActionInfo.MOVE_RIGHT, KeyEvent.VK_RIGHT, 0);
    putKeyStroke(ActionInfo.MOVE_RIGHT_SELECT, KeyEvent.VK_RIGHT, shift);
    putKeyStroke(ActionInfo.MOVE_RIGHT_WORD, KeyEvent.VK_RIGHT, moveByWordMod);
    putKeyStroke(ActionInfo.MOVE_RIGHT_WORD_SELECT, KeyEvent.VK_RIGHT, moveByWordModShift);
    putKeyStroke(ActionInfo.MOVE_UP, KeyEvent.VK_UP, 0);
    putKeyStroke(ActionInfo.MOVE_UP_SELECT, KeyEvent.VK_UP, shift);
    putKeyStroke(ActionInfo.MOVE_UP_SCROLL, KeyEvent.VK_UP, defaultModifier);
    putKeyStroke(ActionInfo.MOVE_UP_LINE, KeyEvent.VK_UP, alt);
    putKeyStroke(ActionInfo.MOVE_DOWN, KeyEvent.VK_DOWN, 0);
    putKeyStroke(ActionInfo.MOVE_DOWN_SELECT, KeyEvent.VK_DOWN, shift);
    putKeyStroke(ActionInfo.MOVE_DOWN_SCROLL, KeyEvent.VK_DOWN, defaultModifier);
    putKeyStroke(ActionInfo.MOVE_DOWN_LINE, KeyEvent.VK_DOWN, alt);
    putKeyStroke(ActionInfo.PAGE_UP, KeyEvent.VK_PAGE_UP, 0);
    putKeyStroke(ActionInfo.PAGE_UP_SELECT, KeyEvent.VK_PAGE_UP, shift);
    putKeyStroke(ActionInfo.PAGE_LEFT_SELECT, KeyEvent.VK_PAGE_UP, defaultShift);
    putKeyStroke(ActionInfo.PAGE_DOWN, KeyEvent.VK_PAGE_DOWN, 0);
    putKeyStroke(ActionInfo.PAGE_DOWN_SELECT, KeyEvent.VK_PAGE_DOWN, shift);
    putKeyStroke(ActionInfo.PAGE_RIGHT_SELECT, KeyEvent.VK_PAGE_DOWN, defaultShift);
    putKeyStroke(ActionInfo.INSERT_LF_BREAK, KeyEvent.VK_ENTER, 0);
    putKeyStroke(ActionInfo.INSERT_CR_BREAK, KeyEvent.VK_ENTER, shift);
    putKeyStroke(ActionInfo.MACRO_BEGIN, KeyEvent.VK_B, defaultShift);
    putKeyStroke(ActionInfo.MACRO_END, KeyEvent.VK_N, defaultShift);
    putKeyStroke(ActionInfo.MACRO_PLAYBACK, KeyEvent.VK_M, defaultShift);
}

From source file:net.sf.firemox.DeckBuilder.java

/**
 * Creates new form DeckBuilder//from  w w w  . j a  v a2s.  c  o  m
 */
private DeckBuilder() {
    super("DeckBuilder");
    form = this;
    timerPanel = new TimerGlassPane();
    cardLoader = new CardLoader(timerPanel);
    timer = new Timer(200, cardLoader);
    setGlassPane(timerPanel);
    try {
        setIconImage(Picture.loadImage(IdConst.IMAGES_DIR + "deckbuilder.gif"));
    } catch (Exception e) {
        // IGNORING
    }

    // Load settings
    loadSettings();

    // Initialize components
    final JMenuItem newItem = UIHelper.buildMenu("menu_db_new", 'n', this);
    newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK));

    final JMenuItem loadItem = UIHelper.buildMenu("menu_db_load", 'o', this);
    loadItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK));

    final JMenuItem saveAsItem = UIHelper.buildMenu("menu_db_saveas", 'a', this);
    saveAsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0));

    final JMenuItem saveItem = UIHelper.buildMenu("menu_db_save", 's', this);
    saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));

    final JMenuItem quitItem = UIHelper.buildMenu("menu_db_exit", this);
    quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK));

    final JMenuItem deckConstraintsItem = UIHelper.buildMenu("menu_db_constraints", 'c', this);
    deckConstraintsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));

    final JMenuItem aboutItem = UIHelper.buildMenu("menu_help_about", 'a', this);
    aboutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, InputEvent.SHIFT_MASK));

    final JMenuItem convertDCK = UIHelper.buildMenu("menu_convert_DCK_MP", this);

    final JMenu mainMenu = UIHelper.buildMenu("menu_file");
    mainMenu.add(newItem);
    mainMenu.add(loadItem);
    mainMenu.add(saveAsItem);
    mainMenu.add(saveItem);
    mainMenu.add(new JSeparator());
    mainMenu.add(quitItem);

    super.optionMenu = new JMenu("Options");

    final JMenu convertMenu = UIHelper.buildMenu("menu_convert");
    convertMenu.add(convertDCK);

    final JMenuItem helpItem = UIHelper.buildMenu("menu_help_help", 'h', this);
    helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));

    final JMenu helpMenu = new JMenu("?");
    helpMenu.add(helpItem);
    helpMenu.add(deckConstraintsItem);
    helpMenu.add(aboutItem);

    final JMenuBar menuBar = new JMenuBar();
    menuBar.add(mainMenu);
    initAbstractMenu();
    menuBar.add(optionMenu);
    menuBar.add(convertMenu);
    menuBar.add(helpMenu);
    setJMenuBar(menuBar);
    addWindowListener(this);

    // Build the panel containing amount of available cards
    final JLabel amountLeft = new JLabel("<html>0/?", SwingConstants.RIGHT);

    // Build the left list
    allListModel = new MListModel<MCardCompare>(amountLeft, false);
    leftList = new ThreadSafeJList(allListModel);
    leftList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    leftList.setLayoutOrientation(JList.VERTICAL);
    leftList.getSelectionModel().addListSelectionListener(this);
    leftList.addMouseListener(this);
    leftList.setVisibleRowCount(10);

    // Initialize the text field containing the amount to add
    addQtyTxt = new JTextField("1");

    // Build the "Add" button
    addButton = new JButton(LanguageManager.getString("db_add"));
    addButton.setMnemonic('a');
    addButton.setEnabled(false);

    // Build the panel containing : "Add" amount and "Add" button
    final Box addPanel = Box.createHorizontalBox();
    addPanel.add(addButton);
    addPanel.add(addQtyTxt);
    addPanel.setMaximumSize(new Dimension(32010, 26));

    // Build the panel containing the selected card name
    cardNameTxt = new JTextField();
    new HireListener(cardNameTxt, addButton, this, leftList);

    final JLabel searchLabel = new JLabel(LanguageManager.getString("db_search") + " : ");
    searchLabel.setLabelFor(cardNameTxt);

    // Build the panel containing search label and card name text field
    final Box searchPanel = Box.createHorizontalBox();
    searchPanel.add(searchLabel);
    searchPanel.add(cardNameTxt);
    searchPanel.setMaximumSize(new Dimension(32010, 26));

    listScrollerLeft = new JScrollPane(leftList);
    MToolKit.addOverlay(listScrollerLeft);

    // Build the left panel containing : list, available amount, "Add" panel
    final JPanel srcPanel = new JPanel(null);
    srcPanel.add(searchPanel);
    srcPanel.add(listScrollerLeft);
    srcPanel.add(amountLeft);
    srcPanel.add(addPanel);
    srcPanel.setMinimumSize(new Dimension(220, 200));
    srcPanel.setLayout(new BoxLayout(srcPanel, BoxLayout.Y_AXIS));

    // Initialize constraints
    constraintsChecker = new ConstraintsChecker();
    constraintsChecker.setBorder(new EtchedBorder());
    final JScrollPane constraintsCheckerScroll = new JScrollPane(constraintsChecker);
    MToolKit.addOverlay(constraintsCheckerScroll);

    // create a pane with the oracle text for the present card
    oracleText = new JLabel();
    oracleText.setPreferredSize(new Dimension(180, 200));
    oracleText.setVerticalAlignment(SwingConstants.TOP);

    final JScrollPane oracle = new JScrollPane(oracleText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    MToolKit.addOverlay(oracle);

    // build some Pie Charts and a panel to display it
    initSets();
    datasets = new ChartSets();
    final JTabbedPane tabbedPane = new JTabbedPane();
    for (ChartFilter filter : ChartFilter.values()) {
        final Dataset dataSet = filter.createDataSet(this);
        final JFreeChart chart = new JFreeChart(null, null,
                filter.createPlot(dataSet, painterMapper.get(filter)), false);
        datasets.addDataSet(filter, dataSet);
        ChartPanel pieChartPanel = new ChartPanel(chart, true);
        tabbedPane.add(pieChartPanel, filter.getTitle());
    }
    // add the Constraints scroll panel and Oracle text Pane to the tabbedPane
    tabbedPane.add(constraintsCheckerScroll, LanguageManager.getString("db_constraints"));
    tabbedPane.add(oracle, LanguageManager.getString("db_text"));
    tabbedPane.setSelectedComponent(oracle);

    // The toollBar for color filtering
    toolBar = new JToolBar();
    toolBar.setFloatable(false);
    final JButton clearButton = UIHelper.buildButton("clear");
    clearButton.addActionListener(this);
    toolBar.add(clearButton);
    final JToggleButton toggleColorlessButton = new JToggleButton(
            UIHelper.getTbsIcon("mana/colorless/small/" + MdbLoader.unknownSmlMana), true);
    toggleColorlessButton.setActionCommand("0");
    toggleColorlessButton.addActionListener(this);
    toolBar.add(toggleColorlessButton);
    for (int index = 1; index < IdCardColors.CARD_COLOR_NAMES.length; index++) {
        final JToggleButton toggleButton = new JToggleButton(
                UIHelper.getTbsIcon("mana/colored/small/" + MdbLoader.coloredSmlManas[index]), true);
        toggleButton.setActionCommand(String.valueOf(index));
        toggleButton.addActionListener(this);
        toolBar.add(toggleButton);
    }

    // sorted card type combobox creation
    final List<String> idCards = new ArrayList<String>(Arrays.asList(CardFactory.exportedIdCardNames));
    Collections.sort(idCards);
    final Object[] cardTypes = ArrayUtils.addAll(new String[] { LanguageManager.getString("db_types.any") },
            idCards.toArray());
    idCardComboBox = new JComboBox(cardTypes);
    idCardComboBox.setSelectedIndex(0);
    idCardComboBox.addActionListener(this);
    idCardComboBox.setActionCommand("cardTypeFilter");

    // sorted card properties combobox creation
    final List<String> properties = new ArrayList<String>(
            CardFactory.getPropertiesName(DeckConstraints.getMinProperty(), DeckConstraints.getMaxProperty()));
    Collections.sort(properties);
    final Object[] cardProperties = ArrayUtils
            .addAll(new String[] { LanguageManager.getString("db_properties.any") }, properties.toArray());
    propertiesComboBox = new JComboBox(cardProperties);
    propertiesComboBox.setSelectedIndex(0);
    propertiesComboBox.addActionListener(this);
    propertiesComboBox.setActionCommand("propertyFilter");

    final JLabel colors = new JLabel(" " + LanguageManager.getString("colors") + " : ");
    final JLabel types = new JLabel(" " + LanguageManager.getString("types") + " : ");
    final JLabel property = new JLabel(" " + LanguageManager.getString("properties") + " : ");

    // filter Panel with colors toolBar and card type combobox
    final Box filterPanel = Box.createHorizontalBox();
    filterPanel.add(colors);
    filterPanel.add(toolBar);
    filterPanel.add(types);
    filterPanel.add(idCardComboBox);
    filterPanel.add(property);
    filterPanel.add(propertiesComboBox);

    getContentPane().add(filterPanel, BorderLayout.NORTH);

    // Destination section :

    // Build the panel containing amount of available cards
    final JLabel rightAmount = new JLabel("0/?", SwingConstants.RIGHT);
    rightAmount.setMaximumSize(new Dimension(220, 26));

    // Build the right list
    rightListModel = new MCardTableModel(new MListModel<MCardCompare>(rightAmount, true));
    rightListModel.addTableModelListener(this);
    rightList = new JTable(rightListModel);
    rightList.setShowGrid(false);
    rightList.setTableHeader(null);
    rightList.getSelectionModel().addListSelectionListener(this);
    rightList.getColumnModel().getColumn(0).setMaxWidth(25);
    rightList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);

    // Build the panel containing the selected deck
    deckNameTxt = new JTextField("loading...");
    deckNameTxt.setEditable(false);
    deckNameTxt.setBorder(null);
    final JLabel deckLabel = new JLabel(LanguageManager.getString("db_deck") + " : ");
    deckLabel.setLabelFor(deckNameTxt);
    final Box deckNamePanel = Box.createHorizontalBox();
    deckNamePanel.add(deckLabel);
    deckNamePanel.add(deckNameTxt);
    deckNamePanel.setMaximumSize(new Dimension(220, 26));

    // Initialize the text field containing the amount to remove
    removeQtyTxt = new JTextField("1");

    // Build the "Remove" button
    removeButton = new JButton(LanguageManager.getString("db_remove"));
    removeButton.setMnemonic('r');
    removeButton.addMouseListener(this);
    removeButton.setEnabled(false);

    // Build the panel containing : "Remove" amount and "Remove" button
    final Box removePanel = Box.createHorizontalBox();
    removePanel.add(removeButton);
    removePanel.add(removeQtyTxt);
    removePanel.setMaximumSize(new Dimension(220, 26));

    // Build the right panel containing : list, available amount, constraints
    final JScrollPane deskListScroller = new JScrollPane(rightList);
    MToolKit.addOverlay(deskListScroller);
    deskListScroller.setBorder(BorderFactory.createLineBorder(Color.GRAY));
    deskListScroller.setMinimumSize(new Dimension(220, 200));
    deskListScroller.setMaximumSize(new Dimension(220, 32000));

    final Box destPanel = Box.createVerticalBox();
    destPanel.add(deckNamePanel);
    destPanel.add(deskListScroller);
    destPanel.add(rightAmount);
    destPanel.add(removePanel);
    destPanel.setMinimumSize(new Dimension(220, 200));
    destPanel.setMaximumSize(new Dimension(220, 32000));

    // Build the panel containing the name of card in picture
    cardPictureNameTxt = new JLabel("<html><i>no selected card</i>");
    final Box cardPictureNamePanel = Box.createHorizontalBox();
    cardPictureNamePanel.add(cardPictureNameTxt);
    cardPictureNamePanel.setMaximumSize(new Dimension(32010, 26));

    // Group the detail panels
    final JPanel viewCard = new JPanel(null);
    viewCard.add(cardPictureNamePanel);
    viewCard.add(CardView.getInstance());
    viewCard.add(tabbedPane);
    viewCard.setLayout(new BoxLayout(viewCard, BoxLayout.Y_AXIS));

    final Box mainPanel = Box.createHorizontalBox();
    mainPanel.add(destPanel);
    mainPanel.add(viewCard);

    // Add the main panel
    getContentPane().add(srcPanel, BorderLayout.WEST);
    getContentPane().add(mainPanel, BorderLayout.CENTER);

    // Size this frame
    getRootPane().setPreferredSize(new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT));
    getRootPane().setMinimumSize(getRootPane().getPreferredSize());
    pack();
}

From source file:com.mirth.connect.client.ui.Mirth.java

public static void initUIManager() {
    try {/*from w  w  w  . j a  va2s . c om*/
        PlasticLookAndFeel.setPlasticTheme(new MirthTheme());
        PlasticXPLookAndFeel look = new PlasticXPLookAndFeel();
        UIManager.setLookAndFeel(look);
        UIManager.put("win.xpstyle.name", "metallic");
        LookAndFeelAddons.setAddon(WindowsLookAndFeelAddons.class);

        /*
         * MIRTH-1225 and MIRTH-2019: Create alternate key bindings if CTRL is not the same as
         * the menu shortcut key (i.e. COMMAND on OSX)
         */
        if (InputEvent.CTRL_MASK != Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) {
            createAlternateKeyBindings();
        }

        if (SystemUtils.IS_OS_MAC) {
            OSXAdapter.setAboutHandler(Mirth.class, Mirth.class.getDeclaredMethod("aboutMac", (Class[]) null));
            OSXAdapter.setQuitHandler(Mirth.class, Mirth.class.getDeclaredMethod("quitMac", (Class[]) null));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    // keep the tooltips from disappearing
    ToolTipManager.sharedInstance().setDismissDelay(3600000);

    // TabbedPane defaults
    // UIManager.put("TabbedPane.selected", new Color(0xffffff));
    // UIManager.put("TabbedPane.background",new Color(225,225,225));
    // UIManager.put("TabbedPane.tabAreaBackground",new Color(225,225,225));
    UIManager.put("TabbedPane.highlight", new Color(225, 225, 225));
    UIManager.put("TabbedPane.selectHighlight", new Color(0xc3c3c3));
    UIManager.put("TabbedPane.contentBorderInsets", new InsetsUIResource(0, 0, 0, 0));

    // TaskPane defaults
    UIManager.put("TaskPane.titleBackgroundGradientStart", new Color(0xffffff));
    UIManager.put("TaskPane.titleBackgroundGradientEnd", new Color(0xffffff));

    // Set fonts
    UIManager.put("TextPane.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ToggleButton.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("Panel.font", UIConstants.DIALOG_FONT);
    UIManager.put("PopupMenu.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("OptionPane.font", UIConstants.DIALOG_FONT);
    UIManager.put("Label.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("Tree.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ScrollPane.font", UIConstants.DIALOG_FONT);
    UIManager.put("TextField.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("Viewport.font", UIConstants.DIALOG_FONT);
    UIManager.put("MenuBar.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("FormattedTextField.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("DesktopIcon.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("TableHeader.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ToolTip.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("PasswordField.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("TaskPane.font", UIConstants.TEXTFIELD_BOLD_FONT);
    UIManager.put("Table.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("TabbedPane.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ProgressBar.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("CheckBoxMenuItem.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ColorChooser.font", UIConstants.DIALOG_FONT);
    UIManager.put("Button.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("TextArea.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("Spinner.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("RadioButton.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("TitledBorder.font", UIConstants.TEXTFIELD_BOLD_FONT);
    UIManager.put("EditorPane.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("RadioButtonMenuItem.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ToolBar.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("MenuItem.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("CheckBox.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("JXTitledPanel.title.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("Menu.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("ComboBox.font", UIConstants.TEXTFIELD_PLAIN_FONT);
    UIManager.put("JXLoginPanel.banner.font", UIConstants.BANNER_FONT);
    UIManager.put("List.font", UIConstants.TEXTFIELD_PLAIN_FONT);

    InputMap im = (InputMap) UIManager.get("Button.focusInputMap");
    im.put(KeyStroke.getKeyStroke("pressed ENTER"), "pressed");
    im.put(KeyStroke.getKeyStroke("released ENTER"), "released");

    try {
        UIManager.put("wizard.sidebar.image",
                ImageIO.read(com.mirth.connect.client.ui.Frame.class.getResource("images/wizardsidebar.png")));
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:edu.purdue.cc.bionet.ui.GraphVisualizer.java

/**
 * Performs the necessary actions to set up the Graph.
 *///from www .j a v a2 s  .  c o m
protected void setup() {
    this.graph = (UndirectedSparseGraph<V, E>) this.getGraphLayout().getGraph();
    this.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<V>());
    //      this.getRenderContext( ).setEdgeLabelTransformer( new ToStringLabeller<E>( ));
    this.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);
    PluggableGraphMouse mouse = new PluggableGraphMouse() {
        public void mouseWheelMoved(MouseWheelEvent e) {
            scale((float) Math.pow(1.25, -e.getWheelRotation()), e.getPoint());
        }
    };
    mouse.add(new PickingGraphMousePlugin());
    mouse.add(new PickingGraphMousePlugin(-1, InputEvent.BUTTON1_MASK | InputEvent.CTRL_MASK));
    this.setGraphMouse(mouse);
    this.getPickedVertexState().addItemListener(this);
    this.getPickedEdgeState().addItemListener(this);
    this.addMouseListener(this);
    this.addComponentListener(new LayoutScaler());

    // set up coloring
    Transformer v = new Transformer<V, Paint>() {
        public Paint transform(V v) {
            if (getPickedVertexState().isPicked(v)) {
                return pickedVertexPaint;
            } else {
                if (commonNeighborIndicator && isCommonNeighbor(v)) {
                    return commonNeighborPaint;
                } else {
                    return vertexPaint;
                }
            }
        }
    };
    Transformer vo = new Transformer<V, Paint>() {
        public Paint transform(V v) {
            if (getPickedVertexState().isPicked(v)) {
                return pickedVertexOutline;
            } else {
                if (commonNeighborIndicator && isCommonNeighbor(v)) {
                    return commonNeighborOutline;
                } else {
                    return vertexOutline;
                }
            }
        }
    };

    this.getRenderContext().setVertexFillPaintTransformer(v);
    this.getRenderContext().setVertexDrawPaintTransformer(vo);

    Transformer e = new Transformer<E, Paint>() {
        public Paint transform(E e) {
            if (getPickedEdgeState().isPicked(e)) {
                return pickedEdgePaint;
            } else {
                return edgePaint;
            }
        }
    };
    this.getRenderContext().setEdgeDrawPaintTransformer(e);
    this.setPickedLabelColor(this.pickedLabelColor);
    this.commonNeighbors = new NeighborCollection<V, E>(this);
}

From source file:com.projity.pm.graphic.views.GanttView.java

public void init(ReferenceNodeModelCache cache, NodeModel model, CoordinatesConverter coord) {
    this.coord = coord;
    this.cache = NodeModelCacheFactory.getInstance().createFilteredCache((ReferenceNodeModelCache) cache,
            getViewName(), null);//from w  w w  . ja  va2s . c om

    fieldContext = new FieldContext();
    fieldContext.setLeftAssociation(true);
    /*cellStyle=new CellStyle(){
       CellFormat cellProperties=new CellFormat();
       public CellFormat getCellProperties(GraphicNode node){
    cellProperties.setBold(node.isSummary());
    cellProperties.setItalic(node.isAssignment());
    //cellProperties.setBackground((node.isAssignment())?"NORMAL_LIGHT_YELLOW":"NORMAL_YELLOW");
    cellProperties.setCompositeIcon(node.isComposite());
    return cellProperties;
       }
            
    };*/
    super.init();
    updateHeight(project);
    updateSize();

    //sync the height of spreadsheet and gantt
    leftScrollPane.getViewport().addChangeListener(new ChangeListener() {
        private Dimension olddl = null;

        public void stateChanged(ChangeEvent e) {
            Dimension dl = leftScrollPane.getViewport().getViewSize();
            if (dl.equals(olddl))
                return;
            olddl = dl;
            //            Dimension dr=rightScrollPane.getViewport().getViewSize();
            //            ((Gantt)rightScrollPane.getViewport().getView()).setPreferredSize(new Dimension((int)dr.getWidth(),(int)dl.getHeight()));
            //            rightScrollPane.getViewport().revalidate();
            ((Gantt) rightScrollPane.getViewport().getView()).setPreferredSize(
                    new Dimension(rightScrollPane.getViewport().getViewSize().width, dl.height));
        }
    });

    //TODO automatic scrolling to add as an option
    //      spreadSheet.getRowHeader().getSelectionModel().addListSelectionListener(new ListSelectionListener(){
    //         public void valueChanged(ListSelectionEvent e) {
    //            if (!e.getValueIsAdjusting()&&spreadSheet.getRowHeader().getSelectedRowCount()==1){
    //               List impls=spreadSheet.getSelectedNodesImpl();
    //               if (impls.size()!=1) return;
    //               Object impl=impls.get(0);
    //               if (!(impl instanceof HasStartAndEnd)) return;
    //               HasStartAndEnd interval=(HasStartAndEnd)impl;
    //               gantt.scrollToTask(interval, true);
    //            }
    //         }
    //      });

    MouseWheelListener scrollManager = new MouseWheelListener() {
        public void mouseWheelMoved(MouseWheelEvent e) {
            if (0 != (e.getModifiers() & InputEvent.ALT_MASK)) {
                Component c = e.getComponent();
                while ((c != null) && !(c instanceof JViewport))
                    c = c.getParent();
                JViewport vp = (JViewport) c;
                Point p = vp.getViewPosition();
                int newX = p.x + e.getUnitsToScroll() * getWidth() / 20;
                if (newX > 0) {
                    p.x = newX;
                } else {
                    p.x = 0;
                }
                vp.setViewPosition(p);
            } else if (0 != (e.getModifiers() & InputEvent.CTRL_MASK)) {
                zoom(-e.getUnitsToScroll() / 3);
            } else {
                //Vertical scroll allways on gantt chart
                JViewport vp = (JViewport) gantt.getParent();
                Point p = vp.getViewPosition();

                int newY = p.y + e.getUnitsToScroll() * gantt.getRowHeight();
                if (newY > 0) {
                    p.y = newY;
                } else {
                    p.y = 0;
                }
                vp.setViewPosition(p);
            }
        }
    };

    leftScrollPane.getViewport().addMouseWheelListener(scrollManager);

    gantt.addMouseWheelListener(scrollManager);

    cache.update();

    //Call this last to be sure everything is initialized
    //gantt.insertCacheData(); //useless?

}

From source file:com.mirth.connect.client.ui.components.rsta.MirthRSyntaxTextArea.java

public MirthRSyntaxTextArea(ContextType contextType, String styleKey, boolean autoCompleteEnabled) {
    super(new MirthRSyntaxDocument(styleKey));
    this.contextType = contextType;

    setBackground(UIConstants.BACKGROUND_COLOR);
    setSyntaxEditingStyle(styleKey);//from  www . j a va 2 s.c om
    setCodeFoldingEnabled(true);
    setAntiAliasingEnabled(true);
    setWrapStyleWord(true);
    setAutoIndentEnabled(true);

    // Add a document listener so that the save button is enabled whenever changes are made.
    getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void changedUpdate(DocumentEvent e) {
            onChange();
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            onChange();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            onChange();
        }

        private void onChange() {
            if (saveEnabled) {
                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
            }
        }
    });

    addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (saveEnabled) {
                boolean isAccelerated = (((e.getModifiers()
                        & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) > 0)
                        || ((e.getModifiers() & InputEvent.CTRL_MASK) > 0));
                if ((e.getKeyCode() == KeyEvent.VK_S) && isAccelerated) {
                    PlatformUI.MIRTH_FRAME.doContextSensitiveSave();
                }
            }
        }
    });

    undoMenuItem = new CustomMenuItem(this, new UndoAction(), ActionInfo.UNDO);
    redoMenuItem = new CustomMenuItem(this, new RedoAction(), ActionInfo.REDO);
    cutMenuItem = new CustomMenuItem(this, new CutAction(this), ActionInfo.CUT);
    copyMenuItem = new CustomMenuItem(this, new CopyAction(this), ActionInfo.COPY);
    pasteMenuItem = new CustomMenuItem(this, new PasteAction(), ActionInfo.PASTE);
    deleteMenuItem = new CustomMenuItem(this, new DeleteAction(), ActionInfo.DELETE);
    selectAllMenuItem = new CustomMenuItem(this, new SelectAllAction(), ActionInfo.SELECT_ALL);
    findReplaceMenuItem = new CustomMenuItem(this, new FindReplaceAction(this), ActionInfo.FIND_REPLACE);
    findNextMenuItem = new CustomMenuItem(this, new FindNextAction(this), ActionInfo.FIND_NEXT);
    clearMarkedOccurrencesMenuItem = new CustomMenuItem(this, new ClearMarkedOccurrencesAction(this),
            ActionInfo.CLEAR_MARKED_OCCURRENCES);
    foldingMenu = new JMenu("Folding");
    collapseFoldMenuItem = new CustomMenuItem(this, new CollapseFoldAction(), ActionInfo.FOLD_COLLAPSE);
    expandFoldMenuItem = new CustomMenuItem(this, new ExpandFoldAction(), ActionInfo.FOLD_EXPAND);
    collapseAllFoldsMenuItem = new CustomMenuItem(this, new CollapseAllFoldsAction(),
            ActionInfo.FOLD_COLLAPSE_ALL);
    collapseAllCommentFoldsMenuItem = new CustomMenuItem(this, new CollapseAllCommentFoldsAction(),
            ActionInfo.FOLD_COLLAPSE_ALL_COMMENTS);
    expandAllFoldsMenuItem = new CustomMenuItem(this, new ExpandAllFoldsAction(), ActionInfo.FOLD_EXPAND_ALL);
    displayMenu = new JMenu("Display");
    showTabLinesMenuItem = new CustomJCheckBoxMenuItem(this, new ShowTabLinesAction(this),
            ActionInfo.DISPLAY_SHOW_TAB_LINES);
    showWhitespaceMenuItem = new CustomJCheckBoxMenuItem(this, new ShowWhitespaceAction(this),
            ActionInfo.DISPLAY_SHOW_WHITESPACE);
    showLineEndingsMenuItem = new CustomJCheckBoxMenuItem(this, new ShowLineEndingsAction(this),
            ActionInfo.DISPLAY_SHOW_LINE_ENDINGS);
    wrapLinesMenuItem = new CustomJCheckBoxMenuItem(this, new WrapLinesAction(this),
            ActionInfo.DISPLAY_WRAP_LINES);
    macroMenu = new JMenu("Macro");
    beginMacroMenuItem = new CustomMenuItem(this, new BeginMacroAction(), ActionInfo.MACRO_BEGIN);
    endMacroMenuItem = new CustomMenuItem(this, new EndMacroAction(), ActionInfo.MACRO_END);
    playbackMacroMenuItem = new CustomMenuItem(this, new PlaybackMacroAction(), ActionInfo.MACRO_PLAYBACK);
    viewUserAPIMenuItem = new CustomMenuItem(this, new ViewUserAPIAction(this), ActionInfo.VIEW_USER_API);

    // Add actions that wont be in the popup menu
    getActionMap().put(ActionInfo.DELETE_REST_OF_LINE.getActionMapKey(), new DeleteRestOfLineAction());
    getActionMap().put(ActionInfo.DELETE_LINE.getActionMapKey(), new DeleteLineAction());
    getActionMap().put(ActionInfo.JOIN_LINE.getActionMapKey(), new JoinLineAction());
    getActionMap().put(ActionInfo.GO_TO_MATCHING_BRACKET.getActionMapKey(), new GoToMatchingBracketAction());
    getActionMap().put(ActionInfo.TOGGLE_COMMENT.getActionMapKey(), new ToggleCommentAction());
    getActionMap().put(ActionInfo.DOCUMENT_START.getActionMapKey(), new DocumentStartAction(false));
    getActionMap().put(ActionInfo.DOCUMENT_SELECT_START.getActionMapKey(), new DocumentStartAction(true));
    getActionMap().put(ActionInfo.DOCUMENT_END.getActionMapKey(), new DocumentEndAction(false));
    getActionMap().put(ActionInfo.DOCUMENT_SELECT_END.getActionMapKey(), new DocumentEndAction(true));
    getActionMap().put(ActionInfo.LINE_START.getActionMapKey(), new LineStartAction(false));
    getActionMap().put(ActionInfo.LINE_SELECT_START.getActionMapKey(), new LineStartAction(true));
    getActionMap().put(ActionInfo.LINE_END.getActionMapKey(), new LineEndAction(false));
    getActionMap().put(ActionInfo.LINE_SELECT_END.getActionMapKey(), new LineEndAction(true));
    getActionMap().put(ActionInfo.MOVE_LEFT.getActionMapKey(), new MoveLeftAction(false));
    getActionMap().put(ActionInfo.MOVE_LEFT_SELECT.getActionMapKey(), new MoveLeftAction(true));
    getActionMap().put(ActionInfo.MOVE_LEFT_WORD.getActionMapKey(), new MoveLeftWordAction(false));
    getActionMap().put(ActionInfo.MOVE_LEFT_WORD_SELECT.getActionMapKey(), new MoveLeftWordAction(true));
    getActionMap().put(ActionInfo.MOVE_RIGHT.getActionMapKey(), new MoveRightAction(false));
    getActionMap().put(ActionInfo.MOVE_RIGHT_SELECT.getActionMapKey(), new MoveRightAction(true));
    getActionMap().put(ActionInfo.MOVE_RIGHT_WORD.getActionMapKey(), new MoveRightWordAction(false));
    getActionMap().put(ActionInfo.MOVE_RIGHT_WORD_SELECT.getActionMapKey(), new MoveRightWordAction(true));
    getActionMap().put(ActionInfo.MOVE_UP.getActionMapKey(), new MoveUpAction(false));
    getActionMap().put(ActionInfo.MOVE_UP_SELECT.getActionMapKey(), new MoveUpAction(true));
    getActionMap().put(ActionInfo.MOVE_UP_SCROLL.getActionMapKey(), new ScrollAction(true));
    getActionMap().put(ActionInfo.MOVE_UP_LINE.getActionMapKey(), new MoveLineAction(true));
    getActionMap().put(ActionInfo.MOVE_DOWN.getActionMapKey(), new MoveDownAction(false));
    getActionMap().put(ActionInfo.MOVE_DOWN_SELECT.getActionMapKey(), new MoveDownAction(true));
    getActionMap().put(ActionInfo.MOVE_DOWN_SCROLL.getActionMapKey(), new ScrollAction(false));
    getActionMap().put(ActionInfo.MOVE_DOWN_LINE.getActionMapKey(), new MoveLineAction(false));
    getActionMap().put(ActionInfo.PAGE_UP.getActionMapKey(), new PageUpAction(false));
    getActionMap().put(ActionInfo.PAGE_UP_SELECT.getActionMapKey(), new PageUpAction(true));
    getActionMap().put(ActionInfo.PAGE_LEFT_SELECT.getActionMapKey(), new HorizontalPageAction(this, true));
    getActionMap().put(ActionInfo.PAGE_DOWN.getActionMapKey(), new PageDownAction(false));
    getActionMap().put(ActionInfo.PAGE_DOWN_SELECT.getActionMapKey(), new PageDownAction(true));
    getActionMap().put(ActionInfo.PAGE_RIGHT_SELECT.getActionMapKey(), new HorizontalPageAction(this, false));
    getActionMap().put(ActionInfo.INSERT_LF_BREAK.getActionMapKey(), new InsertBreakAction("\n"));
    getActionMap().put(ActionInfo.INSERT_CR_BREAK.getActionMapKey(), new InsertBreakAction("\r"));

    List<Action> actionList = new ArrayList<Action>();
    for (Object key : getActionMap().allKeys()) {
        actionList.add(getActionMap().get(key));
    }
    actions = actionList.toArray(new Action[actionList.size()]);

    if (autoCompleteEnabled) {
        LanguageSupportFactory.get().register(this);
        // Remove the default auto-completion trigger since we handle that ourselves
        getInputMap().remove(AutoCompletion.getDefaultTriggerKey());
    }
}