Java Forum / General / April 2006
Different from OS10 to Unix?
Tuvas - 20 Apr 2006 21:14 GMT I've been trying to troubleshoot a code based on the method shown in http://java.sun.com/products/jfc/tsc/articles/treetable1/index.html , on how to create a treetable. The code seems to work just fine on a unix machine, but it doesn't work correctly on an OS10 machine. What happens is clicking on the button on the left won't open the window, and if you click once on the name, it will show a partial black and partially white area. Clicking on the black area (top) will open the above tree, and clicking on the bottom will open the correct side. It doesn't do this for any other OS we've tried. Any ideas as to why? I've always understood Java to be exactly uniform across all OSes. Thanks!
Oliver Wong - 20 Apr 2006 22:30 GMT > I've been trying to troubleshoot a code based on the method shown in > http://java.sun.com/products/jfc/tsc/articles/treetable1/index.html , [quoted text clipped - 5 lines] > above tree, and clicking on the bottom will open the correct side. It > doesn't do this for any other OS we've tried. Any ideas as to why? When you say "clicking on the button on the left won't open the window", I have no idea what you're talking about, since you didn't provide your source code (the website you linked to doesn't seem to have any applications with buttons on the left side). Perhaps you can produce an SSCCE (http://mindprod.com/jgloss/sscce.html).
This sounds like a GUI question, so you may find more helpful responses in comp.lang.java.gui.
> I've > always understood Java to be exactly uniform across all OSes. Thanks! Ideally, Java would be exactly uniform across all OSes. In practice, bugs slip into the code, causing Java programs to behave differently on different OSes. Perhaps you've discovered one of those bugs.
- Oliver
Tuvas - 20 Apr 2006 22:36 GMT The problem is, the code is HUGE, and we can't seem to track down where the problem is happening, so as to be able to provide a simple coding solution. The image shown in http://java.sun.com/products/jfc/tsc/articles/bookmarks/snapshot.gif shows a snapshot of the code running, what can happen is one of 2 things. If you click on the leftmost icon, it will open up the folder. If you double click the name or folder, it will open up. I'm pretty sure this is probably beyond the scope of anyone without a fine-toothed comb to find the problem, I'm mostly just curious if anyone else has used the same library and had a similar problem.
Monique Y. Mudama - 20 Apr 2006 22:56 GMT > The problem is, the code is HUGE, and we can't seem to track down > where the problem is happening, so as to be able to provide a simple [quoted text clipped - 6 lines] > a fine-toothed comb to find the problem, I'm mostly just curious if > anyone else has used the same library and had a similar problem. I don't think there are a whole lot of developers on this newsgroup who see their products on Macs. I base this on the fact that I also had a Mac bug, but with an extremely short code example demonstrating the problem, and still didn't get a nibble.
Then again, it could also be because Apple is extremely tight-lipped about its bugs. Rather annoying.
 Signature monique
Help us help you: http://www.catb.org/~esr/faqs/smart-questions.html
steve - 20 Apr 2006 23:44 GMT > The problem is, the code is HUGE, and we can't seem to track down where > the problem is happening, so as to be able to provide a simple coding [quoted text clipped - 6 lines] > comb to find the problem, I'm mostly just curious if anyone else has > used the same library and had a similar problem. yep i had this problem about a year ago on a tree , that incedentally was written on os X then transposed to linux & windows SE.
if i remember rightly it was down to the tree listener.
but it sounds like your problem is also down to the threads, and updating the display in the wrong thread ,causing the images to corrupt.
a snapshot of the corrupted screen will tell me. (as there is some differences on osx)
the other thing to watch for on osx is the mouse, and button clicks, if you use the 'wrong' listener you will miss or get multiple mouse clicks. but it works fine on the other 2 platforms
As for java being cross platform , I develop solution on all 3 , osx ,linux,windows & i can tell you it is not identical, once you get off the main road.
Steve
 Signature NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth
Tuvas - 21 Apr 2006 05:07 GMT Which listener works with Macs then, and which works with the others? I'll get a snapshot of the mac version ASAP, probably tommorow or Saturday. We are only really trying to build a system that works for Linux, Solarias Unix, and OSX, we don't care as much about Windows, although it is nice. Thanks for the help! Any ideas as to what we can do to fix the problem would be nice as well...
James McGill - 21 Apr 2006 05:18 GMT First, this is not homework... I want to do a component that can be like a progress bar or vu meter bar, that sort of thing, where the colors make a smooth transition between given extremes. So, let's say the parameters were "Red" and "Green", and I guess scale and weighting factors, I could get a set of colors that were "between" Red and Green in a given color space. I imagine the function could then accept "Black" and "White" and render some sort of grayscale.
Thanks for any ideas or suggestions.
James
Oliver Wong - 21 Apr 2006 15:12 GMT > First, this is not homework... I want to do a component that can be > like a progress bar or vu meter bar, that sort of thing, where the [quoted text clipped - 3 lines] > in a given color space. I imagine the function could then accept > "Black" and "White" and render some sort of grayscale. You basically just interpolate between each of the R, G and B values.
- Oliver
Roedy Green - 21 Apr 2006 21:22 GMT On Thu, 20 Apr 2006 21:18:54 -0700, James McGill <jmcgill@cs.arizona.edu> wrote, quoted or indirectly quoted someone who said :
>First, this is not homework... I want to do a component that can be >like a progress bar or vu meter bar, that sort of thing, where the [quoted text clipped - 3 lines] >in a given color space. I imagine the function could then accept >"Black" and "White" and render some sort of grayscale. Is your problem computing the intermediate colours?
Here is a snippet from my FadingCellRenderer that shows new entries bright and they gradually fade:
// compute intermediate colours by linear interpolation foreground = new Color ( interpolate(age, timeToHold, timeToFinish, freshForeground.getRed(), fadedForeground.getRed()), interpolate(age, timeToHold, timeToFinish, freshForeground.getGreen(), fadedForeground.getGreen()), interpolate(age, timeToHold, timeToFinish, freshForeground.getBlue(), fadedForeground.getBlue()));
background = new Color( interpolate(age, timeToHold, timeToFinish, freshBackground.getRed(), fadedBackground.getRed()), interpolate(age, timeToHold, timeToFinish, freshBackground.getGreen(), fadedBackground.getGreen()), interpolate(age, timeToHold, timeToFinish, freshBackground.getBlue(), fadedBackground.getBlue()));
/** * linearly interpolate the value of y given x with points on * the line x1,y1 and x2,y2 * * @param x * @param x1 * @param x2 * @param y1 * @param y2 */ private static final int interpolate (int x, int x1, int x2, int y1, int y2) { if ( x2 == x1 ) { return (y1 + y2) / 2; } else { return y1 + ( ( y2-y1 ) * (x - x1) ) / (x2 - x1); } }
 Signature Canadian Mind Products, Roedy Green. http://mindprod.com Java custom programming, consulting and coaching.
steve - 21 Apr 2006 22:50 GMT > Which listener works with Macs then, and which works with the others? > I'll get a snapshot of the mac version ASAP, probably tommorow or > Saturday. We are only really trying to build a system that works for > Linux, Solarias Unix, and OSX, we don't care as much about Windows, > although it is nice. Thanks for the help! Any ideas as to what we can > do to fix the problem would be nice as well... i did not say it WAS you listener , just that it might be, or it could be a thread issue.
personally I would extract the tree code to its bare minimum, into a separate class , that could be passed a init. construct. Then test just that class on osx /linux, and if you find it not working post the class here.
That said I have just been thru my source. ( after 1 year).
what i can say is that i have the code working both on Linux & osx , daily (i use osx .some of my staff use linux suse 9.3 , others use windows SE)
ahhhhhh! it appears i tried various mouse events, mouse pressed,entered then settled on mouseclicked.
public void mouseClicked(MouseEvent me) { // 19/06/2005 this was f.cked on linux the double click was not working correctly!! //corruption of icons ,or partial expanansion int mouseCount = me.getClickCount(); //get the click count JTree at = albumView.getAlbumTree();
//mycode TreePath tp = at.getSelectionPath();
if (tp != null) { DefaultMutableTreeNode obj = (DefaultMutableTreeNode) tp.getLastPathComponent();
//end of my code if (me.getSource() instanceof PhotoIcon) { PhotoIcon pi = (PhotoIcon) me.getSource();
//System.out.println("double CLick: "+pi.getPhoto()); if ( (//(mouseCount == constants.DOUBLE_CLICK) || (mouseCount == constants.SINGLE_CLICK)) && (build_rep == false)) { showPhoto(pi.getPhoto(), mouseCount);
// this.repaint(); } else if (build_rep == true) { addtoBuildWin(pi); // stick it in the bottom cos its a build rep. } } else { if ( (//(mouseCount == constants.DOUBLE_CLICK) || (mouseCount == constants.SINGLE_CLICK))&& obj.getUserObject() instanceof Section && me.getSource() instanceof JTree) { //// System.out.println("Section: "+obj+" "+me.getSource()); showSection((Section) obj.getUserObject()); } else { if ( (//(mouseCount == constants.DOUBLE_CLICK) || (mouseCount == constants.SINGLE_CLICK)) && obj.getUserObject() instanceof Photo && me.getSource() instanceof JTree) { showPhoto((Photo) obj.getUserObject(), mouseCount);
// this.repaint(); } else { if ( (//(mouseCount == constants.DOUBLE_CLICK) || (mouseCount == constants.SINGLE_CLICK)) && obj.getUserObject() instanceof Report && me.getSource() instanceof JTree) { editReport((Report) obj.getUserObject()); ; } } } } } }
 Signature NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|