Hey,
I am having difficulty creating a user interface. There is a problem with
code below in that when it is compiled and run the CardLayout panel is
empty due to the face that the only card described is empty (I think).
I know that I am using a combination of Swing and awt.
Any help would be much appreciated.
Thanks
Connell
// Card instruction label (at the top)
JLabel two=new JLabel("<html>Please scan the barcode of the book you want
to lend or enter it into the box below.</html>");
two.setVerticalAlignment(SwingConstants.TOP);
// TextField for user entry
barcode=new TextField(13);
// This panel should arrange the label with "Barcode:" to the left of the
barcode TextField
Panel m=new Panel();
m.setLayout(new FlowLayout());
m.add(new Label("Barcode:"));
m.add(barcode);
// This panel is a card in the CardLayout below which contains both the
instruction label (two) and the panel (m)
Panel bcode=new Panel();
bcode.setLayout(new BorderLayout());
bcode.add("North", two);
bcode.setLocation(0,0);
bcode.setSize(width, height-50);
bcode.add("South", m);
// This is the panel which has the CardLayout
Panel mpanel=new Panel();
cl=new CardLayout();
mpanel.setLayout(cl);
mpanel.add("bc", bcode);
mpanel.setLocation(0,50);
mpanel.setSize(width, height-50);
add(mpanel);
cl.show(mpanel, "bc");
Andrew Thompson - 01 Jan 2004 23:00 GMT
> Hey,
> I am having difficulty creating a user interface. There is a problem with
> code below in that when it is compiled and run the CardLayout panel is
> empty due to the face that the only card described is empty (I think).
> I know that I am using a combination of Swing and awt.
That's the start of the problem, don't do it.
There are good reasons for using AWT
and good reasons for using Swing, but
they do not mix together well.
> Any help would be much appreciated.
Change the app to either AWT or Swing.
If you still have a problem with it, I
suggest you do not post an SSCCE
(not snippets) to the group..
http://www.physci.org/codes/sscce.jsp
HTH
--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site
Andrew Thompson - 01 Jan 2004 23:02 GMT
...
> If you still have a problem with it, I
> suggest you do not post an SSCCE
..or rather.. 'suggest you _do_
post an SSCCE..' ..Duh!