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 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

Error Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException in Java program

In your Java code, you have the following code segment: public class BigOne { public static int i = 0;     JButton onebutton;     JLabel label;     JFrame frame;    public static void main(String[] args) {       BigOne gui = new BigOne();       gui.go();     } public void go() {     frame = new JFrame(); … Continue reading Error Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException in Java program

Use Windows Builder from Google to create GUIs in Java quickly

If you use Eclipse to create Java programs, you would know that there are several plugins that enable Eclipse to do magic. However, the Google Windows Builder plugin available from the eclipse market place, almost proves it can make "coffee". Using Windows Builder, you can create GUI windows using Swing, SWT or XWT in minutes. … Continue reading Use Windows Builder from Google to create GUIs in Java quickly