コード例 #1
0
  /**
   * create horizontal lines across the image. Raise and lower the pen to darken the appropriate
   * areas
   *
   * @param img the image to convert.
   */
  public boolean convert(TransformedImage img, Writer out) throws IOException {
    final JTextField field_size = new JTextField(Float.toString(blockScale));

    JPanel panel = new JPanel(new GridLayout(0, 1));
    panel.add(new JLabel(Translator.get("HilbertCurveSize")));
    panel.add(field_size);

    String[] directions = {"top right", "top left", "bottom left", "bottom right", "center"};
    final JComboBox<String> direction_choices = new JComboBox<>(directions);
    direction_choices.setSelectedIndex(direction);
    panel.add(direction_choices);

    int result =
        JOptionPane.showConfirmDialog(
            null, panel, getName(), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
    if (result == JOptionPane.OK_OPTION) {
      blockScale = Float.parseFloat(field_size.getText());
      direction = direction_choices.getSelectedIndex();
      convertNow(img, out);
      return true;
    }
    return false;
  }
コード例 #2
0
 @Override
 public String getName() {
   return Translator.get("Sandy Noble Style");
 }