There are 3 code examples for javax.swing.JSlider.
The API names are highlighted below.
You can use
button
to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.
Project Name: megamek Package: megamek.client.ui.swing
Source Code: Slider.java (Click to view .java file)
Method Code:
public void stateChanged(ChangeEvent event){
curText.setText(String.valueOf(value.getValue()));
pack();
repaint();
}
Project Name: megamek Package: megamek.client.ui.swing
Source Code: BotConfigDialog.java (Click to view .java file)
Method Code:
/**
* gets the selected, configured bot from the dialog
* @param host
* @param port
* @return
*/
BotClient getSelectedBot(String host,int port){
if (testbot_radiobutton.isSelected()) {
return new TestBot(getBotName(),host,port);
}
else if (princess_radiobutton.isSelected()) {
Princess toreturn=new Princess(getBotName(),host,port);
toreturn.verbosity=princess_verbosity.getSelectedIndex();
toreturn.aggression=aggression_slidebar.getValue();
for (int i=0; i < princess_targets_list_model.getSize(); i++) {
int xpos=Integer.parseInt(((String)princess_targets_list_model.get(i)).substring(0,2)) - 1;
int ypos=Integer.parseInt(((String)princess_targets_list_model.get(i)).substring(2,4)) - 1;
System.err.println("adding " + Integer.toString(xpos) + " , "+ Integer.toString(ypos)+ " to strategic targets list");
toreturn.strategic_targets.add(new Coords(xpos,ypos));
}
toreturn.forced_withdrawal=princess_forcedwithdrawal.isSelected();
toreturn.homeEdge=BasicPathRanker.HomeEdge.getHomeEdge(princess_homeedge.getSelectedIndex());
return toreturn;
}
return null;
}
Project Name: weka Package: weka.gui.beans
Source Code: CostBenefitAnalysis.java (Click to view .java file)
Method Code:
/**
* Set the threshold data for the panel to use.
* @param data PlotData2D object encapsulating the threshold data.
* @param classAtt the class attribute from the original data used to generate
* the threshold data.
* @throws Exception if something goes wrong.
*/
public synchronized void setDataSet(PlotData2D data,Attribute classAtt) throws Exception {
m_masterPlot=new PlotData2D(data.getPlotInstances());
boolean[] connectPoints=new boolean[m_masterPlot.getPlotInstances().numInstances()];
for (int i=1; i < connectPoints.length; i++) {
connectPoints[i]=true;
}
m_masterPlot.setConnectPoints(connectPoints);
m_masterPlot.m_alwaysDisplayPointsOfThisSize=10;
setClassForConfusionMatrix(classAtt);
m_performancePanel.setMasterPlot(m_masterPlot);
m_performancePanel.validate();
m_performancePanel.repaint();
m_shapeSizes=new int[m_masterPlot.getPlotInstances().numInstances()];
for (int i=0; i < m_shapeSizes.length; i++) {
m_shapeSizes[i]=1;
}
m_masterPlot.setShapeSize(m_shapeSizes);
constructCostBenefitData();
m_costBenefitPanel.setMasterPlot(m_costBenefit);
m_costBenefitPanel.validate();
m_costBenefitPanel.repaint();
m_totalPopPrevious=0;
m_fpPrevious=0;
m_tpPrevious=0;
m_tnPrevious=0;
m_fnPrevious=0;
m_previousShapeIndex=-1;
Instance first=m_masterPlot.getPlotInstances().instance(0);
double totalPos=first.value(m_masterPlot.getPlotInstances().attribute(ThresholdCurve.TRUE_POS_NAME).index());
double totalNeg=first.value(m_masterPlot.getPlotInstances().attribute(ThresholdCurve.FALSE_POS_NAME));
m_originalPopSize=(int)(totalPos + totalNeg);
m_totalPopField.setText("" + m_originalPopSize);
m_performancePanel.setYIndex(5);
m_performancePanel.setXIndex(10);
m_costBenefitPanel.setXIndex(0);
m_costBenefitPanel.setYIndex(1);
updateInfoForSliderValue((double)m_thresholdSlider.getValue() / 100.0);
}