javax.swing.JTextArea.addFocusListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(256)

本文整理了Java中javax.swing.JTextArea.addFocusListener()方法的一些代码示例,展示了JTextArea.addFocusListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.addFocusListener()方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:addFocusListener

JTextArea.addFocusListener介绍

暂无

代码示例

代码示例来源:origin: runelite/runelite

notesEditor.addFocusListener(new FocusListener()

代码示例来源:origin: ron190/jsql-injection

/**
 * Build new instance of JTextArea to decorate.
 */
public JPopupTextArea(JTextArea proxy) {
  super(proxy);
  this.getProxy().addFocusListener(new FocusAdapter() {
    @Override
    public void focusGained(FocusEvent arg0) {
      JPopupTextArea.this.getProxy().getCaret().setVisible(true);
      JPopupTextArea.this.getProxy().getCaret().setSelectionVisible(true);
    }
  });
  this.getProxy().setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
  this.getProxy().setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

public void install(JTextArea textArea) {
  textArea.addCaretListener(this);
  textArea.addComponentListener(this);
  textArea.addFocusListener(this);
  textArea.addKeyListener(this);
  textArea.addMouseListener(this);
  textArea.addMouseMotionListener(this);
}

代码示例来源:origin: ron190/jsql-injection

this.textToTranslate[0].addFocusListener(new FocusAdapter() {
  @Override
  public void focusGained(FocusEvent arg0) {

代码示例来源:origin: stackoverflow.com

JTextArea text = ...;
text.addFocusListener(new FocusListener() {
  public void focusGained(FocusEvent e) {}
  public void focusLost(FocusEvent e) {
    // Load your content.
  }

});

代码示例来源:origin: net.sf.ingenias/editor

public void addFocusListener(FocusListener ke){
 if (contenido!=null)
 this.contenido.addFocusListener(ke);
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

/**
 * Constructs a <code>TableCellEditor</code> that uses a text field.
 */
public TextAreaTableCellEditor() {
  editorComponent = new JTextArea();
  editorComponent.setRows(3);
  this.clickCountToStart = 2;
  delegate = new EditorDelegate() {
    private static final long serialVersionUID = 240L;
    @Override
    public void setValue(Object value) {
      editorComponent.setText((value != null) ? value.toString() : "");
    }
    @Override
    public Object getCellEditorValue() {
      return editorComponent.getText();
    }
  };
  editorComponent.addFocusListener(delegate);
}

代码示例来源:origin: net.sf.taverna.t2.workbench/contextual-views-impl

private JTextArea createTextArea(final Class<?> c, final String value) {
  classToCurrentValueMap.put(c, value);
  JTextArea area = new JTextArea(value);
  area.setFocusable(true);
  area.addFocusListener(new TextAreaFocusListener(area, c));
  area.setColumns(DEFAULT_AREA_WIDTH);
  area.setLineWrap(true);
  area.setWrapStyleWord(true);
  classToAreaMap.put(c, area);
  logger.info("Adding to map " + c.getCanonicalName() + "("
      + c.hashCode() + ") to " + area.hashCode());
  return area;
}

代码示例来源:origin: stackoverflow.com

public void run() {
  JFrame frame = new JFrame();
  final JTextArea text = new JTextArea();
  text.addFocusListener(new FocusListener() {

    public void focusLost(FocusEvent fe) {
      text.setEditable(true);     
    }

    public void focusGained(FocusEvent fe) {
      text.setEditable(false);
    }
  });
  text.setEditable(true);
  String line = "added line";
  text.append(line);
  text.setCaretPosition(text.getCaretPosition() + line.length());

  frame.getContentPane().add(text);
  frame.setSize(300,300);
  frame.setVisible(true);
}

代码示例来源:origin: stackoverflow.com

public JTextArea txtArea() {
  JTextArea area = new JTextArea();
  CustomFocusListener cFL = new CustomFocusListener();
  area.addFocusListener(cFL);
  String st = String.valueOf(tab);
  area.setName(st);

   return area;
}

代码示例来源:origin: org.apache.jmeter/jorphan

/**
 * Initialises all of the components on this panel.
 */
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
  setLayout(new BorderLayout());
  mTextArea.setRows(4);
  mTextArea.setLineWrap(true);
  mTextArea.setWrapStyleWord(true);
  // Register the handler for focus listening. This handler will
  // only notify the registered when the text changes from when
  // the focus is gained to when it is lost.
  mTextArea.addFocusListener(this);
  // Add the sub components
  this.add(mLabel, BorderLayout.NORTH);
  this.add(new JScrollPane(mTextArea), BorderLayout.CENTER);
}

代码示例来源:origin: triplea-game/triplea

textArea.addFocusListener(new FocusAdapter() {
 @Override
 public void focusGained(final FocusEvent e) {

代码示例来源:origin: stackoverflow.com

jt.addFocusListener(this);
jt.setFont(new Font("varinda",Font.PLAIN,15));

代码示例来源:origin: org.orbisgis/toc

/**
 * Builds the components that will be used to edit the inner Description
 */
private void buildDescriptionComponents(){
  TreeSet<ContainerItem<Locale>> locales = retrieveLocales();
  Locale suit = getSuitableLocale();
  locCombo = new WideComboBox(locales.toArray());
  locCombo.setSelectedItem(new ContainerItem<Locale>(suit, suit.getDisplayName()));
  txtTitle = new JTextField("");
  txtAbstract = new JTextArea("");
  txtAbstract.setRows(6);
  txtAbstract.setLineWrap(true);
  txtAbstract.setWrapStyleWord(true);
  abstractComponent = new JScrollPane(txtAbstract);
  setTitleAndAbstractTexts(suit);
  FocusListener titleListener = EventHandler.create(FocusListener.class, this, "onTitleFocusLost", "", "focusLost");
  FocusListener abstractListener = EventHandler.create(FocusListener.class, this, "onAbstractFocusLost", "", "focusLost");
  ActionListener comboListener = EventHandler.create(ActionListener.class, this, "onSelectedItem");
  txtAbstract.addFocusListener(abstractListener);
  txtTitle.addFocusListener(titleListener);
  locCombo.addActionListener(comboListener);
}

代码示例来源:origin: org.apache.uima/uimaj-tools

/**
 * Creates the text area.
 */
private void createTextArea() {
 try {
  this.textArea = new JTextArea();
  this.addCursorOwningComponent(this.textArea);
  Border emptyBorder = BorderFactory.createEmptyBorder(2, 4, 2, 2);
  Border grayLineBordre = BorderFactory.createLineBorder(Color.gray, 1);
  this.textArea.setBorder(BorderFactory.createCompoundBorder(grayLineBordre, emptyBorder));
  this.textArea.setSelectionColor(selectionColor);
  this.textArea.setEditable(true);
  this.textArea.setLineWrap(true);
  this.textArea.setWrapStyleWord(true);
  this.textArea.setText(defaultText);
  this.textArea.addMouseListener(new PopupListener(this));
  // textArea.setFocusable(true);
  this.textArea.addFocusListener(new TextFocusHandler(this));
  this.textArea.getDocument().addDocumentListener(new TextChangedListener(this));
  this.textArea.addCaretListener(new CaretChangeHandler(this));
  this.undoMgr = new UndoMgr(this);
  this.textArea.getDocument().addUndoableEditListener(this.undoMgr);
 } catch (Exception e) {
  handleException(e);
 }
}

代码示例来源:origin: com.fifesoft/rsyntaxtextarea

public void install(JTextArea textArea) {
  textArea.addCaretListener(this);
  textArea.addComponentListener(this);
  textArea.addFocusListener(this);
  textArea.addKeyListener(this);
  textArea.addMouseListener(this);
  textArea.addMouseMotionListener(this);
}

代码示例来源:origin: AliView/AliView

txtCommand.addFocusListener(new FocusListener() {		
  public void focusLost(FocusEvent e){
    JTextArea txt = (JTextArea) e.getSource();

代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea

public void install(JTextArea textArea) {
  textArea.addCaretListener(this);
  textArea.addComponentListener(this);
  textArea.addFocusListener(this);
  textArea.addKeyListener(this);
  textArea.addMouseListener(this);
  textArea.addMouseMotionListener(this);
}

代码示例来源:origin: AliView/AliView

txtCommand.addFocusListener(new FocusListener() {		
  public void focusLost(FocusEvent e){
    JTextArea txt = (JTextArea) e.getSource();

代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit

documentHandler = new DocumentHandler();
contentTextArea.addFocusListener(new FocusHandler());

相关文章

JTextArea类方法