List of usage examples for javax.swing Action SHORT_DESCRIPTION
String SHORT_DESCRIPTION
To view the source code for javax.swing Action SHORT_DESCRIPTION.
Click Source Link
String
description for the action, used for tooltip text. From source file:Main.java
public static void main(String[] argv) throws Exception { final Action action = new AbstractAction("Action Name") { {/* w w w.j a v a 2s . c o m*/ putValue(Action.SHORT_DESCRIPTION, "Tool Tip Text"); putValue(Action.LONG_DESCRIPTION, "Help Text"); Icon icon = new ImageIcon("icon.gif"); putValue(Action.SMALL_ICON, icon); putValue(Action.MNEMONIC_KEY, new Integer(java.awt.event.KeyEvent.VK_A)); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control F2")); } public void actionPerformed(ActionEvent evt) { System.out.println("action"); } }; JButton button = new JButton(action); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame(); Container pane = f.getContentPane(); Icon icon = new RedOvalIcon(); final Action action = new MyAction("Hello", icon); // Add tooltip action.putValue(Action.SHORT_DESCRIPTION, "World"); JToolBar jt1 = new JToolBar(); JButton b1 = new JButton(action); jt1.add(b1);//from w w w . j a v a2s. co m pane.add(jt1, BorderLayout.NORTH); JToolBar jt2 = new JToolBar(); JButton b2 = new JButton(action); jt2.add(b2); pane.add(jt2, BorderLayout.SOUTH); JButton jb = new JButton("Toggle Action"); jb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { action.setEnabled(!action.isEnabled()); } }); pane.add(jb, BorderLayout.CENTER); f.setSize(200, 200); f.show(); }
From source file:coolmap.application.utils.viewportActions.ZoomOutAction.java
public ZoomOutAction() { super("", UI.getImageIcon("zoomOut")); this.putValue(Action.SHORT_DESCRIPTION, "Zoom out current view"); }
From source file:Main.java
public ShowAction() { super("About"); putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_A)); putValue(Action.NAME, "Go to number "); putValue(Action.SHORT_DESCRIPTION, "Change the number to "); super.setEnabled(false); }
From source file:Main.java
public ShowAction() { super("About"); putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_A)); putValue(Action.NAME, "Go to number "); putValue(Action.SHORT_DESCRIPTION, "Change the number to "); }
From source file:Main.java
public ShowAction() { super("About"); putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_A)); putValue(Action.NAME, "Go to number "); putValue(Action.SHORT_DESCRIPTION, "Change the number to "); super.setEnabled(false); System.out.println(super.isEnabled()); }
From source file:coolmap.application.utils.viewportActions.ZoomInAction.java
public ZoomInAction() { super("", UI.getImageIcon("zoomIn")); this.putValue(Action.SHORT_DESCRIPTION, "Zoom in current view"); }
From source file:Main.java
PrintHelloAction() { super("Print"); putValue(Action.SHORT_DESCRIPTION, "Hello, World"); super.setEnabled(true); System.out.println(super.isEnabled()); }
From source file:Main.java
PrintHelloAction() { super("Print"); putValue(Action.SHORT_DESCRIPTION, "Hello, World"); Object[] keys = super.getKeys(); for (Object o : keys) { System.out.println(o);/*ww w . j a v a 2 s .co m*/ } }
From source file:Main.java
PrintHelloAction() { super("Print"); putValue(Action.SHORT_DESCRIPTION, "Hello, World"); System.out.println(super.getValue(Action.SHORT_DESCRIPTION)); }