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.

BASIC / NOTES</>↗
Basic26 Oct 2010

How do I use the || operator in Java?

The || operator or conditional OR operator operates on two boolean expressions. This operator exhibit “short-circuiting” behavior, which means that the second operand is evaluated only if needed. The || operator evaluate only boolean values. For an OR (||) expression it will return true if either of the operand is true. If the first operand […]

Wayan · 1 min read
BASIC / NOTES</>↗
Basic26 Oct 2010

How do I use the boolean negation (!) operator in Java?

The ! operator is a logical compliment operator. The operator inverts the value of a boolean expression. package org.kodejava.basic; public class NegationOperator { public static void main(String[] args) { // negate the result of boolean expressions boolean negate = !(2 < 3); boolean value = !false; System.out.println("result: " + negate); System.out.println("value : " + value); […]

Wayan · 1 min read
SWING / NOTES</>↗
Swing26 Oct 2010

How do I wrap the text lines in JTextArea?

To wrap the lines of JTextArea we need to call the setLineWrap(boolean wrap) method and pass a true boolean value as the parameter. The setWrapStyleWord(boolean word) method wrap the lines at word boundaries when we set it to true. package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class TextAreaWrapDemo extends JPanel { public TextAreaWrapDemo() { initializeUI(); […]

Wayan · 2 min read
REGEX / NOTES</>↗
Regex26 Oct 2010

How do I match a regex pattern in case-insensitive?

Finding the next subsequence of the input sequence that matches the pattern while ignoring the case of the string in regular expression can simply apply by create a pattern using compile(String regex, int flags) method and specifies a second argument with PATTERN.CASE_INSENSITIVE constant. package org.kodejava.regex; import java.util.regex.Pattern; import java.util.regex.Matcher; public class RegexIgnoreCaseDemo { public static […]

Wayan · 1 min read
SWING / NOTES</>↗
Swing25 Oct 2010

How do I set the font and color of JTextArea?

To set the font and color of JTextArea we can use the setFont() and setForeground() methods of the JTextArea. To create a font we must define the font name, the font style and its size. For the colors we can uses the constant color values defined by the Color class. package org.kodejava.swing; import javax.swing.*; import […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing25 Oct 2010

How do I create an uneditable JTextArea?

The following example shows you how to set the property of the JTextArea so that it cannot be edited or modified. To make the JTextArea not editable call the setEditable() method and pass a false value as the parameter. package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class TextAreaNotEditable extends JPanel { public TextAreaNotEditable() { initializeUI(); […]

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.