2010-10-26 14 views
8

में ऑटो एंड लाइन मेरे पास एक लंबी स्ट्रिंग वाला jTextArea है।
आइए usume:JTextArea

String str = "this is a toooo long string"; 

अब मैं एक स्विंग jTextArea में इस स्ट्रिंग दिखाना चाहते हैं। लेकिन मेरे टेक्स्ट एरिया फ्रेम पर सीमित आकार है। तो, मैं पूरी स्ट्रिंग को देखने में सक्षम नहीं हूं।
उदाहरण के लिए, पाठ क्षेत्र केवल पता चलता है:

यह शुरू '\ n' ऑटो छिपा वर्णों से बचें पाठ क्षेत्र के लिए संभव है "यह एक टी है"? नोट: मुझे ऑटो स्क्रोल नहीं चाहिए।

धन्यवाद

उत्तर

20
JTextArea textArea = new JTextArea(
    "This is an editable JTextArea. " + 
    "A text area is a \"plain\" text component, " + 
    "which means that although it can display text " + 
    "in any font, all of the text is in the same font." 
); 
textArea.setFont(new Font("Serif", Font.ITALIC, 16)); 
textArea.setLineWrap(true); 
textArea.setWrapStyleWord(true); 

से लिया: http://download.oracle.com/javase/tutorial/uiswing/components/textarea.html

संबंधित मुद्दे