本文整理汇总了Java中javax.swing.JSpinner.setPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Java JSpinner.setPreferredSize方法的具体用法?Java JSpinner.setPreferredSize怎么用?Java JSpinner.setPreferredSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JSpinner
的用法示例。
在下文中一共展示了JSpinner.setPreferredSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SatelliteMultiViewerCorner
import javax.swing.JSpinner; //导入方法依赖的package包/类
public SatelliteMultiViewerCorner() {
layer = new SpinnerListModel();
layer.addChangeListener(new ChangeListener() {
@SuppressWarnings("rawtypes")
@Override
public void stateChanged(ChangeEvent e) {
// find viewer for satellite
if (layer.getValue() instanceof LayerViewer)
setViewer((LayerViewer) layer.getValue());
else
setViewer(null);
}
});
spinner = new JSpinner(layer);
// Workaround to fix the satellite jumping issue
// caused by changeevent-setviewer-dolayout-setvalue-(layoutinvalid)
spinner.setPreferredSize(new Dimension(105, 22));
getSatellite().getContentPane().add(spinner, BorderLayout.NORTH);
// by default disabled
setEnabled(false);
}
示例2: initComponents
import javax.swing.JSpinner; //导入方法依赖的package包/类
private void initComponents() {
this.setLayout(new BorderLayout());
epochs = new JSpinner(new SpinnerNumberModel(10, 10, 50, 1));
JPanel epochOption = new JPanel(new BorderLayout());
JPanel flowTemp = new JPanel(new FlowLayout(FlowLayout.LEFT));
epochs.setPreferredSize(new Dimension(70, 40));
epochs.setFont(new Font(epochs.getFont().getName(), epochs.getFont().getStyle(), epochs.getFont().getSize() + 4));
flowTemp.add(new JLabel("<html><body><h3>Select the maximum number of epochs: </h3></body></html> "));
flowTemp.add(epochs);
JButton setEpoch = new JButton(this.setEpoch);
setEpoch.setPreferredSize(new Dimension(85, 35));
flowTemp.add(setEpoch);
epochOption.add(flowTemp, BorderLayout.CENTER);
//JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
//btnPanel.add(setEpoch);
//epochOption.add(btnPanel,BorderLayout.SOUTH);
this.add(epochOption, BorderLayout.NORTH);
}
示例3: initComponents
import javax.swing.JSpinner; //导入方法依赖的package包/类
/**
* Initialize all gui objects
*/
private void initComponents() {
setLayout(new BorderLayout());
JPanel topPanel = new JPanel(new GridLayout(2, 1));
topPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
JLabel label = new JLabel("Execution number: ");
final JSpinner spinner = new JSpinner();
spinner.setPreferredSize(DIM_SPINNER);
spinner.setValue(new Integer(1));
label.setLabelFor(spinner);
// Pack spinner and its label on top, while description is on the second line
JPanel tmp = new JPanel();
tmp.add(label);
tmp.add(spinner);
topPanel.add(tmp);
description.setHorizontalAlignment(SwingConstants.CENTER);
topPanel.add(description);
// Adds state change to spinner.
spinner.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
int i = ((Integer) spinner.getValue()).intValue();
if (i <= 0) {
i = 1;
}
if (i > model.getWhatIfValues().length) {
i = model.getWhatIfValues().length;
}
select(i - 1);
spinner.setValue(new Integer(i));
}
});
add(topPanel, BorderLayout.NORTH);
add(tabber, BorderLayout.CENTER);
select(0);
}
示例4: initComponents
import javax.swing.JSpinner; //导入方法依赖的package包/类
private void initComponents() {
this.setLayout(new BorderLayout());
epochs = new JSpinner(new SpinnerNumberModel(10, 10, 50, 1));
JPanel epochOption = new JPanel(new BorderLayout());
JPanel flowTemp = new JPanel(new FlowLayout(FlowLayout.LEFT));
epochs.setPreferredSize(new Dimension(70, 40));
epochs.setFont(new Font(epochs.getFont().getName(), epochs.getFont().getStyle(), epochs.getFont().getSize() + 4));
flowTemp.add(new JLabel("<html><body><h3>Select the maximum number of epochs: </h3></body></html> "));
flowTemp.add(epochs);
JButton setEpoch = new JButton(this.setEpoch);
setEpoch.setPreferredSize(new Dimension(85, 35));
flowTemp.add(setEpoch);
epochOption.add(flowTemp, BorderLayout.CENTER);
this.add(epochOption, BorderLayout.NORTH);
}
示例5: initComponents
import javax.swing.JSpinner; //导入方法依赖的package包/类
/**
* Initialize all components of this panel
*/
private void initComponents() {
setLayout(new BorderLayout(5, 5));
this.setBorder(new EmptyBorder(20, 20, 20, 20));
// Builds upper panel
JPanel upperPanel = new JPanel(new BorderLayout());
JLabel description = new JLabel(BLOCKING_DESCRIPTION);
upperPanel.add(description, BorderLayout.CENTER);
//build upper right corner of the main panel
JPanel upRightPanel = new JPanel(new BorderLayout());
addRegion = new JButton("Add Region");
addRegion.setMinimumSize(DIM_BUTTON_S);
upRightPanel.add(addRegion, BorderLayout.CENTER);
upperPanel.add(upRightPanel, BorderLayout.EAST);
//build spinner panel
JPanel spinnerPanel = new JPanel();
JLabel spinnerDescrLabel = new JLabel("Regions:");
regionsNumSpinner = new JSpinner();
regionsNumSpinner.setPreferredSize(DIM_BUTTON_XS);
spinnerPanel.add(spinnerDescrLabel);
spinnerPanel.add(regionsNumSpinner);
upRightPanel.add(spinnerPanel, BorderLayout.SOUTH);
add(upperPanel, BorderLayout.NORTH);
// Creates blocking regions list
regions = new RegionTable();
JScrollPane jsp = new JScrollPane(regions, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jsp.setPreferredSize(new Dimension(500, 200));
add(jsp, BorderLayout.WEST);
update();
}
示例6: initComponent
import javax.swing.JSpinner; //导入方法依赖的package包/类
/**
* Initialize all gui related stuff
*/
private void initComponent() {
setLayout(new GridLayout(2, 1));
stationPanel = new JPanel(new BorderLayout(5, 5));
stationPanel.setBorder(BorderFactory.createTitledBorder(new EtchedBorder(), "Stations in " + bd.getRegionName(regionKey)));
// Creates panel with add station button and spinner
JPanel addPanel = new JPanel(new BorderLayout());
addStation = new JButton("Add Station");
addStation.setToolTipText("Adds a station to selected blocking region");
addStation.setMinimumSize(DIM_BUTTON_S);
addPanel.add(addStation, BorderLayout.CENTER);
//build spinner panel
JPanel spinnerPanel = new JPanel();
JLabel spinnerDescrLabel = new JLabel("Stations:");
stationNumSpinner = new JSpinner();
stationNumSpinner.setPreferredSize(DIM_BUTTON_XS);
spinnerPanel.add(spinnerDescrLabel);
spinnerPanel.add(stationNumSpinner);
addPanel.add(spinnerPanel, BorderLayout.SOUTH);
// Creates a tmp panel to put addStation panel on the northeast corner
JPanel tmpPanel = new JPanel(new BorderLayout());
tmpPanel.add(addPanel, BorderLayout.NORTH);
stationPanel.add(tmpPanel, BorderLayout.EAST);
// Creates table to display stations
stationTable = new StationTable();
warningPanel = new WarningScrollTable(stationTable, WARNING_STATION);
warningPanel.addCheckVector(sd.getStationKeysNoSourceSink());
stationPanel.add(warningPanel);
add(stationPanel);
// Creates the inner parameter panel
parameterPanel = new BlockingRegionParameterPanel(cd, bd, regionKey);
// Hides unneeded global properties (specified by table)
parameterPanel.setGlobalVisible(false);
add(parameterPanel);
}
示例7: initComponents
import javax.swing.JSpinner; //导入方法依赖的package包/类
private void initComponents() {
this.setBorder(new EmptyBorder(5, 5, 5, 5));
this.setLayout(new BorderLayout(5, 5));
infiniteQueueSelector = new JRadioButton("Infinite");
finiteQueueSelector = new JRadioButton("Finite");
queueLengthGroup = new ButtonGroup();
queueLengthGroup.add(infiniteQueueSelector);
queueLengthGroup.add(finiteQueueSelector);
queueLengthSpinner = new JSpinner();
queueLengthSpinner.setValue(new Integer(1));
queueLengthSpinner.setPreferredSize(DIM_BUTTON_XS);
queueTable = new QueueTable();
//queue details panel
JPanel queuePolicyPanel = new JPanel(new BorderLayout());
queuePolicyPanel.setBorder(new TitledBorder(new EtchedBorder(), "Queue Policy"));
queuePolicyPanel.add(new WarningScrollTable(queueTable, WARNING_CLASS), BorderLayout.CENTER);
JPanel queueLengthPanel = new JPanel(new GridLayout(3, 1, 3, 3));
queueLengthPanel.setBorder(new TitledBorder(new EtchedBorder(), "Capacity"));
// Queue strategy selector
JPanel queueStrategy = new JPanel(new BorderLayout());
queueStrategy.add(new JLabel("Station queue policy: "), BorderLayout.WEST);
queuePolicyCombo = new JComboBox();
queueStrategy.add(queuePolicyCombo, BorderLayout.CENTER);
queuePolicyPanel.add(queueStrategy, BorderLayout.NORTH);
queueStrategy.setBorder(BorderFactory.createEmptyBorder(2, 5, 10, 5));
queueLengthPanel.add(infiniteQueueSelector);
queueLengthPanel.add(finiteQueueSelector);
JPanel spinnerPanel = new JPanel();
JLabel label = new JLabel("<html>Max no. customers <br>(queue+service)</html>");
label.setToolTipText("The maximum number of customers allowed in the station.");
spinnerPanel.add(label);
spinnerPanel.add(queueLengthSpinner);
queueLengthPanel.add(spinnerPanel);
this.add(queueLengthPanel, BorderLayout.WEST);
this.add(queuePolicyPanel, BorderLayout.CENTER);
}
示例8: setData
import javax.swing.JSpinner; //导入方法依赖的package包/类
public void setData(StationDefinition sd, ClassDefinition cd, Object stationKey) {
this.removeAll();
this.stationKey = stationKey;
data = sd;
classData = cd;
serviceTable = new ServiceTable();
serversNumSpinner = new JSpinner();
serversNumSpinner.setPreferredSize(DIM_BUTTON_XS);
classEditor.setData(cd);
initComponents();
updateSpinner();
addManagers();
}
示例9: createComponents
import javax.swing.JSpinner; //导入方法依赖的package包/类
private void createComponents() {
vp = new VisualisationPanel(this);
JPanel wp = new JPanel(new BorderLayout());
wp.add(vp, BorderLayout.CENTER);
container.setLayout(new BorderLayout());
wp.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createEmptyBorder(5, 10, 10, 10),
BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)));
container.add(wp, BorderLayout.CENTER);
infoPanel = new JPanel();
infoPanel.setLayout(new FlowLayout());
infoLabel = new JLabel("No problem to display.");
samplingSpinner = new JSpinner(new SpinnerNumberModel(
SAMPLING_PERIOD_INIT, 1, null, 1));
samplingSpinner.addChangeListener(samplingListener);
samplingSpinner.setPreferredSize(new Dimension(50, 20));
samplingSpinner.setVisible(false);
vp.setSamplingPeriod(SAMPLING_PERIOD_INIT);
infoPanel.add(infoLabel);
infoPanel.add(samplingSpinner);
container.add(infoPanel, BorderLayout.NORTH);
createMenus();
createAnimationControls();
}
示例10: initComponents
import javax.swing.JSpinner; //导入方法依赖的package包/类
/**
* Initialize all components of this panel
*/
private void initComponents() {
setLayout(new BorderLayout(5, 5));
this.setBorder(new EmptyBorder(20, 20, 20, 20));
// Builds upper panel
JPanel upperPanel = new JPanel(new BorderLayout());
JLabel description = new JLabel(BLOCKING_DESCRIPTION);
upperPanel.add(description, BorderLayout.CENTER);
//build upper right corner of the main panel
JPanel upRightPanel = new JPanel(new BorderLayout());
addRegion = new JButton("Add Region");
addRegion.setMinimumSize(DIM_BUTTON_S);
upRightPanel.add(addRegion, BorderLayout.CENTER);
upperPanel.add(upRightPanel, BorderLayout.EAST);
//build spinner panel
JPanel spinnerPanel = new JPanel();
JLabel spinnerDescrLabel = new JLabel("Regions:");
regionsNumSpinner = new JSpinner();
regionsNumSpinner.setPreferredSize(DIM_BUTTON_XS);
spinnerPanel.add(spinnerDescrLabel);
spinnerPanel.add(regionsNumSpinner);
upRightPanel.add(spinnerPanel, BorderLayout.SOUTH);
add(upperPanel, BorderLayout.NORTH);
// Creates blocking regions list
regions = new RegionTable();
regions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JScrollPane jsp = new JScrollPane(regions, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jsp.setPreferredSize(new Dimension(220, 200));
add(jsp, BorderLayout.WEST);
update();
}
示例11: initComponent
import javax.swing.JSpinner; //导入方法依赖的package包/类
/**
* Initialize all gui related stuff
*/
private void initComponent() {
setLayout(new GridLayout(2, 1));
stationPanel = new JPanel(new BorderLayout(5, 5));
stationPanel.setBorder(BorderFactory.createTitledBorder(new EtchedBorder(), "Stations in " + bd.getRegionName(regionKey)));
// Creates panel with add station button and spinner
JPanel addPanel = new JPanel(new BorderLayout());
addStation = new JButton("Add Station");
addStation.setToolTipText("Adds a station to selected blocking region");
addStation.setMinimumSize(DIM_BUTTON_S);
addPanel.add(addStation, BorderLayout.CENTER);
//build spinner panel
JPanel spinnerPanel = new JPanel();
JLabel spinnerDescrLabel = new JLabel("Stations:");
stationNumSpinner = new JSpinner();
stationNumSpinner.setPreferredSize(DIM_BUTTON_XS);
spinnerPanel.add(spinnerDescrLabel);
spinnerPanel.add(stationNumSpinner);
addPanel.add(spinnerPanel, BorderLayout.SOUTH);
// Creates a tmp panel to put addStation panel on the northeast corner
JPanel tmpPanel = new JPanel(new BorderLayout());
tmpPanel.add(addPanel, BorderLayout.NORTH);
stationPanel.add(tmpPanel, BorderLayout.EAST);
// Creates table to display stations
stationTable = new StationTable();
WarningScrollTable warning = new WarningScrollTable(stationTable, WARNING_STATIONS);
warning.addCheckVector(sd.getStationKeysNoSourceSink());
stationPanel.add(warning);
add(stationPanel);
// Creates blocking region panel
blockingPanel = new BlockingRegionParameterPanel(cd, bd, regionKey);
// Hides unneeded global properties (specified by table)
blockingPanel.setGlobalVisible(false);
add(blockingPanel);
}
示例12: initPanel
import javax.swing.JSpinner; //导入方法依赖的package包/类
private void initPanel() {
this.setLayout(new GridLayout(1, 1));
Box mainPanel = Box.createHorizontalBox();
mainPanel.add(Box.createHorizontalStrut(5));
/** Pannello principale centrale **/
JPanel centralMainP = new JPanel(new BorderLayout(5, 10));
/** Upper Panel **/
JPanel upperP = new JPanel(new BorderLayout(5, 5));
/** Stringa infos clustering **/
String current = new String(INFO_CLUSTERING);
current = current.replaceFirst("X", Integer.toString(numClust));
current = current.replaceFirst("Y", defaultFormat.format(entropy));
infoClustering = new JLabel(current);
upperP.add(infoClustering, BorderLayout.NORTH);
/** Pannello selezione fuzzy error**/
JPanel fuzzyErrorP = new JPanel(new GridLayout(1, 2));
/** Pannello text,spinner,button fuzzy error**/
JPanel leftFuzzy = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
JLabel testoSpinner = new JLabel("Select the error: ");
fuzzyError = new JSpinner(new SpinnerNumberModel(0.1, 0.01, 0.99, 0.01));
fuzzyError.setValue(new Double(infos.getError()));
fuzzyError.setPreferredSize(new Dimension(60, 25));
selectErrore = new JButton("Apply error");
selectErrore.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
/** Impostazione errore per visualizzazione matrice dispersione **/
infos.setError(m, ((Double) fuzzyError.getValue()).doubleValue());
matrix.setFuzzyNess(((Double) fuzzyError.getValue()).doubleValue());
((clustDetModel) clusteringFinalTable.getModel()).setInfos(infos.numElem, infos.percent);
fPanel.setInfos();
/** Impostazioni valori per tabella **/
}
});
leftFuzzy.add(testoSpinner);
leftFuzzy.add(fuzzyError);
leftFuzzy.add(selectErrore);
/** Pannello con testo descrizione error **/
descrSetError = new JLabel(DESCR_ERRROR);
fuzzyErrorP.add(leftFuzzy);
fuzzyErrorP.add(descrSetError);
upperP.add(fuzzyErrorP, BorderLayout.SOUTH);
/** Table results **/
centralMainP.add(getUpperTable(), BorderLayout.CENTER);
centralMainP
.add(
new JLabel(
"<HTML><b><font size = 4>WARNING</font></b><br><font size=3>The sum can be greater than 100% due to multiple observations assignement<br></font>"),
BorderLayout.SOUTH);
centralMainP.add(upperP, BorderLayout.NORTH);
mainPanel.add(centralMainP);
mainPanel.add(Box.createHorizontalStrut(5));
this.add(mainPanel);
}
示例13: initGraphics
import javax.swing.JSpinner; //导入方法依赖的package包/类
/**
* Initialize GUI of this panel
*/
private void initGraphics() {
setLayout(new BorderLayout(10, 10));
setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
mainPanel = new JPanel(new BorderLayout(5, 5));
mainPanel.setBorder(BorderFactory.createEtchedBorder());
// Adds description label
JLabel descrLabel = new JLabel(DESCRIPTION_GRAPH);
add(descrLabel, BorderLayout.NORTH);
add(mainPanel, BorderLayout.CENTER);
// Creates left panel with options
left = new JPanel(new BorderLayout(3, 3));
// Adds performance index selection
JPanel indexPanel = new JPanel();
JLabel pIndex = new JLabel("Burstiness factor: ");
index = new JComboBox(INDICES_TYPES);
pIndex.setLabelFor(index);
JPanel formulaPanel = new JPanel();
JPanel formula2Panel = new JPanel();
JLabel formula = new JLabel("b = (number of epochs for which lambda(k)>lambda) / n");
JLabel formula2 = new JLabel("a = lambda+ / lambda");
formulaPanel.add(formula);
formula2Panel.add(formula2);
indexPanel.add(pIndex);
indexPanel.add(index);
JPanel totPanel = new JPanel(new BorderLayout(4, 4));
totPanel.add(indexPanel, BorderLayout.NORTH);
totPanel.add(formulaPanel, BorderLayout.CENTER);
totPanel.add(formula2Panel, BorderLayout.SOUTH);
left.add(totPanel, BorderLayout.NORTH);
// Adds panel for bounds selection
JPanel boundsPanel = new JPanel(new GridLayout(2, 4, 1, 1));
boundsPanel.add(new JLabel("Xmin: ", SwingConstants.RIGHT));
Xmin = new JSpinner(new SpinnerNumberModel(0.0, 0, engine.getEpochRange(), 0.01));
Xmin.setPreferredSize(DIM_SPINNER);
boundsPanel.add(Xmin);
boundsPanel.add(new JLabel("Xmax: ", SwingConstants.RIGHT));
Xmax = new JSpinner(new SpinnerNumberModel(0.0, 0, engine.getEpochRange(), 0.01));
Xmax.setPreferredSize(DIM_SPINNER);
boundsPanel.add(Xmax);
boundsPanel.add(new JLabel("Ymin: ", SwingConstants.RIGHT));
Ymin = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 1e10, 0.01));
Ymin.setPreferredSize(DIM_SPINNER);
boundsPanel.add(Ymin);
boundsPanel.add(new JLabel("Ymax: ", SwingConstants.RIGHT));
Ymax = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 1e10, 0.01));
Ymax.setPreferredSize(DIM_SPINNER);
boundsPanel.add(Ymax);
left.add(boundsPanel, BorderLayout.SOUTH);
mainPanel.add(left, BorderLayout.WEST);
// Puts graph in the right panel
// Creates label for X-axis
String xLabel = "";
graph = new NewPlot();
xLabel = "Number of epochs";
graph.setXLabel(xLabel);
graph.setXRange(0, 30);
graph.setYLabel("Burstiness factor " + currentIndex);
mainPanel.add(graph, BorderLayout.CENTER);
columnHeads = new Vector();
columnHeads.add("Epoch");
columnHeads.add("Factor b");
columnHeads.add("Factor a");
table = new JTable(rows, columnHeads);
tableScrollPane = new JScrollPane(table);
tableScrollPane.setPreferredSize(new Dimension(160, tableScrollPane.getPreferredSize().height));
left.add(tableScrollPane, BorderLayout.CENTER);
updateSpinners();
addActions();
}
示例14: initGraphics
import javax.swing.JSpinner; //导入方法依赖的package包/类
/**
* Initialize GUI of this panel
*/
private void initGraphics() {
setLayout(new BorderLayout(10, 10));
setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
mainPanel = new JPanel(new BorderLayout(5, 5));
mainPanel.setBorder(BorderFactory.createEtchedBorder());
// Adds description label
JLabel descrLabel = new JLabel(DESCRIPTION_GRAPH);
add(descrLabel, BorderLayout.NORTH);
add(mainPanel, BorderLayout.CENTER);
// Creates left panel with options
left = new JPanel(new BorderLayout(3, 3));
// Adds performance index selection
JPanel indexPanel = new JPanel();
JLabel pIndex = new JLabel("Granularity: ");
index = new JComboBox(INDICES_TYPES);
pIndex.setLabelFor(index);
indexPanel.add(pIndex);
indexPanel.add(index);
left.add(indexPanel, BorderLayout.NORTH);
// Adds panel for bounds selection
JPanel boundsPanel = new JPanel();
Box b = Box.createHorizontalBox();
b.add(Box.createHorizontalStrut(5));
b.add(new JLabel("Xmin: ", SwingConstants.RIGHT));
Xmin = new JSpinner();
Xmin.setPreferredSize(DIM_SPINNER);
b.add(Xmin);
b.add(Box.createHorizontalStrut(5));
b.add(new JLabel("Xmax: ", SwingConstants.RIGHT));
Xmax = new JSpinner();
Xmax.setPreferredSize(DIM_SPINNER);
b.add(Xmax);
Box b1 = Box.createHorizontalBox();
b1.add(Box.createHorizontalStrut(5));
b1.add(new JLabel("Ymin: ", SwingConstants.RIGHT));
Ymin = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 1e10, 0.01));
Ymin.setPreferredSize(DIM_SPINNER);
b1.add(Ymin);
b1.add(Box.createHorizontalStrut(5));
b1.add(new JLabel("Ymax: ", SwingConstants.RIGHT));
Ymax = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 1e10, 0.01));
Ymax.setPreferredSize(DIM_SPINNER);
b1.add(Ymax);
Box vb = Box.createVerticalBox();
vb.add(b);
vb.add(b1);
left.add(vb, BorderLayout.SOUTH);
mainPanel.add(left, BorderLayout.WEST);
// Puts graph in the right panel
// Creates label for X-axis
String xLabel = "";
graph = new NewPlot();
xLabel = "Time";
graph.setXLabel(currentIndex);
graph.setXRange(0, 0);
graph.setYLabel("Job / s");
mainPanel.add(graph, BorderLayout.CENTER);
columnHeads = new Vector();
columnHeads.add(" ");
columnHeads.add("Time");
columnHeads.add("Job / s");
table = new JTable(rows, columnHeads);
tableScrollPane = new JScrollPane(table);
tableScrollPane.setPreferredSize(new Dimension(160, tableScrollPane.getPreferredSize().height));
left.add(tableScrollPane, BorderLayout.CENTER);
updateSpinners();
addActions();
}
示例15: initGraphics
import javax.swing.JSpinner; //导入方法依赖的package包/类
/**
* Initialize GUI of this panel
*/
private void initGraphics() {
setLayout(new BorderLayout(10, 10));
setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
mainPanel = new JPanel(new BorderLayout(5, 5));
mainPanel.setBorder(BorderFactory.createEtchedBorder());
// Adds description label
JLabel descrLabel = new JLabel(DESCRIPTION_GRAPH);
add(descrLabel, BorderLayout.NORTH);
add(mainPanel, BorderLayout.CENTER);
// Creates left panel with options
left = new JPanel(new BorderLayout(3, 3));
// Adds performance index selection
JPanel indexPanel = new JPanel();
JLabel pIndex = new JLabel("Burstiness factor: ");
index = new JComboBox(INDICES_TYPES);
pIndex.setLabelFor(index);
JPanel formulaPanel = new JPanel();
JPanel formula2Panel = new JPanel();
JLabel formula = new JLabel("b = (number of epochs for which lambda(k)>lambda) / n");
JLabel formula2 = new JLabel("a = lambda+ / lambda");
formulaPanel.add(formula);
formula2Panel.add(formula2);
indexPanel.add(pIndex);
indexPanel.add(index);
JPanel totPanel = new JPanel(new BorderLayout(4, 4));
totPanel.add(indexPanel, BorderLayout.NORTH);
totPanel.add(formulaPanel, BorderLayout.CENTER);
totPanel.add(formula2Panel, BorderLayout.SOUTH);
left.add(totPanel, BorderLayout.NORTH);
// left.add(formulaPanel, BorderLayout.NORTH);
// Adds panel for bounds selection
JPanel boundsPanel = new JPanel(new GridLayout(2, 4, 1, 1));
boundsPanel.add(new JLabel("Xmin: ", SwingConstants.RIGHT));
Xmin = new JSpinner(new SpinnerNumberModel(0.0, 0, engine.getEpochRange(), 0.01));
Xmin.setPreferredSize(DIM_SPINNER);
boundsPanel.add(Xmin);
boundsPanel.add(new JLabel("Xmax: ", SwingConstants.RIGHT));
Xmax = new JSpinner(new SpinnerNumberModel(0.0, 0, engine.getEpochRange(), 0.01));
Xmax.setPreferredSize(DIM_SPINNER);
boundsPanel.add(Xmax);
boundsPanel.add(new JLabel("Ymin: ", SwingConstants.RIGHT));
Ymin = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 1e10, 0.01));
Ymin.setPreferredSize(DIM_SPINNER);
boundsPanel.add(Ymin);
boundsPanel.add(new JLabel("Ymax: ", SwingConstants.RIGHT));
Ymax = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 1e10, 0.01));
Ymax.setPreferredSize(DIM_SPINNER);
boundsPanel.add(Ymax);
left.add(boundsPanel, BorderLayout.SOUTH);
mainPanel.add(left, BorderLayout.WEST);
// Puts graph in the right panel
// Creates label for X-axis
String xLabel = "";
graph = new NewPlot();
xLabel = "Number of epochs";
graph.setXLabel(xLabel);
graph.setXRange(0, 30);
graph.setYLabel("Burstiness factor " + currentIndex);
mainPanel.add(graph, BorderLayout.CENTER);
columnHeads = new Vector();
columnHeads.add("Epoch");
columnHeads.add("Factor b");
columnHeads.add("Factor a");
table = new JTable(rows, columnHeads);
tableScrollPane = new JScrollPane(table);
tableScrollPane.setPreferredSize(new Dimension(160, tableScrollPane.getPreferredSize().height));
left.add(tableScrollPane, BorderLayout.CENTER);
updateSpinners();
addActions();
}