Nicholas van Orton

Greenhorn
+ Follow
since Aug 13, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nicholas van Orton

I've gone and rebuilt the suspect class, and have found that the following code seemed to have been the problem:



Replacing that section of code with t = new javax.swing.JTable(); has worked.

Overriding the isCellEditable method has had to occur in this class instead, where the DefaultTableModel objects are created:



Any clues as to why this problem has occurred?

Thanks,
16 years ago
javax.swing.SpringLayout does not implement the java.io.Serializable interface, which would explain why Java can't write a SpringLayout object to file. The next question would be why my program would be trying to write a SpringLayout object in the first place.

I've put together a very stripped-down version of what I'm trying to do:





Those two snippets of code work quite well and show that what I'm trying to do is possible.

The hardest part in this post is trying to present what I'm working with in a way where someone might be able to help my with where I am going wrong.

The reading and writing of data is handled here.

This vector is being used to store these objects.

Things seems to go quite well until the DefaultTableModel object is asked to be displayed (here) in a JTable (here).

The code that I have put together are all kept within here.

Any help with this would be very much appreciated, as would an explanation as to why this is happening.

Thanks,
16 years ago
I'm not sure if this is an IO issue of a Swing issue (or perhaps a little of both), however I have a data structure as follows and I'm having issues with writing the data with a DefaultTableModel object included:

- Vector, used to store any number of 'batch' objects
- A 'batch' object contains a DefaultTableModel object to display tabular data

The idea behind all of this is to allow for any number of 'batch' objects to contain a DefaultTableModel object and be stored within the Vector (the Vector being the object that is written to and read from file).

Rows, columns and data can be added to the DefaultTableModel object and the Vector object written to and read from file without problem, provided that the DefaultTableModel is not displayed in a JTable object.

Once the Vector has been read and the DefaultTableModel object set to be displayed within a JTable, trouble arises.

i.e.:



Without any changes to the DefaultTableModel object, I go to save the Vector and the following exception occurs (my appologies if this is a little long):



The JTable is being displayed within a JFrame that uses the SpringLayout layout manager.

I am completely lost as to why this is occuring.

Perhaps using a DefaultTableModel object is not the best way of storing tabular data?
16 years ago
I see what you mean, this may just be a limitation on using a JTable?

Is there anyway to use the removeMouseListener() method on a JTable cell?
17 years ago
Hi folks,

At the moment, I'm putting together a date picker using a JTable, which looks something like this:



I'm not all that familiar with JTables, but I was just wondering if there is any way of preventing the blank cells (those that .equal("") in their respective arrays)?

Also, if a variable:

int date = 6;

was used to represent today's date, is there any way of searching through all the cells & selecting the cell that contains that value?

Any help with this would be very much appreciated.
17 years ago
Thanks for your help, it worked!
17 years ago
Hi folks,

I'm trying to set up a situation with two components - a JSpinner & JTextField - where I can traverse between the two using the 'Tab' key and have the text of the JSpinner & JTextField automatically selected once they are tabbed into.

At the moment, I've come up with this:



It works when tabbing from the JSpinner into the JTextField, but not the other way around.

I'm obviously doing something wrong.

If there are any clues, they would be very much appreciated.

Thanks
17 years ago
Hi folks,

This may just be a Java for Mac OS X problem, but here goes.

I've noticed that when the text in a JSpinner's text field is selected, the blinking text cursor remains flashing away in the text field. However when the text in a JTextField is selected, the blinking text cursor disappears; the latter being the behaviour for text fields & 'spinners' alike in Mac OS X.

Is there any method do be used to correct this?

Thanks
17 years ago
Hi folks,

Just a quick question to ensure that a Java app takes on the characteristics of a Mac OS X app.

In almost all Mac OS X apps, an item called 'Special Characters...' appears in the 'Edit' menu. This, when selected, opens up the Mac OS X Character Palette.

I'm just wondering how you to integrate this into a Jav app for Mac OS X.

Thanks
17 years ago
I'm using Java 1.5.0_05 on Mac OS X v10.4 - I would have thought that this shouldn't have made any difference.
18 years ago
I've had to remove the line "super(new SpringLayout());" and replaced it with "this.setLayout(layout);" at it works.

Any explanations as to why this is would be very much appreciated.

Thanks
18 years ago
I've tried your solutions, and the JPanel is now appearing. However, the JSlider object is not appearing where its SpringLayout constraints say it should appear.

Any more clues?
[ April 14, 2006: Message edited by: Nicholas van Orton ]
18 years ago
Keeping in mind that I'm just a beginner, this one is a real head scratcher for me. Here's what I've got at the moment:



I add this JPanel to my Main class:



My dilemma is that when I add the ControlPane() object to the BorderLayout.SOUTH of the JFrame, nothing appears! Yet It works when the ControlPane() object is added to the BorderLayout.CENTER of the JFrame - which I would be doing if I didn't have anything else to add to the JFrame.

Any clues?

Thanks
18 years ago
I really appreciate all of these replies, thank you.

This is definately a great place to learn more about and share ideas about Java.
18 years ago
Hi all,

I'm completely new to regular expressions and I'm having a little trouble grasping all the concepts behind how to use regular expressions.

I have a String array that contains a series of weights:



At the moment, I'm adding up all the weights using a StringTokenizer to extract the numbers as follows:



I'm figuring that this is a rather inefficient way of doing things, as a new StringTokenizer object is created and subsequently destroyed on every run through the for loop.

Thus I turned to regular expressions for help. At the moment I've got:



What I'm suppose to do now is where I'm lost. I've even tried the following, to no avail.



Any help would be very much appreciated.

Thanks
18 years ago