How to make a form refer to the parent frame using a JDialog

Below code segment shows how to use a JDialog to refer to a parent frame. MyApp.java

public class MyApp { JDialog dialog; JFrame parentFrame; public static void main(String[] args) { MyApp app = new MyApp(); app.gui(); } public void gui() { //The parentFrame parentFrame = new JFrame(); parentFrame = setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //The dialog dialog = . . . → Read More: How to make a form refer to the parent frame using a JDialog

Send files to others using sendspace.com as temporary file storage space

If you need to send a file to someone over the Internet, you can try several services such as Dropbox, OneDrive, Google Drive and more. But, what if you want to accomplish the same without logging in or registering on a website and also without giving away a lot of private information?

To do this, . . . → Read More: Send files to others using sendspace.com as temporary file storage space

How to remove all rows from a Java JTable created using Custom TableModel

To remove all rows from a Java JTable created using Custom TableModel, try the following:

MyModel myTableModel = (MyModel) myTable.getModel(); for (int i = myTableModel.getRowCount()-1; i >= 0; i–) myTableModel.deleteRow(i);

Define the deleteRow(int row) method in the MyModel class.

netstat shows unknown connections to *.clients.your-server.de domain

Upon starting Firefox and web browsing, when I perform a netstat -tuape, I find a network connection opened and shut down which points to a server *.clients.your-server.de.

Upon further investigation with $ sudo netstat -tuape <enter>

it was found that this shows up each time I start up Firefox and enter a URL to visit. . . . → Read More: netstat shows unknown connections to *.clients.your-server.de domain

Gnucash not able to retrieve stock quotes from Yahoo Finance USA fix to USA.pm

If you use Gnucash with stock quotes, you would have found that since early February 2014, it is not able to fetch the stock quotes of companies such as AMZN, IBM, MSFT from the NYSE. Yahoo Finance is the source for Gnucash to retrieve these quotes from the NYSE. Yahoo Finance has made a change . . . → Read More: Gnucash not able to retrieve stock quotes from Yahoo Finance USA fix to USA.pm

MumbaiStock v 1.4 Gnucash Finance Module enhancement released

MumbaiStock v 1.4 Gnucash Finance Module has been released. This fixes a date calculation bug.

MumbaiStock Gnucash Finance Module (https://github.com/geetuvaswani/MumbaiStock) had a bug… that it could not calculate the previous date correctly at end of any month. The arithmetic was wrong and it was expected that the programmer would build the code to perform date . . . → Read More: MumbaiStock v 1.4 Gnucash Finance Module enhancement released

Display a popup message in Java Swing

At times, we need to show quick messages in a small window on screen to users in Java. Here is a quick way to do this.

import javax.swing.JOptionPane JOptionPane.showMessageDialog(null, “This is my Message Dialog”);

How to prevent Android from scanning select folders on start up

Many Android phones like the Sony Xperia and Samsung, use the Media Scanner service that starts up when you switch on your Android phone. This service crawls through all folders in the storage card or the storage memory. This would mean that Android applications such as the Gallery and Media players can identify your files . . . → Read More: How to prevent Android from scanning select folders on start up

Read data from a JTable created from AbstractTableModel

If you have a JTable in Java created with an AbstractTableModel, you can read the data from it, using following:

int rowCount = testTable.getRowCount(); for (int i = 0; i < rowCount; i++) { String mColumn1 = (String) testTable.getModel().getValueAt(i, 0); String mColumn2 = (String) testTable.getModel().getValueAt(i, 1); }

Alternatively, you could also try where the JTable . . . → Read More: Read data from a JTable created from AbstractTableModel

Delete a selected row in JTable with a custom model

DefaultTableModel model = (DefaultTableModel) myTable.getModel(); //Get reference to model model.removeRow(x); //Remove row x

You can also add a method deleteRow(int row) to your custom model class code as in:

public class MyTableModel extends AbstractModel { private Vector dataVector = new Vector(); String[] columnNames = {“First Name”, “Last Name”, “Age”}; public int getRowCount() { if (dataVector.size() . . . → Read More: Delete a selected row in JTable with a custom model

TOPICS