Home » desktop java » Page 3

Tag Archives: desktop java

Create a shape from lines and curves

With this tutorial we shall show you how to swap RGB values in an Image. This is very useful when you are trying to create some effects to your Application. Basically all you have to do in order to swapp RGD values of an Image is: Create a GeneralPath class instance Use moveTo, lineTo, quadTo, curveTo and closePath to draw ...

Read More »

Combining shapes example

In this tutorial we shall show you how to create a simple graphic by combining basic shapes. We are going to use some the built in classes that Java offers. Basically to create and combine shapes in Java: Use Line2D, Ellipse2D, Rectangle2D, RoundRectangle2D, Arc2D, Area to create some simple shapes Use add, subtract, intersect, exclusiveOr methods of the Area class ...

Read More »

Creating basic shapes example

In this tutorial we shall show you how to construct a simple graphic by creating basic shapes. We are going to use some the built in classes that Java offers. Basically to create simple shapes in Java: Use Line2D, Ellipse2D, Rectangle2D, RoundRectangle2D, Arc2D, Area to create some simple shapes Then use Graphics2D class and its draw function ton paint each shape an a new Frame. Let’s see how the ...

Read More »

List all available font families

With this tutorial we are going to see how to list all available font families in your environment using Java. A font family refers to a set of font faces with a related typographic design. For example, the font faces in the Lucida Sans Typewriter family are Lucida Sans Typewriter Bold, and Lucida Sans Typewriter Regular etc. This example lists ...

Read More »

Draw mixed style text example

In this tutorial you are going to see how can you draw a line of text that each word has a different style In order to draw mixed style text in Java, all you have to do is: Set the desired font if different from default font using the Font class Use AttributedString to create String that you can work ...

Read More »

Window closing event handling

In this example we are going to see how to handle window closing events. This is a very basic event handling when you are working on a UI Application. Basically all you have to do to handle window closing events is: Create a simple JFrame window Use addWindowListener to add a window listener to the JFrame Override windowClosing method of ...

Read More »

VetoableChangeListener example

With this example you are going to learn about a very important event monitoring component, the VetoableChangeListener. The VetoableChangeListener is , in many ways, similar to the PropertyChangeListener class. The main difference is that PropertyChangeListener is applied to bound properties. On the other hand the VetoableChangeListener is applied to constraint properties. A bound property is just as simple as a property. A ...

Read More »

WindowListener demo

In this tutorial we will see how to use the WindowListener. This is particularly useful when you are working with a window application and you want to monitor the state of each window. With the WindowListener you can monitor a number of events. The opening or the closing of a window for instance. So, when a window opens or closes, ...

Read More »

Display all events occurring in a window

In this example we shall show you how to display all events occurring in a windows. This is very useful when you want to have full control o events that occur in a Java applications that has many windows to handle. It is a very simple ways to manage the activity on your windows. To display all the events that ...

Read More »

Multicast event example

In this tutorial we are going to see how to manage multicast events. Multicast events are quite useful when you have to work with many windows in your application and you just want to perform the same action or a group of actions in a number of windows in your application at the same time. For example, if the user ...

Read More »