David Eason

Greenhorn
+ Follow
since Oct 31, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by David Eason

Three questions, all related.
1. Given that no version of either Netscape or Internet Explorer ever supported Java 2, I think Sun has an interest in making sure developers can take advantage in the latest features.
Is Sun better off if your web browser forces a download from Sun instead of providing a Microsoft or Netscape implementation based on older specs?
2. Since Java of some type is available from the Microsoft and Netscape offerings, users may not have much incentive to download the Sun browser plug-in offering the latest features. At the same time, most people who use Java seem to use it in a web browser. If you're Sun, are you really trying to make Java a platform in the sense that the average user goes to Best Buy looking for a PC bundled with Java 2 version 1.4 rather than Windows XP? Or do you just concede that battle (except for intranets) and concentrate on server-side and device-side Java, cases in which the user does not really think about the platform?
3. For what applications are new Java jobs most likely to appear?
23 years ago
Unfortunately Heller and Ernest are hidden behind et al. Will the page maintainers consider naming all three authors and briefly noting in the review that this is the RHE book?

[This message has been edited by David Eason (edited November 24, 2001).]
23 years ago

I am creating some components that extend JPanel, and don't know whether to use a Pane or a Panel suffix.


First, I don't think it matters a whole lot.
Secondly, I would note that Panel begets Applet and that JPanel begets AbstractColorChooserPanel, and I would use either of those as your precedents. In other words, use a more descriptive name (like Applet) or a class name ending in Panel. I can't find any example in the API of a Pane object begotten from the Panel or JPanel classes; however, you might if your class acts more like one of the classes ended in Pane, for example if you are deriving from Panel but your class will ultimately be a fancier form of ScrollPane.

23 years ago
I am looking for a web based tutorial or some really simple examples of how to get started creating custom awt-based components. I would like the examples to be non-swing but using the 1.1+ event model. Even if they just aggregate some existing components and add some functionality, that would be helpful I think.

23 years ago
Never thought of it that way, Valentin. Thanks for the visual 8|

Originally posted by vipul gupta1000:
only disappointment was that my girlfriend asked me to score not less than 90% ... she scored 100%... i missed by 1% that was the disappointment....


Congratulations to you and your girlfriend!
23 years ago

Originally posted by Valentin Crettaz:
You can find out if a class is immutable by looking at its API. If you can't find any method with which you could change its internal state (i.e. the value of its member variables and the one inherited from the superclasses) then you may deduce that the class is immutable. That is the class has no "mutator" methods, which means you cannot mutate (change) the state of the object. It may have "accessor" method (to access its internal state) though. Mutator are often method beginning with "set..." and accessor with "get..."


I asked a similar question in the Beginner's forum today. From the point of view of C++, the String class has a mutator method called <CODE>operator=</CODE> which lets me write:

Presumably the operator= method is hard coded into javac, since Java doesn't allow operator methods. So it seems that the String class does have a mutator method after all, albeit not one exposed to developers, and is therefore mutable.
What am I missing here?
[OK, I think I am done editing now.]
There is a tutorial at http://pandonia.canberra.edu.au/java/xadvisor/gridbag/gridbag.html I used the applet under the "Anchor" subhead to make some preliminary notes about the use of "fill" and "anchor" in combination. The applet is a little tricky because you have to change fill before anchor takes effect. Here are my notes so far:
<blockquote>
NONE + any anchor = no change in size and anchor honored
HORIZONTAL + NORTH or NORTHEAST or NORTHWEST or CENTER = top of cell, entire width.
HORIZONTAL + SOUTH or SOUTHEAST or SOUTHWEST = bottom of cell, entire width.
HORIZONTAL + EAST or WEST = vertical center of cell, entire width.
VERTICAL + NORTH or SOUTH or CENTER = horizontal center of cell, entire height
VERTICAL + WEST or NORTHWEST or SOUTHWEST = left side of cell, entire height
VERTICAL + EAST or NORTHEAST or SOUTHEAST = right side of cell, entire height
BOTH + anchor = entire height and width, so anchor not relevant
</blockquote>
Does this look about right? It seems to make some logical sense except I don't understand why HORIZONTAL + CENTER would put you at the top of the cell.

[This message has been edited by David Eason (edited November 09, 2001).]
23 years ago
The article Understanding that parameters are passed by value and not by reference ended this way:
<blockquote>
What if you want to disallow changes to the Point object in methods such as modifyPoint ? There are two solutions for this:

  • Pass a clone of the Point object to the modifyPoint method.

  • Make the Point object immutable.


  • </blockquote>
    My question is, how do you make an object "immutable"?
23 years ago
Sorry I couldn't think of a better example for the & operator. Basically, it is used to extract individual bits from a numeric type.


As for the shift operators, in other programming languages one use for them is fast multiplication and division by powers of 2. I am not sure if that particular optimization is necessary in Java, because I am not that familiar with Java.

[This message has been edited by David Eason (edited November 06, 2001).]
23 years ago
Bill Venners has written an exceptional article that gave clear answers to every question I could think of about exceptions.
http://www.javaworld.com/javaworld/jw-07-1998/jw-07-exceptions.html
As for your exception of interest:

<PRE>
java.lang.Object
|
+--java.lang.Throwable
|
+--java.lang.Exception
|
+--java.lang.InterruptedException
</PRE>

As described in Figure 4 from the Java World article, all Exceptions are checked except for RuntimeException and its progeny. Hence java.lang.InterruptedException is a checked exception.

[This message has been edited by David Eason (edited November 06, 2001).]
23 years ago
Check out Random Numbers from Maha's Java Gotchas page.

[This message has been edited by David Eason (edited November 06, 2001).]
23 years ago
It seems to have the side effect of keeping you from making your Cat class coderanch. Although in real life, I guess it would have package scope instead of public scope so it wouldn't matter.
I am in the "playing with code" phase right now anyway.
Thanks for the replies!

[This message has been edited by David Eason (edited November 06, 2001).]
23 years ago
I have a book Pure Java 2 by Kenneth Litwak. The author is fond of creating an extra class, which he calls a driver class, to house the main() method. He says this is purer object oriented design. For example:

Is there any value to this approach? This is my first post by the way, and I am happy to have found this site.

[This message has been edited by David Eason (edited November 06, 2001).]
23 years ago