當前位置: 首頁>>代碼示例>>Java>>正文


Java ChangeEvent.getSource方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:AddDependencyPanel.java

示例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();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:StopwatchCustomizer.java

示例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;
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:FileMoveBreakpointsHandler.java

示例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);
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:JavaFileFilterListener.java

示例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);
    }
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:32,代碼來源:ShiftedGeometricDistributionDemo.java

示例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);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:MatchingObject.java

示例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);
}
}
 
開發者ID:mathhobbit,項目名稱:EditCalculateAndChart,代碼行數:35,代碼來源:plrPlt.java

示例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();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:SnapshotCustomizer.java

示例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();	
		}	
	}
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:10,代碼來源:TimeModelContinuousConfiguration.java

示例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());
}
 
開發者ID:ZabuzaW,項目名稱:TreeFlood,代碼行數:9,代碼來源:LocalStorageExplorationGUIController.java

示例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();
    }
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:37,代碼來源:GaussianDistributionDemo.java

示例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;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:ToggleButtonDemo.java

示例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);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:EditableDiffView.java

示例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);
    }
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:32,代碼來源:BernoulliDistributionDemo.java

示例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);
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:8,代碼來源:Table.java


注:本文中的javax.swing.event.ChangeEvent.getSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。