Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2016
    Posts
    2
    Rep Power
    0

    Default ComboBox with correct aligned elements

    I need following ComboBox:
    1. Arrowbutton needs to be on the left side.
    2. Textalignment needs to be left-to-right.
    3. Popup alignment needs to be left-to-right, with the left top corner of the popup touching the left bottom corner of the combobox textfield.

    As I see it, if I align elements left-to-right, then
    1. Text is aligned left-to-right
    2. Popup is aligned left-to-right
    3. Arrowbutton is on the right side.

    If I align elements right-to-left, then
    1. Text is aligned right-to-left
    2. Popup is aligned right-to-left
    3. Arrowbutton is on the left side.

    What do I have to do?

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: ComboBox with correct aligned elements

    Quote Originally Posted by FriendOfMisery View Post
    What do I have to do?
    Check out the tutorials in my signature for the JComboBox class and try some stuff. Then, when you can't get it to work, post your code and ask some specific questions. Don't post a lot of code, just enough that will compile and execute to demonstrate the problem.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: ComboBox with correct aligned elements

    Since this is JavaFX, then have you looked at the JavaFX tutorials, especially the ComboBox one?
    https://docs.oracle.com/javafx/2/ui_.../combo-box.htm
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  4. #4
    Join Date
    Feb 2016
    Posts
    2
    Rep Power
    0

    Default Re: ComboBox with correct aligned elements

    Looked into the tutorials, tried out certain things, etc.. I would not post this, if there had been tutorials available on this. One can set alignment, but this would not archive what I want.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: ComboBox with correct aligned elements

    Quote Originally Posted by FriendOfMisery View Post
    Looked into the tutorials, tried out certain things, etc.. I would not post this, if there had been tutorials available on this.
    Not everyone does this, sadly, which is why we point them out.
    There are lots of questions that come from people for whom the various Java forums are their first port of call...

    Anyway, I've not done this myself, but I seem to remember you can get at the individual bits of a ComboBox.
    So you can access the Cell used in the list, which means you can set the alignment for those?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: ComboBox with correct aligned elements

    JavaFX! I totally missed that key point.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  7. #7
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    398
    Rep Power
    5

    Default Re: ComboBox with correct aligned elements

    'Not sure whether this is still of interest, but you can set the layout for individual elements of a combobox in javafx.

    Check this.

Similar Threads

  1. Replies: 2
    Last Post: 06-22-2015, 09:21 AM
  2. Replies: 3
    Last Post: 10-27-2013, 06:57 PM
  3. show elements in correct order
    By Shien in forum New To Java
    Replies: 4
    Last Post: 12-30-2011, 05:20 PM
  4. Left-aligned controls in a list
    By Markgm in forum AWT / Swing
    Replies: 4
    Last Post: 04-19-2011, 02:32 AM
  5. Tabs Won't Work In Right Aligned JPanel
    By davidedwardgill in forum AWT / Swing
    Replies: 0
    Last Post: 08-08-2008, 07:45 PM

Tags for this Thread

Posting Permissions

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