@Override public void actionPerformed(ActionEvent e) { if ("startButton".equals(e.getActionCommand())) { datasetIndex = datasetBox.getSelectedIndex(); if (dataset[datasetIndex] == null) { DelimitedTextParser parser = new DelimitedTextParser(); parser.setDelimiter("[\t]+"); parser.setRowNames(true); parser.setColumnNames(true); if (datasetIndex == 2 || datasetIndex == 3) { parser.setRowNames(false); } try { dataset[datasetIndex] = parser.parse(datasetName[datasetIndex], smile.data.parser.IOUtils.getTestDataFile(datasource[datasetIndex])); } catch (Exception ex) { JOptionPane.showMessageDialog(null, "Failed to load dataset.", "ERROR", JOptionPane.ERROR_MESSAGE); System.err.println(ex); } } Thread thread = new Thread(this); thread.start(); } }
@Override public void actionPerformed(ActionEvent e) { // System.out.println(e); try { float x = Float.parseFloat(tfx.getText()); float y = Float.parseFloat(tfy.getText()); point.setLocation(x, y); writeMethod.invoke(filter, point); point = (Point2D.Float) readMethod.invoke(filter); // getString the value from the getter method to constrain it set(point); } catch (NumberFormatException fe) { tfx.selectAll(); tfy.selectAll(); } catch (InvocationTargetException ite) { ite.printStackTrace(); } catch (IllegalAccessException iae) { iae.printStackTrace(); } }
private void saveSimMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveSimMenuActionPerformed String file = FileUtils.selectNonExistingFile(this, ".xml.gz"); if ( file != null){ try { simForm.guiToObj(); simulation.labelNumberTransducers(); simulation.setHoloMemory( holoPatternsForm.getHoloMemory() ); simulation.getMaskObjects().clear(); scene.gatherMeshEntitiesWithTag( simulation.getMaskObjects(), Entity.TAG_MASK); simulation.getSlices().clear(); scene.gatherMeshEntitiesWithTag( simulation.getSlices(), Entity.TAG_SLICE); FileUtils.writeCompressedObject(new File(file), simulation); } catch (IOException ex) { Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex); } } }
private void queryButtonActionPerformed(ActionEvent e) { // query that returns all contacts TypedQuery<Addresses> findByLastname = entityManager.createNamedQuery( "Addresses.findByLastname", Addresses.class); // configure parameter for query findByLastname.setParameter("lastname", queryTextField.getText()); results = findByLastname.getResultList(); // get all addresses numberOfEntries = results.size(); if (numberOfEntries != 0) { currentEntryIndex = 0; displayRecord(); nextButton.setEnabled(true); previousButton.setEnabled(true); } else browseButtonActionPerformed(e); }
@Override public void actionPerformed (ActionEvent e) { if (e.getSource() == panel.btnRemove) { removeTag(getSelectedTag()); } else if (e.getSource() == panel.btnUpdate) { dialog.setVisible(false); EventQueue.invokeLater(new Runnable() { @Override public void run () { SystemAction.get(UpdateAction.class).update(repository, getSelectedTag().getRevisionInfo()); } }); } }
public void loadPage(String url, final ActionListener listener) throws IOException { this.url = url; pane = new JEditorPane(); pane.setContentType("text/html"); pane.addPropertyChangeListener("page", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { generate(0); if (listener != null) listener.actionPerformed(new ActionEvent( HTMLPrintable.this, 0, "PageLoaded")); } }); pane.setPage(url); }
@Override public void actionPerformed(ActionEvent e) { /* Button event listener */ String command = e.getActionCommand(); if (command.equals("Pass")) { /* Test has passed. Dispose the frame with success message */ testComplete = true; testResult = true; System.out.println("Test Passed."); } else if (command.equals("Fail")) { /* Test has failed. Dispose the frame and throw exception */ testComplete = true; testResult = false; } }
private void butDeleteSpecScedActionPerformed( java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butDeleteSpecScedActionPerformed if (listSpecSced.getSelectedIndex() != -1) { if (0 != JOptionPane .showConfirmDialog(this, "Do you really want remove the special schedule?", "Removing", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)) { return; } QSpecSchedule sps = (QSpecSchedule) listSpecSced.getSelectedValue(); if (sps != null) { final QCalendar item = (QCalendar) listCalendar.getSelectedValue(); if (item == null) { return; } item.getSpecSchedules().remove(sps); listSpecSced.setModel(new DefaultComboBoxModel(item.getSpecSchedules().toArray())); } } }
@Override public void actionPerformed(ActionEvent e) { File file = SwingTools.chooseFile(RapidMinerGUI.getMainFrame(), "export_process", null, false, false, new String[] { RapidMiner.PROCESS_FILE_EXTENSION, "xml" }, new String[] { "Process File", "Process File" }); if (file == null) { return; } try { new FileProcessLocation(file).store(RapidMinerGUI.getMainFrame().getProcess(), null); } catch (IOException e1) { SwingTools.showSimpleErrorMessage("cannot_save_process", e1, RapidMinerGUI.getMainFrame().getProcess() .getProcessLocation(), e1.getMessage()); } }
public static void searchByTag_actionPerformed(ActionEvent e) { TagSearchController sc = new TagSearchController(App.getFrame(), Local.getString("Search By Tag")); Dimension frmSize = App.getFrame().getSize(); Point loc = App.getFrame().getLocation(); sc.setLocation((frmSize.width) / 3 + loc.x, (frmSize.height) / 3 + loc.y); sc.setVisible(true); if (sc.CANCELLED) return; }
public SimplePlotterPanelDialog(Frame owner, final DataTable dataTable, int width, int height, boolean modal) { super(owner, dataTable.getName(), modal); setDefaultCloseOperation(DISPOSE_ON_CLOSE); PlotterPanel plotterPanel = new PlotterPanel(dataTable, PlotterConfigurationModel.DATA_SET_PLOTTER_SELECTION); getContentPane().add(plotterPanel, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ok(); } }); buttonPanel.add(okButton); getContentPane().add(buttonPanel, BorderLayout.SOUTH); if ((width < 0) || (height < 0)) { setSize(600, 400); } else { setSize(width, height); } setLocationRelativeTo(owner); }
private void customizeOptionsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customizeOptionsButtonActionPerformed String origin = txtVMOptions.getText(); try { String result = ProjectUISupport.showVMOptionCustomizer(SwingUtilities.getWindowAncestor(this), origin); result = splitJVMParams(result, true); txtVMOptions.setText(result); } catch (Exception e) { Logger.getLogger(RunJarPanel.class.getName()).log(Level.WARNING, "Cannot parse vm options.", e); // NOI18N } }
private Action onTestDataRenameAction() { return new AbstractAction() { @Override public void actionPerformed(ActionEvent ae) { String newName = getValue("newValue").toString(); Boolean returnVal = false; if (Validator.isValidName(newName)) { TestDataTablePanel panel = getSelectedData(); if (panel != null) { returnVal = panel.rename(getValue("newValue").toString()); } } putValue("rename", returnVal); } }; }
private void addAllButtonActionPerformed(ActionEvent evt) { DataObject resource = selectResource(); if (resource == null) { return; } // Feed data. for (int i = 0; i < resourcesTable.getRowCount(); i++) { DataObject dataObject = (DataObject) resourcesTable.getValueAt(i, 0); sourceMap.put(dataObject, new SourceData(resource)); tableModel.fireTableCellUpdated(i, 1); } descPanel.fireStateChanged(); }
void parentTask_actionPerformed(ActionEvent e) { // String taskId = taskTable.getModel().getValueAt(taskTable.getSelectedRow(), TaskTable.TASK_ID).toString(); // // Task t = CurrentProject.getTaskList().getTask(taskId); /*XXX Task t2 = CurrentProject.getTaskList().getTask(taskTable.getCurrentRootTask()); String parentTaskId = t2.getParent(); if((parentTaskId == null) || (parentTaskId.equals(""))) { parentTaskId = null; } taskTable.setCurrentRootTask(parentTaskId); taskTable.tableChanged();*/ // parentPanel.updateIndicators(); // //taskTable.updateUI(); }
public void testExecutionCanBeForcedToBeSynchronous() throws Exception { DoesOverrideAndReturnsTrue action = (DoesOverrideAndReturnsTrue)DoesOverrideAndReturnsTrue.get(DoesOverrideAndReturnsTrue.class); synchronized (action) { action.actionPerformed(new ActionEvent(this, 0, "waitFinished")); assertTrue("When asked for synchronous the action is finished immediatelly", action.finished); } if (err.toString().indexOf(DoesOverrideAndReturnsTrue.class.getName()) >= 0) { fail("No warning about the class: " + err); } }
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); }
@Override public void actionPerformed(ActionEvent e) { if( e.getSource() == showAll ) { GlassSwingWorker<JComponent> worker = new GlassSwingWorker<JComponent>() { @Override public JComponent construct() throws Exception { return new OverrideDefaultAclViewer(aclManager, userService, domainObj, privilege); } @Override public void finished() { showAll.setEnabled(false); InheritedEditorPanel.this.add(get(), BorderLayout.CENTER); InheritedEditorPanel.this.updateUI(); } @Override public void exception() { getException().printStackTrace(); } }; worker.setComponent(this); worker.start(); } }
private void buttonAdvanceActionPerformed( java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAdvanceActionPerformed setAdvanceRegim(!isAdvanceRegim()); if (isMed && !isAdvanceRegim()) { showMed(); } showButtons(root, panelMain); }
public AttributeFileValueCellEditor(ParameterTypeAttributeFile type) { super(type); JButton button = new JButton(new ResourceAction(true, "edit_attributefile") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { buttonPressed(); } }); button.setMargin(new Insets(0, 0, 0, 0)); button.setToolTipText("Edit or create attribute description files and data (XML)."); addButton(button, GridBagConstraints.RELATIVE); addButton(createFileChooserButton(), GridBagConstraints.REMAINDER); }
private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) { tikzExporter.setFixedSize(sizeFixedRButton.isSelected()); if(sizeFixedRButton.isSelected()) { int width, height; width = Integer.parseInt(widthTextField.getText()); height = Integer.parseInt(heightTextField.getText()); tikzExporter.setSize(width, height); } else if(sizeScaledRButton.isSelected()) { double node, edge, coord; node = Double.parseDouble(nodeTextField.getText()); edge = Double.parseDouble(edgeTextField.getText()); coord = Double.parseDouble(coordTextField.getText()); tikzExporter.setScalingFactors(node, edge, coord); } else if(sizeDefaultRButton.isSelected()) { // Select default scaling factors tikzExporter.setDefaultFactors(); getScalingFactors(); calculateHeightAndWidth(); } if(style3DRButton.isSelected()) { tikzExporter.setNodeStyle("ball"); } else { tikzExporter.setNodeStyle("circle"); } tikzExporter.setOutputFile(new File(fileTextField.getText())); tikzExporter.exportToTikz(networkPanel.getNetworkLayout()); this.setVisible(false); }
private ActionListener privateItemListener() { ActionListener listener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final String roomNumber = roomNumCmbBox.getSelectedItem().toString(); if(!roomNumber.isEmpty()) { Room theRoom = roomDaoImpl.getRoomByRoomNumber(roomNumber); roomTypeCmbBox.setSelectedItem(theRoom.getType()); priceField.setValue(theRoom.getPrice()); currencyCmbBox.setSelectedItem(theRoom.getCurrency()); } repaint(); } }; return listener; }
public void jAlignActionB_actionPerformed(ActionEvent e) { HTMLEditorKit.AlignmentAction aa = new HTMLEditorKit.AlignmentAction( "justifyAlign", StyleConstants.ALIGN_JUSTIFIED); aa.actionPerformed(e); }
private void buttonCustomJSMessageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCustomJSMessageActionPerformed final JFXJavaScriptCallbacksPanel rc = new JFXJavaScriptCallbacksPanel(jfxProps); final DialogDescriptor dd = new DialogDescriptor(rc, NbBundle.getMessage(JFXDeploymentPanel.class, "TXT_JSCallbacks"), // NOI18N true, DialogDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, null); if (DialogDisplayer.getDefault().notify(dd) == DialogDescriptor.OK_OPTION) { jfxProps.setJSCallbacks(rc.getResources()); jfxProps.setJSCallbacksChanged(true); refreshCustomJSLabel(); } }
private void cbSharableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbSharableActionPerformed txtLibFolder.setEnabled(cbSharable.isSelected()); btnLibFolder.setEnabled(cbSharable.isSelected()); lblHint.setEnabled(cbSharable.isSelected()); lblLibFolder.setEnabled(cbSharable.isSelected()); if (cbSharable.isSelected()) { txtLibFolder.setText(currentLibrariesLocation); } else { txtLibFolder.setText(""); //NOi18N } }
public void actionPerformed(ActionEvent e){ JEditorPane editor = getEditor(e); if (editor != null) { javax.swing.text.DefaultHighlighter.DefaultHighlightPainter highlightPainter = new javax.swing.text.DefaultHighlighter.DefaultHighlightPainter(Color.YELLOW); //editor.getHighlighter().addHighlight(p0, p1, highlightPainter); } }
@Override public Action getPreferredAction () { return new AbstractAction () { public void actionPerformed (ActionEvent e) { try { model.performDefaultAction (object); } catch (UnknownTypeException ex) { // NodeActionsProvider is voluntary } } }; }
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == getMainWindow().getBarMenu().getRaCodeHighLighting()) { if (((JCheckBoxMenuItem) e.getSource()).isSelected()) { getMainWindow().getWorkspace().enableSyntaxEditingRaEditor(); } else { getMainWindow().getWorkspace().disableSyntaxEditingRaEditor(); } } else if (e.getSource() == getMainWindow().getBarMenu().getSqlCodeHighLighting()) { if (((JCheckBoxMenuItem) e.getSource()).isSelected()) { getMainWindow().getWorkspace().enableSyntaxEditingSqlEditor(); } else { getMainWindow().getWorkspace().disableSyntaxEditingSqlEditor(); } } }
@Override public void actionPerformed(ActionEvent ae) { @SuppressWarnings("unchecked") TableRowSorter<TableModel>sorter = (TableRowSorter<TableModel>) getJTableThreadProtocolVector().getRowSorter(); if (ae.getSource()==this.getJRadioButtonNoFilter()) { // --- Remove Filter ---------------- sorter.setRowFilter(null); } else if (ae.getSource()==this.getJRadioButtonFilterAgents()) { // --- Set Filter ------------------- RowFilter<Object,Object> agentFilter = new RowFilter<Object, Object>() { public boolean include(Entry<? extends Object, ? extends Object> entry) { // --- get column with ThreadDetail-Instance (ThreadName) --- if(entry.getValue(1) instanceof ThreadDetail) { ThreadDetail tt = (ThreadDetail)entry.getValue(1); if(tt.isAgent() == true) { return true; } } return false; } }; sorter.setRowFilter(agentFilter); } }
public void actionPerformed(ActionEvent e) { /* * Create a string containing the current action command and display * it in the top panel's label. */ String actionCommand = e.getActionCommand(); label.setText("Action: " + actionCommand); if (actionCommand.equals("comboBoxChanged") && (switching == false)) { comboWasChanged(e); } if (actionCommand.equals("<") || actionCommand.equals(">")) { unitButtonPressed(e); checkUnitVsTarget(targetDimension); } if (actionCommand.equals("^") || actionCommand.equals("v")) { exponentButtonPressed(e); checkUnitVsTarget(targetDimension); } if (actionCommand.equals("Submit")) { int usize = unitsVector.size(); Unit[] allUnits = new Unit[usize]; double[] allExponents = new double[usize]; for (int i = 0; i < usize; i++) { allUnits[i] = UnitFilter.stringToUnit(unitsVector .elementAt(i).toString()); allExponents[i] = Double.parseDouble((exponentVector .elementAt(i).toString())); } currentCompoundUnit = new CompoundUnit(allUnits, allExponents); System.exit(0); } }
/** * */ public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof mxGraphComponent) { mxGraphComponent graphComponent = (mxGraphComponent) e .getSource(); double scale = this.scale; if (scale == 0) { String value = (String) JOptionPane.showInputDialog( graphComponent, mxResources.get("value"), mxResources.get("scale") + " (%)", JOptionPane.PLAIN_MESSAGE, null, null, ""); if (value != null) { scale = Double.parseDouble(value.replace("%", "")) / 100; } } if (scale > 0) { graphComponent.zoomTo(scale, graphComponent.isCenterZoom()); } } }
/** * Action listener: handles actions in panel buttons */ // Call on EDT public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JButton) { JButton button = (JButton) e.getSource(); // Refresh button if (button == refreshButton) { refreshAttributes(); return; } // Clear button if (button == clearButton) { clearCurrentNotifications(); return; } // Subscribe button if (button == subscribeButton) { registerListener(); return; } // Unsubscribe button if (button == unsubscribeButton) { unregisterListener(); return; } } }
@Override public Object getValueAt(int row, int col) { // TODO Auto-generated method stub switch(col){ case COURSE_NAME:return list.get(row); case COURSE_BUTTON:final JButton jbtn = new JButton("Go to Course Page"); jbtn.setActionCommand(list.get(row)); jbtn.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent arg0) { String course=jbtn.getActionCommand(); System.out.println(course+" on button press"); //System.out.println(" on button press"); String path=cmdao.getDirectoryPathForProf(course, user); pf.csp.curr_subject=course; System.out.println(path); try { pf.csp.resetPanes(pdao.getProfByUsername(user), path); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } CardLayout card=(CardLayout)pf.panel.getLayout(); pf.btnBack.setEnabled(true); card.show(pf.panel, "CourseSpecificPanel"); } }); return jbtn; } return null; }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { Gutter gutter = RSyntaxUtilities.getGutter(textArea); if (gutter!=null) { int line = textArea.getCaretLineNumber(); try { gutter.toggleBookmark(line); } catch (BadLocationException ble) { // Never happens UIManager.getLookAndFeel(). provideErrorFeedback(textArea); ble.printStackTrace(); } } }
/** * The operation to perform when this action is triggered. * * @param e the action event */ public void actionPerformed(ActionEvent e) { JTextComponent target = getTextComponent(e); if (target != null) { if ((! target.isEditable()) || (! target.isEnabled())) { UIManager.getLookAndFeel().provideErrorFeedback(target); return; } target.replaceSelection("\n"); } }
@Override public void actionPerformed(ActionEvent e) { if (ImageToZxSpec.getInFiles() == null || ImageToZxSpec.getInFiles().length == 0) { JOptionPane.showMessageDialog(null, getCaption("dialog_choose_input_first"), getCaption("dialog_files_not_selected"), JOptionPane.INFORMATION_MESSAGE); } if (ImageToZxSpec.getOutFolder() == null) { JOptionPane.showMessageDialog(null, getCaption("dialog_choose_folder_first"), getCaption("dialog_folder_not_selected"), JOptionPane.INFORMATION_MESSAGE); } if (operationFinishedListener != null) { operationFinishedListener.operationFinished(ImageToZxSpec.getInFiles() != null && ImageToZxSpec.getInFiles().length >0 && ImageToZxSpec.getOutFolder() != null); } }
private void addMenuItemListener(final JCheckBoxMenuItem menuItem) { final boolean[] internalChange = new boolean[1]; menuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { if (internalChange[0]) return; final int column = Integer.parseInt(e.getActionCommand()); if (column == 5 && !fieldsListTableModel.isRealColumnVisible(column)) { BrowserUtils.performTask(new Runnable() { public void run() { final int retainedSizesState = referencesBrowserController.getReferencesControllerHandler(). getHeapFragmentWalker().computeRetainedSizes(false, true); SwingUtilities.invokeLater(new Runnable() { public void run() { if (retainedSizesState != HeapFragmentWalker.RETAINED_SIZES_COMPUTED) { internalChange[0] = true; menuItem.setSelected(!menuItem.isSelected()); internalChange[0] = false; } else { fieldsListTableModel.setRealColumnVisibility(column, !fieldsListTableModel.isRealColumnVisible(column)); fieldsListTable.createDefaultColumnsFromModel(); fieldsListTable.updateTreeTableHeader(); setColumnsData(); } } }); } }); } else { fieldsListTableModel.setRealColumnVisibility(column, !fieldsListTableModel.isRealColumnVisible(column)); fieldsListTable.createDefaultColumnsFromModel(); fieldsListTable.updateTreeTableHeader(); setColumnsData(); } } }); }
/** * Invoked when an action occurs. */ public void actionPerformed(ActionEvent e) { int index = stationTable.getSelectedRow(); if (index >= 0 && index < stationTable.getRowCount()) { Object key = stations.get(index); stations.remove(key); bd.removeRegionStation(regionKey, key); BlockingStationPanel.this.update(); } }
private void newFolderButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newFolderButtonActionPerformed final Node [] nodes = manager.getSelectedNodes (); rp.post(new Runnable() { @Override public void run() { DataFolder df = doNewFolder (nodes); assert df != null : "New DataFolder can not be created under "+Arrays.toString(nodes); // invoke inplace editing Node targerNode; if (nodes == null || nodes.length == 0) { targerNode = manager.getRootContext (); } else { targerNode = nodes [0].isLeaf () ? nodes [0].getParentNode () : nodes [0]; } final Node newSubfolder = findChild (targerNode, df.getName (), 3); assert newSubfolder != null : "Node for subfolder found in nodes: " + Arrays.asList (targerNode.getChildren ().getNodes ()); if (newSubfolder != null) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { manager.setSelectedNodes (new Node [] { newSubfolder }); } catch (PropertyVetoException pve) { Logger.getLogger(TemplatesPanel.class.getName()).log(Level.WARNING, null, pve); } view.invokeInplaceEditing (); } }); } } }); }
@Override public void actionPerformed(final ActionEvent e) { if (!getModel().getSelectedPerspective().isUserDefined()) { getModel().restoreDefault(getModel().getSelectedPerspective().getName()); getModel().getSelectedPerspective().apply(context); } }