hyperlink in java - java

Is there any method to create clickable hyperlink in JTextArea in Java?

One way you can do it if you absolutely want to use the jTextArea is to get the User MouseClick(x,y) location and then handle from there.
However, the easier way out would be to use a JEditorPane. Maybe this link will help:
http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JEditorPane.html
Cheers!

Related

Format an editable textarea

At the moment I try to find a method to create a TextArea that I can edit and simply (without cheating) apply syntax highlighting to. Is that possible without the need of a custom Component? I already managed to format a text using a JEditorPane, but I am not sure how to implement that the text is dynamicly highlighted... And that efficiently. Is that possibly without an enormous amount of coding?
You can't use a JTextArea since it does not support text attributes.
Instead you can use a JTextPane. Read the section from the Swing tutorial on Text Component Features for more information and examples.

Alternative for JComboBox without drop down list

Java, Swing, JCombobox.
I need a single-line textbox with 2 arrows (up and down) instead of drop down list.
I'm sure that's pretty easy but i've not been succeeded to find solution.
Thanks in advance.
For your requirement, Java Swing already has a component called JSpinner.
have look at JSpinner with SpinnerListModel
Try using a
JList. Just set the height of the list so that only one element is visible at a time. For further infomation please refer to this...
http://zetcode.com/tutorials/javaswingtutorial/basicswingcomponentsII/

Code/text folding in SWING

I'm looking for a way to provide 'text folding' capabilities to a swing JTextArea or JTextPane
More specifically, I want to add a block of data in a text component and I want the component to display only some header line. Then the user can unfold the block by clicking some icon. This is just like the code folding feature in most IDE.
I've found ->some sample code<- after some thorough search, but the mechanisms used here are quite obscure to me and it stops working when I try to remove text from the document.
Maybe using XML as input could be a lead ?
This one how to add collapsible area
http://java-sl.com/collapse_area.html
This one how to represent XML
http://java-sl.com/xml_editor_kit.html
I would start by looking at the NetBeans API: http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-editor-fold/overview-summary.html
If you were to do it yourself, you'd need to provide a Document implementation that makes the JTextComponent think that pieces are being added or removed, then attach click events that tell the document to update itself. A lot of work.
Visually, it may also be better to use JEditorPane, but that's probably more work.

Adding Focus on SuggestBox?

Hi I want to focus on the SuggestBox as page loads.
I could not find any EventListener for this purpose so I am guessing that I have to
define my own handler to do that (maybe do something with native textbox.focus?)
What is the GWT way to set focus on the text boxes.
Thanks.
I just had to add textBox.setFocus(true).

Ability to view text in each class

Recently, I program for the Android platform. I have a question about the text.
Is there any way to display the text without using the XML?
I also want the text to be able to show in each class.
If you're asking if you can replace the text of anything programatically, yes you can. Usually, you have a setText method you can use for that. I'd advise you to read the tutorial and the javadoc to know more about this.

Categories

Resources