Browse Source

修改一下控件

master
xiaoxia 8 years ago
parent
commit
0d8e87ef31
  1. 9
      designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java

9
designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java

@ -107,14 +107,16 @@ public class UITreeComboBox extends JComboBox{
class UITreeComboBoxRenderer extends DefaultListCellRenderer {
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus){
if(value != null){
TreePath path = (TreePath)value;
if(tree != null ){
TreePath path = tree.getSelectedTreePath()[0];
tree.setAndScrollSelectionPath(path);
Object node = path.getLastPathComponent();
value = node;
TreeCellRenderer r = tree.getCellRenderer();
JLabel lb = (JLabel)r.getTreeCellRendererComponent(
tree, value, isSelected, false, false, index,
cellHasFocus);
return lb;
}
return super.getListCellRendererComponent(list, value, index,
@ -138,6 +140,9 @@ public class UITreeComboBox extends JComboBox{
setSelectedItem(paths[0]);
MenuSelectionManager.defaultManager().clearSelectedPath();
} else {
tree.refreshUI();
tree.refreshTreeRoot();
repaint();
return;
}

Loading…
Cancel
Save