Simon Ruddleston

+ Follow
since Dec 05, 2007
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Simon Ruddleston

Sorry if this seems obvious but I've been away from Java programming for a few years and am confused about free distribution and use.

Several years ago I wrote a java program using Oracle SE8 Update 31 (and earlier versions) and distributed it to clients (for sale) who downloaded a JRE (often done automatically in Windows).

If I continue to use this JDK can I avoid the requirement for a commercial licence and will my clients still be able to download a free JRE?

If I need to use an OpenSource JDK (say OpenJDK) and stick to version 8 will the Oracle jre still work with the application and be automatically downloadable in windows.

I want to keep it as simple as possible for myself and my clients, but need the application to continue to be usable for existing clients. It is a standalone application (not enterprise) with a lot of mathematical routines involved and a small amount of graphics.

I occasionally provide updates for program.

Any recommendations welcome.

Many thanks

3 weeks ago
I have a simple JTable that comprises of text values. The user may edit the values by single clicking (inserts the cursor at the clicked location) or double clicking (highlights the text).

I would programmatically like to set the cursor (or highlight the text) on the first cells value when the table is created and displayed. I can't see a way to either click over the first row or select it. Prefer not to use SetRowSelectionInterval as this highlights the selected row rather than the text.

static String[] getEditedNames(Component parentForDisplay, String[] recordNames) {
    class EditNameTableModel extends AbstractTableModel {
        private String[] columnNames = {"Record name"};
        private Class[] columnClass = new Class[]{"Record Name".getClass()};
        private String[] data;
        public EditNameTableModel(String[] recordNames) {
          data = recordNames;

        public int getColumnCount() {
          return columnNames.length;

        public int getRowCount() {
          return data.length;

        public String getColumnName(int col) {
          return columnNames[col];

        public Object getValueAt(int row, int col) {
          if(col == 0) {return data[row];}
          else return null;

        public Class getColumnClass(int c) {
          return columnClass[c];

        public boolean isCellEditable(int row, int col) {
          return true;
        public void setValueAt(Object value, int row, int col) {
          data[row] = (String)value;
          fireTableCellUpdated(row, col);
        public String[] getNameValues() {
            return data;
     EditNameTableModel tableModel = new EditNameTableModel(recordNames);
     JTable nameTable = new JTable(tableModel);
     // Set the click count to 1 for editing
     TableColumn col = nameTable.getColumnModel().getColumn(0);
     DefaultCellEditor singleclick = new DefaultCellEditor(new JTextField());
     col.setCellEditor (singleclick);
     // Needed so that the last edited record is updated when focus moves to 'okay'
     nameTable.putClientProperty("terminateEditOnFocusLost", true);
     JScrollPane editNameScrollPane = new JScrollPane(nameTable);
     editNameScrollPane.setPreferredSize(new Dimension(50, 150));
     editNameScrollPane.setMaximumSize(new Dimension(50, 150));

Many thanks
3 years ago

I've deleted all jre's and re-installed jre 8 update 31 and now don't have any problems. Not sure why this fixed it.

When I originally wrote the code (many years ago), it turns out I used Preferences prefs = Preferences.userRoot(). I think I did this so that any user could use the same configuration settings when running the program. This meant the users had to go into the registry and allow permissions to the javasoft area.

I've taken your advice and changed the code to Preferences prefs = Preferences.userRoot();

It gets rid of a headache for me explaining what to do and for some of my clients having to get IT departments involved to access the registry.

Many thanks for your help.

6 years ago

Meant to say Preferences not Permissions that the config data is stored through

Simon R
6 years ago
I have a program that stores configuration data using java permissions.

Up until recently this is all automatically stored in the registry by java (HKey_Local_Machine\Software\JavaSoft\Prefs).

In order to allow the PC to do this I have to 'allow permissions' by highlighting the prefs folder in the registry, and inserting a tick to allow permissions access for the user.

This worked fine up to the recent java install (8 Update 31).

After installing jre 8 Update 31 the program is no longer able to access the registry prefs folder to retrieve and store configuration data. I've tried resetting the permissions tick boxes but this doesn't help.

Uninstalling 8 Update 31 and reverting back to 8 Update 5 fixes the problem.

Any help on how to fix the problem would be most welcome. The program has a small distribution to clients and I can see this being a problem.

Simon R
6 years ago
I've been using JBuilder 8 with JDK1.4 and have recently changed to JDK1.6. When building the software everything is OK apart from a few deprication warning for using Java.Uil.Logging.Logger.

When running the application (which ran OK under JDK1.4) I get

Exception in thread "main" java.lang.VerifyError: (class: bestFit/BestFitControllerImpl, method: showMakeSurveyFailureDialog signature: (LbestFit/mvc/dataPanelMvc/SurveyException;)V) Incompatible object argument for function call

Through experimenting with code it appears to be that the verifyer doesn't like String concatenation of more than 2 string. That is if I use a StringBuffer or concatenate the strings one by one, the verifyer error moves to the next string concatenation problem ie

private void showMakeSurveyFailureDialog(SurveyException e) {
"Problem computing the coords from survey records.\n\n" +
e.getMessage() + "\nRefer to log for detailed errors.",
"BestFit Dimensional Application", JOptionPane.WARNING_MESSAGE);

causes the error but

private void showMakeSurveyFailureDialog(SurveyException e) {
StringBuffer buffer = new StringBuffer("Problem computing the coords from survey records.\n\n");
buffer.append("\nRefer to log for detailed errors.");
JOptionPane.showMessageDialog(view, buffer.toString,
"BestFit Dimensional Application", JOptionPane.WARNING_MESSAGE);


Is multiple string addition at a single go a problem in JDK1.5 / JDK1.6 or is there some other problem I'm not aware of?

Any help would be greatly appreciated. Thinking of using Eclipse and would like to sort out this problem first.

Best regards

11 years ago
I would like to create a pop up dialog that displays the application details while waiting for the main application to load.

I've tryed using a dialog that displays an Image and plan to use a timer such that the dialog is displosed of after a set time.

Not sure if this is the best approach. The dialogs title bar gives a poor impression. Can I remove the title bar from the dialog such that just the contents of the dialogs JPanel are displayed?

Many thanks
13 years ago