posted 9 years ago
hi Pete,
well, I guess it is possible, but.....
Here is some code that rescales everything within a frame, when the frame
is resized. That's the good news.
The bad news is that there are some major drawbacks.
For instance: in my progrma the button does not actually change its location or size.
So, when you shrink the frame, and the button, it will not detect mouse clicks correctly.
And make the frame smaller and move the mouse over the button. Anything that you notice?
Then the layout manager doesn't work as I would like it to work. Enlarge the frame,
and you'll see what I mean.
So, although it is a start, you need other things as well. First of all, you need to intercept
all mouse clicks over your frame. Doing this with the glasspane is a possibility.
Then you have you determine what original part that click represents, and determine the
corret component for which the cick was meant. And so on. Not for the fainted of heart.
It is certainly nice to give it a try to see how far you can go.
There are alternatives. Darryl mentions JavaFX. Although I myself just started learning JavaFX,
I think it is the best option.
Other possibilities involve making the size of every component relative to the content pane.
That will involve many revalidates, and that will not be easy and/or fast in any way.
Never tried it though, so who knows.
In 9 days, at Coursera website, a course on Android programming will start, which I will
follow as well. See if that comes with some auto resize possibilities.
And lastly: Campbell said in a positive way, that it is possible, at the cost of doubling the code
size. So, maybe he has already some sample code that he could share.
Greetz,
Piet
There are three kinds of actuaries: those who can count, and those who can't.