Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

JavaFx Default & Cancel Buttons

Fig 3. JavaFx Button Example

In the JavaFx framework, buttons play a crucial role in facilitating user interaction and triggering specific actions. Typically, users manipulate buttons by positioning their mouse cursor over them and clicking to initiate a desired action. It’s worth noting that a single container can contain multiple buttons, among which there can be a designated Default Button and a Cancel button. Upon pressing the Enter key on the keyboard, the default button’s handler is invoked, while pressing the Esc key

Continue Reading →

C# Anonymous Function Handler

Fig 3. Anonymous Delegate Handler Function

Let us say, we need to define a handler for the event and do not want to define a handler function in the class definition. In that case, one can go for the Anonymous Function Handler. We can define Anonymous Function Handler either using a Lambda Expression or using the Anonymous Delegate. In this example, we will try both the technique.

Continue Reading →

JavaFx Label with Mnemonic

Fig 1. JavaFx Label Control Mnemonic

A Label can be placed before the other UI node or on top of the UI node. A Label cannot be focused on. This means, we cannot use the Tab key to set the focus to a Label. Even though it will not receive focus, it can transfer the focus to other controls and in this example, we will set Mnemonic to a label control so that it will transfer the focus to another control.

Continue Reading →

Setup Wildfly Eclipse Neon for JavaEE

Fig 1. JavaEE JCP JSR Overview

JavaEE stands for Java Enterprise Edition, and it is a web development framework. JavaEE is a specification developed on top of Java SE (Java Standard Edition). In this Example, we will setup Eclipse & Wildfly. Have a look at the depiction below:

The corporate unit comes-up with the generalised specification and submits it to the JCP (Java Community Process) for review. The JCP members reviews the JSR (Java Specification Requirement) and asks for clarification and in the process, they improve the JSR. The reviewed JSR will be published as JavaEE requirement for the next release.

Continue Reading →

Conversion Operator Overloading in C#

Fig 6. Using C# Overloaded Conversion Operators

Conversion Operator in C# converts one Type to another type. There are two flavours to it and we should implement both. One is Implicit Conversion and other one is Explicit Conversion. In a class type, we can provide two conversion operators those tells how a class can be casted to other type & how other type can be converted to class type. In this example, we will create a class called TimePart and add a conversion method to convert that to a String. We will also provide a conversion method which converts the String into a TimePart instance.

Continue Reading →