How to restrict size of JButton in GridLayout in Java

If you put the following code in Java with only the lines in blue in your Java Swing program, you will find that whenever the Java dialog is resized, the button grows and looks ugly as it occupies the full row of the GridLayout. Code Segment as below. parameterPanel.setLayout(new GridLayout(2,1)); JButton parameterButton = new JButton("Parameters"); … Continue reading How to restrict size of JButton in GridLayout in Java

How to create a .jar file with entry point using jpackit for your Java application

Download jpackit from this link http://sourceforge.net/projects/jpackit/ Create a jar file of all the *.class files in your java folder $ jar -cvf myapplication.jar *.class <enter> Start jpackit as follows: $ java -jar jpackit-1.0.2.jar <enter> Now fill in the parameters by clicking the Choose ... button next to them Parameter Value Comment Base Dir /home/user/myapplication The … Continue reading How to create a .jar file with entry point using jpackit for your Java application

How to print a date in the default JTable.print() header and setup the page

After a struggle, managed to figure out that the MessageFormat is not that complicated at all. All I wanted was to print a heading on each page of the JTable with the current date in it. The heading was to read "Report as on " + today's date. Here is how I accomplished the task. … Continue reading How to print a date in the default JTable.print() header and setup the page

How to open multiple buffers in JEdit like in GEdit or Mousepad

Many of us use a text editor to edit program code. The simplest and clean edit is GEdit on the Gnome desktop. However, if you are not on the Gnome desktop, you may miss it. You can use JEdit which is much more powerful, however, by default, it does not open multiple programs alongside each … Continue reading How to open multiple buffers in JEdit like in GEdit or Mousepad

Install Oracle Java SDK on Fedora 18

Download the RPM for the 64 bit version from http://www.oracle.com/technetwork/java/javase/downloads/index.html Next install it on your computer by typing in a terminal window: # yum localinstall jdk*.rpm <enter> Once that is done, you need to now set up the alternatives to the OpenJDK version that is on your system. To change the alternatives, follow the steps … Continue reading Install Oracle Java SDK on Fedora 18

MyApp.MyListListener is not abstract and does not override abstract method actionPerformed(ActionEvent) in ActionListener

Below error means that the spelling of actionPerformed method is incorrect. MyApp.java:100: error: MyApp.MyListListener is not abstract and does not override abstract method actionPerformed(ActionEvent) in ActionListener public class MyListListener implements ActionListener { public void actionPeformed(ActionEvent ev) { See the spelling of actionPerformed. It is incorrect.

Use SQLite with Java

In order to use SQLite 3 with Java, you need to do the following steps on your Linux or Windows box. I have deliberately kept off specific commands. Install SQLite3 from your Linux distribution repository. You can also download the Windows edition if you use Windows. Visit https://bitbucket.org/xerial/sqlite-jdbc and download the JDBC driver. I downloaded … Continue reading Use SQLite with Java