SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

SWING / NOTES</>↗
Swing12 Nov 2010

How do I insert a text in a specified position in JTextArea?

The insert(String str, int pos) of the JTextArea allows us to insert a text at the specified position. In the example below we insert brown and over words into the current JTextArea text. package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class TextAreaInsertText extends JPanel { public TextAreaInsertText() { initializeUI(); } public static void showFrame() { […]

Wayan · 1 min read
SWING / NOTES</>↗
Swing12 Nov 2010

How do I replace text in the JTextArea?

In this example you’ll see how to use the replaceRange(String str, int start, int end) method to replace a string in the JTextArea from the start position to the end position with the specified string. package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class TextAreaReplaceText extends JPanel { public TextAreaReplaceText() { initializeUI(); } public static void […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API07 Nov 2010

How do I use join method to wait for threads to finish?

If you want a thread to work until another thread dies, you can join the thread onto the end of the another thread using the join() method. For example, you want thread B only work until thread A completes its work, then you want thread B to join thread A. package org.kodejava.example.lang; public class ThreadJoin […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API07 Nov 2010

How do I set the priority of a thread?

Threads always run with some priority, usually represented as a number between 1 and 10 (although in some cases the range is less than 10). A thread gets a default priority that is the priority of the thread of execution that creates it. But, you can also set a thread’s priority directly by calling the […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API07 Nov 2010

How do I get the currently executing thread?

To get the currently executing thread, use the static currentThread() method of the Thread class. This method returns a reference of the currently executing thread object. package org.kodejava.lang; public class GetCurrentThreadDemo { public static void main(String[] args) { // Get the currently executing thread object Thread thread = Thread.currentThread(); System.out.println("Id : " + thread.getId()); System.out.println("Name […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API07 Nov 2010

How do I set and get the name of a thread?

You can assign a name to thread instance by using the setName() method and get the name of the thread using the getName() method. The naming support is also available as a constructor of the Thread class such as Thread(String name) and Thread(Runnable target, String name). package org.kodejava.lang; public class ThreadNameDemo extends Thread { public […]

Wayan · 1 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.