JideComboBox preferredSize not correct

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

JideComboBox preferredSize not correct

Postby gtt » Sat Nov 06, 2021 2:14 pm

JideComboBox preferredSize not correct (3.7.12) (Changing to JComboBox behaves correctly)

{code}

import com.jidesoft.swing.JideComboBox;

/**
* Very primitive test exapmple for preferredSize of a JideComboBox
* JFAST-6734
* @author olb 11/2021
*/
public class JideComboBoxtest {
public static void main(String[] args) {

// This text is not displayed completely
String [] items = {"Mein"};
JideComboBox cb = new JideComboBox(items)
{ // ... unless getPreferredSize() is slightly modified
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
return new Dimension(d.width+1, d.height);
}
}
;

JFrame frame = new JFrame();
JPanel panel = new JPanel(new FlowLayout());
panel.add(cb);
frame.add(panel);
frame.pack();
frame.setVisible(true);
}
{code}
Attachments
prefSize ohne Korrektur.png
prefSize ohne Korrektur.png (7.92 KiB) Viewed 5832 times
prefSize mit Korrektur.png
prefSize mit Korrektur.png (7.3 KiB) Viewed 5832 times
gtt
 
Posts: 289
Joined: Thu Feb 04, 2010 11:42 pm

Re: JideComboBox preferredSize not correct

Postby gtt » Thu Dec 23, 2021 7:54 am

what about my prevoius post?
gtt
 
Posts: 289
Joined: Thu Feb 04, 2010 11:42 pm

Re: JideComboBox preferredSize not correct

Postby JIDE Support » Thu Dec 23, 2021 11:16 am

There is a miscalculation in the preferred size. We will fix it. Before it, you can use your workaround for now.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37135
Joined: Sun Sep 14, 2003 10:49 am

Re: JideComboBox preferredSize not correct

Postby gtt » Fri Dec 24, 2021 2:51 am

Ok, thanks for this shorttime answer,
but please keep in mind we are selling a Low Code platform which extremely depends on
customizable swing beans (components) and a lot of internal customizable features and
layouts depend on the size behaviour of each other.

Therefore this is important for us.

kindly regards markus
gtt
 
Posts: 289
Joined: Thu Feb 04, 2010 11:42 pm

Re: JideComboBox preferredSize not correct

Postby JIDE Support » Tue Feb 22, 2022 7:13 pm

Just so you know, this bug is fixed in the latest 3.7.13 release.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37135
Joined: Sun Sep 14, 2003 10:49 am

Re: JideComboBox preferredSize not correct

Postby gtt » Thu Mar 03, 2022 11:23 am

Thank you for prompt reaction,

so i switched to 3.7.13 but unfortunatly nothing changed.

Again: This ist the very very simple example that produces a non complete text "Mein"
if i use JideComboBox.

Switching to JComboBox it shows a complete Text, fine.

Example 1:

public class JideComboBoxtest {
public static void main(String[] args) {

// This text is not displayed completely
String [] items = {"Mein"};
JideComboBox cb = new JideComboBox(items);
// JComboBox cb = new JComboBox(items);

JFrame frame = new JFrame();
JPanel panel = new JPanel(new FlowLayout());
panel.add(cb);
frame.add(panel);
frame.pack();
frame.setVisible(true);
}
}



Example 2: This is also very important : Only a little bit more complex.
JComboxBox renders fine, JideComboBox doesnt.


public class JideComboBoxtest {
public static void main(String[] args) {

// This text is not displayed completely
String [] items = {"Mein"};
JideComboBox cb = new JideComboBox(items);
// JComboBox cb = new JComboBox(items);

cb.setRenderer(new BorderListCellRenderer(20));

JFrame frame = new JFrame();
JPanel panel = new JPanel(new FlowLayout());
panel.add(cb);
frame.add(panel);
frame.pack();
frame.setVisible(true);
}

static class BorderListCellRenderer implements ListCellRenderer {
private Border insetBorder;
private DefaultListCellRenderer defaultRenderer;

public BorderListCellRenderer(int rightMargin) {
this.insetBorder = new EmptyBorder(0, 2, 0, rightMargin);
this.defaultRenderer = new DefaultListCellRenderer();
}

@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {

JLabel renderer = (JLabel) defaultRenderer
.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
renderer.setBorder(insetBorder);
JPanel p = new JPanel(new BorderLayout());
p.add(BorderLayout.CENTER, new JLabel(value.toString()));
p.add(BorderLayout.EAST, new JLabel(NamedIcon.ARROW_DOWN.getImageIcon()));
return p;
}
}
}
gtt
 
Posts: 289
Joined: Thu Feb 04, 2010 11:42 pm

Re: JideComboBox preferredSize not correct

Postby JIDE Support » Fri Mar 04, 2022 12:02 am

Thanks. I need to do some further fix.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37135
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 6 guests