本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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();
}
}
示例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;
}
}