Matthew Alesi

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

Recent posts by Matthew Alesi

I've not read the Sanghera book, but I can easily vouch for the Sierra/Bates one. It's a fantastic book to learn from and covers every topic in plenty of detail. I studied from that book extensively and was able to achieve a 98% .
I was considering making a program that includes using the javac tool, as well as the java command line tool, in the GUI as a critical part. As an example I would site an IDE like NetBeans, which can compile your files as well as run a "mini" command line in the bottom of the window when you run your program.

How would I go about using javac to compile files in my program, and how would I go about displaying the command line output of the java tool in a textarea in my program? Any leads, however small, would be much appreciated!!!

16 years ago
There's no actual term "null interface." What you might be referring to is a marker interface, which is indeed an interface defined with no actual methods to implement.

One of the most well-known examples is Serializable. When you implement Serializable, you do not have to actually implement any methods; you are simply telling the JVM that this class is allowed to be serialized. Another example is the Java 5 addition RandomAccess, which is implemented by ArrayList (and other classes) to signify that it provides effecient ( O(1) ) access to its elements.

So that's all there is to "null" interfaces.
16 years ago
I asked this question before, but apparently it was a "thread hi-jack" .

I've often heard of Javascript described as "versatile" and that it has multiple uses "both in and out" of the WWW. The thing is, I've never really heard of any examples of Javascript being used in places other than web pages.

Can somebody show me where I might use javascript in a non-web page environment? It sounds like it might be interesting, and I really like Javascript (from what I know of it).
[Thread hi-jack removed. Please start new topics for your own questions.]
[ May 04, 2007: Message edited by: Bear Bibeault ]
All this leads me to wonder...

It seems like the Web that we have today, while awesome, is just a mixing pot of technologies that might have been implemented in a much better way. Why is it that the Web seems to be implemented so haphazardly? With all the power and potential that interactive technologies like Ajax have, why are we still limited to confined, finicky, and often much slower browser windows? (This is probably why I stick to desktop applications!)

It seems to me like it would be much cooler to have a kind of Web where all content wasn't bound by a browser, where web pages could render themselves outside the box--almost Java Web Start-ish but more lightweight and with web apps. But that's just my ramblings. What are the author's thoughts?
That's really interesting. Like I said, I'd really like to learn web programming, but I've been put off by what seemed to be its messy nature. It's good to hear that web programming is taking a more standardized approach.

A really neat thing about your book is that it focuses on projects and practical applications (ten, nonetheless), rather than just hypothetical examples of what you might do with random pieces of technology. That said, would somebody like me, who is trying to learn, be able to pick up on what is going on in these projects? I feel like I would really like this book, I'm just wondering if I'd be able to understand it.
I do a lot of Java programming and I'm used to the world of desktop applications. So when I look at web programming and JavaScript and AJAX and such, it always looks so...disorganized. It seems like there are different rules for every browser, all sorts of workarounds and variations necessary.

How would you introduce somebody like me into web programming? It still remains an interesting field for me, I'm just not used to it. I'd really like to see what it has to offer.
[ May 02, 2007: Message edited by: Matthew Alesi ]
Here's a small program that replicates the problem. You have a button on the top that sets the text of a label on a panel within the scroll pane. However, the window doesn't update.

I hope this helps!
16 years ago
This seems like an elementary issue, but it's tarnishing my application. When my GUI first shows, it's a toolbar with an empty JScrollPane below it, and you're supposed to cllick Open in the toolbar, and then stuff shows up below. But when I set up the stuff below and call setVisible(true) on the scrollpane to display all the contents, nothing shows up. The only way to make it display is to resize the frame.

Nonetheless, whenever I make any subsequent changes, the GUI updates itself properly.

Why is this happening, and how can I get my GUI to repaint for sure without an ugly (unnecessary) resize?

This is due soon. Thanks everybody!
16 years ago
if it helps at all, the GUI constructs a "page" in a JPanel with several components, and then places the panel in a JScrollPane to make it scrollable like a web page.

Just for a little perspective.
16 years ago
I didn't post any code because it is indeed long. My GUI class contains private references to a JFrame and all the components that it displays, which includes subpanels, a scroll pane, a toolbar, etc. The class constructor (with helper methods) initializes all these components and properly assembles them into my main window. During this initialization step, each of the Action classes is instantiated and associated with a toolbar item. Since the tasks of each of the Action classes affect elements of the GUI (e.g., opening a file displays a report in the scroll pane), I made them inner classes so they have direct access to all the component references. My initial question was whether it would be a bad idea to make these Action classes normal (non-inner) classes, and instead give the instance variables of the GUI class default (package) access so the Action classes could still function as they do now.

I definitely understand how this might sound suspicious as you say, and since I don't have much experience in this area, I'd REALLY like to hear more design ideas. I want to do this well, it's really an experience issue.
16 years ago
I'm writing a project to be graded, and one of the important parts of this project is good code structure. Good encapsulation, loose coupling, and all that. However, I have a problem when it comes to my GUI.

My program uses standard UI-model separation, and all the GUI classes are in their own package. I decided to implement my GUI actions by subclassing Swing's AbstractAction, so that I can use the same action in tooblars and menus if I like. My program is not complicated enough for a controller, so the actionPerformed method in each of these AbstractAction subclasses does all the work associated with that action. As of now, these AbstractAction subclasses are inner classes within my main GUI class.

This GUI file is getting outrageously long, and it is the only class in its package. The action classes could stand on their own, but I would have to open up my GUI's private component instance variables to package access. As a result, only classes within the package would be able to use these variables, but they would be opened up nonetheless.

<b>Bottom line: is it better design to keep all these AbstractAction subclasses within my GUI class as one enormous file, or should I make them separate classes and give my instance variables package access?</b>

Thanks everybody!
16 years ago
I'm creating a program that involves making a page of sorts. My "page" is a JPanel using BoxLayout (vertically), with a JLabel title, a JTableHeader and JTable full of data, and a JPanel at the bottom with some more info inside. The entire page panel is wrapped inside a JScrollPane and placed in my a JFrame. The entire thing is meant to look like almost like a website; you don't scroll the table itself, you scroll the whole page.

The problem is the table width. The table, by default sets its width to that of the panel it's in, but since the values don't nearly fill up all this space it looks astronomically wide. Every kind of setSize, etc. method that exists requires a height in addition to a width, but I don't want to set the height; the number of table rows is variable.

Can anybody help me figure out a simple way to set the width of my JTable so that it doesn't take over the pane?

Thanks all!!
16 years ago
That sounds great--when do you anticipate this next volume will be released? Is it a future project or is it in the works right now?
16 years ago