Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging the combobox starting point
    primarykey
    data
    text
    <p>I have a combobox that is put in a 20x20 field, so only the button is shown. </p> <p>When the user clicks the button, it drops down a popupmenu that is 150 wide (using Mark McLaren's WiderDropDownCombo solution). </p> <p>However, the button is on the rightmost side of the panel, that contains 2 other fields (both JTextFields). When I open the dropdown menu, it starts from the top-left corner by default and goes out of bounds for the area. I need to change that so the combobox would appear beneath all fields. </p> <p>I've tried messing with CellRenderers and orientation, but It doesn't seem to work. Anyone know something about the solution?!</p> <p>My code for the part that creates the field is following :</p> <pre><code> HistoryProcessor processor = new HistoryProcessor(field.getName().toLowerCase()); amount = new JTextField( amountString ); currency = new JTextField( currencyString ); amount.setMinimumSize( new Dimension(94, 20) ); amount.setPreferredSize( amount.getMinimumSize() ); amount.setMaximumSize( amount.getMinimumSize() ); currency.setMinimumSize( new Dimension(30, 20) ); currency.setPreferredSize( currency.getMinimumSize() ); currency.setMaximumSize( currency.getMinimumSize() ); popupButton = processor.populateHistoryBox(); popupButton.setWide(true); popupButton.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); popupButton.setMinimumSize(new Dimension(20, 20)); popupButton.setPreferredSize(popupButton.getMinimumSize()); popupButton.setMaximumSize(popupButton.getMinimumSize()); panel.add(amount, BorderLayout.WEST); panel.add(currency, BorderLayout.CENTER); panel.add(popupButton, BorderLayout.EAST); popupButton.addPopupMenuListener(new MoneyHistoryListener(this)); </code></pre> <p>where amount is the first field, currency the second and popupButton is the combobox. it is automatically filled by HistoryProcessor. Here's an image to my problem : <a href="https://i.stack.imgur.com/X3ZLk.jpg" rel="nofollow noreferrer">http://i.stack.imgur.com/X3ZLk.jpg</a></p> <p><img src="https://i.stack.imgur.com/P0nKk.jpg" alt="enter image description here"></p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload