Skip to main content

Transparent JSpinner and JComboBox

1 reply [Last post]
linc
Offline
Joined: 2011-05-10
Points: 0

Hi!

I want to create both a transparent JSpinner and JComboBox on top of a JPanel with a background image. I've tried using setOpaque(false) but it doesn't seem to help.

How can I achieve this effect? Do I need to override some rendering function in JSpinner and JComboBox respectively?

Any help appreciated!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
linc
Offline
Joined: 2011-05-10
Points: 0

FYI

comboBox.setOpaque(false);
comboBox.setRenderer(new DefaultListCellRenderer(){
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
JComponent result = (JComponent)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
result.setOpaque(false);
return result;
}});

http://stackoverflow.com/questions/13939176/making-jcombobox-transparent

Any idea on how to solve the JSpinner transparency issue?