Java Code Examples for javax.swing.JTextArea#selectAll()
The following examples show how to use
javax.swing.JTextArea#selectAll() .
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 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 3
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 4
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 5
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 6
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 7
Source File: DNDTextToScaledArea.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void createAndShowGUI() { frame = new JFrame(); frame.setSize(300, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(new BorderLayout()); srcTextArea = new JTextArea(TEXT); srcTextArea.setDragEnabled(true); srcTextArea.selectAll(); dstTextArea = new JTextArea(); panel.add(dstTextArea, BorderLayout.CENTER); panel.add(srcTextArea, BorderLayout.SOUTH); frame.getContentPane().add(panel); frame.setVisible(true); }
Example 8
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 9
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 10
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 11
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 12
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 13
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 14
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 15
Source File: ShowGeometryWktAction.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
private void exportToWkt() { SimpleFeatureFigure selectedFeatureFigure = getSimpleFeatureFigure(); if (selectedFeatureFigure == null) { Dialogs.showInformation(DLG_TITLE, "Please select a geometry.", null); return; } SimpleFeature simpleFeature = selectedFeatureFigure.getSimpleFeature(); CoordinateReferenceSystem sourceCrs = simpleFeature.getDefaultGeometryProperty().getDescriptor().getCoordinateReferenceSystem(); CoordinateReferenceSystem targetCrs = DefaultGeographicCRS.WGS84; Geometry sourceGeom = selectedFeatureFigure.getGeometry(); Geometry targetGeom; try { targetGeom = transformGeometry(sourceGeom, sourceCrs, targetCrs); } catch (Exception e) { Dialogs.showWarning(DLG_TITLE, "Failed to transform geometry to " + targetCrs.getName() + ".\n" + "Using " + sourceCrs.getName() + " instead.", null); targetGeom = sourceGeom; targetCrs = sourceCrs; } WKTWriter wktWriter = new WKTWriter(); wktWriter.setFormatted(true); wktWriter.setMaxCoordinatesPerLine(2); wktWriter.setTab(3); String wkt = wktWriter.writeFormatted(targetGeom); JTextArea textArea = new JTextArea(16, 32); textArea.setEditable(false); textArea.setText(wkt); textArea.selectAll(); JPanel contentPanel = new JPanel(new BorderLayout(4, 4)); contentPanel.add(new JLabel("Geometry Well-Known-Text (WKT):"), BorderLayout.NORTH); contentPanel.add(new JScrollPane(textArea), BorderLayout.CENTER); contentPanel.add(new JLabel("Geometry CRS: " + targetCrs.getName().toString()), BorderLayout.SOUTH); ModalDialog modalDialog = new ModalDialog(SnapApp.getDefault().getMainFrame(), DLG_TITLE, ModalDialog.ID_OK, null); modalDialog.setContent(contentPanel); modalDialog.center(); modalDialog.show(); }
Example 16
Source File: BandMathsDialog.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
private void makeUI() { JButton loadExpressionButton = new JButton("Load..."); loadExpressionButton.setName("loadExpressionButton"); loadExpressionButton.addActionListener(createLoadExpressionButtonListener()); JButton saveExpressionButton = new JButton("Save..."); saveExpressionButton.setName("saveExpressionButton"); saveExpressionButton.addActionListener(createSaveExpressionButtonListener()); JButton editExpressionButton = new JButton("Edit Expression..."); editExpressionButton.setName("editExpressionButton"); editExpressionButton.addActionListener(createEditExpressionButtonListener()); final JPanel panel = GridBagUtils.createPanel(); int line = 0; GridBagConstraints gbc = new GridBagConstraints(); JComponent[] components = createComponents(PROPERTY_NAME_PRODUCT, SingleSelectionEditor.class); gbc.gridy = ++line; GridBagUtils.addToPanel(panel, components[1], gbc, "gridwidth=3, fill=BOTH, weightx=1"); gbc.gridy = ++line; GridBagUtils.addToPanel(panel, components[0], gbc, "insets.top=3, gridwidth=3, fill=BOTH, anchor=WEST"); gbc.gridy = ++line; components = createComponents(PROPERTY_NAME_BAND_NAME, TextFieldEditor.class); GridBagUtils.addToPanel(panel, components[1], gbc, "weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST"); GridBagUtils.addToPanel(panel, components[0], gbc, "weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST"); gbc.gridy = ++line; components = createComponents(PROPERTY_NAME_BAND_DESC, TextFieldEditor.class); GridBagUtils.addToPanel(panel, components[1], gbc, "weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST"); GridBagUtils.addToPanel(panel, components[0], gbc, "weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST"); gbc.gridy = ++line; components = createComponents(PROPERTY_NAME_BAND_UNIT, TextFieldEditor.class); GridBagUtils.addToPanel(panel, components[1], gbc, "weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST"); GridBagUtils.addToPanel(panel, components[0], gbc, "weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST"); gbc.gridy = ++line; components = createComponents(PROPERTY_NAME_BAND_WAVELENGTH, TextFieldEditor.class); GridBagUtils.addToPanel(panel, components[1], gbc, "weightx=0, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=WEST"); GridBagUtils.addToPanel(panel, components[0], gbc, "weightx=1, insets.top=3, gridwidth=2, fill=HORIZONTAL, anchor=WEST"); gbc.gridy = ++line; components = createComponents(PROPERTY_NAME_SAVE_EXPRESSION_ONLY, CheckBoxEditor.class); GridBagUtils.addToPanel(panel, components[0], gbc, "insets.top=3, gridwidth=3, fill=HORIZONTAL, anchor=EAST"); gbc.gridy = ++line; JPanel nodataPanel = new JPanel(new BorderLayout()); components = createComponents(PROPERTY_NAME_NO_DATA_VALUE_USED, CheckBoxEditor.class); nodataPanel.add(components[0], BorderLayout.WEST); components = createComponents(PROPERTY_NAME_NO_DATA_VALUE, NumericEditor.class); nodataPanel.add(components[0]); GridBagUtils.addToPanel(panel, nodataPanel, gbc, "weightx=1, insets.top=3, gridwidth=3, fill=HORIZONTAL, anchor=WEST"); gbc.gridy = ++line; components = createComponents(PROPERTY_NAME_GENERATE_UNCERTAINTY_BAND, CheckBoxEditor.class); GridBagUtils.addToPanel(panel, components[0], gbc, "insets.top=3, gridwidth=3, fill=HORIZONTAL, anchor=EAST"); gbc.gridy = ++line; JLabel expressionLabel = new JLabel(Bundle.CTL_BandMathsDialog_LblExpression()); JTextArea expressionArea = new JTextArea(); expressionArea.setRows(3); TextComponentAdapter textComponentAdapter = new TextComponentAdapter(expressionArea); bindingContext.bind(PROPERTY_NAME_EXPRESSION, textComponentAdapter); GridBagUtils.addToPanel(panel, expressionLabel, gbc, "insets.top=3, gridwidth=3, anchor=WEST"); gbc.gridy = ++line; GridBagUtils.addToPanel(panel, expressionArea, gbc, "weighty=1, insets.top=3, gridwidth=3, fill=BOTH, anchor=WEST"); gbc.gridy = ++line; final JPanel loadSavePanel = new JPanel(); loadSavePanel.add(loadExpressionButton); loadSavePanel.add(saveExpressionButton); GridBagUtils.addToPanel(panel, loadSavePanel, gbc, "weighty=0, insets.top=3, gridwidth=2, fill=NONE, anchor=WEST"); GridBagUtils.addToPanel(panel, editExpressionButton, gbc, "weighty=1, insets.top=3, gridwidth=1, fill=HORIZONTAL, anchor=EAST"); gbc.gridy = ++line; GridBagUtils.addToPanel(panel, new JLabel(""), gbc, "insets.top=10, weightx=1, weighty=1, gridwidth=3, fill=BOTH, anchor=WEST"); setContent(panel); expressionArea.selectAll(); expressionArea.requestFocus(); }