示例#1
0
  /**
   * Default constructor.
   *
   * @param main reference to the main window
   */
  public DialogInsert(final GUI main) {
    super(main, INSERTTITLE);

    label1 = new BaseXLabel(EDITNAME + COLS, true, true).border(0, 0, 0, 0);
    label2 = new BaseXLabel(EDITVALUE + COLS, true, true).border(0, 0, 0, 0);

    input1 = new BaseXTextField(this);
    input1.addKeyListener(keys);
    BaseXLayout.setWidth(input1, 320);

    input2 = new BaseXEditor(true, this);
    input2.setFont(GUIConstants.mfont);
    input2.addKeyListener(keys);
    BaseXLayout.setWidth(input2, 320);

    final BaseXBack knd = new BaseXBack(new TableLayout(1, 5));
    final ButtonGroup group = new ButtonGroup();

    final ActionListener al =
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            change(e.getSource());
          }
        };

    final int lkind = gui.gprop.num(GUIProp.LASTINSERT);
    radio = new BaseXRadio[EDITKIND.length];
    for (int i = 1; i < EDITKIND.length; ++i) {
      radio[i] = new BaseXRadio(EDITKIND[i], false, this);
      radio[i].addActionListener(al);
      radio[i].setSelected(i == lkind);
      radio[i].addKeyListener(keys);
      group.add(radio[i]);
      knd.add(radio[i]);
    }
    set(knd, BorderLayout.NORTH);

    back = new BaseXBack(10, 0, 0, 0);
    set(back, BorderLayout.CENTER);

    final BaseXBack pp = new BaseXBack(new BorderLayout());
    info = new BaseXLabel(" ").border(8, 0, 2, 0);
    pp.add(info, BorderLayout.WEST);

    buttons = okCancel(this);
    pp.add(buttons, BorderLayout.EAST);
    set(pp, BorderLayout.SOUTH);

    setResizable(true);
    change(radio[lkind]);

    action(null);
    finish(null);
  }
示例#2
0
 /**
  * Adds a combobox.
  *
  * @param min minimum value
  * @param max maximum value
  * @param pos position
  * @param itr integer flag
  */
 private void addSlider(final double min, final double max, final int pos, final boolean itr) {
   final BaseXDSlider sl = new BaseXDSlider(gui, min, max, this);
   BaseXLayout.setWidth(sl, COMPW + BaseXDSlider.LABELW);
   sl.itr = itr;
   sl.addKeyListener(main);
   panel.add(sl, pos);
 }
示例#3
0
 /**
  * Adds a combobox.
  *
  * @param values combobox values
  * @param pos position
  */
 private void addCombo(final String[] values, final int pos) {
   final BaseXCombo cm = new BaseXCombo(gui, values);
   BaseXLayout.setWidth(cm, COMPW);
   cm.addActionListener(this);
   cm.addKeyListener(main);
   panel.add(cm, pos);
 }
示例#4
0
  /**
   * Constructor.
   *
   * @param win parent window
   */
  public BaseXPassword(final Window win) {
    BaseXLayout.setWidth(this, BaseXTextField.DWIDTH);
    BaseXLayout.addInteraction(this, win);

    if (!(win instanceof BaseXDialog)) return;

    addKeyListener(((BaseXDialog) win).keys);
    addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseEntered(final MouseEvent e) {
            BaseXLayout.focus(e.getComponent());
          }
        });
  }
示例#5
0
 /**
  * Adds a text field.
  *
  * @param pos position
  */
 private void addInput(final int pos) {
   final BaseXTextField txt = new BaseXTextField(gui);
   BaseXLayout.setWidth(txt, COMPW);
   BaseXLayout.setHeight(txt, txt.getFont().getSize() + 11);
   txt.setMargin(new Insets(0, 0, 0, 10));
   txt.addKeyListener(
       new KeyAdapter() {
         @Override
         public void keyReleased(final KeyEvent e) {
           query(false);
         }
       });
   txt.addKeyListener(main);
   panel.add(txt, pos);
 }
示例#6
0
  /**
   * Default constructor.
   *
   * @param main reference to the main window
   */
  private DialogBindings(final GUI main) {
    super(main, EXTERNAL_VARIABLES, false);

    final int cl = context.length;
    for (int c = 0; c < cl; c++) {
      context[c] = new BaseXTextField(this);
      BaseXLayout.setWidth(context[c], c % 2 == 0 ? 80 : 200);
    }

    final BaseXBack table = new BaseXBack(new TableLayout((2 + cl) / 2, 2, 8, 4));
    table.add(new BaseXLabel(NAME + COLS, false, true));
    table.add(new BaseXLabel(VALUE + COLS, false, true));
    for (final BaseXTextField ctx : context) table.add(ctx);
    set(table, BorderLayout.CENTER);

    fill();
    finish(gui.gopts.get(GUIOptions.BINDINGSLOC));
  }
示例#7
0
  /**
   * Constructor.
   *
   * @param win parent reference
   * @param mouse mouse interaction
   */
  public BaseXMem(final Window win, final boolean mouse) {
    super(win);
    BaseXLayout.setWidth(this, DWIDTH);
    BaseXLayout.setHeight(this, getFont().getSize() + 6);
    if (mouse) {
      setCursor(CURSORHAND);
      addMouseListener(this);
      addMouseMotionListener(this);
    }

    final Thread t =
        new Thread() {
          @Override
          public void run() {
            repaint();
            Performance.sleep(500);
          }
        };
    t.setDaemon(true);
    t.start();
  }
示例#8
0
 /**
  * Creates a slider.
  *
  * @param option option
  * @return slider reference
  */
 private BaseXSlider newSlider(final NumberOption option) {
   final BaseXSlider slider = new BaseXSlider(0, MAXCOLOR, option, gui.gopts, this);
   BaseXLayout.setWidth(slider, 150);
   return slider;
 }