How to close the program in Java completely in Swing

A Java Swing application can be closed using the following code segment to retrieve the parent of the container, check if it is a JFrame and then dispose the JFrame:

public class btnCancelListener implements ActionListener { public void actionPerformed(ActionEvent ev) { Container bframe = btnCancel.getParent(); bframe = bframe.getParent(); while (! (bframe instanceof JFrame)) { System.out.println(“Done”); . . . → Read More: How to close the program in Java completely in Swing

How to display message dialog in Java Swing using JOptionPane.showMessageDialog

Following code segments shows how to display a message dialog in Java Swing:

import javax.swing.JOptionPane; JOptionPane.showMessageDialog(mainFrame, “Data processing has been completed”);

where, mainFrame = the parent frame in which the dialog should be displayed. mainFrame can also be replaced with null.

How to disable File Name Input in JFileChooser in Java

JFileChooser is a very powerful Component in Java. It even enables filtering of file names. However, there is no direct method to prevent a user from entering the File Name input in it.

The following method disables the JTextField File input text box inĀ  JFileChooser, by basically taking the JFileChooser as a Component, looking for . . . → Read More: How to disable File Name Input in JFileChooser in Java

Gradle error during build of Android Project in Android Studio

If you notice error that the Gradle home path is incorrect, when building your Android Project in Android Studio, select and set the gradle path to correct one. To do so, select File -> Settings. Click on Build, Execution, Deployment -> Build Tools -> Gradle.

Error building Java Program in Eclipse Mars after changing Java version

Right Click on the Project in the Package Explorer. Select Build Path -> Configure Build Path -> Libraries. Now remove JRE System Library 1.7 and add the one for java-8-oracle by clicking on Add Library -> JRE System Library -> Click Execution Environment and set that to JavaSE-1.8 (java-8-oracle). Click Finish.

This resolves the error . . . → Read More: Error building Java Program in Eclipse Mars after changing Java version

Error Junit:Junit:4.12 not found or missing after Android Studio 1.4 to 1.5 update

After I updated Android Studio from 1.4 to 1.5, all went well and the patch got applied. However, when starting the project, I got an error that read something like this. Error Junit:Junit:4.12 not found or missing

This error occurred due to gradle not getting updated / synced properly. Apparently, to speed up Android Studio, . . . → Read More: Error Junit:Junit:4.12 not found or missing after Android Studio 1.4 to 1.5 update

How to debug MumbaiStock.pm with Finance::Quotes

After creating or editing any of the Finance::Quotes modules you need to test them. To test, open a terminal window and do the following to check if the module gives any errors $ cd /usr/share/perl5/Finance/Quote <enter> $ sudo cp ~/MumbaiStock.pm . <enter> $ cd ~ <enter> $ gnc-fq-check <enter>

If above command returns any errors, . . . → Read More: How to debug MumbaiStock.pm with Finance::Quotes

Error Unable to run mksdcard SDK tool in Android Studio in Linux

When installing the Android Studio in Ubuntu Linux, the error Unable to run mksdcard SDK tool appears. This can be fixed by opening a terminal window and entering the following command: $ sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6 <enter>

MumbaiStock – A Perl module for Finance::Quote to enable stock price retrieval from the Bombay Stock Exchange

Note that I no longer use github.

MumbaiStock v 1.0 Gnucash Finance Module has been released. This is a totally new module to parse the page at the Bombay Stock Exchange web site to retrieve the bhav copy for the last trading day. This module will fetch the last traded price from the bhavcopy for . . . → Read More: MumbaiStock – A Perl module for Finance::Quote to enable stock price retrieval from the Bombay Stock Exchange

How to resolve update-binfmts: warning: current package is oracle-java8, but binary format already installed by openjdk-7

I earlier had Oracle Java 7 installed on my Linux box. I upgraded to Oracle Java 8 as follows (below commands to be typed in a terminal window): $ sudo apt-get purge oracle-java7-installer <enter> $ sudo apt-get install oracle-java8-installer <enter>

However, when Oracle Java 8 was downloaded and installed, I saw a message like this: . . . → Read More: How to resolve update-binfmts: warning: current package is oracle-java8, but binary format already installed by openjdk-7

March 2019
M T W T F S S
« Feb    
 123
45678910
11121314151617
18192021222324
25262728293031