Category: Uncategorized

  • Java: Preventing a child window’s close operation from exiting the app.

    I included a second JFrame in NetBeans, which I used as a child window. When the child window was closed, all windows were closed. I finally figured out that the default close operation needed to be either HIDE_ON_CLOSE or DISPOSE_ON_CLOSE. The default in Java is HIDE_ON_CLOSE, but in NetBeans is EXIT_ON_CLOSE. I first changed this…

  • Passing an object including java Objects to a C library.

    Very similar to including Java Strings:The passed object, WebSiteVisit: package helloworld;/**** @author thomas*/public class WebSiteVisit { /** URL of the web page that linked user to this one */ public String refererURL; public String pageVisited; public int ipAddress; IPAddress ipAddr; /** Creates a new instance of WebSiteVisit */ public WebSiteVisit() { } public WebSiteVisit(String referer,…

  • Passing an object including java Strings to a C library.

    Main.java, the class which calls the C function, passing the WebSiteVisit object /**** @author thomas*/public class Main { private native void nativePrintObject(WebSiteVisit wsv); /** Creates a new instance of Main */ public Main() { } static { System.load(“/home/thomas/testlib/HelloWorldNative/dist/HelloWorldNative.so”); } /** * @param args the command line arguments */ public static void main(String[] args) { Main…