Java Code Examples for javax.swing.JTextArea#addMouseListener()
The following examples show how to use
javax.swing.JTextArea#addMouseListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MissingDragExitEventTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 2
Source File: MissingDragExitEventTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 3
Source File: MissingDragExitEventTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 4
Source File: CReilInstructionDialog.java From binnavi with Apache License 2.0 | 6 votes |
/** * Creates a new dialog object. * * @param parent Parent window used for dialogs. * @param title Title of the dialog. * @param text Text to show in the dialog. * * @throws InternalTranslationException Thrown if the instruction could not be converted to REIL * code. */ private CReilInstructionDialog(final Window parent, final String title, final String text) throws InternalTranslationException { super(parent, title); m_textArea = new JTextArea(text); m_textArea.setEditable(false); m_textArea.setFont(GuiHelper.MONOSPACED_FONT); m_textArea.addMouseListener(new PopupListener()); addMenuBar(); setLayout(new BorderLayout()); add(new JScrollPane(m_textArea)); setSize(500, 300); }
Example 5
Source File: MissingDragExitEventTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 6
Source File: MissingDragExitEventTest.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 7
Source File: MissingDragExitEventTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 8
Source File: MissingDragExitEventTest.java From hottub with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 9
Source File: MissingDragExitEventTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 10
Source File: MissingDragExitEventTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 11
Source File: MissingDragExitEventTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 12
Source File: MissingDragExitEventTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 13
Source File: MissingDragExitEventTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 14
Source File: MissingDragExitEventTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static void initAndShowUI() { frame = new JFrame("Test frame"); frame.setSize(SIZE, SIZE); frame.setLocationRelativeTo(null); final JTextArea jta = new JTextArea(); jta.setBackground(Color.RED); frame.add(jta); jta.setText("1234567890"); jta.setFont(jta.getFont().deriveFont(150f)); jta.setDragEnabled(true); jta.selectAll(); jta.setDropTarget(new DropTarget(jta, DnDConstants.ACTION_COPY, new TestdropTargetListener())); jta.addMouseListener(new TestMouseAdapter()); frame.setVisible(true); }
Example 15
Source File: TextHistoryPane.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * constructor * * @param nlines number of lines of text to keep history of * @param removeIncr remove this number of lines at a time * @param popupOK enable popup menu * @param ptSize font point size */ public TextHistoryPane(boolean editable, int nlines, int removeIncr, boolean popupOK, boolean lineWrap, int ptSize) { super(new BorderLayout()); this.nlines = nlines - 1; this.removeIncr = Math.min(nlines - 1, removeIncr - 1); // cant be bigger than nlines ta = new JTextArea(); ta.setLineWrap(lineWrap); ta.setEditable(editable); fontu = FontUtil.getMonoFont(ptSize); ta.setFont(fontu.getFont()); if (popupOK) ta.addMouseListener(new MyPopupMenu()); // JScrollPane sp = new JScrollPane(ta, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, // JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JScrollPane sp = new JScrollPane(ta); // , JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, // JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); add(sp, BorderLayout.CENTER); javax.swing.filechooser.FileFilter[] filters = new javax.swing.filechooser.FileFilter[2]; filters[0] = new FileManager.HDF5ExtFilter(); filters[1] = new FileManager.NetcdfExtFilter(); fileChooser = new FileManager(null, null, null, null); }
Example 16
Source File: ReportDefect.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 5 votes |
/** * set up the listener for the text area editor open the full size editor on * right click * * @param jTextArea - target text area control */ private void setListener(final JTextArea jTextArea) { jTextArea.addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { panelTextArea.setText(jTextArea.getText()); temp = jTextArea; showNext(); panelTextArea.requestFocus(); } } }); jTextArea.setToolTipText("Press Right click to edit in Full Mode"); }
Example 17
Source File: RspTextPanel.java From rest-client with Apache License 2.0 | 5 votes |
/** * * @Title: init * @Description: Component Initialization * @param * @return void * @throws */ private void init(String name) { this.setLayout(new BorderLayout(RESTConst.BORDER_WIDTH, 0)); txtAra = new JTextArea(RESTConst.AREA_ROWS, 1); txtAra.setName(name); txtAra.setEditable(false); txtAra.addMouseListener(ma); miFmt = new JMenuItem(RESTConst.FORMAT); miFmt.setName(RESTConst.FORMAT); miFmt.addActionListener(this); miCpy = new JMenuItem(RESTConst.COPY); miCpy.setName(RESTConst.COPY); miCpy.addActionListener(this); pm = new JPopupMenu(); pm.add(miCpy); pm.addSeparator(); pm.add(miFmt); JPanel pnlCenter = new JPanel(); pnlCenter.setLayout(new BorderLayout()); JScrollPane sp = new JScrollPane(txtAra); pnlCenter.add(sp); this.add(pnlCenter, BorderLayout.CENTER); }