⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e968. retrieving text from a jtextcomponent.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
This example works for all types of text components. 
    // Create the text component
    JTextComponent tc = new JTextArea("Initial Text");
    
    // Get length
    int docLength = tc.getDocument().getLength();
    
    // Get all text
    String text = tc.getText();
    
    try {
        // Get the first 3 characters
        int offset = 0;
        int len = 3;
        text = tc.getText(offset, len);
    
        // Get the last 3 characters
        offset = docLength-3;
        len = 3;
        text = tc.getText(offset, len);
    } catch (BadLocationException e) {
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -