use of javax.swing.Action in project checkstyle by checkstyle.
the class MyAnnotation3 method holder.
/** methods in anonymous inner classes */
void holder() {
Action a = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
}
void somethingElse(@MyAnnotation3 ActionEvent e) {
}
};
Action b = new AbstractAction() {
public void actionPerformed(final ActionEvent e) {
}
void somethingElse(@MyAnnotation3 final ActionEvent e) {
}
};
}
use of javax.swing.Action in project pcgen by PCGen.
the class NotesView method rightJustifyButtonActionPerformed.
//GEN-LAST:event_sizeCBActionPerformed
private void rightJustifyButtonActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_rightJustifyButtonActionPerformed
Action action = new StyledEditorKit.AlignmentAction("Right Justify", StyleConstants.ALIGN_RIGHT);
action.actionPerformed(evt);
editor.grabFocus();
int cp = editor.getCaretPosition();
updateButtons(editor, cp);
}
use of javax.swing.Action in project intellij-community by JetBrains.
the class ScrollPaneActions method actionPerformed.
@Override
public void actionPerformed(AnActionEvent event) {
JScrollPane pane = getScrollPane(event);
if (pane == null)
return;
Action action = getSwingAction(pane);
if (action == null)
return;
action.actionPerformed(new ActionEvent(pane, ActionEvent.ACTION_PERFORMED, mySwingActionId));
}
use of javax.swing.Action in project adempiere by adempiere.
the class Util method printActionInputMap.
// dump (Map)
/**
* Print Action and Input Map for component
* @param comp Component with ActionMap
*/
public static void printActionInputMap(JComponent comp) {
// Action Map
ActionMap am = comp.getActionMap();
// including Parents
Object[] amKeys = am.allKeys();
if (amKeys != null) {
System.out.println("-------------------------");
System.out.println("ActionMap for Component " + comp.toString());
for (int i = 0; i < amKeys.length; i++) {
Action a = am.get(amKeys[i]);
StringBuffer sb = new StringBuffer("- ");
sb.append(a.getValue(Action.NAME));
if (a.getValue(Action.ACTION_COMMAND_KEY) != null)
sb.append(", Cmd=").append(a.getValue(Action.ACTION_COMMAND_KEY));
if (a.getValue(Action.SHORT_DESCRIPTION) != null)
sb.append(" - ").append(a.getValue(Action.SHORT_DESCRIPTION));
System.out.println(sb.toString() + " - " + a);
}
}
/** Same as below
KeyStroke[] kStrokes = comp.getRegisteredKeyStrokes();
if (kStrokes != null)
{
System.out.println("-------------------------");
System.out.println("Registered Key Strokes - " + comp.toString());
for (int i = 0; i < kStrokes.length; i++)
{
System.out.println("- " + kStrokes[i].toString());
}
}
/** Focused */
InputMap im = comp.getInputMap(JComponent.WHEN_FOCUSED);
KeyStroke[] kStrokes = im.allKeys();
if (kStrokes != null) {
System.out.println("-------------------------");
System.out.println("InputMap for Component When Focused - " + comp.toString());
for (int i = 0; i < kStrokes.length; i++) {
System.out.println("- " + kStrokes[i].toString() + " - " + im.get(kStrokes[i]).toString());
}
}
/** Focused in Window */
im = comp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
kStrokes = im.allKeys();
if (kStrokes != null) {
System.out.println("-------------------------");
System.out.println("InputMap for Component When Focused in Window - " + comp.toString());
for (int i = 0; i < kStrokes.length; i++) {
System.out.println("- " + kStrokes[i].toString() + " - " + im.get(kStrokes[i]).toString());
}
}
/** Focused when Ancester */
im = comp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
kStrokes = im.allKeys();
if (kStrokes != null) {
System.out.println("-------------------------");
System.out.println("InputMap for Component When Ancestor - " + comp.toString());
for (int i = 0; i < kStrokes.length; i++) {
System.out.println("- " + kStrokes[i].toString() + " - " + im.get(kStrokes[i]).toString());
}
}
System.out.println("-------------------------");
}
use of javax.swing.Action in project adempiere by adempiere.
the class HTMLEditor_MenuAction method createMenuBar.
// setHTMLText
/**
* Create Menu Bar
*/
private void createMenuBar() {
// Build Lookup
Action[] actionArray = editorPane.getActions();
Hashtable<Object, Action> actions = new Hashtable<Object, Action>();
for (int i = 0; i < actionArray.length; i++) {
Object name = actionArray[i].getValue(Action.NAME);
// System.out.println (name);
actions.put(name, actionArray[i]);
}
for (int i = 0; i < extraActions.length; i++) {
Object name = extraActions[i].getValue(Action.NAME);
actions.put(name, extraActions[i]);
}
// Add the font menu
JMenu menu = buildMenu(Msg.getMsg(Env.getCtx(), "Font"), fontMenu, actions);
if (menu != null)
menuBar.add(menu);
// Add the alignment menu
menu = buildMenu(Msg.getMsg(Env.getCtx(), "Align"), alignMenu, actions);
if (menu != null)
menuBar.add(menu);
// Add the HTML menu
menu = buildMenu("HTML", htmlMenu, actions);
if (menu != null)
menuBar.add(menu);
// Add to Button Actions
Action targetAction = (Action) actions.get("font-bold");
bBold.addActionListener(targetAction);
targetAction = (Action) actions.get("font-italic");
bItalic.addActionListener(targetAction);
targetAction = (Action) actions.get("font-underline");
bUnderline.addActionListener(targetAction);
}
Aggregations