jtextarea

JScrollPane don't appear on JTextArea

喜夏-厌秋 提交于 2020-11-29 19:03:06
问题 I have next problem, JScrollPane don't appear on JTextArea and I don't know why? I tried in many ways but nothing, it don't want to show me! I put below a part of the code. All appears correctly, JFame, JTextArea, text inside JTextArea, all without JScrollPane. Please, can somebody help me? package pachet; import java.awt.BorderLayout; import java.awt.Container; import java.util.ArrayList; import javax.swing.GroupLayout; import static javax.swing.GroupLayout.Alignment.BASELINE; import javax

JTextArea - selection behavior on double / triple click + moving mouse

送分小仙女□ 提交于 2020-02-22 05:36:30
问题 The problem: when you double click on word in JTextArea it is marked, but when you don't release the mouse button and try to mark next word, it is not marking whole word, but single characters instead. It should mark the whole words (not single characters) when moving mouse (on double click). That's literally the default behavior in all programs which I tried, like: Notepad, Firefox, Chrome, Word, even Netbeans, etc. Same thing with triple click (when holding and moving the mouse should mark

Displaying an item from a collection using Jradio button

那年仲夏 提交于 2020-02-08 02:49:15
问题 I been learning about java for some time now and even bought several books to help me along. i am now in at the point in my journey that i want to learn about collections. i am able to use array lists in a very basic ways but i would like to understand how they work when use in conjunction with J radio buttons and other swing components. I been working, watching YouTube videos and reading books such as "Introduction to Java Programming- Comprehensive, 10E" and "Java in a Nutshell - (6th E) O

JFrame add scrollbar

杀马特。学长 韩版系。学妹 提交于 2020-01-24 11:59:05
问题 I've tried a few tutorials and had a look at other answers but it still doesn't seem to help me, I want to add a scrollbar to this console-like JTextArea, and keep the property whereby each new line of text will push the rest up. This is what it looks like currently: And the code: Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int width = 600; int height = 400; JFrame frame = new JFrame("ChanDown"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel

Line spacing in iText list item or JTextArea

风格不统一 提交于 2020-01-24 11:00:13
问题 I need to syncronise line spacing of my PDF ListItem and JTextArea in my GUI. I can do it by adjusting one or another. And it all works great unil a ListItem (or JTextArea) is more than one line long (line wrap is set to true in JTextArea). I can adjust the height between the two ListItems. That distance will also be applied to the height between two rows of a single multiline ListItem. However, in my GUI, due to compononet boreders and default line spacing in JTextArea, those two are not the

How to set Background image to a JTextArea in a JPanel

雨燕双飞 提交于 2020-01-23 01:58:30
问题 I want to set a custom background image on a JTextArea . I had looked in google but without a result, the background could be a logo, also I want to know how to set the background's resolution. I Have only one class in a package. I have a MySQL connector driver as Referenced Library, my workbench is Eclipse, exporting jar with the Fat-jar plugin Code: public class panel extends JPanel implements ActionListener { protected JTextField textField, textField2; protected static JTextArea textArea;

trouble passing input from one JTextArea into another JTextArea

流过昼夜 提交于 2020-01-17 09:28:09
问题 My issue lies in my DocumentLister AreaListener. I can't seem to figure out how to pass in the text the user enters into one of the JTextAreas for my conversions and return it to the other JTextArea. The goal of the program is to take in a user entered Roman or Arabic Number in one of the fields, convert it and return the value of the conversion to the other field in real time. My GUI and conversion methods work, I just can't seem to wrap my head around obtaining that string from the user and

Java Swing TextArea: How to simultaneously print Transliterated text/s in an Output TextArea?

♀尐吖头ヾ 提交于 2020-01-16 10:32:27
问题 I am trying to write a text editor. I want two TextAreas: 1st one for typing/editing in unicode script and 2nd one for simultaneously printing output of the unicode script input in corresponding Roman Script (ASCII) set by myself on the basis of a transliteration scheme. I am not able to update and simultaneously print the input text in output textarea while I call the transliteration method. I can sense a little bit that there is something wrong while I set the output textArea to print

Opening, Editing and Saving text in JTextArea to .txt file

感情迁移 提交于 2020-01-15 12:15:27
问题 I am messing around with java swing and am trying to open a text file containing existing data with a JTextArea. It doesn't seem to be saving any changes regardless of the different things I have tried. Below is code that reads the text file fine, but doesn't write it (obviously). If someone could please advise me as to how I could successfully save changes to the JTextArea I would be greatful. package funwithswing; import java.awt.*; import javax.swing.*; import java.io.*; import java.util

automatic dynamic expansion / contraction of JTextArea in Java

£可爱£侵袭症+ 提交于 2020-01-15 08:56:07
问题 I start off by creating a JTextArea of a specific size. The user can add text within it but it will get cut off if it becomes too long (vertically or horizontally). I want the JTextArea to automatically expand or contract (for deletion of text). I may allow users to change font and font size in the future, so it would be good if I could avoid making things increase/decrease by a certain size. I am currently using bounds to size my JTextArea. Perhaps I should size by rows and columns and use a