🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.swing
4 messages
4 total messages Started by dingfelder Tue, 19 Jul 2005 03:19
card layout issue
#488
Author: dingfelder
Date: Tue, 19 Jul 2005 03:19
18 lines
1451 bytes
I am having an issue where i create a card layout, and my show metho sometimes does not work

         JPanel cardPanel = new JPanel();
         CardLayout cards = new CardLayout();

In jbinit, I do:
         cardPanel.setLayout(cards);
         cardPanel.add(panel1, "First");
         cardPanel.add(panel2, "Second");
         cardPanel.add(panel3, "Third");
         cards.show(cardPanel, "First");

in the code, in the action for a particular button, I do

         cards.show(cardPanel, "First");

Why would this show method work at one point in the program but not later?
Re: card layout issue
#489
Author: dingfelder
Date: Tue, 19 Jul 2005 03:22
26 lines
1789 bytes
Forget I asked.  I misspelled the card panel string.

It seems that the card panel does not complain if you call show for a nonexistant card :(

Seems like it should throw an exception if you pass it a bad card name`.

"dingfelder" <dingfelder_nospam@sirtrack.com> wrote:
>
>I am having an issue where i create a card layout, and my show metho sometimes does not work
>
>         JPanel cardPanel = new JPanel();
>         CardLayout cards = new CardLayout();
>
>In jbinit, I do:
>         cardPanel.setLayout(cards);
>         cardPanel.add(panel1, "First");
>         cardPanel.add(panel2, "Second");
>         cardPanel.add(panel3, "Third");
>         cards.show(cardPanel, "First");
>
>in the code, in the action for a particular button, I do
>
>         cards.show(cardPanel, "First");
>
>Why would this show method work at one point in the program but not later?
Re: card layout issue
#492
Author: Lori M Olson [TeamB]
Date: Tue, 19 Jul 2005 14:26
31 lines
1836 bytes
dingfelder wrote:
> Forget I asked.  I misspelled the card panel string.
> 
> It seems that the card panel does not complain if you call show for a
> nonexistant card :(
> 
> Seems like it should throw an exception if you pass it a bad card
> name`.
> 

CardLayout has been around since Java 1.0.x.  It's always worked that 
way.  If they changed it now, it would break a lot of old code.

-- 

Regards,

Lori Olson [TeamB]

------------

Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.

Google Advanced Newsgroup Search
     http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
     http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
     http://www.visi.com/~gyles19/fom-serve/cache/1.html
Re: card layout issue
#504
Author: dingfelder
Date: Thu, 21 Jul 2005 01:28
40 lines
1998 bytes
I agree.
I'm not suggesting they change it, just that it was poor design to start with 

:)

Cheers !

"Lori M Olson [TeamB]" <javadragon@techie.com> wrote:
>dingfelder wrote:
>> Forget I asked.  I misspelled the card panel string.
>> 
>> It seems that the card panel does not complain if you call show for a
>> nonexistant card :(
>> 
>> Seems like it should throw an exception if you pass it a bad card
>> name`.
>> 
>
>CardLayout has been around since Java 1.0.x.  It's always worked that 
>way.  If they changed it now, it would break a lot of old code.
>
>-- 
>
>Regards,
>
>Lori Olson [TeamB]
>
>------------
>
>Save yourself, and everyone else, some time and search the
>newsgroups and the FAQ-O-Matic before posting your next
>question.
>
>Google Advanced Newsgroup Search
>     http://www.google.ca/advanced_group_search
>Other Newsgroup Searches:
>     http://www.borland.com/newsgroups/ngsearch.html
>Joi Ellis's FAQ-O-Matic:
>     http://www.visi.com/~gyles19/fom-serve/cache/1.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads