예제 #1
0
  private int[][] apply(boolean preview) {
    int[][] heightmap = new int[128][128];
    int step = 1;

    if (!preview) {
      parent.setProgressBar(sldIterations.getValue());
      heightmap = parent.cloneArray(parent.getHeightMap());
    } else {
      heightmap = parent.getPreviewMap();
      step =
          (int)
              Math.ceil(
                  (double) parent.getHeightMap().length / (double) parent.getPreviewMap().length);
    }

    for (int i = 0; i < sldIterations.getValue() / step; i++) {
      heightmap = applyThermal(heightmap);

      if (!preview) parent.increaseProgressBar();
    }

    if (!preview) parent.resetProgressBar();

    return heightmap;
  }
 public void stateChanged(ChangeEvent e) {
   JSlider source = (JSlider) e.getSource();
   if (!source.getValueIsAdjusting()) {
     int delay = 1000 * (int) source.getValue();
     LifeSimulation.timer().setDelay(delay);
   }
 }
예제 #3
0
  /**
   * Sets the panel in which the GUI should be implemented Any standard swing components can be used
   *
   * @param panel The GUI panel
   */
  public void setPanel(JPanel panel) {
    this.panel = panel;

    panel.setLayout(new BorderLayout());

    JLabel label =
        new JLabel("Produces an effect similar to thermal erosion", (int) JLabel.CENTER_ALIGNMENT);
    panel.add(label, BorderLayout.PAGE_START);

    JPanel iterations = new JPanel();
    iterations.setLayout(new FlowLayout());

    label = new JLabel("Iterations ");
    iterations.add(label);
    sldIterations = new JSlider(1, 100, 1);
    sldIterations.addChangeListener(this);
    iterations.add(sldIterations);
    txtIterations = new JTextField(Integer.toString((int) sldIterations.getValue()));
    txtIterations.setEditable(false);
    txtIterations.setPreferredSize(new Dimension(35, 25));
    iterations.add(txtIterations);

    panel.add(iterations, BorderLayout.CENTER);

    btnApply = new JButton("Apply Thermal Erosion");
    btnApply.addActionListener(this);
    panel.add(btnApply, BorderLayout.PAGE_END);

    if (preview) parent.refreshMiniView(apply(preview));
  }
예제 #4
0
  private void setComponentsEnabled(boolean enabled) {
    list.setEnabled(enabled);
    process.setEnabled(enabled);
    remove.setEnabled(enabled);
    xres.setEnabled(enabled);
    yres.setEnabled(enabled);
    aspect.setEnabled(enabled);

    boolean b = aspect.isSelected() && enabled;
    colorLabel.setEnabled(b);
    colorBox.setEnabled(b);
    redLabel.setEnabled(b);
    red.setEnabled(b);
    redValue.setEnabled(b);
    greenLabel.setEnabled(b);
    green.setEnabled(b);
    greenValue.setEnabled(b);
    blueLabel.setEnabled(b);
    blue.setEnabled(b);
    blueValue.setEnabled(b);

    format.setEnabled(enabled);
    algorithm.setEnabled(enabled);
    prepend.setEnabled(enabled);
    append.setEnabled(enabled);
    output.setEnabled(enabled);
  }
 /** Called when the speed slider was moved. */
 public void SpeedSlider_stateChanged(ChangeEvent e) {
   JSlider source = (JSlider) e.getSource();
   if (!source.getValueIsAdjusting()) {
     int speed = source.getValue();
     notifyControllerListeners(ControllerEvent.SPEED_CHANGE, new Integer(speed));
   }
 }
예제 #6
0
 public void stateChanged(ChangeEvent e) {
   if (e.getSource() == whichRadius) {
     if (!whichRadius.getValueIsAdjusting()) {
       // System.out.println(acc.length);
       if (acc != null) buildAccumulator(whichRadius.getValue());
       accumulator.setSelected(true);
     }
   }
 }
예제 #7
0
  private void loadPreferences() {
    // grab the preferences so that they can be used to fill out the layout
    ThumbMakerPreferences myPreferences = ThumbMakerPreferences.getInstance();

    // x resolution text box
    xres.setText(myPreferences.getStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME));

    // y resolution text box
    yres.setText(myPreferences.getStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME));

    // aspect ratio checkbox
    aspect.setSelected(
        myPreferences
            .getStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME)
            .equalsIgnoreCase(ThumbMakerPreferences.BOOLEAN_TRUE_STRING));

    // load the color values from the preferences
    int redValueNumber = myPreferences.getIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME);
    int greenValueNumber =
        myPreferences.getIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME);
    int blueValueNumber = myPreferences.getIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME);

    // set the background color image
    colorBox.setBackground(new Color(redValueNumber, greenValueNumber, blueValueNumber));

    // red slider
    red.setValue(redValueNumber);
    redValue.setText("" + redValueNumber);

    // green slider
    green.setValue(greenValueNumber);
    greenValue.setText("" + greenValueNumber);

    // blue slider
    blue.setValue(blueValueNumber);
    blueValue.setText("" + blueValueNumber);

    // algorithm combo box
    algorithm.setSelectedIndex(
        myPreferences.getIntegerPref(ThumbMakerPreferences.RESIZE_ALG_PREF_NAME));

    // format combo box
    format.setSelectedIndex(
        myPreferences.getIntegerPref(ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME));

    // prepend field
    prepend.setText(myPreferences.getStringPref(ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME));

    // append field
    append.setText(myPreferences.getStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME));

    // output folder field
    output.setText(
        (new File(myPreferences.getStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME)))
            .getAbsolutePath());
  }
예제 #8
0
 private static void setSilderUI(JSlider slider) {
   if (slider.getUI() instanceof WindowsSliderUI) {
     slider.setUI(new WindowsJumpToClickedPositionSliderUI(slider));
   } else {
     slider.setUI(new MetalJumpToClickedPositionSliderUI());
   }
   //         slider.setSnapToTicks(false);
   //         slider.setPaintTicks(true);
   //         slider.setPaintLabels(true);
 }
예제 #9
0
  public void stateChanged(ChangeEvent e) {
    JSlider source = (JSlider) e.getSource();

    if (source == unitXSlider) {
      ux = source.getValue();
      graph.setUnityX(ux);
    } else {
      uy = source.getValue();
      graph.setUnityY(uy);
    }
  }
예제 #10
0
 /** Called when color slider values change. */
 public void stateChanged(ChangeEvent e) {
   JSlider slider = (JSlider) e.getSource();
   int val = slider.getValue();
   String s = "" + val;
   if (val < 100) s = "0" + s;
   if (val < 10) s = "0" + s;
   if (slider == red) redValue.setText(s);
   else if (slider == green) greenValue.setText(s);
   else if (slider == blue) blueValue.setText(s);
   Color c = new Color(red.getValue(), green.getValue(), blue.getValue());
   colorBox.setBackground(c);
 }
예제 #11
0
 public Slider() {
   super("Slider");
   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   setLookAndFeel();
   JSlider pickNum = new JSlider(JSlider.HORIZONTAL, 0, 30, 5);
   pickNum.setMajorTickSpacing(10);
   pickNum.setMinorTickSpacing(1);
   pickNum.setPaintTicks(true);
   pickNum.setPaintLabels(true);
   add(pickNum);
   pack();
   setVisible(true);
 }
예제 #12
0
  public Piece pickNextPiece() {
    if (adversary.getValue() == 0 && happy.getValue() == 0) {
      adStat.setText(adversaryOff);
      adHappy.setText(happyOff);
      return (super
          .pickNextPiece()); // not to mess with the sequence of random numbers for test mode
    }

    if (adversary.getValue() != 0 && happy.getValue() != 0) {
      adversary.setValue(0);
      adversary.repaint();
    }

    if (random.nextInt(100) <= adversary.getValue()) {
      adStat.setText(adversaryOn);
      return getWorstPiece(true);
    } else {
      adStat.setText(adversaryOff);
    }
    if (random.nextInt(100) <= happy.getValue()) {
      adHappy.setText(happyOn);
      return getWorstPiece(false);
    } else {
      adHappy.setText(happyOff);
    }
    return (super.pickNextPiece());
  }
예제 #13
0
 private JPanel makeSlider(JLabel label, JSlider slider, JLabel value, String color) {
   JPanel p = new JPanel();
   p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
   label.setDisplayedMnemonic(label.getText().charAt(0));
   label.setLabelFor(slider);
   String tip = color + " color component slider";
   label.setToolTipText(tip);
   slider.setToolTipText(tip);
   value.setToolTipText(tip);
   p.add(label);
   slider.setMaximumSize(new Dimension(128, slider.getMaximumSize().height));
   slider.addChangeListener(this);
   p.add(slider);
   p.add(value);
   return p;
 }
예제 #14
0
  private void savePreferences() {
    // grab the preferences so that they can be filled in from the
    // user's selections
    ThumbMakerPreferences myPreferences = ThumbMakerPreferences.getInstance();

    // x resolution text box
    myPreferences.setStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME, xres.getText());

    // y resolution text box
    myPreferences.setStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME, yres.getText());

    // aspect ratio checkbox
    String aspectText;
    if (aspect.isSelected()) {
      aspectText = ThumbMakerPreferences.BOOLEAN_TRUE_STRING;
    } else aspectText = ThumbMakerPreferences.BOOLEAN_FALSE_STRING;
    myPreferences.setStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME, aspectText);

    // red slider
    myPreferences.setIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME, red.getValue());

    // green slider
    myPreferences.setIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME, green.getValue());

    // blue slider
    myPreferences.setIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME, blue.getValue());

    // algorithm combo box
    myPreferences.setIntegerPref(
        ThumbMakerPreferences.RESIZE_ALG_PREF_NAME, algorithm.getSelectedIndex());

    // format combo box
    myPreferences.setIntegerPref(
        ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME, format.getSelectedIndex());

    // prepend field
    myPreferences.setStringPref(
        ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME, prepend.getText());

    // append field
    myPreferences.setStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME, append.getText());

    // output folder field
    myPreferences.setStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME, output.getText());
  }
  private JComponent createSettingsPanel() {
    JPanel result = new JPanel(new FlowLayout(FlowLayout.RIGHT, 3, 0));
    result.add(new JLabel(ApplicationBundle.message("label.font.size")));
    myFontSizeSlider = new JSlider(JSlider.HORIZONTAL, 0, FontSize.values().length - 1, 3);
    myFontSizeSlider.setMinorTickSpacing(1);
    myFontSizeSlider.setPaintTicks(true);
    myFontSizeSlider.setPaintTrack(true);
    myFontSizeSlider.setSnapToTicks(true);
    UIUtil.setSliderIsFilled(myFontSizeSlider, true);
    result.add(myFontSizeSlider);
    result.setBorder(BorderFactory.createLineBorder(UIUtil.getBorderColor(), 1));

    myFontSizeSlider.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            if (myIgnoreFontSizeSliderChange) {
              return;
            }
            EditorColorsManager colorsManager = EditorColorsManager.getInstance();
            EditorColorsScheme scheme = colorsManager.getGlobalScheme();
            scheme.setQuickDocFontSize(FontSize.values()[myFontSizeSlider.getValue()]);
            applyFontSize();
          }
        });

    String tooltipText = ApplicationBundle.message("quickdoc.tooltip.font.size.by.wheel");
    result.setToolTipText(tooltipText);
    myFontSizeSlider.setToolTipText(tooltipText);
    result.setVisible(false);
    result.setOpaque(true);
    myFontSizeSlider.setOpaque(true);
    return result;
  }
예제 #16
0
  protected void attachTo(Component jc) {
    if (extListener != null && extListener.accept(jc)) {
      extListener.startListeningTo(jc, extNotifier);
      listenedTo.add(jc);
      if (wizardPage.getMapKeyFor(jc) != null) {
        wizardPage.maybeUpdateMap(jc);
      }
      return;
    }
    if (isProbablyAContainer(jc)) {
      attachToHierarchyOf((Container) jc);
    } else if (jc instanceof JList) {
      listenedTo.add(jc);
      ((JList) jc).addListSelectionListener(this);
    } else if (jc instanceof JComboBox) {
      ((JComboBox) jc).addActionListener(this);
    } else if (jc instanceof JTree) {
      listenedTo.add(jc);
      ((JTree) jc).getSelectionModel().addTreeSelectionListener(this);
    } else if (jc instanceof JToggleButton) {
      ((AbstractButton) jc).addItemListener(this);
    } else if (jc
        instanceof JFormattedTextField) { // JFormattedTextField must be tested before JTextCompoent
      jc.addPropertyChangeListener("value", this);
    } else if (jc instanceof JTextComponent) {
      listenedTo.add(jc);
      ((JTextComponent) jc).getDocument().addDocumentListener(this);
    } else if (jc instanceof JColorChooser) {
      listenedTo.add(jc);
      ((JColorChooser) jc).getSelectionModel().addChangeListener(this);
    } else if (jc instanceof JSpinner) {
      ((JSpinner) jc).addChangeListener(this);
    } else if (jc instanceof JSlider) {
      ((JSlider) jc).addChangeListener(this);
    } else if (jc instanceof JTable) {
      listenedTo.add(jc);
      ((JTable) jc).getSelectionModel().addListSelectionListener(this);
    } else {
      if (logger.isLoggable(Level.FINE)) {
        logger.fine(
            "Don't know how to listen to a "
                + // NOI18N
                jc.getClass().getName());
      }
    }

    if (accept(jc) && !(jc instanceof JPanel)) {
      jc.addPropertyChangeListener("name", this);
      if (wizardPage.getMapKeyFor(jc) != null) {
        wizardPage.maybeUpdateMap(jc);
      }
    }

    if (logger.isLoggable(Level.FINE) && accept(jc)) {
      logger.fine("Begin listening to " + jc); // NOI18N
    }
  }
예제 #17
0
 public void stateChanged(ChangeEvent e) {
   if (e.getSource().equals(sldIterations)) {
     txtIterations.setText(Integer.toString((int) sldIterations.getValue()));
     if (preview) {
       parent.setPreviewMap(parent.getHeightMap(), 128);
       parent.refreshMiniView(apply(preview));
     }
   }
 }
예제 #18
0
 public ImageOps() {
   setBackground(Color.white);
   for (int i = 0; i < imgName.length; i++) {
     Image image = getImage(imgName[i]);
     int iw = image.getWidth(this);
     int ih = image.getHeight(this);
     img[i] = new BufferedImage(iw, ih, BufferedImage.TYPE_INT_RGB);
     img[i].createGraphics().drawImage(image, 0, 0, null);
   }
   slider1 = new JSlider(JSlider.VERTICAL, 0, 255, low);
   slider1.setPreferredSize(new Dimension(15, 100));
   slider1.addChangeListener(this);
   slider2 = new JSlider(JSlider.VERTICAL, 0, 255, high);
   slider2.setPreferredSize(new Dimension(15, 100));
   slider2.addChangeListener(this);
   setControls(new Component[] {new DemoControls(this), slider1, slider2});
   setConstraints(new String[] {BorderLayout.NORTH, BorderLayout.WEST, BorderLayout.EAST});
 }
예제 #19
0
 /**
  * Lets the GUI know that a discrete amount of time has passed.
  *
  * @param time The (simulated) time that has passed since the last call to this method.
  */
 public void timePassed(long time) {
   timeElapsed += time;
   timeElapsedLabel.setText("Simulated time elapsed: " + timeElapsed + " ms.");
   timeElapsedLabel.repaint();
   try {
     if (sleep && isShowing())
       Thread.sleep((10000 - simulationSpeedSlider.getValue()) * time / 3000);
   } catch (InterruptedException ie) {
   }
 }
예제 #20
0
  public java.awt.Container createControlPanel() {
    java.awt.Container panel2 = Box.createVerticalBox();
    panel2 = super.createControlPanel();

    brainPlay = new JCheckBox("Brain Play", false);
    if (testMode) brainPlay.setSelected(true);
    panel2.add(brainPlay);

    JPanel row2 = new JPanel();

    // ADVERSARY slider
    row2.add(Box.createVerticalStrut(12));
    row2.add(new JLabel("Adversary:"));

    adversary = new JSlider(0, 100, 0); // min, max, current
    adversary.setPreferredSize(new Dimension(100, 15));
    row2.add(adversary);

    JPanel text = new JPanel();
    text.add(adStat = new JLabel(adversaryOff));
    panel2.add(text);

    panel2.add(row2);

    JPanel row3 = new JPanel();

    // Mr. Happy slider
    row3.add(Box.createVerticalStrut(12));
    row3.add(new JLabel("CELAB"));

    happy = new JSlider(0, 100, 0); // min, max, current
    happy.setPreferredSize(new Dimension(100, 15));
    row3.add(happy);

    JPanel text2 = new JPanel();
    text2.add(adHappy = new JLabel(happyOff));
    panel2.add(text2);

    panel2.add(row3);

    return (panel2);
  }
예제 #21
0
  public void stateChanged(ChangeEvent e) {

    int deepE = lSlider.getValue();
    int shallE = rSlider.getValue();
    if (shallE > deepE) {
      shallE = deepE;
    }
    if (deepE < shallE) {
      deepE = shallE;
    }
    lSlider.setValue(deepE);
    rSlider.setValue(shallE);
    drawPool(deepE, shallE, 5);

    int v = (shallE + deepE) / 2 * 5 * 20;

    deepField.setText(Integer.toString(deepE));
    shallField.setText(Integer.toString(shallE));
    areaField.setText(Integer.toString(v));
  }
예제 #22
0
  /**
   * Activate/Deactivate Rotate-Button
   *
   * @param b
   */
  public void activateRotation(boolean b) {

    if (showRotate && b) {
      rotatePanel.setVisible(b);
      rotateSlider.setValue(((ShapeItem) board.getSelectedItems()[0]).getRotation());

    } else {
      rotatePanel.setVisible(false);
    }
    rotate.setEnabled(b);
  }
예제 #23
0
  protected void detachFrom(Component jc) {
    listenedTo.remove(jc);
    if (extListener != null && extListener.accept(jc)) {
      extListener.stopListeningTo(jc);
    }
    if (isProbablyAContainer(jc)) {
      detachFromHierarchyOf((Container) jc);
    } else if (jc instanceof JList) {
      ((JList) jc).removeListSelectionListener(this);
    } else if (jc instanceof JComboBox) {
      ((JComboBox) jc).removeActionListener(this);
    } else if (jc instanceof JTree) {
      ((JTree) jc).getSelectionModel().removeTreeSelectionListener(this);
    } else if (jc instanceof JToggleButton) {
      ((AbstractButton) jc).removeActionListener(this);
    } else if (jc instanceof JTextComponent) {
    } else if (jc
        instanceof JFormattedTextField) { // JFormattedTextField must be tested before JTextCompoent
      jc.removePropertyChangeListener("value", this);
      ((JTextComponent) jc).getDocument().removeDocumentListener(this);
    } else if (jc instanceof JColorChooser) {
      ((JColorChooser) jc).getSelectionModel().removeChangeListener(this);
    } else if (jc instanceof JSpinner) {
      ((JSpinner) jc).removeChangeListener(this);
    } else if (jc instanceof JSlider) {
      ((JSlider) jc).removeChangeListener(this);
    } else if (jc instanceof JTable) {
      ((JTable) jc).getSelectionModel().removeListSelectionListener(this);
    }

    if (accept(jc) && !(jc instanceof JPanel)) {
      jc.removePropertyChangeListener("name", this);
      Object key = wizardPage.getMapKeyFor(jc);

      if (key != null) {
        if (logger.isLoggable(Level.FINE)) {
          logger.fine(
              "Named component removed from hierarchy: "
                  + // NOI18N
                  key
                  + ".  Removing any corresponding "
                  + // NOI18N
                  "value from the wizard settings map."); // NOI18N
        }

        wizardPage.removeFromMap(key);
      }
    }

    if (logger.isLoggable(Level.FINE) && accept(jc)) {
      logger.fine("Stop listening to " + jc); // NOI18N
    }
  }
예제 #24
0
 public void stateChanged(ChangeEvent e) {
   // when using these sliders use double buffering, which means
   // ignoring when DemoSurface.imageType = 'On Screen'
   if (getImageType() <= 1) {
     setImageType(2);
   }
   if (e.getSource().equals(slider1)) {
     if (opsIndex == 0) {
       thresholdOp(slider1.getValue(), high);
     } else {
       rescaleFactor = slider1.getValue();
       biop[1] = new RescaleOp((float) rescaleFactor / 128.0f, rescaleOffset, null);
     }
   } else {
     if (opsIndex == 0) {
       thresholdOp(low, slider2.getValue());
     } else {
       rescaleOffset = (float) slider2.getValue();
       biop[1] = new RescaleOp((float) rescaleFactor / 128.0f, rescaleOffset, null);
     }
   }
   repaint();
 }
 private void setFontSizeSliderSize(FontSize fontSize) {
   myIgnoreFontSizeSliderChange = true;
   try {
     FontSize[] sizes = FontSize.values();
     for (int i = 0; i < sizes.length; i++) {
       if (fontSize == sizes[i]) {
         myFontSizeSlider.setValue(i);
         break;
       }
     }
   } finally {
     myIgnoreFontSizeSliderChange = false;
   }
 }
예제 #26
0
  private void createGUI() {
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    Container window = getContentPane();
    window.setLayout(new FlowLayout());

    lSlider = new JSlider(JSlider.VERTICAL, 1, 6, 1);
    window.add(lSlider);
    lSlider.addChangeListener(this);

    panel = new JPanel();
    panel.setPreferredSize(new Dimension(200, 175));
    panel.setBackground(Color.WHITE);
    window.add(panel);

    rSlider = new JSlider(JSlider.VERTICAL, 1, 6, 1);
    window.add(rSlider);
    rSlider.addChangeListener(this);

    deepLabel = new JLabel("Deep end: ");
    window.add(deepLabel);

    deepField = new JTextField(4);
    window.add(deepField);

    shallLabel = new JLabel("Shall end: ");
    window.add(shallLabel);

    shallField = new JTextField(4);
    window.add(shallField);

    areaLabel = new JLabel("Area of the swimming pool: ");
    window.add(areaLabel);

    areaField = new JTextField(4);
    window.add(areaField);
  }
예제 #27
0
  /** Change the view to display a given question number (1-origin) */
  protected void setQNumber(int nn) {
    String userShowNumber = Integer.toString(nn);

    System.out.println("setQNumber(" + userShowNumber + ");");

    // notify the model
    //	TODO -- if necessary!

    // update the view
    numTF.setText(userShowNumber);
    numSlider.setValue(nn);

    // show the right question
    myCardLayout.show(questionsPanel, userShowNumber);
  }
  TimerControls(ControlBar creator) {
    parent = creator;
    super.setPreferredSize(new Dimension(200, 172));
    setLayout(new BorderLayout());

    pausePlay = new JButton("Play");
    speed = makeJSlider();

    pausePlay.addActionListener(this);
    speed.addChangeListener(this);

    super.add(pausePlay, BorderLayout.WEST);
    super.add(speed, BorderLayout.EAST);
    super.add(new JLabel(" Simulation Speed Controls"), BorderLayout.NORTH);

    super.repaint();
    super.setVisible(true);
  }
  private JSlider makeJSlider() {

    JSlider slider = new JSlider(JSlider.VERTICAL, 0, 10, 1);
    slider.setMajorTickSpacing(1);
    slider.setPaintTicks(true);
    slider.setSnapToTicks(true);

    Hashtable labelTable = new Hashtable();
    for (int i = 0; i <= 10; i += 2) {
      labelTable.put(new Integer(i), new JLabel(i + " Seconds"));
    }
    slider.setLabelTable(labelTable);
    slider.setPaintLabels(true);
    return slider;
  }
예제 #30
0
 public void loadImage() throws IOException {
   nonMax = ImageIO.read(new File(path));
   width = nonMax.getWidth();
   height = nonMax.getHeight();
   rmax = width > height ? height / 2 : width / 2;
   accRMax = (rmax + offset - 1) / offset;
   whichRadius.setMaximum(accRMax);
   img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
   Graphics g = img.getGraphics();
   g.drawImage(nonMax, 0, 0, null);
   g.dispose();
   res = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
   g = res.getGraphics();
   g.drawImage(img, 0, 0, null);
   g.dispose();
   greyScale = copyImage(nonMax);
   ImageIcon icon = new ImageIcon(img);
   ImageIcon icon2 = new ImageIcon(greyScale);
   lbl1.setIcon(icon);
   lbl2.setIcon(icon2);
 }