•  

    March 2008
    M T W T F S S
    « Feb   Apr »
     12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31  

JMenuBar/JMenuItem and JTextPane: Focus Owner Problem for Cut/Copy/Paste/Select All

When using JMenuItem in JMenuBar to cut/copy/paste/select all text from a JTextPane, a focus from JTextPanel is temporarily lost to JMenuItem. The loss of focus causes isFocusOwner() of JTextPane to return false. As a result, the cut/copy/paste/select all methods using JMenuItem do not work.
For example, I use JMenuItems for cut/copy/paste/select all methods with the following [...]

Implement Java methods for showing/hiding components

I am implementing a user-interface where there is a main JPanel called centerPanel containing two smaller JPanels, source panel and target panel. The source panel contains a JTextPane, and the target panel also contains a JTextPane and another JPanel for holding JButtons. The structure of this user-interface is described below.
centerPanel (JPanel with GridLayout)

sourceWindowPanel (JPanel)

JTextPane

targetSourceWindowPanel (JPanel)

jTextPane

JPanel

JButton1

JButton2

JList

JTextField

The issues are:

 If I set centerPanel layout as [...]

Setup WEKA and LIBSVM for WEKA in Debian Etch

When we try to use LIBSVM through WEKA, we might encounter the problem of libsvm.jar not in the classpath. Here, I’d like to describe how to set up Weka and LIBSVM for weka.
1) Download weka-3.5.7.zip from http://www.cs.waikato.ac.nz/ml/weka/, and unzip it to /path/to/weka-3.5.7
2) Download libsvm-2.85.zip from http://www.csie.ntu.edu.tw/~cjlin/libsvm/, and unzip it into /path/to/libsvm-2.85
3) Copy weka.gif in the [...]

A Practice on LIBSVM Example in Debian Etch Using Java

This exercise comes from “A Practical Guide to Support Vector Classification” paper by Chih-WEi Hsu, Chih-Chung Chang and Chih-Jen Lin. It can be downloaded from http://www.csie.ntu.edu.tw/~cjlin/libsvm/index.html.
The goal for writing this page is to record step-by-step instructions of an example in the paper above using Java version in Debian Etch. So, this record will be used [...]