Browse Source

REPORT-4634 组件叠加体验优化=>5 支持 delete 和 backspace 删除组件

master
plough 7 years ago
parent
commit
3c01476b7b
  1. 19
      designer_form/src/com/fr/design/designer/beans/actions/FormDeleteAction.java

19
designer_form/src/com/fr/design/designer/beans/actions/FormDeleteAction.java

@ -5,7 +5,7 @@ package com.fr.design.designer.beans.actions;
import java.awt.event.KeyEvent;
import javax.swing.KeyStroke;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.general.Inter;
@ -26,7 +26,15 @@ public class FormDeleteAction extends FormUndoableAction {
this.setMnemonic('D');
// Richie:删除菜单图标
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png"));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0));
}
@Override
public JComponent createToolBarComponent() {
JComponent comp = super.createToolBarComponent();
// 除了 BACKSPACE 之外,DELETE 键也要能删除(直接在此处添加绑定,没有按钮提示)
comp.registerKeyboardAction(this, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
return comp;
}
/**
@ -50,13 +58,6 @@ public class FormDeleteAction extends FormUndoableAction {
@Override
public void update() {
// FormDesigner f = this.getEditingComponent();
// if (f == null) {
// this.setEnabled(false);
// return;
// }
// SelectionModel selection = f.getSelectionModel();
// this.setEnabled(selection.hasSelectionComponent());
this.setEnabled(true);
}
}
Loading…
Cancel
Save