public ActionListener addRoomActionListener() {
ActionListener acl = (ActionEvent e) -> {
final String roomNumber = roomNumCmbBox.getSelectedItem().toString();
final String roomType = roomTypeCmbBox.getSelectedItem().toString();
final String currency = currencyCmbBox.getSelectedItem().toString();
final int personCount = (int) personCountSpinner.getValue();
final String val = priceField.getValue().toString();
priceValue = Double.valueOf(val);
Object[] row = new Object[] { roomNumber,roomType,personCount,val,currency };
roomCountModel.addRow(row);
for (int i = 0; i < personCount; i++) {
model.addRow(new Object[] { roomNumber,roomType });
}
};
return acl;
}
项目:Tarski
文件:VisualizationActionListenerFactory.java
public static ActionListener deleteAtomActionListener() {
return new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
final IMarker marker =
Visualization.getMarker((AlloyAtom) Visualization.rightClickedAnnotation);
final String sigTypeName = marker.getAttribute(MarkUtilities.MARKER_TYPE,"");
final String relUri = marker.getAttribute(MarkUtilities.RELATIVE_URI,"");
display.getDefault().syncExec(new DeleteAtomCommand(marker));
Visualization.showViz();
AlloyOtherSolutionReasoning.getInstance().finish();
for (final Visualizationchangelistener listener : VisualizationActionListenerFactory.listeners) {
listener.onAtomremoved(sigTypeName,relUri);
}
}
};
}
项目:openjdk-jdk10
文件:HiddenDefaultButtonTest.java
private static void createGUI() {
frame = new JFrame();
frame.setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);
JButton button = new JButton("Default button");
button.setDefaultCapable(true);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ButtonClickCount++;
}
});
frame.add(button);
button.setVisible(false);
frame.getRootPane().setDefaultButton(button);
frame.setSize(200,200);
frame.setLocationRelativeto(null);
frame.setVisible(true);
}
项目:alevin-svn2
文件:MultiAlgoScenarioWizard.java
/**
* @return {@link jpopupmenu} for manipulating an entry in the network
* table.
*/
private jpopupmenu createContextMenu() {
jpopupmenu menu = new jpopupmenu();
ActionListener listener = new ContextHandler(this);
String[] menuItems = {
CHANGE_GENERATOR_LBL,CHANGE_GENERATOR_ACTN,CONfigURE_GENERATOR_LBL,CONfigURE_GENERATOR_ACTN,copY_CONfigURATION_LBL,copY_CONfigURATION_ACTN,PASTE_CONfigURATION_LBL,PASTE_CONfigURATION_ACTN
};
for (int i = 0; i < menuItems.length / 2; i++) {
JMenuItem item = new JMenuItem(menuItems[i*2]);
item.setActionCommand(menuItems[i*2+1]);
item.addActionListener(listener);
menu.add(item);
if (item.getText().equals(PASTE_CONfigURATION_LBL)) {
this.paste = item;
item.setEnabled(false);
}
}
return menu;
}
项目:rapidminer
文件:CompositeMenuToggleButton.java
/**
* Adds the given {@link Action}s to the {@link #popupMenu}.
*
* @param actions
* the actions which should be added to the menu
*/
public void addActions(Action... actions) {
for (Action action : actions) {
JRadioButtonMenuItem item = new JRadioButtonMenuItem(action);
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateSelectionStatus();
}
});
popupMenuGroup.add(item);
popupMenu.add(item);
}
}
项目:AgentWorkbench
文件:Translation.java
/**
* This method initializes jComboBoxDestinationLang.
* @return javax.swing.JComboBox
*/
private JComboBox<LanguageListElement> getJComboBoxDestinationLang() {
if (jComboBoxDestinationLang == null) {
jComboBoxDestinationLang = new JComboBox<LanguageListElement>();
jComboBoxDestinationLang.setModel(langSelectionModelDestin);
jComboBoxDestinationLang.setPreferredSize(new Dimension(200,26));
jComboBoxDestinationLang.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (currDataSet!=null) {
jTextFieldDestination.setText((String) currDataSet.get(jComboBoxDestinationLang.getSelectedindex()+1));
setGoogleTranslation();
}
}
});
}
return jComboBoxDestinationLang;
}
项目:AWGW
文件:WorldFrame.java
private void configureMenuItem(JMenuItem item,String resource,ActionListener listener) {
configureAbstractButton(item,resource);
item.addActionListener(listener);
try {
String accel = resources.getString(resource + ".accel");
String MetaPrefix = "@";
if (accel.startsWith(MetaPrefix)) {
int menuMask = getToolkit().getMenuShortcutKeyMask();
Keystroke key = Keystroke.getKeystroke(
Keystroke.getKeystroke(accel.substring(MetaPrefix.length())).getKeyCode(),menuMask);
item.setAccelerator(key);
} else {
item.setAccelerator(Keystroke.getKeystroke(accel));
}
} catch (MissingResourceException ex) {
// no accelerator
}
}
项目:VASSAL-src
文件:ServerStatusView.java
private void initComponents() {
JPanel current = new JPanel(new BorderLayout());
JToolBar toolbar = new JToolBar();
toolbar.setFloatable(false);
JButton b = new JButton(Resources.getString("Chat.refresh")); //$NON-NLS-1$
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
refresh();
}
});
toolbar.add(b);
current.add(toolbar,BorderLayout.norTH);
treeCurrent = createTree();
current.add(new JScrollPane(treeCurrent),BorderLayout.CENTER);
model = (DefaultTreeModel) treeCurrent.getModel();
addTab(Resources.getString("Chat.current"),current); //$NON-NLS-1$
addchangelistener(this);
setBorder(new TitledBorder(Resources.getString("Chat.server_connections"))); //$NON-NLS-1$
setStatusServer(status);
}
项目:JavaGraph
文件:EncodedEnumeratedType.java
public EnumeratedEditor(GrammarModel grammar,Map<String,String> options) {
super(grammar,new FlowLayout(FlowLayout.LEFT,0));
setBackground(ExplorationDialog.INFO_BG_COLOR);
this.selector = new JComboBox<>();
// MdM - line below causes selector not to appear at all
// this.selector.setMinimumSize(new Dimension(50,20));
this.selector.setBackground(ExplorationDialog.INFO_Box_BG_COLOR);
this.selector.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
notifyTemplateListeners();
}
});
this.keys = new String[options.size()];
this.nrKeys = 0;
if (this.nrKeys == 0) {
this.selector.addItem("<HTML><FONT color=red>"
+ "Error! No valid options available." + "</FONT></HTML>");
}
refresh();
add(this.selector);
}
项目:incubator-netbeans
文件:InstallStep.java
@Messages({
"# {0} - plugin_name","inBackground_WritePermission=You don''t have permission to install plugin {0} into the installation directory.","inBackground_WritePermission_Details=details","cancel=Cancel","install=Install anyway"})
private void notifyWritePermissionProblem(final OperationException ex,final UpdateElement culprit) {
// lack of privileges for writing
ActionListener onMouseClickAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ProblemPanel problem = new ProblemPanel(ex,culprit,false);
problem.showWriteProblemDialog();
}
};
String title = inBackground_WritePermission(culprit.getdisplayName());
String description = inBackground_WritePermission_Details();
Notificationdisplayer.getDefault().notify(title,ImageUtilities.loadImageIcon("org/netbeans/modules/autoupdate/ui/resources/error.png",false),// NOI18N
description,onMouseClickAction,Notificationdisplayer.Priority.HIGH,Notificationdisplayer.Category.ERROR);
}
项目:dead-code-detector
文件:PatternPanel.java
private void initButtons() {
final Insets margin = new Insets(2,2,2);
addPatternButton.setMargin(margin);
removePatternButton.setMargin(margin);
addPatternButton.setIcon(DcdUiHelper.createIcon("/images/add.gif"));
removePatternButton.setIcon(DcdUiHelper.createIcon("/images/remove.gif"));
addPatternButton.setHorizontalAlignment(SwingConstants.LEADING);
removePatternButton.setHorizontalAlignment(SwingConstants.LEADING);
addPatternButton.setopaque(false);
removePatternButton.setopaque(false);
final ActionListener actionHandler = new ActionListener() {
/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent event) {
onAction(event);
}
};
addPatternButton.addActionListener(actionHandler);
removePatternButton.addActionListener(actionHandler);
}
项目:incubator-netbeans
文件:ProblemPanel.java
private DialogDescriptor getNetworkProblemDescriptor() {
DialogDescriptor descriptor = getProblemDesriptor(NbBundle.getMessage(ProblemPanel.class,"CTL_ShowProxyOptions"));
JButton showProxyOptions = new JButton ();
Mnemonics.setLocalizedText (showProxyOptions,NbBundle.getMessage(ProblemPanel.class,"CTL_ShowProxyOptions"));
showProxyOptions.getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage(ProblemPanel.class,"ACSD_ShowProxyOptions"));
showProxyOptions.addActionListener (new ActionListener () {
@Override
public void actionPerformed (ActionEvent arg0) {
Optionsdisplayer.getDefault ().open ("General"); // NOI18N
}
});
if (isWarning) {
descriptor.setAdditionalOptions(new Object [] {showProxyOptions});
}
return descriptor;
}
protected void createPauseButton() {
final JButton btPause = new JButton("Pause",new ImageIcon(runcentralisedMAS.class.getResource("/images/resume_co.gif")));
btPause.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (MASConsoleGUI.get().isPause()) {
btPause.setText("Pause");
MASConsoleGUI.get().setPause(false);
} else {
btPause.setText("Continue");
MASConsoleGUI.get().setPause(true);
}
}
});
MASConsoleGUI.get().addButton(btPause);
}
项目:educational-plugin
文件:CreateCourseArchivePanel.java
public CreateCourseArchivePanel(@NotNull final Project project,CreateCourseArchiveDialog dlg,String name) {
setLayout(new BorderLayout());
add(myPanel,BorderLayout.CENTER);
myErrorIcon.setIcon(AllIcons.Actions.Lightning);
setState(false);
myDlg = dlg;
String sanitizedname = FileUtil.sanitizefileName(name);
myNameField.setText(sanitizedname.startsWith("_") ? EduNames.COURSE : sanitizedname);
myLocationField.setText(project.getBasePath());
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
myLocationField.addbrowseFolderListener("Choose Location Folder",null,project,descriptor);
myLocationField.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String location = myLocationField.getText();
File file = new File(location);
if (!file.exists() || !file.isDirectory()) {
myDlg.enableOKAction(false);
setError("Invalid location");
}
myDlg.enableOKAction(true);
}
});
}
/**
* Returns the jpopupmenu for the tabs.
*
* @return the jpopupmenu
*/
private jpopupmenu getTabPopupMenu() {
JMenuItem jme = new JMenuItem();
if (isMaximizedTab) {
jme.setText(Language.translate("Wiederherstellen"));
} else {
jme.setText(Language.translate("Maximieren"));
}
jme.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (isMaximizedTab) {
currProject.setNotChangedButNotify(Project.VIEW_Restore);
} else {
currProject.setNotChangedButNotify(Project.VIEW_Maximize);
}
}
});
jpopupmenu pop = new jpopupmenu();
pop.add(jme);
return pop;
}
/**
* This method initializes timeFormater
* @return agentgui.simulationService.time.TimeFormatSelection
*/
protected TimeFormatSelection getJPanelTimeFormater() {
if (jPanelTimeFormater == null) {
jPanelTimeFormater = new TimeFormatSelection();
jPanelTimeFormater.setPreferredSize(new Dimension(360,80));
jPanelTimeFormater.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
if (enabledchangelistener==true) {
saveTimeModelToSimulationSetup();
}
}
});
}
return jPanelTimeFormater;
}
项目:Java-RPG-Maker-MV-Decrypter
文件:GUI_ActionListener.java
/**
* Open an Explorer with the given Path
*
* @param directoryPath - Path to open
* @return Open-Explorer ActionListener
*/
static ActionListener openExplorer(String directoryPath) {
return e -> {
Desktop desktop = Desktop.getDesktop();
try {
desktop.open(new java.io.File(File.ensureDSonEndOfPath(directoryPath)).getAbsoluteFile());
} catch(Exception ex) {
ex.printstacktrace();
ErrorWindow errorWindow = new ErrorWindow(
"Unable to open the File-Explorer with the Directory: " + directoryPath,ErrorWindow.ERROR_LEVEL_ERROR,false
);
errorWindow.show();
}
};
}
项目:ramus
文件:Manager.java
private MenuItem createPreferences() {
MenuItem pItem = new MenuItem(getString("Action.Preferences"));
pItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setup();
}
});
return pItem;
}
项目:defense-solutions-proofs-of-concept
文件:MainMenuJPanel.java
/**
* Called when a waypoint is added. This implementation adds a waypoint button.
* @param graphic the waypoint graphic,whose ID may or may not be populated.
* @param graphicUid the waypoint graphic's ID.
* @see RouteListener#waypointAdded(com.esri.core.map.Graphic,int)
*/
public void waypointAdded(Graphic graphic,int graphicUid) {
final JToggleButton button = new JToggleButton((String) graphic.getAttributeValue("name"));
waypointButtonToGraphicId.put(button,graphicUid);
graphicIdToWaypointButton.put(graphicUid,button);
Font font = new Font("Arial",Font.PLAIN,18);
button.setFont(font);
button.setFocusable(false);
button.setSelected(false);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (button == selectedWaypointButton) {
//Unselect
buttonGroup_waypoints.remove(button);
button.setSelected(false);
buttonGroup_waypoints.add(button);
selectedWaypointButton = null;
routeController.setSelectedWaypoint(null);
} else {
selectedWaypointButton = button;
routeController.setSelectedWaypoint(waypointButtonToGraphicId.get(button));
}
}
});
button.setMaximumSize(new Dimension(Integer.MAX_VALUE,60));
button.setMinimumSize(new Dimension(0,60));
jPanel_waypointsList.add(button);
buttonGroup_waypoints.add(button);
}
项目:phoenix.webui.suite.runner
文件:SuiteRunnerLauncher.java
/**
* @param centerPanel
* @param urlList
*/
private static void createItemsPanel(JPanel centerPanel,List<URL> urlList)
{
JPanel itemsPanel = new JPanel();
centerPanel.add(itemsPanel,BorderLayout.CENTER);
if(CollectionUtils.isEmpty(urlList))
{
return;
}
for(URL url : urlList)
{
String text = url.getFile();
JCheckBox Box = new JCheckBox(new File(text).getName());
Box.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
JCheckBox source = (JCheckBox) e.getSource();
if(source.isSelected())
{
runnerList.add(source.getText());
}
else
{
runnerList.remove(source.getText());
}
}
});
itemsPanel.add(Box);
}
}
项目:java-swing-template
文件:Dashboard.java
/**
* Creates new form Dashboard
*/
public Dashboard() {
initComponents();
Dashboard.this.setExtendedState(JFrame.MAXIMIZED_BOTH);
initButtons();
initBackground();
Utilities.setwindowIcon(Dashboard.this);
Timer t = new Timer(3000,new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (new File("updater.exe").exists()) {
Thread th = new Thread(new Runnable() {
@Override
public void run() {
Utilities.runShellCommand(Updator.COMMAND_UPDATECHECK);
}
});
th.start();
} else {
JOptionPane.showMessageDialog(Dashboard.this,"Your software version is not equipped with the automatic update funcationality.\nPlease install the latest software to get updater facility.\nThank you.","Outdated software",JOptionPane.@R_750_4045@ION_MESSAGE);
}
}
});
t.setRepeats(false);
t.start();
}
public synchronized void addActionListener(java.awt.event.ActionListener listener) {
if (actionListenerList == null) {
actionListenerList = new java.util.ArrayList<ActionListener>();
}
actionListenerList.add(listener);
}
项目:ramus
文件:OtherElementTableCellEditor.java
private JButton createEditButton() {
JButton edit = new JButton();
edit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
edit();
}
});
edit.setIcon(new ImageIcon(getClass().getResource(
"/com/ramussoft/gui/edit.png")));
edit.setToolTipText(GlobalResourcesManager.getString("edit"));
edit.setFocusable(false);
edit.setPreferredSize(new Dimension(16,16));
return edit;
}
项目:GameOfSet
文件:InfoPanel.java
private JButton createAddButton() {
JButton button = new JButton("ADD");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
mainFrame.flipThreeMoreCards();
}
});
return button;
}
项目:GitHub
文件:ErrorDialog.java
public ErrorDialog(String errorInfo) {
setContentPane(contentPane);
setTitle("Error Info");
getRootPane().setDefaultButton(okButton);
this.setAlwaysOnTop(true);
editTP.setText(errorInfo);
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
});
editTP.setCaretPosition(0);
}
项目:XiaomiRobotVacuumProtocol
文件:RRDraw.java
public RRDraw() {
super("File View Test Frame");
setSize(350,400);
setDefaultCloSEOperation(EXIT_ON_CLOSE);
parent = this;
rrDrawPanel = new RRDrawPanel();
Container c = getContentPane();
// The default BorderLayout will work better.
// c.setLayout(new FlowLayout());
JButton openButton = new JButton("Open");
final JLabel statusbar = new JLabel("Output of your selection will go here");
openButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
JFileChooser chooser = new JFileChooser("images");
int option = chooser.showOpenDialog(parent);
if (option == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
BufferedImage loadImage = loadImage(file);
statusbar.setText(file.getName() + " size " + loadImage.getWidth() + "x" + loadImage.getHeight());
// setSize(loadImage.getWidth(),loadImage.getHeight());
rrDrawPanel.setSize(loadImage.getHeight(),loadImage.getWidth());
} else {
statusbar.setText("You cancelled.");
}
}
});
JPanel north = new JPanel();
north.add(openButton);
north.add(statusbar);
north.setBackground(Color.GRAY);
north.setForeground(Color.BLUE);
c.add(north,"First");
c.add(new JScrollPane(rrDrawPanel),"Center");
}
项目:featurea
文件:SimulationTreePanel.java
/**
* Notifies all the action listeners of the event.
*
* @param command the command
*/
private void notifyActionListeners(String command) {
ActionListener[] listeners = this.getListeners(ActionListener.class);
int size = listeners.length;
ActionEvent event = new ActionEvent(this,ActionEvent.ACTION_PERFORMED,command);
for (int i = 0; i < size; i++) {
listeners[i].actionPerformed(event);
}
}
/**
* Used by Controller to post action events for selection and close
* operations. If the event is consumed,the UI should take no action to
* change the selection or close the tab,and will presume that the receiver
* of the event is handling performing whatever action is appropriate.
*
* @param event The event to be fired
*/
protected final void postActionEvent( TabActionEvent event ) {
List<ActionListener> list;
synchronized( this ) {
if( actionListenerList == null ) {
return;
}
list = Collections.unmodifiableList( actionListenerList );
}
for( ActionListener l : list ) {
l.actionPerformed( event );
}
}
项目:jtk
文件:LogAxisPlotDemo.java
public static JButton limitsTestButton(final PlotPanel plot){
JButton b = new JButton("setLimits Test");
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
plot.setLimits(10,20,100,1000);
}
});
return b;
}
项目:DocIT
文件:EmployeeView.java
public void showEmployee(Employee employee) {
frame.setTitle("Employee \"" + employee.getName() + "\"");
nameField.setText(employee.getName());
addressField.setText(employee.getAddress());
salaryField.setText(Double.toString(employee.getSalary()));
for (ActionListener al : cutButton.getActionListeners())
cutButton.removeActionListener(al);
cutButton.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
controller.cutEmployeeClicked();
}
});
frame.setVisible(true);
}
项目:incubator-netbeans
文件:BasicReplaceResultsPanel.java
private void init() {
JPanel leftPanel = new JPanel();
replaceButton = new JButton();
replaceButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
replace();
}
});
updateReplaceButton();
leftPanel.setLayout(new BoxLayout(leftPanel,BoxLayout.PAGE_AXIS));
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout(FlowLayout.LEADING,1));
buttonPanel.add(replaceButton);
replaceButton.setMaximumSize(replaceButton.getPreferredSize());
buttonPanel.setMaximumSize(new Dimension( // #225246
(int) buttonPanel.getMaximumSize().getWidth(),(int) buttonPanel.getPreferredSize().getHeight()));
leftPanel.add(resultsOutlinesupport.getoutlineView());
leftPanel.add(buttonPanel);
this.splitPane = new JSplitPane();
splitPane.setLeftComponent(leftPanel);
splitPane.setRightComponent(new ContextView(resultModel,getExplorerManager()));
initSplitDividerLocationHandling();
getContentPanel().add(splitPane);
initResultModelListener();
replaceButton.getAccessibleContext().setAccessibleDescription(
NbBundle.getMessage(ResultView.class,"ACS_TEXT_BUTTON_REPLACE")); //NOI18N
}
/** Overrides superclass method. */
@Override
public void create() throws IOException {
final PropertiesDataObject propertiesDataObject =
(PropertiesDataObject)getCookie(DataObject.class);
final Dialog[] dialog = new Dialog[1];
final LocalePanel panel = new LocalePanel();
DialogDescriptor dialogDescriptor = new DialogDescriptor(
panel,NbBundle.getBundle(PropertiesDatanode.class).getString("CTL_NewLocaleTitle"),true,DialogDescriptor.OK_CANCEL_OPTION,DialogDescriptor.OK_OPTION,new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == DialogDescriptor.OK_OPTION) {
if (containsLocale(propertiesDataObject,panel.getLocale())) {
NotifyDescriptor.Message msg = new NotifyDescriptor.Message(
messageformat.format(NbBundle.getBundle(PropertiesDatanode.class).getString("MSG_LangExists"),panel.getLocale()),NotifyDescriptor.ERROR_MESSAGE);
Dialogdisplayer.getDefault().notify(msg);
} else {
Util.createLocaleFile(propertiesDataObject,panel.getLocale().toString(),true);
dialog[0].setVisible(false);
dialog[0].dispose();
}
}
}
}
);
dialogDescriptor.setClosingOptions(new Object [] { DialogDescriptor.CANCEL_OPTION });
dialog[0] = Dialogdisplayer.getDefault().createDialog(dialogDescriptor);
dialog[0].setVisible(true);
}
项目:KernelHive
文件:MainFrame.java
private void initHelpMenu() {
mnHelp = new JMenu(BUNDLE.getString("MainFrame.mnHelp.text"));
mnHelp.setMnemonic(KeyEvent.VK_H);
mainMenuBar.add(mnHelp);
// mntmContents = new
// JMenuItem(BUNDLE.getString("MainFrame.mntmContents.text"));
// mntmContents.setAccelerator(Keystroke.getKeystroke(KeyEvent.VK_F1,// 0));
// mntmContents.setIcon(new
// ImageIcon(MainFrame.class.getResource("/toolbarButtonGraphics/general/About16.gif")));
// mntmContents.addActionListener(new ActionListener() {
//
// @Override
// public void actionPerformed(ActionEvent e) {
// // Todo Auto-generated method stub
//
// }
// });
// mnHelp.add(mntmContents);
mntmAbout = new JMenuItem(BUNDLE.getString("MainFrame.mntmAbout.text"));
mntmAbout
.setIcon(new ImageIcon(
MainFrame.class
.getResource("/toolbarButtonGraphics/general/@R_750_404[email protected]")));
mntmAbout.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
controller.openAboutDialog();
}
});
mnHelp.add(mntmAbout);
}
项目:openjdk-jdk10
文件:bug8025082.java
private static void createUI() {
frame = new JFrame();
frame.setDefaultCloSEOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500,500);
JTextPane textpane = new JTextPane();
textpane.setText("Select Me");
textpane.selectAll();
JPanel panel = new JPanel(new BorderLayout());
panel.add(textpane,BorderLayout.CENTER);
button = new JButton("Press Me");
panel.add(button,BorderLayout.soUTH);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!textpane.getCaret().isSelectionVisible()) {
throw new RuntimeException("Highlight removed after "
+ "button click");
}
}
});
frame.getContentPane().add(panel);
frame.setLocationRelativeto(null);
frame.setVisible(true);
}
项目:incubator-netbeans
文件:TreeList.java
public TreeList(TreeListModel model) {
super(model);
setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
setFixedCellHeight(ROW_HEIGHT + INSETS_TOP + INSETS_BottOM + 2);
setCellRenderer(renderer);
setBackground(ColorManager.getDefault().getDefaultBackground());
ToolTipManager.sharedInstance().registerComponent(this);
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() != 2 || e.isPopupTrigger() || e.isConsumed()) {
return;
}
int index = locationToIndex(e.getPoint());
if (index < 0 || index >= getModel().getSize()) {
return;
}
Object value = getModel().getElementAt(index);
if (value instanceof TreeListNode) {
TreeListNode node = (TreeListNode) value;
if (null != node && !node.isExpandable()) {
ActionListener al = node.getDefaultAction();
if (null != al) {
al.actionPerformed(new ActionEvent(e.getSource(),e.getID(),e.paramString()));
}
} else if (null != node && node.isExpandable()) {
if (!node.isLoaded()) {
return;
}
node.setExpanded(!node.isExpanded());
}
}
}
});
}
项目:cuttlefish
文件:StatusBar.java
public StatusBar() {
super();
this.setBackground(Color.WHITE);
terminateTask = new JButton("Stop");
label = new JLabel();
label1 = new JLabel("Status ");
progressBar = new JProgressBar();
progressBar.setMinimum(50);
progressBar.setMaximum(100);
add(label1);
add(progressBar);
add(label);
add(terminateTask);
setMessage("Ready");
terminateTask.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(currentTask == null)
return;
currentTask.cancel(true);
setMessage("Task canceled");
terminateTask.setEnabled(false);
}
});
}
项目:ZooKeeper
文件:NodeViewerData.java
/**
*
*/
public NodeViewerData() {
this.setLayout(new BorderLayout());
this.dataArea = new JTextPane();
this.toolbar = new JToolBar();
this.toolbar.setFloatable(false);
JScrollPane scroller = new JScrollPane(this.dataArea);
scroller
.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
this.add(scroller,BorderLayout.CENTER);
this.add(this.toolbar,BorderLayout.norTH);
JButton saveButton = new JButton(ZooInspectorIconResources
.getSaveIcon());
saveButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (selectednode != null) {
if (JOptionPane.showConfirmDialog(NodeViewerData.this,"Are you sure you want to save this node?"
+ " (this action cannot be reverted)","Confirm Save",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
zooInspectorManager.setData(selectednode,dataArea
.getText());
}
}
}
});
this.toolbar.add(saveButton);
}
项目:openjdk-jdk10
文件:Test6179222.java
public static void main(String[] args) {
Test6179222 test = new Test6179222();
// test 6179222
test(EventHandler.create(ActionListener.class,test,"foo","source.icon"));
// test 6265540
test(EventHandler.create(ActionListener.class,"bar.doit"));
if (!test.bar.invoked) {
throw new Error("Bar was not set");
}
}
项目:Tarski
文件:VisualizationActionListenerFactory.java
public static ActionListener interpretAtomMenuItemActionListener() {
return new ActionListener() {
IMarker selectedMarker;
@Override
public void actionPerformed(final ActionEvent e) {
final AlloyAtom alloyAtom = (AlloyAtom) Visualization.rightClickedAnnotation;
showWizard();
if (selectedMarker == null) {
return;
}
final String sigTypeName = alloyAtom.getType().getName();
final String stringIndex = alloyAtom.toString().substring(sigTypeName.length());
int index = 0;
if (!stringIndex.isEmpty()) {
index = Integer.parseInt(stringIndex);
}
AlloyUtilities.bindAtomToMarker(sigTypeName,index,selectedMarker);
Visualization.showViz();
}
private void showWizard() {
display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
final InterpretationWizard wizard = new InterpretationWizard();
final WizardDialog dialog = new WizardDialog(
Activator.getDefault().getWorkbench().getWorkbenchWindows()[0].getShell(),wizard);
dialog.open();
selectedMarker = wizard.getSelectedMarker();
}
});
}
};
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。