Different from OS10 to Unix?

T

Tuvas

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!
 
O

Oliver Wong

Tuvas said:
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?

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
 
T

Tuvas

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.
 
M

Monique Y. Mudama

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.

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.
 
S

steve

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.

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
 
T

Tuvas

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...
 
J

James McGill

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
 
O

Oliver Wong

James McGill 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
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.

You basically just interpolate between each of the R, G and B values.

- Oliver
 
R

Roedy Green

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.

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);
}
}
 
S

steve

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 fucked 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());
;
}
}
}
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top