jframe

JFrame examples and tutorials (collection)

Today is organization day for me, and in an effort to organize everything I've ever written about a Java JFrame, here is a collection of links to all my Java JFrame examples and tutorials.

Mac Java - A default Mac menubar without a JFrame

Yesterday I ran into a pretty obscure situation in my Imagen application where I needed to show a modified Mac menubar, even though I didn't have a Java JFrame displayed at the time. The way Imagen works is that I show a JFrame, then hide it, and the application then waits for the user to do something with the application icon in the Mac Dock, typically dropping an image onto that icon.

Transparent JFrame - How to make a JFrame transparent on Mac OS X

Summary: How to make a Java JFrame transparent (translucent) on Mac OS X.

A lot of people complain about a lot of things in regards to Java on Apple's Mac OS X platform, and okay, occasionally I'm one of them, but a very cool thing you can do on OS X is to create translucent (transparent) frames and windows with Java.

Java xeyes - Follow the mouse cursor location outside a JFrame

A Java xeyes solution - I started working on my Java speech recognition app again today, and in the process I saw some source code I thought I should post here. When I was developing this app, I thought it would fun to put a GUI on it, and when I thought about what sort of GUI it should have, I thought of the old X-Windows xeyes app. I looked around to see if anyone had written a "Java xeyes" application, but from what I've seen, nobody has.

Hide Mac Desktop clutter with DesktopShield (free)

Update: I've taken the approach shown in this article and turned it into a much more robust Mac OS X app, which I'm selling for a whopping $0.99.

Follow this link for a free trial of my "Mac OS X Hide Your Desktop Icons" application.

I wrote a very small "Java on Mac OS X" application that I'd like to share here today. This one is a little different, so let me explain the problem.

I've found that using Mac OS X is different from using Windows, in that with Mac applications, I almost never use them in full-screen mode. Typically they occupy 1/2 or 2/3 of my over screen, and then I have to see my Mac Desktop behind the application window. I actually prefer everything about this approach except for one thing: My Desktop is usually very cluttered, and I don't like to see that clutter while I'm working.

A Java menubar example

Java Swing FAQ: How do I create a menubar (and menu and menuitems) in Java?

As I was working on a Java/Swing problem last week, I was scouring through the Mac OS X Java-Dev mailing list, and along the way I ran into some really nice source code I thought I could modify into a decent Java Menubar example. After a little rewriting, here is that "Java Menubar" example.

JFrame example - how to display a JFrame

This morning when I saw some Java code on a mailing list, it made me think that I needed to put a simple JFrame example out here, something that would show how to properly construct and display a JFrame without getting into a discussion of anything else.

JFrame color - How to set the JFrame background color

JFrame color FAQ: How do I set the JFrame background color?

In general, to set the JFrame background color, just call the JFrame setBackground method, like this:

jframe.setBackground(Color.RED);

Note that there are many more things you can do with the Java Color class, including:

JFrame title - how to set the JFrame title

JFrame title FAQ: How do I set the title of a JFrame?

Solution

There are two ways to set the JFrame title.

First, you can set the JFrame title when you construct your JFrame, like this:

JFrame size example - how to set the initial JFrame size

I've been getting back into the Java/Swing world during the last few days, and I thought I'd share some example code here. In my current application, one of the things I just worked on was setting the initial JFrame size to a value I liked.

Syndicate content