CORE API / NOTES</>↗Core API29 Apr 2006
OS platform has a different symbol used for path separator. Path separator is a symbol that separate one path element from the other. In Windows the path separator is a semicolon symbol (;), you have something like: .;something.jar;D:/libs/commons.jar While in Linux based operating systems the path separator is a colon symbol (:), it looks like: […]
SWING / NOTES</>↗Swing27 Apr 2006
If you have a JFrame in your Java Swing application and want to center its position on the screen you can use the following code snippets. The first way is to utilize java.awt.Toolkit class to get the screen size. The getScreenSize() method return a java.awt.Dimension from where we can get the width and height of […]
CORE API / NOTES</>↗Core API23 Apr 2006
Environment variables are a set of dynamic values that can affect a running process, such as our Java program. Each process usually have their own copy of these variables. Now we would like to obtain the available variables in our environment or operating system, how do I do this in Java? Here is a code […]
JDBC / NOTES</>↗JDBC20 Apr 2006
In this example you’ll learn how to create a program to insert data into a database table. To insert a data we need to get connected to a database. After a connection is obtained you can create a java.sql.Statement object from it, and using this object we can execute some query strings. package org.kodejava.jdbc; import […]
JDBC / NOTES</>↗JDBC15 Apr 2006
This post is about an example for obtaining a connection to MySQL database. For connecting to other database all you have to do is change the url to match to url format for a particular database and of course you have to register a correct JDBC driver of the database you are using. Here are […]
AWT / NOTES</>↗AWT11 Apr 2006
package org.kodejava.awt; import java.awt.*; public class BeepExample { public static void main(String[] args) { // This is the way we can send a beep audio out. Toolkit.getDefaultToolkit().beep(); } } Using Runtime.exec() method we can do something like the code snippet below to produce beep sound using powershell command. try { Process process = Runtime.getRuntime().exec( new […]