Java Code Examples for java.awt.event.ActionEvent

The following are top voted examples for showing how to use java.awt.event.ActionEvent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: smile_1.5.0_java7   File: SammonMappingDemo.java   View source code 9 votes vote down vote up
@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();
    }
}
 
Example 2
Project: ramus   File: HTMLPrintable.java   View source code 8 votes vote down vote up
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);
}
 
Example 3
Project: jaer   File: ControlPanel.java   View source code 6 votes vote down vote up
@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();
                }
            }
 
Example 4
Project: Ultraino   File: MainForm.java   View source code 6 votes vote down vote up
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);
        }
    }
}
 
Example 5
Project: LivroJavaComoProgramar10Edicao   File: AddressBook.java   View source code 6 votes vote down vote up
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);
}
 
Example 6
Project: incubator-netbeans   File: TagManager.java   View source code 6 votes vote down vote up
@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());
            }
        });
    }
}
 
Example 7
Project: openjdk-jdk10   File: VolatileImageConfigurationTest.java   View source code 6 votes vote down vote up
@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;
    }
}
 
Example 8
Project: sbc-qsystem   File: FAdmin.java   View source code 6 votes vote down vote up
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()));
        }
    }
}
 
Example 9
Project: incubator-netbeans   File: ResourceWizardPanel.java   View source code 5 votes vote down vote up
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();
}
 
Example 10
Project: sbc-qsystem   File: FWelcome.java   View source code 5 votes vote down vote up
private void buttonAdvanceActionPerformed(
    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAdvanceActionPerformed
    setAdvanceRegim(!isAdvanceRegim());
    if (isMed && !isAdvanceRegim()) {
        showMed();
    }
    showButtons(root, panelMain);
}
 
Example 11
Project: rapidminer   File: AttributeFileValueCellEditor.java   View source code 5 votes vote down vote up
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);
}
 
Example 12
Project: cuttlefish   File: TikzDialog.java   View source code 5 votes vote down vote up
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);
}
 
Example 13
Project: Hotel-Properties-Management-System   File: NewReservationWindow.java   View source code 5 votes vote down vote up
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;
}
 
Example 14
Project: Dahlem_SER316   File: HTMLEditor.java   View source code 5 votes vote down vote up
public void jAlignActionB_actionPerformed(ActionEvent e) {
	HTMLEditorKit.AlignmentAction aa =
		new HTMLEditorKit.AlignmentAction(
			"justifyAlign",
			StyleConstants.ALIGN_JUSTIFIED);
	aa.actionPerformed(e);
}
 
Example 15
Project: incubator-netbeans   File: JFXDeploymentPanel.java   View source code 5 votes vote down vote up
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();
    }
}
 
Example 16
Project: incubator-netbeans   File: PanelOptionsVisual.java   View source code 5 votes vote down vote up
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
        }
}
 
Example 17
Project: SER316-Ingolstadt   File: HTMLEditor.java   View source code 5 votes vote down vote up
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);
	}
}
 
Example 18
Project: incubator-netbeans   File: TreeModelNode.java   View source code 5 votes vote down vote up
@Override
public Action getPreferredAction () {
    return new AbstractAction () {
        public void actionPerformed (ActionEvent e) {
            try {
                model.performDefaultAction (object);
            } catch (UnknownTypeException ex) {
                // NodeActionsProvider is voluntary
            }
        }
    };
}
 
Example 19
Project: JITRAX   File: ListenersSetter.java   View source code 5 votes vote down vote up
@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();
		}
	}
}
 
Example 20
Project: AgentWorkbench   File: ThreadMonitorProtocolTableTab.java   View source code 5 votes vote down vote up
@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);
	}
}
 
Example 21
Project: etomica   File: UnitGraphics.java   View source code 5 votes vote down vote up
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);
			}

		}
 
Example 22
Project: Tarski   File: EditorActions.java   View source code 5 votes vote down vote up
/**
 * 
 */
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());
		}
	}
}
 
Example 23
Project: OpenJSharp   File: XSheet.java   View source code 5 votes vote down vote up
/**
 * 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;
        }
    }
}
 
Example 24
Project: Course-Management-System   File: tableModelTeach.java   View source code 5 votes vote down vote up
@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;
}
 
Example 25
Project: powertext   File: RTextAreaEditorKit.java   View source code 5 votes vote down vote up
@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();
		}
	}
}
 
Example 26
Project: jdk8u-jdk   File: DefaultEditorKit.java   View source code 5 votes vote down vote up
/**
 * 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");
    }
}
 
Example 27
Project: imagetozxspec   File: FileReadyListener.java   View source code 5 votes vote down vote up
@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);
	}
}
 
Example 28
Project: incubator-netbeans   File: ReferencesBrowserControllerUI.java   View source code 5 votes vote down vote up
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();
            }
        }
    });
}
 
Example 29
Project: jmt   File: BlockingStationPanel.java   View source code 5 votes vote down vote up
/**
 * 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();
	}
}
 
Example 30
Project: incubator-netbeans   File: TemplatesPanel.java   View source code 5 votes vote down vote up
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 ();
                        }
                    });
                }
            }
        });
    }
 
Example 31
Project: rapidminer   File: PerspectiveController.java   View source code 5 votes vote down vote up
@Override
public void actionPerformed(final ActionEvent e) {
	if (!getModel().getSelectedPerspective().isUserDefined()) {
		getModel().restoreDefault(getModel().getSelectedPerspective().getName());
		getModel().getSelectedPerspective().apply(context);
	}
}
 
Example 32
Project: rapidminer   File: InputHandler.java   View source code 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent evt) {
	JEditTextArea textArea = getTextArea(evt);
	int caret = textArea.getCaretPosition();
	int line = textArea.getCaretLine();
	int lineStart = textArea.getLineStartOffset(line);
	caret -= lineStart;

	String lineText = textArea.getLineText(textArea.getCaretLine());

	if (caret == lineText.length()) {
		if (lineStart + caret == textArea.getDocumentLength()) {
			textArea.getToolkit().beep();
			return;
		}
		caret++;
	} else {
		String noWordSep = (String) textArea.getDocument().getProperty("noWordSep");
		caret = TextUtilities.findWordEnd(lineText, caret, noWordSep);
	}

	if (select) {
		textArea.select(textArea.getMarkPosition(), lineStart + caret);
	} else {
		textArea.setCaretPosition(lineStart + caret);
	}
}
 
Example 33
Project: incubator-netbeans   File: CustomizerRun.java   View source code 5 votes vote down vote up
private void configDelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_configDelActionPerformed
    String config = (String) configCombo.getSelectedItem();
    assert config != null;
    configs.put(config, null);
    configChanged(null);
    uiProperties.activeConfig = null;
}
 
Example 34
Project: Dahlem_SER316   File: AddResourceDialog.java   View source code 5 votes vote down vote up
/**
 * enable localRB fields. Request focus for the text field so the user can
 * start typing and set the pathField text selected
 */

void localFileRB_actionPerformed(ActionEvent e) {
	enableFields();
	checkOkEnabled();
	urlField.select(0, 0);
	pathField.select(0, pathField.getText().length());
	pathField.requestFocus();
	descriptionField.select(0, descriptionField.getText().length());
	descriptionField.requestFocus();
}
 
Example 35
Project: incubator-netbeans   File: FileTreeView.java   View source code 5 votes vote down vote up
@NbBundle.Messages({
    "CTL_FileTree.treeColumn.Name=File"
})
public FileTreeView () {
    em = new ExplorerManager();
    view = new OutlineView(Bundle.CTL_FileTree_treeColumn_Name());
    view.getOutline().setShowHorizontalLines(true);
    view.getOutline().setShowVerticalLines(false);
    view.getOutline().setRootVisible(false);
    view.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    view.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    view.setPopupAllowed(false);
    view.getOutline().addMouseListener(this);
    view.getOutline().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ).put(
            KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK ), "org.openide.actions.PopupAction");
    view.getOutline().getActionMap().put("org.openide.actions.PopupAction", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showPopup(org.netbeans.modules.versioning.util.Utils.getPositionForPopup(view.getOutline()));
        }
    });
    view.getOutline().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "slideOut");
    viewComponent = new ViewContainer(em);
    viewComponent.add(view, BorderLayout.CENTER);
    viewComponent.addAncestorListener(this);
    em.addPropertyChangeListener(this);
}
 
Example 36
Project: rapidminer   File: ActivationSuccessfulCard.java   View source code 5 votes vote down vote up
public JPanel getContent() {
    JPanel panel = new JPanel();
    panel.setOpaque(false);
    panel.setLayout(new BoxLayout(panel, 1));
    panel.add(Box.createRigidArea(new Dimension(0, 40)));
    this.lbStatusIcon = new JLabel(OnboardingDialog.getIcon("onboarding.license_installed"));
    this.lbStatusIcon.setAlignmentX(0.5F);
    panel.add(this.lbStatusIcon);
    panel.add(Box.createRigidArea(new Dimension(0, 10)));
    this.lbStatus = OnboardingDialog.createLabel("onboarding.license_installed", "bold", true);
    this.lbStatus.putClientProperty("com.rapidminer.ui.label.foreground", CUSTOM_GREEN);
    this.lbStatus.setIcon((Icon)null);
    panel.add(this.lbStatus);
    panel.add(Box.createRigidArea(new Dimension(0, 10)));
    panel.add(this.createLicenseDetailPanel());
    panel.add(OnboardingDialog.createLabel("onboarding.change_license1", "normal", true));
    panel.add(OnboardingDialog.createLabel("onboarding.change_license2", "bold", true));
    panel.add(Box.createVerticalGlue());
    this.btFinish = new JButton(new ResourceAction("onboarding.finish", new Object[0]) {
        private static final long serialVersionUID = 1L;

        public void actionPerformed(ActionEvent e) {
            if(ActivationSuccessfulCard.this.getContainer().getWelcomeType() == WelcomeType.FIRST_WELCOME) {
                ActivationSuccessfulCard.this.getContainer().dispose();
            } else {
                ActivationSuccessfulCard.this.getContainer().dispose();
                Runnable doAfterSuccess = ActivationSuccessfulCard.this.getContainer().getAfterSuccessAction();
                if(doAfterSuccess != null) {
                    doAfterSuccess.run();
                }
            }

        }
    });
    this.btFinish.putClientProperty("com.rapidminer.ui.button.type", "normal");
    panel.add(OnboardingDialog.createButtonPanel(new JButton[]{this.btFinish}));
    return panel;
}
 
Example 37
Project: VASSAL-src   File: ConfigureTree.java   View source code 5 votes vote down vote up
protected Action buildPasteAction(final Configurable target) {
  final Action a = new AbstractAction(pasteCmd) {
    private static final long serialVersionUID = 1L;

    public void actionPerformed(ActionEvent e) {
      if (cutData != null) {
        final DefaultMutableTreeNode targetNode = getTreeNode(target);
        final Configurable cutObj = (Configurable) cutData.getUserObject();
        final Configurable convertedCutObj = convertChild(target, cutObj);
        if (remove(getParent(cutData), cutObj)) {
          insert(target, convertedCutObj, targetNode.getChildCount());
        }
        copyData = getTreeNode(convertedCutObj);
      }
      else if (copyData != null) {
        final Configurable copyBase = (Configurable) copyData.getUserObject();
        Configurable clone = null;
        try {
          clone = convertChild(target, copyBase.getClass().getConstructor().newInstance());
        }
        catch (Throwable t) {
          ReflectionUtils.handleNewInstanceFailure(t, copyBase.getClass());
        }

        if (clone != null) {
          clone.build(copyBase.getBuildElement(Builder.createNewDocument()));
          insert(target, clone, getTreeNode(target).getChildCount());
          updateGpIds(clone);
        }
      }
      cutData = null;
      updateEditMenu();
    }
  };
  a.setEnabled(isValidPasteTarget(target));
  return a;
}
 
Example 38
Project: Pogamut3   File: WatchLapAction.java   View source code 5 votes vote down vote up
/**
 * Depending on state of plan capture button either start listening for
 * debugged engines or stop listening.
 */
@Override
public void actionPerformed(ActionEvent e) {
    setBooleanState(!getBooleanState());

    // remove previous BPs irrespective of the boolean state
    if (getBooleanState()) {
        // add watch to the evaluation method of posh engine
        breakpointManager.addListener(evaluateListener);
    } else {
        breakpointManager.removeListener(evaluateListener);
        breakpointManager.purge();
    }
}
 
Example 39
Project: QN-ACTR-Release   File: ClusteringInfoPanel.java   View source code 5 votes vote down vote up
public void actionPerformed(ActionEvent arg0) {
	if (clusteringTable.getSelectedRow() >= 0) {
		session.removeClustering(clusteringTable.getSelectedRow());
		clusteringTable.tableChanged(new TableModelEvent(clusteringTable.getModel()));
		//Non ci sono pi� clustering passo a finestra precedente
		if (session.getListOfClustering().size() == 0) {
			parent.setLastPanel(WORKLOAD_CLUSTERING_PANEL);
			parent.setLastPanel();
		}
	}
}
 
Example 40
Project: java-swing-template   File: Dashboard.java   View source code 5 votes vote down vote up
/**
 * 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.INFORMATION_MESSAGE);
            }
        }
    });
    t.setRepeats(false);
    t.start();
}