本文整理汇总了Java中javax.swing.event.ChangeEvent.getSource方法的典型用法代码示例。如果您正苦于以下问题:Java ChangeEvent.getSource方法的具体用法?Java ChangeEvent.getSource怎么用?Java ChangeEvent.getSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.event.ChangeEvent
的用法示例。
在下文中一共展示了ChangeEvent.getSource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
/** delayed change of query text */
@Override
public void stateChanged (ChangeEvent e) {
Document doc = (Document)e.getSource();
try {
curTypedText = doc.getText(0, doc.getLength()).trim();
} catch (BadLocationException ex) {
// should never happen, nothing we can do probably
return;
}
AddDependencyPanel.this.searchField.setForeground(defSearchC);
if (curTypedText.length() > 0) {
find(curTypedText);
}
}
示例2: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
public void stateChanged(ChangeEvent e) {
if (e.getSource() == measureTimestampRadio) {
updateValidity();
}
if (e.getSource() == measureTimestampDurationRadio) {
boolean selected = measureTimestampDurationRadio.isSelected();
locationEndCustomizer.setEnabled(selected);
locationEndHeaderLabel.setEnabled(selected);
locationEndHeaderSeparator.setEnabled(selected);
CodeProfilingPoint.Location endLocation = getPPEndLocation();
if (selected && (endLocation != null) && (endLocation.getFile().trim().length() == 0)) {
CodeProfilingPoint.Location startLocation = getPPStartLocation();
CodeProfilingPoint.Location newEndLocation = new CodeProfilingPoint.Location(startLocation.getFile(),
startLocation.getLine() + 1,
CodeProfilingPoint.Location.OFFSET_END);
locationEndCustomizer.setPPLocation(newEndLocation);
}
updateValidity();
}
}
示例3: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
Object source = e.getSource();
if (source instanceof Collection) {
FileObject bfo = this.fo;
if (bfo == null) {
return ;
}
for (Object obj : ((Collection) source)) {
DataObject dobj = (DataObject) obj;
FileObject primary = dobj.getPrimaryFile();
if (bfo.equals(primary)) {
synchronized (this) {
dobjRef = new WeakReference<DataObject>(dobj);
dobjwl = WeakListeners.propertyChange(this, dobj);
dobj.addPropertyChangeListener(dobjwl);
if (registryListener != null) {
DataObject.getRegistry().removeChangeListener(registryListener);
registryListener = null;
}
}
break;
}
}
}
}
示例4: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(final ChangeEvent event) {
Map.Entry<URL,JavaFileFilterImplementation>[] entries;
synchronized (this.listensOn) {
entries = listensOn.entrySet().toArray(new Map.Entry[listensOn.size()]);
}
final Object source = event.getSource();
for (Map.Entry<URL,JavaFileFilterImplementation> entry : entries) {
if (entry.getValue().equals(source)) {
final URL root = entry.getKey();
try {
verify(root);
} catch (IOException ioe) {
Exceptions.printStackTrace(ioe);
} catch (URISyntaxException use) {
Exceptions.printStackTrace(use);
} finally {
IndexingManager.getDefault().refreshIndex(root, null, true);
}
}
}
}
示例5: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
if (e.getSource() == probSlider) {
prob = probSlider.getValue() / 10.0;
ShiftedGeometricDistribution dist = new ShiftedGeometricDistribution(prob);
double[][] p = new double[11][2];
double[][] q = new double[11][2];
for (int i = 0; i < p.length; i++) {
p[i][0] = i;
p[i][1] = dist.p(p[i][0]);
q[i][0] = i;
q[i][1] = dist.cdf(p[i][0]);
}
pdf.clear();
pdf.add(new BarPlot(p));
cdf.clear();
cdf.staircase(q, Color.BLACK);
double[] data = new double[500];
for (int i = 0; i < data.length; i++) {
data[i] = dist.rand();
}
histogram.clear();
histogram.histogram(data, 10, Color.BLUE);
}
}
示例6: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
if (enabled) {
TextDetail td = (TextDetail) e.getSource();
int origMatchesSelected = selectedMatchesCount;
selectedMatchesCount += td.isSelected() ? 1 : -1;
changeSupport.firePropertyChange(PROP_MATCHES_SELECTED,
origMatchesSelected, selectedMatchesCount);
if (selected && selectedMatchesCount == 0) {
setSelected(false);
} else if (!selected && selectedMatchesCount > 0) {
setSelected(true);
}
}
}
示例7: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider)e.getSource();
if (!source.getValueIsAdjusting()) {
int fps = source.getValue();
String varName = source.getName();
//regenerate data set and repaint
int i;
for( i = 1; i<vars.size();i++)
if(vars.get(i).contentEquals(varName))
break;
varsValues.set(i,rangesLeft.get(i).add(steps.get(i).multiply(new BigDecimal(fps))));
//System.out.println(i);
String chartName=FunctionToPlot;
for(int j = 1; j < vars.size();j++){
chartName = SmartReplace.get(chartName,vars.get(j),varsValues.get(j).toPlainString());
//chartName = chartName.replace(vars.get(j),varsValues.get(j).toPlainString());
sliderLabels[j-1].setText(vars.get(j)+'='+varsValues.get(j).toPlainString());
}
try{
chartP.setChart(createPolarChart(getDataset(),chartName));
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
// chartPanel = new ChartPanel(chart);
//contentPanel.repaint();
//this.repaint();
//this.setVisible(true);
}
}
示例8: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
public void stateChanged(ChangeEvent e) {
if (e.getSource() == saveToProjectRadio) {
updateValidity();
} else if (e.getSource() == saveToFileRadio) {
saveToFileField.setEnabled(saveToFileRadio.isSelected());
saveToFileButton.setEnabled(saveToFileRadio.isSelected());
updateValidity();
}
}
示例9: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent ce) {
if (this.enabledChangeListener==true) {
Object ceTrigger = ce.getSource();
if (ceTrigger instanceof JSpinner) {
this.saveTimeModelToSimulationSetup();
}
}
}
示例10: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(final ChangeEvent e) {
if (!(e.getSource() instanceof JSlider)) {
return;
}
final JSlider sizeSlider = (JSlider) e.getSource();
this.changeTreeProportions(sizeSlider.getValue());
}
示例11: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
if (e.getSource() == sigmaSlider) {
sigma = sigmaSlider.getValue() / 10.0;
if (sigma == 0) sigma = 0.01;
GaussianDistribution dist = new GaussianDistribution(0, sigma);
double[][] p = new double[200][2];
double[][] q = new double[200][2];
for (int i = 0; i < p.length; i++) {
p[i][0] = (i - 100) / 10.0;
p[i][1] = dist.p(p[i][0]);
q[i][0] = (i - 100) / 10.0;
q[i][1] = dist.cdf(p[i][0]);
}
pdf.clear();
pdf.line(p, Line.Style.SOLID, Color.BLUE);
cdf.clear();
cdf.line(q, Line.Style.SOLID, Color.BLUE);
double[] data = new double[500];
for (int i = 0; i < data.length; i++) {
data[i] = dist.rand();
}
histogram.clear();
histogram.histogram(data, 20, Color.BLUE);
qqplot.clear();
qqplot.add(new QQPlot(data, dist));
canvas.repaint();
}
}
示例12: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
SingleSelectionModel model = (SingleSelectionModel) e.getSource();
if (model.getSelectedIndex() == 0) {
currentControls = buttons;
} else if (model.getSelectedIndex() == 1) {
currentControls = radiobuttons;
} else if (model.getSelectedIndex() == 2) {
currentControls = checkboxes;
} else {
currentControls = togglebuttons;
}
}
示例13: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
if (jTabbedPane == e.getSource()) {
if (jTabbedPane.getSelectedComponent() == jSplitPane1) {
updateCurrentDifference(null);
} else {
setDifferenceIndex(-1);
}
}
}
示例14: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
if (e.getSource() == probSlider) {
prob = probSlider.getValue() / 10.0;
BernoulliDistribution dist = new BernoulliDistribution(prob);
double[][] p = new double[2][2];
double[][] q = new double[2][2];
for (int i = 0; i < p.length; i++) {
p[i][0] = i;
p[i][1] = dist.p(p[i][0]);
q[i][0] = i;
q[i][1] = dist.cdf(p[i][0]);
}
pdf.clear();
pdf.add(new BarPlot(p));
cdf.clear();
cdf.staircase(q, Color.BLACK);
double[] data = new double[500];
for (int i = 0; i < data.length; i++) {
data[i] = dist.rand();
}
histogram.clear();
histogram.histogram(data, 2, Color.BLUE);
}
}
示例15: stateChanged
import javax.swing.event.ChangeEvent; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
// Keep the scrolling of the row table in sync with main table
JViewport viewport = (JViewport) e.getSource();
JScrollPane scrollPane = (JScrollPane) viewport.getParent();
scrollPane.getVerticalScrollBar().setValue(viewport.getViewPosition().y);
}