Karthikeya Boyini has Published 2193 Articles

Date Formatting Using SimpleDateFormat

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 12:43:03

1K+ Views

SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner. SimpleDateFormat allows you to start by choosing any user-defined patterns for date-time formatting.ExampleLive Demoimport java.util.*; import java.text.*; public class DateDemo {    public static void main(String args[]) {       Date dNow = ... Read More

Create gradient translucent windows in Java Swing

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 12:36:39

3K+ Views

With JDK 7, we can create a gradient based translucent window using swing very easily. Following are the steps needed to make a gradient-based translucent window. Make the background of JFrame transparent first.frame.setBackground(new Color(0, 0, 0, 0)); Create a gradient paint, and fill the panel.JPanel panel = new javax.swing.JPanel() {    protected ... Read More

Date Parsing using SimpleDateFormat

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 12:27:22

384 Views

The SimpleDateFormat class has parse() method, which tries to parse a string according to the format stored in the given SimpleDateFormat object.ExampleLive Demoimport java.util.*; import java.text.*;   public class DateDemo {    public static void main(String args[]) {       SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd");       ... Read More

C# program to find the sum of digits of a number using Recursion

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 12:13:42

363 Views

Let’s say we have set the number for which we will find the sum of digits −int val = 789; Console.WriteLine("Number:", val);The following will find the sum of digits by entering the number and checking it recursively −public int addFunc(int val) {    if (val != 0) {     ... Read More

Compare two strings lexicographically in C#

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 12:11:36

3K+ Views

To compare strings in C#, use the compare() method. It compares two strings and returns the following integer values −If str1 is less than str2, it returns -1. If str1 is equal to str2, it returns 0. If str1 is greater than str2, it returns 1.Set the two ... Read More

Create Toast Message in Java Swing

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 12:08:08

1K+ Views

A toast message is an alert which disappears with time automatically. With JDK 7, we can create a toast message similar to an alert on android very easily. Following are the steps needed to make a toast message.Make a rounded rectangle shaped frame. Add a component listener to frame and ... Read More

Create a simple calculator using Java Swing

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 12:01:39

24K+ Views

Swing API is a set of extensible GUI Components to ease the developer's life to create JAVA based Front End/GUI Applications. It is built on top of AWT API and acts as a replacement of AWT API since it has almost every control corresponding to AWT controls.Following example showcases a ... Read More

How can we check the indexes created by a UNIQUE constraint on a MySQL table?

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 11:48:25

565 Views

SHOW INDEX statement is used to check the indexes created by a UNIQUE constraint on a MySQL table.SyntaxSHOW INDEX from table_name;ExampleSuppose we have the table ‘empl’ which have a UNIQUE constraint on column ‘empno’.mysql> describe empl; +--------+-------------+------+-----+---------+-------+ | Field  | Type        | Null | Key | Default ... Read More

C# Program to Kill a Thread

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 11:48:19

1K+ Views

Create a thread first and start it −// new thread Thread thread = new Thread(c.display); thread.Start();Now display the thread and set a stop function to stop the working of the thread −public void display() {    while (!flag) {       Console.WriteLine("It's Working");       Thread.Sleep(2000);    } ... Read More

C# Program to Pause a Thread

karthikeya Boyini

karthikeya Boyini

Updated on 19-Jun-2020 11:46:34

8K+ Views

To pause a thread in C#, use the sleep() method.You need to set the milliseconds for which you want the thread to pause, for example, for 5 seconds, use −Thread.Sleep(5000);ExampleLet us see how to loop through and set the sleep method to pause the thread.Live Demousing System; using System.Threading; namespace ... Read More

Advertisements