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   Source Code and License 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   Source Code and License 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   Source Code and License 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: Hotel-Properties-Management-System   File: NewReservationWindow.java   Source Code and License 6 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 5
Project: Ultraino   File: MainForm.java   Source Code and License 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 6
Project: LivroJavaComoProgramar10Edicao   File: AddressBook.java   Source Code and License 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 7
Project: incubator-netbeans   File: TagManager.java   Source Code and License 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 8
Project: openjdk-jdk10   File: VolatileImageConfigurationTest.java   Source Code and License 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 9
Project: sbc-qsystem   File: FAdmin.java   Source Code and License 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 10
Project: incubator-netbeans   File: ResourceWizardPanel.java   Source Code and License 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 11
Project: sbc-qsystem   File: FWelcome.java   Source Code and License 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 12
Project: rapidminer   File: AttributeFileValueCellEditor.java   Source Code and License 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 13
Project: cuttlefish   File: TikzDialog.java   Source Code and License 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 14
Project: Dahlem_SER316   File: HTMLEditor.java   Source Code and License 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: PanelOptionsVisual.java   Source Code and License 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 16
Project: SER316-Ingolstadt   File: HTMLEditor.java   Source Code and License 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 17
Project: incubator-netbeans   File: TreeModelNode.java   Source Code and License 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 18
Project: JITRAX   File: ListenersSetter.java   Source Code and License 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 19
Project: AgentWorkbench   File: ThreadMonitorProtocolTableTab.java   Source Code and License 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 20
Project: etomica   File: UnitGraphics.java   Source Code and License 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 21
Project: Tarski   File: EditorActions.java   Source Code and License 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 22
Project: OpenJSharp   File: XSheet.java   Source Code and License 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 23
Project: Course-Management-System   File: tableModelTeach.java   Source Code and License 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 24
Project: powertext   File: RTextAreaEditorKit.java   Source Code and License 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 25
Project: jdk8u-jdk   File: DefaultEditorKit.java   Source Code and License 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 26
Project: imagetozxspec   File: FileReadyListener.java   Source Code and License 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 27
Project: incubator-netbeans   File: ReferencesBrowserControllerUI.java   Source Code and License 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 28
Project: jmt   File: BlockingStationPanel.java   Source Code and License 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 29
Project: incubator-netbeans   File: TemplatesPanel.java   Source Code and License 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 30
Project: rapidminer   File: PerspectiveController.java   Source Code and License 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 31
Project: rapidminer   File: InputHandler.java   Source Code and License 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 32
Project: incubator-netbeans   File: CustomizerRun.java   Source Code and License 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 33
Project: Dahlem_SER316   File: AddResourceDialog.java   Source Code and License 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 34
Project: incubator-netbeans   File: FileTreeView.java   Source Code and License 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 35
Project: rapidminer   File: ActivationSuccessfulCard.java   Source Code and License 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 36
Project: VASSAL-src   File: ConfigureTree.java   Source Code and License 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 37
Project: Pogamut3   File: WatchLapAction.java   Source Code and License 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 38
Project: QN-ACTR-Release   File: ClusteringInfoPanel.java   Source Code and License 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 39
Project: java-swing-template   File: Dashboard.java   Source Code and License 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();
}
 
Example 40
Project: Equella   File: FileManagerEditor.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("nls")
@Override
public void actionPerformed(ActionEvent e)
{
	if( autoMarkAsResources.isSelected() && webdav.isSelected() )
	{
		JOptionPane
			.showMessageDialog(autoMarkAsResources,
				getString("conflict"), null,
				JOptionPane.WARNING_MESSAGE);
	}
}
 
Example 41
Project: StazioneMetereologica   File: ListenerBottoniMainFrame.java   Source Code and License 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    if(e.getSource()==this.mf.getjButton1()){
        this.mf.getjButton1().setEnabled(false);
        this.executors.execute(new SocketTCP(this.ph.getADDRESS(), this.ph.getPORT(), this.dm));
        this.cg.refreshCharts();
    }
}
 
Example 42
Project: jaer   File: AESocketDialog.java   Source Code and License 5 votes vote down vote up
/** Creates new form AEUnicastDialog.
@param parent the parent frame
@param modal true to be modal (not allow access to parent GUI until dismissed
@param socketInterface the interface to control
 */
public AESocketDialog (java.awt.Frame parent,boolean modal,AESocketSettings socketInterface){
    super(parent,modal);
    this.socketInterface = socketInterface;
    initComponents();
    addressFirstEnabledCheckBox.setSelected(socketInterface.isAddressFirstEnabled());
    sequenceNumberEnabledCheckBox.setSelected(socketInterface.isSequenceNumberEnabled());
    hostnameTextField.setText(socketInterface.getHost());
    portTextField.setText(Integer.toString(socketInterface.getPort()));
    swapBytesCheckBox.setSelected(socketInterface.isSwapBytesEnabled());
    timestampMultiplierTextBox.setText(String.format("%.4f",socketInterface.getTimestampMultiplier()));
    use4ByteAddrTsCheckBox.setSelected(socketInterface.is4ByteAddrTimestampEnabled());
    bufferSizeTextBox.setText(Integer.toString(socketInterface.getSendBufferSize()));
    receiveBufferSizeTextBox.setText(Integer.toString(socketInterface.getReceiveBufferSize()));
    includeTimestampsCheckBox.setSelected(socketInterface.isTimestampsEnabled());
    useLocalTimestampsEnabledCheckBox.setSelected(socketInterface.isLocalTimestampEnabled());
     useBufferedStreamsCheckBox.setSelected(socketInterface.isUseBufferedStreams());
   KeyStroke escape = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0,false);
    Action escapeAction = new AbstractAction(){
        public void actionPerformed (ActionEvent e){
            dispose();
        }
    };
    addWindowListener(new WindowAdapter(){
        public void windowActivated (WindowEvent evt){
            okButton.requestFocusInWindow();
            removeWindowListener(this);
        }
    });
    getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape,"ESCAPE");
    getRootPane().getActionMap().put("ESCAPE",escapeAction);

}
 
Example 43
Project: ramus   File: QualifierPreferencesPanel.java   Source Code and License 4 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    setupAttribute();
}
 
Example 44
Project: incubator-netbeans   File: RunAnalysisPanel.java   Source Code and License 4 votes vote down vote up
private void configurationRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_configurationRadioActionPerformed
    updateEnableDisable();
}
 
Example 45
Project: rapidminer   File: ExportProcessAction.java   Source Code and License 4 votes vote down vote up
@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());
	}
}
 
Example 46
Project: incubator-netbeans   File: PauseAction.java   Source Code and License 4 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    if (isSuspended()) {
        resume();
    } else {
        suspend(1);
    }
}
 
Example 47
Project: Neukoelln_SER316   File: TagSearchController.java   Source Code and License 4 votes vote down vote up
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;
}
 
Example 48
Project: stuManager   File: DepartChange.java   Source Code and License 4 votes vote down vote up
public void jButton1_actionPerformed(ActionEvent e) {
	// �쳣�ж�
	if (jComboBox1.getSelectedIndex() == 0) {
		jOptionPane1.showMessageDialog(this, "��ѡ������ѧԺ��", "��ʾ", JOptionPane.INFORMATION_MESSAGE, null);
	} else if (jComboBox2.getSelectedIndex() == 0) {
		jOptionPane1.showMessageDialog(this, "��ѡ������רҵ��", "��ʾ", JOptionPane.INFORMATION_MESSAGE, null);
	} else {
		xueYuan();
		zhuanYe();
		try {
			// ��ѧԺ��רҵ�ֱ������������������жϴ���
			boolean departExist = false, specExist = false;

			ResultSet rs_departExist = conn.getRs("select * from tb_spec where departName= '"
					+ String.valueOf(jComboBox1.getSelectedItem()) + "' ");
			while (rs_departExist.next()) {
				departExist = true;
			}

			ResultSet rs_specExist = conn.getRs("select * from tb_spec where specName= '"
					+ String.valueOf(jComboBox2.getSelectedItem()) + "' ");
			while (rs_specExist.next()) {
				specExist = true;
			}

			if (departExist && specExist) {
				jOptionPane1.showMessageDialog(this, "��ѧԺ��רҵ�Ѿ����ڣ�", "��ʾ", JOptionPane.INFORMATION_MESSAGE, null);
			} else if (!departExist && specExist) {
				jOptionPane1.showMessageDialog(this, "��רҵ������ѧԺ�Ѿ����ڣ�", "��ʾ", JOptionPane.INFORMATION_MESSAGE, null);
			} else if (departExist && !specExist) {
				conn.getUpdate("delete from tb_spec where specId='" + Integer.valueOf(find) + "'");
				conn.getUpdate("insert into tb_spec (departName,specName) values ('"
						+ String.valueOf(jComboBox1.getSelectedItem()) + "','"
						+ String.valueOf(jComboBox2.getSelectedItem()) + "')");
				jOptionPane1.showMessageDialog(this, "��ϲ��Ժϵ��Ϣ�޸ijɹ���", "��ʾ", JOptionPane.INFORMATION_MESSAGE, null);
			} else if (!departExist && !specExist) {
				conn.getUpdate("delete from tb_spec where specId='" + Integer.valueOf(find) + "'");
				conn.getUpdate("insert into tb_spec (departName,specName) values ('"
						+ String.valueOf(jComboBox1.getSelectedItem()) + "','"
						+ String.valueOf(jComboBox2.getSelectedItem()) + "')");
				conn.getUpdate("insert into tb_depart (departName) values ('"
						+ String.valueOf(jComboBox1.getSelectedItem()) + "') ");
				jOptionPane1.showMessageDialog(this, "��ϲ��Ժϵ��Ϣ�޸ijɹ���", "��ʾ", JOptionPane.INFORMATION_MESSAGE, null);
			}
		} catch (Exception ce) {
			System.out.println(ce);
		}
	}
}
 
Example 49
Project: rapidminer   File: SimplePlotterPanelDialog.java   Source Code and License 4 votes vote down vote up
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);
}
 
Example 50
Project: incubator-netbeans   File: TabControlButtonFactory.java   Source Code and License 4 votes vote down vote up
@Override
protected String getTabActionCommand( ActionEvent e ) {
    return TabDisplayer.COMMAND_RESTORE_GROUP;
}
 
Example 51
Project: Wilmersdorf_SER316   File: JNCalendarPanel.java   Source Code and License 4 votes vote down vote up
void todayB_actionPerformed(ActionEvent e) {
  _date = CalendarDate.today();
  refreshView();
  notifyListeners();
}
 
Example 52
Project: incubator-netbeans   File: RunJarPanel.java   Source Code and License 4 votes vote down vote up
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
    }
}
 
Example 53
Project: QN-ACTR-Release   File: ZoomIn.java   Source Code and License 4 votes vote down vote up
/**
 * Invoked when an action occurs.
 */
public void actionPerformed(ActionEvent e) {
  mediator.zoomIn();
}
 
Example 54
Project: Cognizant-Intelligent-Test-Scripter   File: TestDataComponent.java   Source Code and License 4 votes vote down vote up
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);
        }
    };
}
 
Example 55
Project: VASSAL-src   File: SynchAction.java   Source Code and License 4 votes vote down vote up
public void actionPerformed(ActionEvent evt) {
  if (isEnabled()) {
    final long now = System.currentTimeMillis();
    if ( ! targetRoom.equals(lastRoom) || (now - lastSync) > TOO_SOON) {
      GameModule.getGameModule().getGameState().setup(false);
      client.sendTo(p, new SynchCommand(client.getUserInfo(),client));
      lastSync = now;
    }
    lastRoom = targetRoom;
  }
}
 
Example 56
Project: Wilmersdorf_SER316   File: ResourcesPanel.java   Source Code and License 4 votes vote down vote up
void ppRemoveRes_actionPerformed(ActionEvent e) {
  removeResB_actionPerformed(e);
}
 
Example 57
Project: incubator-netbeans   File: FileSystemAction.java   Source Code and License 4 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    assert false : "ActionEvt: " + e;
}
 
Example 58
Project: nbreleaseplugin   File: ViewerPanel.java   Source Code and License 4 votes vote down vote up
@Override
public final void actionPerformed(ActionEvent e) {
    ViewerChangeDialog.show(title, value, ViewerPanel.this, new ChangePanel());
}
 
Example 59
Project: SER316-Dresden   File: TaskPanel.java   Source Code and License 4 votes vote down vote up
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();
  }
 
Example 60
Project: QN-ACTR-Release   File: JSIMMain.java   Source Code and License 4 votes vote down vote up
public void actionPerformed(ActionEvent e) {
	showCredits();
}