Can't Make Swing JList look like AWT Choice

Discussion in 'Java' started by Don Sykes, Feb 25, 2004.

  1. Don Sykes

    Don Sykes Guest

    I've converted most of my apps to Swing from AWT, but I can't seem to
    get a JList in a JScrollPane to behave like Choice does: i.e. show just
    one option at a time for selection. It always fills up the JPanel, in my
    case, displaying 4 or more options at a time.
    I've tried things like setVisibleRowCount(1) and setting the size of the
    JScrollPane explicitly, but no luck. Any suggestions??

    TIA
    --

    Have Java, Will Travel
    Wire paladin, San Francisco

    (paladinATalphaseDOTcom)
     
    Don Sykes, Feb 25, 2004
    #1
    1. Advertising

  2. Don Sykes

    xarax Guest

    "Don Sykes" <> wrote in message
    news:sI5%b.2576$...
    >
    > I've converted most of my apps to Swing from AWT, but I can't seem to
    > get a JList in a JScrollPane to behave like Choice does: i.e. show just
    > one option at a time for selection. It always fills up the JPanel, in my
    > case, displaying 4 or more options at a time.
    > I've tried things like setVisibleRowCount(1) and setting the size of the
    > JScrollPane explicitly, but no luck. Any suggestions??
    >
    > TIA
    > --


    Uh, maybe you want a JComboBox?
     
    xarax, Feb 25, 2004
    #2
    1. Advertising

  3. Don Sykes

    Don Sykes Guest

    xarax wrote:

    > "Don Sykes" <> wrote in message
    > news:sI5%b.2576$...
    >
    >>I've converted most of my apps to Swing from AWT, but I can't seem to
    >>get a JList in a JScrollPane to behave like Choice does: i.e. show just
    >>one option at a time for selection. It always fills up the JPanel, in my
    >>case, displaying 4 or more options at a time.
    >>I've tried things like setVisibleRowCount(1) and setting the size of the
    >>JScrollPane explicitly, but no luck. Any suggestions??
    >>
    >>TIA
    >>--

    >
    >
    > Uh, maybe you want a JComboBox?
    >
    >

    Thanks.
    Silly me. The name JComboBox threw me off. I thought it was used to
    create dialog boxes with buttons!

    --

    Have Java, Will Travel
    Wire paladin, San Francisco

    (paladinATalphaseDOTcom)
     
    Don Sykes, Feb 25, 2004
    #3
  4. Don Sykes wrote:

    > xarax wrote:
    >
    >> "Don Sykes" <> wrote in message
    >> news:sI5%b.2576$...
    >>
    >>>I've converted most of my apps to Swing from AWT, but I can't seem to
    >>>get a JList in a JScrollPane to behave like Choice does: i.e. show just
    >>>one option at a time for selection. It always fills up the JPanel, in my
    >>>case, displaying 4 or more options at a time.
    >>>I've tried things like setVisibleRowCount(1) and setting the size of the
    >>>JScrollPane explicitly, but no luck. Any suggestions??
    >>>
    >>>TIA
    >>>--

    >>
    >>
    >> Uh, maybe you want a JComboBox?
    >>
    >>

    > Thanks.
    > Silly me. The name JComboBox threw me off. I thought it was used to
    > create dialog boxes with buttons!
    >


    You might want to check this out:

    http://java.sun.com/docs/books/tutorial/uiswing/components/components.html

    --
    Kind regards,
    Christophe Vanfleteren
     
    Christophe Vanfleteren, Feb 25, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex
    Replies:
    0
    Views:
    411
  2. Mickey Segal
    Replies:
    0
    Views:
    913
    Mickey Segal
    Feb 2, 2004
  3. mkrause
    Replies:
    0
    Views:
    680
    mkrause
    May 6, 2005
  4. =?iso-8859-1?q?J=FCrgen_Gerstacker?=

    A swing/awt component that looks like a LED

    =?iso-8859-1?q?J=FCrgen_Gerstacker?=, Dec 15, 2006, in forum: Java
    Replies:
    2
    Views:
    1,122
    =?iso-8859-1?q?J=FCrgen_Gerstacker?=
    Dec 17, 2006
  5. active
    Replies:
    4
    Views:
    289
    active
    Apr 3, 2007
Loading...

Share This Page