Fixes sidebar issue with content disappearing.
fixes #6 - Use the correct LayoutManager for the CellRenderer/Editor - Fixed Button style
This commit is contained in:
parent
b9e43e1174
commit
0b35a9e880
@ -993,8 +993,14 @@ class PropertyCellRenderer implements TableCellRenderer {
|
|||||||
} else if (value instanceof String) {
|
} else if (value instanceof String) {
|
||||||
return new JLabel(value.toString());
|
return new JLabel(value.toString());
|
||||||
} else if (value instanceof eva2.gui.PropertyPanel) {
|
} else if (value instanceof eva2.gui.PropertyPanel) {
|
||||||
PropertyPanel propertyPanel = (PropertyPanel) value;
|
JComponent component = new JPanel();
|
||||||
return propertyPanel;
|
component.setLayout(new BorderLayout());
|
||||||
|
component.add((PropertyPanel) value, BorderLayout.CENTER);
|
||||||
|
final JButton dialogButton = new JButton("...");
|
||||||
|
dialogButton.setMargin(new Insets(0,0,0,0));
|
||||||
|
|
||||||
|
component.add(dialogButton, BorderLayout.LINE_END);
|
||||||
|
return component;
|
||||||
} else if (value instanceof PropertyText) {
|
} else if (value instanceof PropertyText) {
|
||||||
return (PropertyText) value;
|
return (PropertyText) value;
|
||||||
} else if (value instanceof PropertyBoolSelector) {
|
} else if (value instanceof PropertyBoolSelector) {
|
||||||
@ -1023,20 +1029,10 @@ class PropertyCellEditor extends AbstractCellEditor implements TableCellEditor {
|
|||||||
component = new JLabel(value.toString());
|
component = new JLabel(value.toString());
|
||||||
} else if (value instanceof PropertyPanel) {
|
} else if (value instanceof PropertyPanel) {
|
||||||
component = new JPanel();
|
component = new JPanel();
|
||||||
component.setLayout(new GridBagLayout());
|
component.setLayout(new BorderLayout());
|
||||||
component.setOpaque(false);
|
component.add((PropertyPanel) value, BorderLayout.CENTER);
|
||||||
GridBagConstraints gbConstraints = new GridBagConstraints();
|
|
||||||
gbConstraints.gridx = 0;
|
|
||||||
gbConstraints.gridy = 0;
|
|
||||||
gbConstraints.weightx = 1.0;
|
|
||||||
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
|
||||||
component.add((PropertyPanel) value, gbConstraints);
|
|
||||||
final JButton dialogButton = new JButton("...");
|
final JButton dialogButton = new JButton("...");
|
||||||
dialogButton.setFocusPainted(false);
|
dialogButton.setMargin(new Insets(0,0,0,0));
|
||||||
dialogButton.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
|
|
||||||
dialogButton.setBorderPainted(false);
|
|
||||||
//dialogButton.setContentAreaFilled(false);
|
|
||||||
dialogButton.setBackground(Color.LIGHT_GRAY);
|
|
||||||
dialogButton.addActionListener(new ActionListener() {
|
dialogButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent event) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
@ -1044,13 +1040,7 @@ class PropertyCellEditor extends AbstractCellEditor implements TableCellEditor {
|
|||||||
fireEditingStopped();
|
fireEditingStopped();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
gbConstraints = new GridBagConstraints();
|
component.add(dialogButton, BorderLayout.LINE_END);
|
||||||
gbConstraints.weighty = 1.0;
|
|
||||||
gbConstraints.fill = GridBagConstraints.BOTH;
|
|
||||||
gbConstraints.anchor = GridBagConstraints.LINE_END;
|
|
||||||
gbConstraints.gridy = 0;
|
|
||||||
gbConstraints.gridx = 1;
|
|
||||||
component.add(dialogButton, gbConstraints);
|
|
||||||
} else if (value instanceof PropertyText) {
|
} else if (value instanceof PropertyText) {
|
||||||
component = (PropertyText) value;
|
component = (PropertyText) value;
|
||||||
} else if (value instanceof PropertyBoolSelector) {
|
} else if (value instanceof PropertyBoolSelector) {
|
||||||
@ -1060,14 +1050,6 @@ class PropertyCellEditor extends AbstractCellEditor implements TableCellEditor {
|
|||||||
} else {
|
} else {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSelected) {
|
|
||||||
component.setForeground(table.getSelectionForeground());
|
|
||||||
component.setBackground(table.getSelectionBackground());
|
|
||||||
} else {
|
|
||||||
component.setForeground(table.getForeground());
|
|
||||||
component.setBackground(table.getBackground());
|
|
||||||
}
|
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user