Re: FlowLayout and lightweight IDEs
On Aug 9, 1:23 am, bH <bherbs...@hotmail.com> wrote:
...about using a FlowLayout. The lineup of labels and
textfields should be made in two horizontal rows by the size given in
Do you intend to transform this code into a web app.
using the Google API? ..
..I tested this with 3 lightweight IDE's All use the same
...the reason I ask is that AFAIU, the Google API is
limited to Java 1.4.
But to the immediate problem.
1) When posting code, please make sure the lines are 'hard wrapped'
before news clients are forced to wrap the text. I provide TWC
to help with that. <http://pscode.org/twc/>
2) It is usually easiest to develop a GUI within a main (J)Panel,
that will be added to the content pane of a (J)Frame or (J)Applet
(or (J)Window or (J)Dialog or JOptionPane..).
3) When working with a JPanel, you would override paintComponent()
rather than paint().
4) Even when working with JPanels, I would not recommend trying to
mix laid out widgets *in* a custom painted panel. The best way to
approach that is to do the custom painting in an appropriately named
JPanel sub-class (e.g. MapPanel), and add the sub-class to the
main panel, along with the other controls in different layout
constraints of the main panel.
5) A FlowLayout is probably not appropriate for the type of layout
you seem to be attempting. A GridBagLayout might achieve the effect,
but I would probably try it as a nested layout. Since I am not
entirely sure of the layout/effect you want to achieve, or how the
space should be reassigned on resize, I will leave further speculation
on that, for the moment.
6) I think others have commented on blocking the EDT during
image download. It would be better to show a progress bar,
and allow the 'load' button to spring back after activation
(though you might disable it once a download starts, the
enable it once the image arrives).