62,567
社区成员




else if ((str.length() - 34) % 34 == 0) {
area.append("\r\n");
}
else if ((str.length() - 34) % 36 == 0) {
area.append("\r\n");
}
public class Test extends JFrame {
public static void main(String[] args) {
Test t = new Test();
t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
t.setSize(400, 400);
final JTextArea area = new JTextArea();
t.add(area);
area.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
String str = area.getText();
if (str.length() == 34) {
area.append("\r\n");
} else if ((str.length() - 34) % 36 == 0) {
area.append("\r\n");
}
}
});
t.setVisible(true);
}
}