當前位置: 首頁>>代碼示例>>Java>>正文


Java JTextArea.selectAll方法代碼示例

本文整理匯總了Java中javax.swing.JTextArea.selectAll方法的典型用法代碼示例。如果您正苦於以下問題:Java JTextArea.selectAll方法的具體用法?Java JTextArea.selectAll怎麽用?Java JTextArea.selectAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JTextArea的用法示例。


在下文中一共展示了JTextArea.selectAll方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initAndShowUI

import javax.swing.JTextArea; //導入方法依賴的package包/類
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);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:18,代碼來源:MissingDragExitEventTest.java

示例2: createAndShowGUI

import javax.swing.JTextArea; //導入方法依賴的package包/類
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);
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:DNDTextToScaledArea.java

示例3: getGraphCellEditorComponent

import javax.swing.JTextArea; //導入方法依賴的package包/類
/**
 * Initialises the editor component with the edit string of the user
 * object of <tt>value</tt> (which is required to be a {@link JCell}).
 */
@Override
public Component getGraphCellEditorComponent(org.jgraph.JGraph graph, Object value,
        boolean isSelected) {
    AspectJCell jCell = (AspectJCell) value;
    // fill the set of labels for autocompletion
    this.labels.clear();
    this.labels.addAll(prefixes);
    AspectJModel jmodel = (AspectJModel) graph.getModel();
    TypeGraph type = jmodel.getResourceModel().getGrammar().getTypeGraph();
    for (TypeLabel label : type.getLabels()) {
        this.labels.add(label.text());
    }
    JTextArea result = getEditorComponent();
    // scale with the jGraph
    Font font = Options.getLabelFont().deriveFont(jCell.getVisuals().getFont());
    font = (font != null) ? font : graph.getFont();
    if (graph.getScale() != 1) {
        double scale = graph.getScale();
        Dimension size = result.getSize();
        size.height *= scale;
        size.width *= scale;
        result.setSize(size);
        font = font.deriveFont((float) (font.getSize() * scale));
    }
    result.setFont(font);
    String editString = ((AspectJCell) value).getUserObject().toEditString();
    result.setText(editString);
    result.selectAll();
    return result;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:35,代碼來源:MultiLinedEditor.java

示例4: keyReleased

import javax.swing.JTextArea; //導入方法依賴的package包/類
public void keyReleased( KeyEvent evt ) {
		//make sure Digitizer is at the top of the Layer Manager so that segments can be displayed
		moveDigitizerLayerToTop();
		if( evt.getSource()==map && evt.getKeyCode() == KeyEvent.VK_ENTER ) {
			// Not sure if we want the Select Colors dialog anymore.
			// Comment out for now, maybe bring back later.  NSS 06/12/17
//			int[] indices = list.getSelectedIndices();
//			if(objects.size()==0 || indices.length == 0) return;
//			DigitizerObject[] obj = new DigitizerObject[indices.length];
//			for( int i=0 ; i<obj.length ; i++) obj[i] = (DigitizerObject)objects.get(indices[i]);
//			options.showDialog( obj );
//			map.repaint();
		} else if( evt.getSource()==table && evt.isControlDown() ) {
			if( evt.getKeyCode() == KeyEvent.VK_C ) {
				LineSegmentsObject obj = (LineSegmentsObject) table.getModel();
				String dataType = obj.grid.getDataType();
				String units = obj.grid.getUnits();
				StringBuffer sb = new StringBuffer();
				sb.append("Longitude\tLatitude\t"+ dataType + " (" + units + ")\n");
				int[] rows = table.getSelectedRows();
				for( int k=0 ; k<rows.length ; k++ ) {
					sb.append( table.getValueAt(rows[k],0) +"\t");
					sb.append( table.getValueAt(rows[k],1) +"\t");
					sb.append( table.getValueAt(rows[k],2) +"\n");
				}
				JTextArea text = new JTextArea(sb.toString());
				text.selectAll();
				text.cut();
/*
			} else if( evt.getKeyCode() == evt.VK_A ) {
				table.selectAll();
*/
			}
		}
		if(evt.isControlDown() && evt.getKeyCode() == KeyEvent.VK_S ) {
				save();
		}
	
	}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:40,代碼來源:Digitizer.java

示例5: editPerformed

import javax.swing.JTextArea; //導入方法依賴的package包/類
/**
* 
* @Title: editPerformed 
* @Description: Edit Menu Item Performed 
* @param @param item 
* @return void 
* @throws
 */
private void editPerformed(JMenuItem item)
{
    JTextArea ta = FormatView.getView().getTxtPanel().getTxtAra();

    if (FormatConst.FORMAT.equals(item.getName()))
    {
        String body = FormatUtil.format(ta.getText());
        ta.setText(body);
        ta.select(0, 0);
        return;
    }

    if (FormatConst.CUT.equals(item.getName()))
    {
        ta.selectAll();
        ta.cut();
        return;
    }

    if (FormatConst.COPY.equals(item.getName()))
    {
        ta.selectAll();
        ta.copy();
        ta.select(0, 0);
        return;
    }

    if (FormatConst.PASTE.equals(item.getName()))
    {
        ta.paste();
        ta.select(0, 0);
        return;
    }

    if (FormatConst.CLEAR.equals(item.getName()))
    {
        ta.setText(StringUtils.EMPTY);
        return;
    }

}
 
開發者ID:wisdomtool,項目名稱:formatter,代碼行數:50,代碼來源:MenuBarView.java


注:本文中的javax.swing.JTextArea.selectAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。