Results 1 to 6 of 6
  1. #1
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default position text/ icon at JCheckBoxMenuItem

    Is there a way to get first the text and than the icon at
    a JCheckBoxMenuItem("select all pf",icon2); ?
    (was all over the place and can not find it)

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default Re: position text/ icon at JCheckBoxMenuItem

    setHorizontalTextPosition(...)

  3. #3
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: position text/ icon at JCheckBoxMenuItem

    Yes camickr I tried that one but it does not have any effect...
    So what would be the coding here when checkbmenu1 is of
    JCheckBoxMenuItem("select all pf",icon2);

    checkbmenu1.setHorizontalAlignment(checkbmenu1.LEF T);
    checkbmenu1.setHorizontalAlignment(JCheckBoxMenuIt em.LEFT);
    checkbmenu2.setHorizontalAlignment(SwingConstants. RIGHT);
    ...........

    checkbmenu1.setHorizontalAlignment(checkbmenu1.LEF T);

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: position text/ icon at JCheckBoxMenuItem

    setComponentOrientation(ComponentOrientation.RIGHT _TO_LEFT)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: position text/ icon at JCheckBoxMenuItem

    Thanks db that indeed works but now everything get's cluttered to the right
    so I tried: checkbmenu1.setHorizontalAlignment(JCheckBoxMenuIt em.LEADING);
    again no effect.... tricky stuff but I'll keep studying, thanks a lot

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: position text/ icon at JCheckBoxMenuItem

    Fundamental question: why do you think you need this?

    If you want total customization, you might need to write your own UI delegate, possibly extending BasicCheckBoxMenuItemUI. Is it worth the trouble, just to create a layout that is unfamiliar to regular users of GUIs?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Drawing Text on JButton Icon
    By tim8w in forum AWT / Swing
    Replies: 7
    Last Post: 01-19-2013, 08:35 AM
  2. How to position text?
    By Ike in forum New To Java
    Replies: 2
    Last Post: 10-08-2011, 06:05 PM
  3. cursor position in text area
    By Saran185 in forum AWT / Swing
    Replies: 1
    Last Post: 02-02-2011, 07:00 AM
  4. JCheckBoxMenuItem as JRadioButtonMenuItem
    By nik_meback in forum AWT / Swing
    Replies: 4
    Last Post: 12-16-2010, 12:19 PM
  5. Change the Font Size and Text Position
    By stayfierce in forum New To Java
    Replies: 1
    Last Post: 12-03-2009, 05:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •