/**
	 * Returns the maximum frequency spinner.
	 * If the spinner doesn't exist it is created:
	 * <ul>
	 * <li>with the specified {@link #getMaxFrequencyModel() model},</li>
	 * <li>to have specified size (80x25 pixel),</li>
	 * <li>with the listener which updates the value of the {@link
	 * #getMinFrequencySpinner() minimum frequency spinner} to be at least
	 * {@code 0.01} smaller then the value of this spinner.</li></ul>
	 * @return the maximum frequency spinner
	 */
	public JSpinner getMaxFrequencySpinner() {
		if (maxFrequencySpinner == null) {
			maxFrequencySpinner = new JSpinner(getMaxFrequencyModel());

			Dimension spinnerSize = new Dimension(80,25);
			maxFrequencySpinner.setPreferredSize(spinnerSize);
			maxFrequencySpinner.setMinimumSize(spinnerSize);
			maxFrequencySpinner.setMaximumSize(spinnerSize);

			maxFrequencySpinner.addChangeListener(new ChangeListener() {

				@Override
				public void stateChanged(ChangeEvent e) {

					double value = ((Number) maxFrequencySpinner.getValue()).doubleValue();

					double otherValue = ((Number) getMinFrequencySpinner().getValue()).doubleValue();

					if ((value-0.01) < otherValue) {
						getMinFrequencySpinner().setValue(value - 0.01);
					}

				}

			});

			maxFrequencySpinner.setEditor(new JSpinner.NumberEditor(maxFrequencySpinner, "0.00"));
			maxFrequencySpinner.setFont(maxFrequencySpinner.getFont().deriveFont(Font.PLAIN));

		}
		return maxFrequencySpinner;
	}
 @Override
 protected JSpinner createSpinner(int b) {
   JSpinner spinner = new JSpinner();
   SpinnerListModel model = new SpinnerListModel(_keyList);
   spinner.setModel(model);
   ((JSpinner.ListEditor) spinner.getEditor()).getTextField().setEditable(false);
   model.addChangeListener(
       new ChangeListener() {
         @Override
         public void stateChanged(ChangeEvent arg0) {
           update();
         }
       });
   Dimension d = new Dimension(40, spinner.getPreferredSize().height);
   spinner.setMinimumSize(d);
   spinner.setPreferredSize(d);
   return spinner;
 }
 /** @return spinner_rotation */
 private JSpinner getSpinner_rotation() {
   if (spinner_rotation == null) {
     spinner_rotation = new JSpinner();
     spinner_rotation.setMaximumSize(new Dimension(80, 27));
     spinner_rotation.setMinimumSize(new Dimension(80, 27));
     spinner_rotation.setPreferredSize(new Dimension(80, 27));
     spinner_rotation.setModel(
         new SpinnerNumberModel(0.0, -Double.MAX_VALUE, Double.MAX_VALUE, 1));
     spinner_rotation.setValue(TwoAxes3D.getRotation());
     spinner_rotation.addChangeListener(
         new ChangeListener() {
           @Override
           public void stateChanged(ChangeEvent e) {
             TwoAxes3D.setRotation((Double) spinner_rotation.getValue());
             fireActionEvent(
                 new ActionEvent(
                     TwoAxes3DSettingsPanel.this,
                     0,
                     SycamoreFiredActionEvents.UPDATE_AGREEMENTS_GRAPHICS.name()));
           }
         });
   }
   return spinner_rotation;
 }
  public NAOCameraFeatures() {
    super(NAME, INPUT_DIM);

    // create image processor
    imageProcessorRGB = new ImageProcessorRGB(IMAGE_WIDTH, IMAGE_HEIGHT, NUM_LEVELS);
    System.out.println(
        "Original input has " + (IMAGE_WIDTH * IMAGE_HEIGHT * BITS_PER_PIXEL) + " dimensions");
    System.out.println(
        "Feature vector has "
            + ImageProcessorRGB.getFeatureVectorLength(NUM_LEVELS)
            + " dimensions");

    // set interactor parameters
    setCycleTime(CYCLE_TIME_DEFAULT);
    setInnerFeedback(false);
    setActivateClusterThreshold(2);
    setIterationCountStop(0);

    // set topology parameters
    SOINNM topology = getTopology();
    topology.setNoiseLevel(0.0); // 0.0
    topology.setUseFixedThreshold(true);
    topology.setFixedThreshold(0.1);
    topology.setAgeDead(100);
    topology.setConnectNewNodes(true);
    topology.setLambda(30);
    topology.setEdgeMaxRemoval(true);
    topology.setNodeNumSignalsMinRemoval(true);
    topology.setReduceErrorInsertion(true);
    topology.setSmallClusterRemoval(true);
    topology.setC2Param(0.01);
    topology.setC1Param(0.1);
    topology.setClusterJoining(true);
    topology.setJoinTolerance(1.0);
    topology.setUseAbsoluteJoinTolerance(true);
    topology.setJoinToleranceAbsolute(0.1);
    topology.setJoiningIterationsMax(10);

    // initialise NAO
    try {
      BufferedReader bReader = new BufferedReader(new FileReader("NAOHostPort.txt"));
      host = bReader.readLine().trim();
      port = Integer.parseInt(bReader.readLine().trim());
      bReader.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
    video = new ALVideoDeviceProxy(host, port);
    video.setParam(18, 0); // camera: 0=front, 1=bottom
    video.subscribe(NAME, RESOLUTION, COLOUR_SPACE, FPS);

    // initial adjustment
    if (CAMERA_CALIBRATION) {
      System.out.println("Performing camera calibration...");
      video.setParam(11, 1); // auto exposition (0-1)
      video.setParam(12, 1); // auto white balance (0-1)
      video.setParam(22, 1); // auto exposure correction algorithm (0-1)
      try {
        video.setParam(13, 1); // auto gain (0-1)
        video.setParam(21, 1); // exposure correction (0-1)
        video.setParam(26, 1); // auto balance (0-1)
        video.setParam(27, 128); // auto balance target (0-255)
        video.setParam(28, 128); // auto balance stable range (0-255)		
      } catch (Exception e) {
        System.out.println("Laser head camera model detected!");
      }
      // wait
      try {
        Thread.sleep(CAMERA_CALIBRATION_TIME);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    // disable automatic adjustments
    if (CAMERA_DISABLE_ADJUSTMENTS) {
      System.out.println("Disabling automatic camera adjustments...");
      video.setParam(11, 0); // auto exposition (0-1)
      video.setParam(12, 0); // auto white balance (0-1)
      video.setParam(22, 0); // auto exposure correction algorithm (0-1)
      try {
        video.setParam(13, 0); // auto gain (0-1)
        video.setParam(21, 0); // exposure correction (0-1)
        video.setParam(26, 0); // auto balance (0-1)
      } catch (Exception e) {
        System.out.println("Laser head camera model detected!");
      }
      // wait
      try {
        Thread.sleep(CAMERA_DISABLE_ADJUSTMENTS_TIME);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    // set exposure and gain manually
    if (CAMERA_MANUAL_EXPOSURE_GAIN) {
      System.out.println("Setting exposure and gain parameters...");
      try {
        video.getParam(13); // cause exception for laser head model
        video.setParam(17, 512); // set exposure (0-4096), 512
        video.setParam(6, 32); // set gain (0-255), 32
      } catch (Exception e) {
        System.out.println("Laser head camera model detected!");
        video.setParam(17, 96); // set exposure (0-512), 96
        video.setParam(6, 48); // set gain (0-255), 48
      }
    }

    // set white balance manually
    if (CAMERA_MANUAL_WHITE_BALANCE) {
      System.out.println("Setting white balance parameters...");
      try {
        video.setParam(4, 80); // red chroma (0-255), 80
        video.setParam(5, 160); // blue chroma (0-255), 160
        video.setParam(25, 64); // auto white balance green gain (0-255), 64
        video.setParam(29, 96); // balance blue (0-255), 96
        video.setParam(30, 96); // balance red (0-255), 96
        video.setParam(31, 96); // balance gain blue (0-255), 96
        video.setParam(32, 96); // balance gain red (0-255), 96
      } catch (Exception e) {
        System.out.println("Laser head camera model detected!");
      }
    }

    // start head movement
    if (MOVE_HEAD) {
      System.out.println("Starting head movement...");
      headMovement = new HeadMovement();
      headMovement.start();
    }

    // create frame
    frame = new JFrame(NAME);
    frame.setSize(600, 600);
    frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent evt) {
            shutdown();
          }
        });
    frame.setLocation(0, 0);
    frame.setVisible(true);

    // create panel
    panel = new JPanel();
    panel.setLayout(new BorderLayout());
    frame.add(panel);

    // create top panel
    JPanel pnTop = new JPanel();
    pnTop.setLayout(new BorderLayout());
    panel.add(pnTop, BorderLayout.PAGE_START);

    // create panel for input and output
    pnIO = new JPanel();
    pnIO.setLayout(new FlowLayout(FlowLayout.LEFT));
    pnIO.setBorder(BorderFactory.createTitledBorder("Input/Output"));

    ImagePanel ipInput = new ImagePanel(IMAGE_BLANK);
    ppInput = new PatternPanel(ipInput, "Input", "");
    pnIO.add(ppInput);

    ImagePanel ipOutput = new ImagePanel(IMAGE_BLANK);
    ppOutput = new PatternPanel(ipOutput, "Output", "");
    pnIO.add(ppOutput);

    pnTop.add(pnIO, BorderLayout.LINE_START);

    // create panel for controls
    JPanel pnControls = new JPanel();
    pnControls.setLayout(new BoxLayout(pnControls, BoxLayout.Y_AXIS));
    pnControls.setBorder(BorderFactory.createTitledBorder("Controls"));
    pnTop.add(pnControls);

    // create panel for interactor
    JPanel pnInteractor = new JPanel();
    pnInteractor.setLayout(new BoxLayout(pnInteractor, BoxLayout.X_AXIS));
    pnControls.add(pnInteractor);

    spCycleTime = new JSpinner(new SpinnerNumberModel((int) CYCLE_TIME_DEFAULT, 100, 1000, 100));
    spCycleTime.setMinimumSize(new Dimension(75, 25));
    spCycleTime.setMaximumSize(new Dimension(75, 25));
    pnInteractor.add(spCycleTime);
    JButton btCycleTime = new JButton("Set Cycle Time");
    btCycleTime.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            setCycleTime(Long.parseLong(spCycleTime.getValue().toString()));
          }
        });
    pnInteractor.add(btCycleTime);

    JPanel pnCycleStatus = new JPanel();
    pnCycleStatus.setLayout(new BoxLayout(pnCycleStatus, BoxLayout.Y_AXIS));
    pnInteractor.add(pnCycleStatus);

    lbCycleTime = new JLabel("Cycle Time: " + getCycleTime() + " ms");
    pnCycleStatus.add(lbCycleTime);

    lbCycleDuration = new JLabel("Cycle Duration: - ms");
    pnCycleStatus.add(lbCycleDuration);

    JPanel pnLearnRecall = new JPanel();
    pnLearnRecall.setLayout(new BoxLayout(pnLearnRecall, BoxLayout.X_AXIS));
    pnControls.add(pnLearnRecall);

    cbLearn = new JCheckBox("Learn");
    cbLearn.setSelected(true);
    pnLearnRecall.add(cbLearn);

    cbRecall = new JCheckBox("Recall");
    cbRecall.setSelected(true);
    cbRecall.setEnabled(false);
    pnLearnRecall.add(cbRecall);

    // create panel for topology
    JPanel pnTopology = new JPanel();
    pnTopology.setLayout(new GridLayout(1, 2));
    pnControls.add(pnTopology);

    JPanel pnTopologyStatus = new JPanel();
    pnTopologyStatus.setLayout(new BoxLayout(pnTopologyStatus, BoxLayout.Y_AXIS));
    pnTopology.add(pnTopologyStatus);

    lbNumNodes = new JLabel("Number of Nodes: " + getTopology().getNodeSet().size());
    pnTopologyStatus.add(lbNumNodes);

    lbNumEdges = new JLabel("Number of Edges: " + getTopology().getEdgeSet().size());
    pnTopologyStatus.add(lbNumEdges);

    lbNumClusters = new JLabel("Number of Clusters: " + getTopology().getClusterSet().size());
    pnTopologyStatus.add(lbNumClusters);

    JPanel pnTopologyControls = new JPanel();
    pnTopologyControls.setLayout(new BoxLayout(pnTopologyControls, BoxLayout.Y_AXIS));
    pnTopology.add(pnTopologyControls);

    fcSaveLoad = new JFileChooser();
    fcSaveLoad.setSelectedFile(new File(System.getProperty("user.dir") + "/" + NAME + ".xml"));

    JButton btClear = new JButton("Clear topology");
    btClear.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            getTopology().clear();
          }
        });
    pnTopologyControls.add(btClear);

    JButton btSave = new JButton("Save topology");
    btSave.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (fcSaveLoad.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) {
              fileSave = fcSaveLoad.getSelectedFile();
            }
          }
        });
    pnTopologyControls.add(btSave);

    JButton btLoad = new JButton("Load topology");
    btLoad.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (fcSaveLoad.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION) {
              fileLoad = fcSaveLoad.getSelectedFile();
            }
          }
        });
    pnTopologyControls.add(btLoad);

    JButton btInsert = new JButton("Insert topology");
    btInsert.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (fcSaveLoad.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION) {
              fileInsert = fcSaveLoad.getSelectedFile();
            }
          }
        });
    pnTopologyControls.add(btInsert);

    // create panel for clusters
    pnClusters = new JPanel();
    pnClusters.setBorder(BorderFactory.createTitledBorder("Clusters"));
    pnClusters.setLayout(new WrapLayout(WrapLayout.LEFT));
    JScrollPane spClusters = new JScrollPane(pnClusters);
    panel.add(spClusters);

    // update panel
    panel.updateUI();
  }
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    panEdit = new javax.swing.JPanel();
    spnPointValue = new javax.swing.JSpinner();
    jLabel5 = new javax.swing.JLabel();
    labGwk = new javax.swing.JLabel();
    splitButton = new javax.swing.JButton();
    badGeomButton = new javax.swing.JToggleButton();
    jPanel2 = new javax.swing.JPanel();
    badGeomCorrectButton = new javax.swing.JButton();
    jPanel3 = new javax.swing.JPanel();
    lblPointValue = new javax.swing.JLabel();
    lblRoute = new javax.swing.JLabel();
    panAdd = new AddPanel();
    jLabel3 = new javax.swing.JLabel();
    panError = new javax.swing.JPanel();
    lblError = new javax.swing.JLabel();

    setEnabled(false);
    setOpaque(false);
    setLayout(new java.awt.CardLayout());

    panEdit.setOpaque(false);
    panEdit.setLayout(new java.awt.GridBagLayout());

    spnPointValue.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 0.0d, 1.0d));
    spnPointValue.setEditor(new javax.swing.JSpinner.NumberEditor(spnPointValue, "###"));
    spnPointValue.setMaximumSize(new java.awt.Dimension(100, 28));
    spnPointValue.setMinimumSize(new java.awt.Dimension(100, 28));
    spnPointValue.setPreferredSize(new java.awt.Dimension(100, 28));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
    panEdit.add(spnPointValue, gridBagConstraints);

    jLabel5.setIcon(
        new javax.swing.ImageIcon(
            getClass()
                .getResource(
                    "/de/cismet/cids/custom/objecteditors/wrrl_db_mv/station.png"))); // NOI18N
    jLabel5.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.jLabel5.text")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    panEdit.add(jLabel5, gridBagConstraints);

    labGwk.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    labGwk.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.labGwk.text_1")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 6;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    panEdit.add(labGwk, gridBagConstraints);

    splitButton.setIcon(
        new javax.swing.ImageIcon(
            getClass()
                .getResource(
                    "/de/cismet/cids/custom/objecteditors/wrrl_db_mv/sql-join-left.png"))); // NOI18N
    splitButton.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.splitButton.text")); // NOI18N
    splitButton.setToolTipText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.splitButton.toolTipText")); // NOI18N
    splitButton.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            splitButtonActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
    panEdit.add(splitButton, gridBagConstraints);

    badGeomButton.setIcon(
        new javax.swing.ImageIcon(
            getClass()
                .getResource(
                    "/de/cismet/cids/custom/objecteditors/wrrl_db_mv/exclamation.png"))); // NOI18N
    badGeomButton.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.badGeomButton.text")); // NOI18N
    badGeomButton.setToolTipText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.badGeomButton.toolTipText")); // NOI18N
    badGeomButton.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            badGeomButtonActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
    panEdit.add(badGeomButton, gridBagConstraints);

    jPanel2.setMaximumSize(new java.awt.Dimension(32, 0));
    jPanel2.setMinimumSize(new java.awt.Dimension(32, 0));
    jPanel2.setOpaque(false);
    jPanel2.setPreferredSize(new java.awt.Dimension(32, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    panEdit.add(jPanel2, gridBagConstraints);

    badGeomCorrectButton.setIcon(
        new javax.swing.ImageIcon(
            getClass()
                .getResource(
                    "/de/cismet/cids/custom/objecteditors/wrrl_db_mv/node-delete.png"))); // NOI18N
    badGeomCorrectButton.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.badGeomCorrectButton.text")); // NOI18N
    badGeomCorrectButton.setToolTipText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.badGeomCorrectButton.toolTipText")); // NOI18N
    badGeomCorrectButton.addActionListener(
        new java.awt.event.ActionListener() {

          @Override
          public void actionPerformed(final java.awt.event.ActionEvent evt) {
            badGeomCorrectButtonActionPerformed(evt);
          }
        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
    panEdit.add(badGeomCorrectButton, gridBagConstraints);

    jPanel3.setMaximumSize(new java.awt.Dimension(32, 0));
    jPanel3.setMinimumSize(new java.awt.Dimension(32, 0));
    jPanel3.setOpaque(false);
    jPanel3.setPreferredSize(new java.awt.Dimension(32, 0));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    panEdit.add(jPanel3, gridBagConstraints);

    lblPointValue.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    lblPointValue.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.lblPointValue.text_1")); // NOI18N
    lblPointValue.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    lblPointValue.setMaximumSize(new java.awt.Dimension(100, 28));
    lblPointValue.setMinimumSize(new java.awt.Dimension(100, 28));
    lblPointValue.setPreferredSize(new java.awt.Dimension(100, 28));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
    panEdit.add(lblPointValue, gridBagConstraints);

    lblRoute.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    lblRoute.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.lblRoute.text_1")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 0);
    panEdit.add(lblRoute, gridBagConstraints);

    add(panEdit, "edit");

    panAdd.setOpaque(false);
    panAdd.setLayout(new java.awt.GridBagLayout());

    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel3.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.jLabel3.text")); // NOI18N
    panAdd.add(jLabel3, new java.awt.GridBagConstraints());

    add(panAdd, "add");

    panError.setOpaque(false);
    panError.setLayout(new java.awt.GridBagLayout());

    lblError.setText(
        org.openide.util.NbBundle.getMessage(
            StationEditor.class, "StationEditor.lblError.text")); // NOI18N
    panError.add(lblError, new java.awt.GridBagConstraints());

    add(panError, "error");
  } // </editor-fold>//GEN-END:initComponents
 private void jbInit() {
   setLayout(bolThis);
   pnlDisplay.setLayout(crdDisplay);
   cmdSave.setText("Save");
   cmdSave.addActionListener(this);
   cmdUnzoom.addActionListener(this);
   cmdResetView.addActionListener(this);
   cmdUnzoom.setText("Unzoom");
   cmdResetView.setText("Reset View");
   pnlDisplayControls.setLayout(crdDisplayControls);
   pnlControls.setLayout(gblControls);
   pnlHistogramControls.setLayout(gblHistogramControls);
   lblBins.setText("Bins:");
   spnBins.setMinimumSize(new Dimension(60, 20));
   spnBins.setPreferredSize(new Dimension(60, 20));
   spnBins.addChangeListener(this);
   spnBins.setModel(new SpinnerNumberModel(new Integer(10), new Integer(1), null, new Integer(1)));
   pnlZoomControls.setLayout(crdZoomControls);
   pnlZoomable.setLayout(gblZoomable);
   scpLineChart.setBorder(BorderFactory.createLoweredBevelBorder());
   scpHistogram.setBorder(BorderFactory.createLoweredBevelBorder());
   scpRaw.setBorder(BorderFactory.createLoweredBevelBorder());
   cboDisplayType.addItemListener(this);
   txaRaw.setEditable(false);
   pnlHistogram.setYAxisLabel("Count");
   cmdMaximize.setText("Maximize");
   cmdMaximize.addActionListener(new LandscapePanel_cmdMaximize_actionAdapter(this));
   this.add(pnlControls, java.awt.BorderLayout.SOUTH);
   this.add(pnlDisplay, java.awt.BorderLayout.CENTER);
   pnlDisplay.add(scpLineChart, "Line Chart");
   pnlDisplay.add(scpHistogram, "Histogram");
   pnlDisplay.add(scpRaw, "Raw Text");
   scpLineChart.getViewport().add(pnlLineChart);
   scpHistogram.getViewport().add(pnlHistogram);
   scpRaw.getViewport().add(txaRaw);
   pnlLineChart.addSelectionListener(this);
   pnlHistogram.addSelectionListener(this);
   cboDisplayType.addItem(new DisplayPair<String, Component>("Line Chart", scpLineChart));
   cboDisplayType.addItem(new DisplayPair<String, Component>("Histogram", scpHistogram));
   cboDisplayType.addItem(new DisplayPair<String, Component>("Raw Text", scpRaw));
   pnlZoomControls.add(pnlZoomable, "Zoomable");
   pnlZoomControls.add(pnlUnzoomable, "Unzoomable");
   pnlZoomable.add(
       cmdUnzoom,
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(5, 5, 5, 0),
           0,
           0));
   pnlZoomable.add(
       cmdResetView,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(5, 5, 5, 0),
           0,
           0));
   pnlHistogramControls.add(
       lblBins,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(5, 5, 5, 0),
           0,
           0));
   pnlHistogramControls.add(
       spnBins,
       new GridBagConstraints(
           2,
           0,
           1,
           1,
           1.0,
           0.0,
           GridBagConstraints.WEST,
           GridBagConstraints.NONE,
           new Insets(5, 5, 5, 5),
           0,
           0));
   pnlDisplayControls.add(pnlLineChartControls, "Line Chart");
   pnlDisplayControls.add(pnlHistogramControls, "Histogram");
   pnlDisplayControls.add(pnlRawControls, "Raw Text");
   pnlControls.add(
       pnlZoomControls,
       new GridBagConstraints(
           1,
           0,
           1,
           2,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 0, 0, 0),
           0,
           0));
   pnlControls.add(
       cboDisplayType,
       new GridBagConstraints(
           0,
           0,
           1,
           2,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.HORIZONTAL,
           new Insets(5, 5, 5, 0),
           0,
           0));
   pnlControls.add(
       pnlDisplayControls,
       new GridBagConstraints(
           3,
           0,
           1,
           2,
           1.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(0, 0, 0, 0),
           0,
           0));
   pnlControls.add(
       cmdMaximize,
       new GridBagConstraints(
           4,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(5, 5, 5, 0),
           0,
           0));
   pnlControls.add(
       cmdSave,
       new GridBagConstraints(
           5,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(5, 5, 5, 5),
           0,
           0));
 }
  /** Construct a new font selector. */
  public FontSelector() {
    Dimension d;

    // Widgets are laid out horizontally.
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    // Set up font family names and a 12-point normal font for each family.
    myFontFamilies =
        GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

    // Set up combo box for font family name.
    myFontFamilyComboBox = new JComboBox(myFontFamilies);
    d = myFontFamilyComboBox.getPreferredSize();
    myFontFamilyComboBox.setMinimumSize(d);
    myFontFamilyComboBox.setMaximumSize(d);
    myFontFamilyComboBox.setPreferredSize(d);
    myFontFamilyComboBox.setEditable(false);
    myFontFamilyComboBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              updateSelectedFont();
            }
          }
        });
    add(myFontFamilyComboBox);
    add(Box.createHorizontalStrut(GAP));

    // Set up combo box for font style.
    myFontStyleComboBox = new JComboBox(new String[] {"Plain", "Bold", "Italic", "Bold Italic"});
    d = myFontStyleComboBox.getPreferredSize();
    myFontStyleComboBox.setMinimumSize(d);
    myFontStyleComboBox.setMaximumSize(d);
    myFontStyleComboBox.setPreferredSize(d);
    myFontStyleComboBox.setEditable(false);
    myFontStyleComboBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              updateSelectedFont();
            }
          }
        });
    add(myFontStyleComboBox);
    add(Box.createHorizontalStrut(GAP));

    // Set up spinner for font size.
    myFontSizeSpinner = new JSpinner(new SpinnerNumberModel(12, 1, 144, 1));
    d = myFontSizeSpinner.getPreferredSize();
    myFontSizeSpinner.setMinimumSize(d);
    myFontSizeSpinner.setMaximumSize(d);
    myFontSizeSpinner.setPreferredSize(d);
    myFontSizeSpinner.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            updateSelectedFont();
          }
        });
    add(myFontSizeSpinner);
    add(Box.createHorizontalStrut(GAP));

    // Set up text sample.
    myTextSample = new JLabel("Quick Brown Fox 123");
    d = myTextSample.getPreferredSize();
    myTextSample.setMinimumSize(d);
    myTextSample.setMaximumSize(d);
    myTextSample.setPreferredSize(d);
    add(myTextSample);

    // Set default selected font.
    setSelectedFont(new Font("SansSerif", Font.PLAIN, 12));
  }