Ed Tidwell

Greenhorn
+ Follow
since Oct 22, 2002
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 Ed Tidwell

One of my favorite Java books of all time.  I was lucky enough to see Josh speak at Java One in 2001 on 'Effective Java'.

He was even kind enough to sign it and I've kept it on my desk all of these year.

Thanks Josh for your excellent humor and writing style.  It's made my life richer and allowed me to keep out of the debugger hunting for bugs.  :-)

Cheers
1 year ago
Could you post a stack trace of the error your getting?

Thanks,
Ed
13 years ago
Sounds right to me.

Your in the 'grey' area of event programming.

So for example when do you know when you have a double or triple mouse click?

There is actually a timer that gets set and if a single mouse click comes in before the timer expires it gets promoted. All OS windowing systems allow you to configure the defaults for this.

So when you clicked on the first item with a CTRL it STILL generated a single selection.

I hope this makes sense.

So the ignore changing check that you are doing should prevent LOTS of events from being generated when the user does a large SHIFT selection. You could think that each item added could generated an action selected event but this prevents it.

Test it with a shift selection and see what happens.

Hope this helps.

Ed
13 years ago
BTW
My wireless card is an 11Mbit/sec connection versus
a 100Mbit/sec connection for my 10BaseT connection.
The problem is NOT the buffer size but the speed of the connection and that read() will return BEFORE it reads ALL of the bytes for the array.
Enjoy,
Ed
Omitted the word NOT which changes the meaning just a little. :-)
[ November 19, 2003: Message edited by: Ed Tidwell ]
15 years ago
Seems there are more people out there with the same problem.
Maybe we can form a rehab help clinic? :-)
Here is the link: http://forum.java.sun.com/thread.jsp?thread=177655&forum=4&message=2020381

Ed
15 years ago
At a quick glance I dont' think you can set the TCP buffers to the values you have given.
That is PART OF THE OS platform that the JVM sits on top of.
So for example I'm willing to bet you can not set the TCP buffer of a wireless card to the same size as the TCP buffer of a 10BaseT connection.
You can ask the JVM how big you want to make your TCP buffers but I'm pretty sure it can ignore this request.
Look at getsendBufferSize() in the Java Docs and notice the key words "buffer size USED BY THE PLATFORM".
You can create you own buffer to pass around and TCP will break it up for streaming over the net behind the scenes. You should look at NIO and Socket Channels.
I hope this was helpful.
Ed
15 years ago
I'm having the same kind of issues.
I have a simple client and server.
Server sends data out via DataOutputStream.
Client reads data in via DataInputStream.
The very first part of the message from the server is an int
that is used to determine how to parse the stream on the client side.
After running this for a while I will get a 0 or a VERY large positive
int value which the SERVER DOES NOT put in the stream. Buffer corruption?
Another ironic twist is when I tested this last night at home using my wireless card I could ONLY SEND ONE message and the server's next message
sent out would have a zero which the client interpets as EOF.
It would appear that I'm having issues with the TCP buffer size ?
I'm considering using NIO and Channels to move the data back and forth since this is the preferred way to do this in 1.4.
Since our problems seem to be related I look forward to hearing how you solve this. :-)
Thanks,
Ed
15 years ago
I had some weird behavior happen to me on XP with 1.4 when it came to JSplitPanes.
I run on Linux, Solaris, NT and XP. It only showed up on XP with JDK 1.4. I noticed a new JDK 1.4.1 and after putting that on my machine the problem went away.
Any time you see different behavior for a standard Swing control between two JVMs on the same platform I would assume a bug.
Here is where you can go look it up...
http://developer.java.sun.com/developer/bugParade/index.jshtml
On a side note you can learn some very good stuff there as well. Work arounds to bugs as well as comments by Sun developers on internals and what needs to be done to fix it.
Hope this is helpful.
Ed
16 years ago
I would go to the swing site tutorials.
http://java.sun.com/docs/books/tutorial/uiswing/
I had to build a framework for us to ship a bunch of Swing applications that could all have the same look and feel. I found the Cooper book to be great for the area. More specifically Section 5, Chapter 27 p.261.
Another item that might help woudl be the Sun book on pattern by Stelting and Maassen. "Applied Java Patterns". Great for point out what patterns are used where in the Java API and why.
I also like Metsker's book "Design Patterns Java Workbook".
Hope this was helpful.
Ed
16 years ago
Do you want everything to show?
I basically did my own JTree renderer for this so I could tweak my Icons.
The only problem here was I knew what was in the tree on how deep the nodes went.
This allowed me to filter items in the XML tree that drove the behavior of the application.
Getting the look and feel of IE will require some work. Just think about the font types and colors you have to set along the way as you go.
If you want everything to show can't you just use JDOM to get an iterator of the root node and rip threw the thing adding it as you go?
Hopefully I've told you something you didn't already know.

Ed
16 years ago
You need to look at what is called the 'Mediator' pattern.
A mediator is basically the middle man in a large application.
So say when I open a certain type of file my mediator has an openAction. The mediator is responisble for putting the file name in the title bar, enabling the save actionItem which enables the Save in the toolbar and menubar.
In my swing applications I have a way to ask the JFrame for the mediator via an inteface.
Here is a code clip to show you what I mean...
<main class>
protected void registerMediator()
{
// register our main frame with the mediator
// for mouse events and messages
_mediator.registerFrame(this);
// register main panel so we can easily resize on updates
_mediator.registerMainPanel(_mainPanel); // _mainPanel is a TFrame object
// register panels that have actions for the mediator
_mediator.registerNetworkPanel(_networkPanel);
_mediator.registerLinkPanel(_linkPanel);
<mediator class>
//------------------------------------
//-- register controls to be mediated
//------------------------------------
public void registerFrame(NetAssign frame)
{
_frame=frame;
}

public void registerMainPanel(JPanel mainPanel)
{
_mainPanel = mainPanel;
}
<event in mediator that needs to be synched across multiple controls...>
public void action(OpenFileAction openFileAction)
{
// is this a Network file they have opened?
if (openFileAction.getFile().getName().endsWith(".Network"))
{
// get network map element
_networkMap.openNetworkFile(openFileAction.getFile());
} // Network file opened
// is this a Link file for a shelf that they have opened?
if (openFileAction.getFile().getName().endsWith(".shelf"))
{
_shelfLink.openLinkFile(openFileAction.getFile());
// init LIC dialog used on right click of MapNode
_assignLicDialog.setShelf(_shelfLink.getShelf());
} // Shelf file opened
// update layout managers
_mainPanel.validate();
// temp
_saveItem.setEnabled(true); // allow them to save the dummy file
// now set the tooltip for the Save action button
_saveItem.putValue(AbstractAction.SHORT_DESCRIPTION, "Save ");
// change this to be the .Assign file name _openNetworkFile.getName());
setMouseCursorToNormal(_frame);
_frame.setStatusBar(" "); // look at clearing messages in a back ground thread down the road
}
16 years ago
/**
* Notifies <code>JList</code> <code>ListSelectionListener</code>s that
* the selection model has changed. It's used to forward
* <code>ListSelectionEvents</code> from the <code>selectionModel</code>
* to the <code>ListSelectionListener</code>s added directly to the
* <code>JList</code>.
* @param firstIndex the first selected index
* @param lastIndex the last selected index
* @param isAdjusting true if multiple changes are being made
*
* @see #addListSelectionListener
* @see #removeListSelectionListener
* @see EventListenerList
*/
protected void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
Is this the answer to your problem?
I forget to do this alot when I work with JTables.
Hope this helps,
Ed
16 years ago
Is there any reason why you wouldn't put this in a JTextPane component to just render this in Java using the HTML Editor kit?
It can be a little slow coming up but once it is loaded in the JVM it is pretty quick. We had someone load a HTML object in a background thread so when they needed the help it was very quick to load.
Hope this helps.
Ed
16 years ago
Sid,
I had to do something like this for work but it was more of a meta language on top of a custom file format for our embedded applications.
Anyway, I would recomend taking a peek at Metsker's book on 'Building Parsers with Java'. After I finished building my tokens my manager told me I had two weeks to wrap it up and ship our product.
Since I work for a pay check I put the parser stuff on the shelf and converted the stuff in and out of XML.
I basically combined special comments with a INI data file to put a dynamic GUI editor on a cryptic protocol configuration file.
Works very well but if you need a smart compiler you should read the Metsker book.
The book by Andrew W. Appel on modern compiler implementation in Java as a great book as well. The second edition just came out and you might want to give it a look as well.
Hope this helps.
Sincerely,
Ed
16 years ago