Java Code Examples for javax.swing.Action

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project beanmill_1, under directory /src/main/java/com/traxel/lumbermill/desk/.

Source file: WindowMenu.java

  22 
vote

/** 
 * --------------------------------------- Instance Initialization ---------------------------------------
 * @param desktop  DOCUMENT ME!
 */
public WindowMenu(final MillDesktop desktop){
  super("Windows");
  final Action action;
  add(new Cascade(desktop));
  add(new TileHorizontal(desktop));
  add(new TileVertical(desktop));
  add(new MinimizeAll(desktop));
  add(new RestoreAll(desktop));
  addSeparator();
}
 

Example 2

From project BMach, under directory /src/jsyntaxpane/actions/.

Source file: ActionUtils.java

  22 
vote

/** 
 * Searches all actions of a JTextComponent for ab action of the given class and returns the first one that matches that class, or null if no Action is found
 * @param < T >
 * @param target
 * @param aClass
 * @return Action object of that class or null
 */
public static <T extends Action>T getAction(JTextComponent target,Class<T> aClass){
  for (  Object k : target.getActionMap().allKeys()) {
    Action a=target.getActionMap().get(k);
    if (aClass.isInstance(a)) {
      @SuppressWarnings("unchecked") T t=(T)a;
      return t;
    }
  }
  return null;
}
 

Example 3

From project codjo-broadcast, under directory /codjo-broadcast-gui/src/main/java/net/codjo/broadcast/gui/plugin/.

Source file: BroadcastGuiPlugin.java

  22 
vote

void registerActions(GuiConfiguration guiConfiguration,MutableGuiContext guiContext){
  WizardAction wizardAction=createWizardAction(guiConfiguration);
  guiConfiguration.registerAction(this,WIZARD_ACTION,wizardAction);
  Action filesAction=new BroadcastFilesAction(guiContext);
  guiConfiguration.registerAction(this,BROADCAST_FILES_ACTION,filesAction);
  Action sectionsAction=new BroadcastSectionsAction(guiContext);
  guiConfiguration.registerAction(this,BROADCAST_SECTIONS_ACTION,sectionsAction);
  if (configuration.isGenericSelectorInstalled()) {
    Action selectorsAction=new BroadcastSelectorsAction(guiContext);
    guiConfiguration.registerAction(this,BROADCAST_SELECTORS_ACTION,selectorsAction);
  }
}
 

Example 4

From project codjo-control, under directory /codjo-control-gui/src/test/java/net/codjo/control/gui/plugin/.

Source file: QuarantineManagerTest.java

  22 
vote

public void test_action() throws Exception {
  Action action=configurationMock.getLastRegisteredAction();
  assertNotNull(action);
  assertNotNull(action.getValue(AbstractAction.SMALL_ICON));
  assertEquals("Emetteur",action.getValue(AbstractAction.NAME));
  assertEquals("Affiche la liste des emetteurs",action.getValue(AbstractAction.SHORT_DESCRIPTION));
}
 

Example 5

From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/launcher/.

Source file: ManagerStateModifier.java

  22 
vote

private void enableAction(boolean enable){
  for (int i=0; i < popupMenu.getComponentCount(); i++) {
    Component component=popupMenu.getComponent(i);
    if (component instanceof JMenuItem) {
      Action action=((JMenuItem)component).getAction();
      if (action instanceof DesactivableAction && ((DesactivableAction)action).isDesactivable()) {
        action.setEnabled(enable);
      }
    }
  }
}
 

Example 6

From project codjo-imports, under directory /codjo-imports-gui/src/main/java/net/codjo/imports/gui/plugin/.

Source file: ImportGuiPlugin.java

  22 
vote

void registerActions(GuiConfiguration guiConfiguration){
  WizardAction wizardAction=createWizardAction(guiConfiguration);
  guiConfiguration.registerAction(this,WIZARD_ACTION,wizardAction);
  Action importAction=new ImportAction(guiContext);
  guiConfiguration.registerAction(this,IMPORT_ACTION,importAction);
}
 

Example 7

From project codjo-segmentation, under directory /codjo-segmentation-gui/src/main/java/net/codjo/segmentation/gui/settings/.

Source file: AxisTreeToolBar.java

  22 
vote

@Override public void setEnabled(boolean enabled){
  super.setEnabled(enabled);
  for (  Object object : allActions.values()) {
    Action action=(Action)object;
    action.setEnabled(enabled);
  }
}
 

Example 8

From project dawn-isencia, under directory /com.isencia.passerelle.engine/src/main/java/com/isencia/passerelle/actor/gui/graph/userlib/.

Source file: AddUserLibraryFolderMenuItemFactory.java

  22 
vote

/** 
 * Add an item to the given context menu that will delete the selected item for the user library
 */
public JMenuItem create(final JContextMenu menu,final NamedObj object){
  if (object instanceof CompositeEntity) {
    if (panel.getUserLibrary() == object || (object instanceof EntityLibrary && panel.getUserLibrary() != null && panel.getUserLibrary().deepContains(object))) {
      Action action=new AddUserLibraryFolderAction(panel);
      action.putValue(Action.SHORT_DESCRIPTION,"Add folder in the library");
      return menu.add(action,(String)action.getValue(Action.NAME));
    }
  }
  return null;
}
 

Example 9

From project drools-planner, under directory /drools-planner-examples/src/main/java/org/drools/planner/examples/common/swingui/.

Source file: SolverAndPersistenceFrame.java

  22 
vote

private JComponent createLoadUnsolvedPanel(){
  loadUnsolvedActionList=new ArrayList<Action>();
  JPanel panel=new JPanel(new GridLayout(0,1));
  for (  File file : solutionBusiness.getUnsolvedFileList()) {
    Action loadUnsolvedAction=new LoadAction(file);
    loadUnsolvedActionList.add(loadUnsolvedAction);
    panel.add(new JButton(loadUnsolvedAction));
  }
  JScrollPane scrollPane=new JScrollPane(panel);
  scrollPane.getVerticalScrollBar().setUnitIncrement(25);
  scrollPane.setPreferredSize(new Dimension(250,200));
  return scrollPane;
}
 

Example 10

From project drugis-common, under directory /common-gui/src/main/java/org/drugis/common/gui/table/.

Source file: TableCopyHandler.java

  22 
vote

@SuppressWarnings("serial") public static void registerCopyAction(final JTable jtable){
  KeyStroke copy=KeyStroke.getKeyStroke(KeyEvent.VK_C,Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
  Action action=new AbstractAction("copy"){
    public void actionPerformed(    ActionEvent event){
      TableCopyHandler handler=new TableCopyHandler(jtable);
      Toolkit.getDefaultToolkit().getSystemClipboard().setContents(handler,handler);
    }
  }
;
  jtable.registerKeyboardAction(action,copy,JComponent.WHEN_FOCUSED);
}
 

Example 11

From project freemind, under directory /freemind/plugins/map/.

Source file: JCursorMapViewer.java

  22 
vote

/** 
 * @param pMindMapController
 * @param pMapDialog
 * @param pMapHook 
 */
public JCursorMapViewer(MindMapController pMindMapController,JDialog pMapDialog,TileCache pTileCache,MapDialog pMapHook){
  super(pTileCache,4);
  mMapHook=pMapHook;
  mFreeMindMapController=new FreeMindMapController(this,pMindMapController,pMapDialog,pMapHook);
  Action updateCursorAction=new AbstractAction(){
    public void actionPerformed(    ActionEvent e){
      mShowCursor=!mShowCursor;
      repaint();
    }
  }
;
  new Timer(1000,updateCursorAction).start();
}
 

Example 12

From project LateralGM, under directory /org/lateralgm/components/.

Source file: GMLTextArea.java

  22 
vote

private JButton makeInputHandlerToolbarButton(final ActionListener l,String key){
  final GMLTextArea source=this;
  Action a=new AbstractAction(Messages.getString(key),LGM.getIconForKey(key)){
    private static final long serialVersionUID=1L;
    public void actionPerformed(    ActionEvent e){
      inputHandler.executeAction(l,source,null);
    }
  }
;
  return makeToolbarButton(a);
}
 

Example 13

From project Maimonides, under directory /src/com/codeko/apps/maimonides/.

Source file: MaimonidesUtil.java

  22 
vote

public static boolean ejecutarTask(Object clase,String task){
  try {
    Action a=getActionTask(clase,task);
    a.actionPerformed(new ActionEvent(MaimonidesApp.getApplication().getMainFrame(),0,task));
    return true;
  }
 catch (  Exception e) {
    Logger.getLogger(MaimonidesUtil.class.getName()).log(Level.WARNING,"Error ejecutando task '" + task + "' de la clase '"+ clase+ "' ("+ clase.getClass().getName()+ ")",e);
    return false;
  }
}
 

Example 14

From project OWASP-WebScarab, under directory /src/org/owasp/webscarab/ui/swing/.

Source file: TranscoderFrame.java

  22 
vote

private void createActionTable(JTextComponent textComponent){
  actions=new Hashtable<Object,Action>();
  Action[] actionsArray=textComponent.getActions();
  for (int i=0; i < actionsArray.length; i++) {
    Action a=actionsArray[i];
    actions.put(a.getValue(Action.NAME),a);
  }
}
 

Example 15

From project pomodoro4nb, under directory /src/org/matveev/pomodoro4nb/dialogs/.

Source file: InterruptionDialog.java

  22 
vote

@Override protected JPanel createDialogContent(){
  final JPanel content=new JPanel(new BorderLayout());
  final JLabel descriptionLabel=new JLabel(getString("InterruptionDialog.descriptionLabel.text"));
  content.add(descriptionLabel,BorderLayout.NORTH);
  descriptionField=new JTextField();
  descriptionField.setPreferredSize(new Dimension(250,20));
  final Action action=getOkButton().getAction();
  descriptionField.getDocument().addDocumentListener(new DocumentValidator(action));
  content.add(descriptionField,BorderLayout.CENTER);
  return content;
}
 

Example 16

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/ingest/.

Source file: IngestMessageTopComponent.java

  21 
vote

/** 
 * Display ingest summary report in some dialog
 */
@Override public void displayReport(String ingestReport){
  Object[] options={"OK","Generate Report"};
  final int choice=JOptionPane.showOptionDialog(null,ingestReport,"Ingest Report",JOptionPane.YES_NO_OPTION,JOptionPane.INFORMATION_MESSAGE,null,options,options[0]);
  final String reportActionName="org.sleuthkit.autopsy.report.ReportAction";
  Action reportAction=null;
  if (choice == JOptionPane.NO_OPTION) {
    List<? extends Action> actions=Utilities.actionsForPath("Toolbars/File");
    for (    Action a : actions) {
      if (a != null) {
        if (a.getClass().getCanonicalName().equals(reportActionName)) {
          reportAction=a;
          break;
        }
      }
    }
    if (reportAction == null)     logger.log(Level.SEVERE,"Could not locate Action: " + reportActionName);
 else     reportAction.actionPerformed(null);
  }
}
 

Example 17

From project ceres, under directory /ceres-ui/src/test/java/com/bc/ceres/swing/actions/.

Source file: SelectionActionTest.java

  21 
vote

public void testDeleteAction(){
  SelectionManager selectionManager=new DefaultSelectionManager();
  TestSelectionContext context=new TestSelectionContext();
  selectionManager.setSelectionContext(context);
  assertEquals(true,selectionManager.getSelection().isEmpty());
  Action action=new DeleteAction(selectionManager);
  assertEquals(false,action.isEnabled());
  setSelectionAndTestActionState(new DefaultSelection("B"),true,action,context);
  setSelectionAndTestActionState(new DefaultSelection(),false,action,context);
  setSelectionAndTestActionState(new DefaultSelection("B"),true,action,context);
  setSelectionAndTestActionState(new DefaultSelection("Z"),false,action,context);
  setSelectionAndTestActionState(new DefaultSelection("B"),true,action,context);
  action.actionPerformed(null);
  assertEquals(true,context.items.contains("A"));
  assertEquals(false,context.items.contains("B"));
  assertEquals(true,context.items.contains("C"));
  assertEquals(true,context.getSelection().isEmpty());
  assertEquals(false,action.isEnabled());
}
 

Example 18

From project jSite, under directory /src/main/java/de/todesbaum/jsite/main/.

Source file: Main.java

  21 
vote

/** 
 * Switches the language of the interface to the given locale.
 * @param locale The locale to switch to
 */
private void switchLanguage(Locale locale){
  Locale supportedLocale=findSupportedLocale(locale);
  Action languageAction=languageActions.get(supportedLocale);
  JRadioButtonMenuItem menuItem=(JRadioButtonMenuItem)languageAction.getValue("menuItem");
  menuItem.setSelected(true);
  I18n.setLocale(supportedLocale);
  for (  Runnable i18nRunnable : I18nContainer.getInstance()) {
    try {
      i18nRunnable.run();
    }
 catch (    Throwable t) {
    }
  }
  wizard.setPage(wizard.getPage());
  configuration.setLocale(supportedLocale);
}
 

Example 19

From project kabeja, under directory /blocks/ui/src/main/java/org/kabeja/ui/impl/.

Source file: ProcessingRunViewComponent.java

  21 
vote

public void setServiceManager(ServiceManager manager){
  Object[] objects=manager.getServiceComponents(ApplicationToolBar.SERVICE);
  Action action=new AbstractAction(Messages.getString("ProcessingRunViewComponent.open.draft"),new ImageIcon(UIUtils.resourceToBytes(this.getClass(),"/icons/open.gif"))){
    private static final long serialVersionUID=1L;
    public void actionPerformed(    ActionEvent e){
      Runnable r=new Runnable(){
        public void run(){
          chooseInput();
        }
      }
;
      Thread t=new Thread(r);
      t.start();
    }
  }
;
  for (int i=0; i < objects.length; i++) {
    ((ApplicationToolBar)objects[i]).addAction(action);
  }
  objects=manager.getServiceComponents(PropertiesEditor.SERVICE);
  for (int i=0; i < objects.length; i++) {
    ((PropertiesEditor)objects[i]).addPropertiesListener(this);
  }
  ApplicationMenuBar mbar=((ApplicationMenuBar)manager.getServiceComponents(ApplicationMenuBar.SERVICE)[0]);
  JMenu viewMenu=new JMenu(Messages.getString("ProcessingRunViewComponent.process.view.menuitem"));
  if (!mbar.hasMenu(ApplicationMenuBar.MENU_ID_VIEW)) {
    mbar.setMenu(ApplicationMenuBar.MENU_ID_VIEW,new JMenu(Messages.getString("menu.view")));
  }
  objects=manager.getServiceComponents(DraftDocumentViewComponent.SERVICE);
  for (int i=0; i < objects.length; i++) {
    ViewControl c=new ViewControl((DraftDocumentViewComponent)objects[i]);
    this.viewComponents.add(c);
    JCheckBoxMenuItem menuItem=new JCheckBoxMenuItem(c.getTitle());
    menuItem.setSelected(c.isEnabled());
    menuItem.addItemListener(c);
    viewMenu.add(menuItem);
  }
  mbar.setJMenuItem(ApplicationMenuBar.MENU_ID_VIEW,viewMenu);
  mbar.setAction(ApplicationMenuBar.MENU_ID_FILE,action);
}
 

Example 20

From project Kayak, under directory /Kayak-ui/src/main/java/com/github/kayak/ui/send/.

Source file: SendFramesTopComponent.java

  21 
vote

public SendFramesTopComponent(){
  initComponents();
  setName(NbBundle.getMessage(SendFramesTopComponent.class,"CTL_SendFramesTopComponent"));
  setToolTipText(NbBundle.getMessage(SendFramesTopComponent.class,"HINT_SendFramesTopComponent"));
  ProjectManager.getGlobalProjectManager().addListener(managementListener);
  project=ProjectManager.getGlobalProjectManager().getOpenedProject();
  if (project != null) {
    project.addProjectChangeListener(projectListener);
    fillComboBox();
  }
  Action send=new AbstractAction(){
    @Override public void actionPerformed(    ActionEvent e){
      JTable table=(JTable)e.getSource();
      int modelRow=Integer.valueOf(e.getActionCommand());
      ((SendFramesTableModel)table.getModel()).send(modelRow);
    }
  }
;
  ButtonColumn bc=new ButtonColumn(jTable1,send,5);
  jTable1.getColumn("Bus").setPreferredWidth(100);
  jTable1.getColumn("ID [hex]").setPreferredWidth(60);
  jTable1.getColumn("Extended").setPreferredWidth(20);
  jTable1.getColumn("Length").setPreferredWidth(70);
  jTable1.getColumn("Data").setPreferredWidth(200);
  jTable1.getColumn("Send").setPreferredWidth(60);
  jTable1.getColumn("Interval [?s]").setPreferredWidth(100);
  jTable1.getColumn("Send interval").setPreferredWidth(100);
  jTable1.getColumn("Note").setPreferredWidth(150);
}
 

Example 21

From project lilith, under directory /lilith/src/main/java/de/huxhorn/lilith/swing/preferences/.

Source file: EditAccessStatusTypeDialog.java

  21 
vote

private void createUi(){
  OkAction okAction=new OkAction();
  Action cancelAction=new CancelAction();
  JPanel mainPanel=new JPanel();
  mainPanel.setLayout(new GridBagLayout());
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.gridx=0;
  gbc.gridy=0;
  gbc.gridwidth=3;
  gbc.weightx=1.0;
  gbc.weighty=1.0;
  gbc.fill=GridBagConstraints.BOTH;
  colorSchemeEditorPanel=new ColorSchemeEditorPanel();
  mainPanel.add(colorSchemeEditorPanel,gbc);
  setLayout(new BorderLayout());
  add(mainPanel,BorderLayout.CENTER);
  JPanel buttonPanel=new JPanel(new FlowLayout(FlowLayout.CENTER));
  buttonPanel.add(new JButton(okAction));
  buttonPanel.add(new JButton(new ResetAction()));
  buttonPanel.add(new JButton(cancelAction));
  add(buttonPanel,BorderLayout.SOUTH);
  KeyStrokes.registerCommand(mainPanel,cancelAction,"CANCEL_ACTION");
  KeyStrokes.registerCommand(buttonPanel,cancelAction,"CANCEL_ACTION");
}
 

Example 22

From project OpenLogViewer, under directory /src/main/java/org/diyefi/openlogviewer/.

Source file: OpenLogViewer.java

  21 
vote

public static void setupWindowKeyBindings(final JFrame window){
  final Action closeWindow=new AbstractAction(){
    private static final long serialVersionUID=1L;
    public void actionPerformed(    final ActionEvent e){
      final WindowEvent wev=new WindowEvent(window,WindowEvent.WINDOW_CLOSING);
      Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev);
    }
  }
;
  boolean isMainApp=false;
  if (window instanceof OpenLogViewer) {
    isMainApp=true;
  }
  if (IS_WINDOWS || IS_LINUX) {
    window.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(Keys.CONTROL_W),Keys.CLOSE_WINDOW);
  }
 else   if (IS_MAC_OS_X) {
    window.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(Keys.COMMAND_W),Keys.CLOSE_WINDOW);
  }
  if (IS_LINUX && isMainApp) {
    window.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(Keys.CONTROL_Q),Keys.CLOSE_WINDOW);
  }
  window.getRootPane().getActionMap().put(Keys.CLOSE_WINDOW,closeWindow);
}
 

Example 23

From project coffeescript-netbeans, under directory /src/coffeescript/nb/.

Source file: CoffeeScriptAction.java

  19 
vote

public Action createContextAwareInstance(Lookup actionContext){
  Collection<? extends CoffeeScriptDataObject> data=actionContext.lookupAll(CoffeeScriptDataObject.class);
  if (data.isEmpty()) {
    return null;
  }
  return new PopupAction(data);
}
 

Example 24

From project contribution_eevolution_smart_browser, under directory /client/src/org/compiere/apps/.

Source file: APanel.java

  19 
vote

/** 
 * Constructor.
 * @param name
 * @param accelerator
 * @param al
 */
SwitchAction(String name,KeyStroke accelerator,ActionListener al){
  super(name);
  putValue(Action.NAME,name);
  putValue(Action.SHORT_DESCRIPTION,name);
  putValue(Action.ACCELERATOR_KEY,accelerator);
  putValue(Action.ACTION_COMMAND_KEY,name);
  this.al=al;
  this.name=name;
}
 

Example 25

From project cowgraph, under directory /CowGraph/CowGraphWindows/src/zbeans/cowgraph/windows/version/.

Source file: DocumentNode.java

  19 
vote

@Override public Action[] getActions(boolean context){
  List<Action> actions=new ArrayList<Action>(10);
  actions.addAll(Utilities.actionsForPath("CowGraph/Nodes/Version/Actions"));
  actions.addAll(Arrays.asList(super.getActions(context)));
  return actions.toArray(new Action[actions.size()]);
}
 

Example 26

From project enclojure, under directory /netbeans/plugins/org-enclojure-plugin/src/main/java/org/enclojure/ide/debugger/breakpoints/.

Source file: ClojureBreakpointActionsProvider.java

  19 
vote

public Action[] getActions(NodeActionsProvider original,Object node) throws UnknownTypeException {
  if (!(node instanceof ClojureLineBreakpoint))   return original.getActions(node);
  Action[] oas=original.getActions(node);
  if (node instanceof ClojureLineBreakpoint) {
    Action[] as=new Action[oas.length + 3];
    as[0]=GO_TO_SOURCE_ACTION;
    as[1]=null;
    System.arraycopy(oas,0,as,2,oas.length);
    as[as.length - 1]=CUSTOMIZE_ACTION;
    return as;
  }
  Action[] as=new Action[oas.length + 1];
  System.arraycopy(oas,0,as,0,oas.length);
  as[as.length - 1]=CUSTOMIZE_ACTION;
  return as;
}
 

Example 27

From project formic, under directory /src/java/org/formic/wizard/impl/gui/.

Source file: GuiWizard.java

  19 
vote

/** 
 * {@inheritDoc}
 * @see org.pietschy.wizard.Wizard#getPreviousAction()
 */
public Action getPreviousAction(){
  if (previousAction == null) {
    previousAction=super.getPreviousAction();
  }
  return previousAction;
}
 

Example 28

From project FScape, under directory /src/main/java/de/sciss/fscape/session/.

Source file: DocumentFrame.java

  19 
vote

/** 
 * Recreates the main frame's title bar after a sessions name changed (clear/load/save as session)
 */
public void updateTitle(){
  final File f=doc.getFile();
  final String name=doc.getName();
  final Icon icn;
  writeProtected=false;
  if (f != null) {
    try {
      writeProtected|=!f.canWrite() || ((f.getParentFile() != null) && !f.getParentFile().canWrite());
    }
 catch (    SecurityException e) {
    }
  }
  if (writeProtected) {
    icn=GUIUtil.getNoWriteIcon();
    if (lbWriteProtected.getIcon() != icn) {
      lbWriteProtected.setIcon(icn);
    }
  }
 else   if (lbWriteProtected.getIcon() != null) {
    lbWriteProtected.setIcon(null);
  }
  final String title=procTitle + (doc.isDirty() ? " - \u2022" : " - ") + name;
  setTitle(title);
  actionShowWindow.putValue(Action.NAME,title);
  actionSave.setEnabled(!writeProtected);
  setDirty(doc.isDirty());
  if (writeProtected && !wpHaveWarned && doc.isDirty()) {
    JOptionPane.showMessageDialog(getWindow(),getResourceString("warnWriteProtected"),getResourceString("msgDlgWarn"),JOptionPane.WARNING_MESSAGE,null);
    wpHaveWarned=true;
  }
}
 

Example 29

From project gs-tool, under directory /src/org/graphstream/tool/gui/.

Source file: IconButton.java

  19 
vote

public static IconButton createIconButton(Type type,int size,String label,Action action){
  ImageIcon off, on, click;
  off=new ImageIcon(Resources.getImage(type.off,size,size,false));
  on=new ImageIcon(Resources.getImage(type.on,size,size,false));
  click=new ImageIcon(Resources.getImage(type.click,size,size,false));
  return new IconButton(action,off,on,click,label);
}
 

Example 30

From project jASM_16, under directory /src/main/java/de/codesourcery/jasm16/ide/ui/views/.

Source file: AbstractView.java

  19 
vote

protected String addKeyBinding(JComponent editor,KeyStroke key,Action action){
  final String actionId=Long.toString(ACTION_ID.incrementAndGet());
  editor.getInputMap().put(key,actionId);
  editor.getActionMap().put(actionId,action);
  return actionId;
}
 

Example 31

From project jCAE, under directory /jcae/core/src/org/jcae/netbeans/cad/.

Source file: BooleanAction.java

  19 
vote

public javax.swing.JMenuItem getMenuPresenter(){
  JMenu menu=new JMenu();
  Mnemonics.setLocalizedText(menu,getName());
  JMenuItem item=new JMenuItem();
  Mnemonics.setLocalizedText(item,item.getText());
  Actions.connect(item,(Action)SystemAction.get(Common.class),true);
  menu.add(item);
  item=new JMenuItem();
  Mnemonics.setLocalizedText(item,item.getText());
  Actions.connect(item,(Action)SystemAction.get(Fuse.class),true);
  menu.add(item);
  item=new JMenuItem();
  Mnemonics.setLocalizedText(item,item.getText());
  Actions.connect(item,(Action)SystemAction.get(Cut.class),true);
  menu.add(item);
  item=new JMenuItem();
  Mnemonics.setLocalizedText(item,item.getText());
  Actions.connect(item,(Action)SystemAction.get(Section.class),true);
  menu.add(item);
  return menu;
}
 

Example 32

From project jftp, under directory /src/main/java/com/myjavaworld/gui/.

Source file: MMenu.java

  19 
vote

@Override public JMenuItem add(Action action){
  MMenuItem mi=new MMenuItem(action);
  mi.setIcon(null);
  add(mi);
  return mi;
}
 

Example 33

From project jgraphx, under directory /examples/com/mxgraph/examples/swing/editor/.

Source file: BasicGraphEditor.java

  19 
vote

/** 
 * @param name
 * @param action
 * @return a new Action bound to the specified string name and icon
 */
@SuppressWarnings("serial") public Action bind(String name,final Action action,String iconUrl){
  AbstractAction newAction=new AbstractAction(name,(iconUrl != null) ? new ImageIcon(BasicGraphEditor.class.getResource(iconUrl)) : null){
    public void actionPerformed(    ActionEvent e){
      action.actionPerformed(new ActionEvent(getGraphComponent(),e.getID(),e.getActionCommand()));
    }
  }
;
  newAction.putValue(Action.SHORT_DESCRIPTION,action.getValue(Action.SHORT_DESCRIPTION));
  return newAction;
}
 

Example 34

From project jMemorize, under directory /src/jmemorize/gui/swing/panels/.

Source file: CardPanel.java

  19 
vote

public void attachTextPane(CardSidePanel cardSide){
  String name=(String)getValue(Action.NAME);
  JTextPane textPane=cardSide.getTextPane();
  for (  KeyStroke shortcut : m_shortcuts) {
    textPane.getInputMap().put(shortcut,name);
  }
  textPane.getActionMap().put(name,this);
  cardSide.addCaretListener(m_caretListener);
}
 

Example 35

From project multibit, under directory /src/main/java/org/multibit/viewsystem/swing/view/.

Source file: MultiBitButton.java

  19 
vote

public MultiBitButton(Action action){
  super(action);
  Font font=new Font(MultiBitFrame.MULTIBIT_FONT_NAME,MultiBitFrame.MULTIBIT_FONT_STYLE,MultiBitFrame.MULTIBIT_LARGE_FONT_SIZE);
  setFont(font);
  setOpaque(false);
  setRolloverEnabled(true);
}
 

Example 36

From project Openbravo-POS-iPhone-App, under directory /UnicentaPOS/src-pos/com/openbravo/pos/forms/.

Source file: MenuExecAction.java

  19 
vote

/** 
 * Creates a new instance of MenuExecAction 
 */
public MenuExecAction(AppView app,String icon,String keytext,String sMyView){
  putValue(Action.SMALL_ICON,new ImageIcon(JPrincipalApp.class.getResource(icon)));
  putValue(Action.NAME,AppLocal.getIntString(keytext));
  putValue(AppUserView.ACTION_TASKNAME,sMyView);
  m_App=app;
  m_sMyView=sMyView;
}
 

Example 37

From project pivote-java, under directory /swing-client/src/main/java/ch/piratenpartei/pivote/ui/.

Source file: AppPanel.java

  19 
vote

private static JideButton menuButton(Action action){
  JideButton button=new JideButton(action);
  button.setButtonStyle(JideButton.TOOLBOX_STYLE);
  button.setBorder(new CompoundBorder(button.getBorder(),BorderFactory.createEmptyBorder(10,10,10,10)));
  return button;
}
 

Example 38

From project pos_1, under directory /src-pos/com/openbravo/pos/forms/.

Source file: MenuExecAction.java

  19 
vote

/** 
 * Creates a new instance of MenuExecAction 
 */
public MenuExecAction(AppView app,String icon,String keytext,String sMyView){
  putValue(Action.SMALL_ICON,new ImageIcon(JPrincipalApp.class.getResource(icon)));
  putValue(Action.NAME,AppLocal.getIntString(keytext));
  putValue(AppUserView.ACTION_TASKNAME,sMyView);
  m_App=app;
  m_sMyView=sMyView;
}
 

Example 39

From project QView, under directory /QView-suite/jre1.5.0_11/sample/jnlp/webpad/src/version1/.

Source file: AboutAction.java

  19 
vote

/** 
 * ctor
 */
public AboutAction(){
  putValue(Action.NAME,NAME_ABOUT);
  putValue(Action.SMALL_ICON,getIcon(SMALL_ICON_ABOUT));
  putValue(LARGE_ICON,getIcon(LARGE_ICON_ABOUT));
  putValue(Action.SHORT_DESCRIPTION,SHORT_DESCRIPTION_ABOUT);
  putValue(Action.LONG_DESCRIPTION,LONG_DESCRIPTION_ABOUT);
  putValue(Action.MNEMONIC_KEY,new Integer(MNEMONIC_KEY_ABOUT));
  putValue(Action.ACTION_COMMAND_KEY,ACTION_COMMAND_KEY_ABOUT);
}