Showing posts with label icon. Show all posts
Showing posts with label icon. Show all posts

Window Pane Management

I have been creating buttons that have no text on them. They only have a graphic icon loaded from an image file. I noticed that the button size grows to accommodate larger pictures. This leads to different sized buttons and a messy user interface. There must be a way to keep a uniform button size, shrinking icon images as needed.

Another problem I have is when a control such as a button is invisible. The other controls rearrange during the paint() so as to obscure the position where the invisible control would be. I don't like this reshuffling of the screen when a control goes invisible. There should be a way to reserve space on the screen for a control that may become visible in the future. However this is not the default behavior.

I normally use appletViewer to test out my applets in development. But I found out that this tool only displays the embedded applet in an HTML page. It does not render any of the other HTML elements. Weird.

Button Behavior

You size an applet in the HTML page that hosts it. I find that you need to size the applet area carefully to allows your controls to be layed out as expected on the screen.

The general pattern I use when user input drives the display is to have a member variable of my JApplet derived class. There is conditional logic in the paint() method that depends on this variable. When a user action changes the variable state, repaint() is called to redraw the screen.

I've been doing a lot with buttons that have no text on them. They only have an icon image on them. I have encountered some problems with transparency. I would like the button background color to bleed through any white portion of my image. However does not seem to be the default behavior of the button class. Maybe I need to set some unknown options. I hope I do not need to code or draw my own button face.