Ejemplo n.º 1
0
        public void componentResized(ComponentEvent e) {

          if (e.getID() != ComponentEvent.COMPONENT_RESIZED) return;

          EntryPanel panel = (EntryPanel) e.getSource();
          Dimension sz = panel.getSize();
          int w =
              (int)
                  ((sz.width - 5 * View.SPACING)
                      / (Model.getPlaces() + ((Model.getPlaces() + 1) / 2) / 2.0));
          int h = sz.height;
          panel.codepanel.setSize(Math.min(w, h));
          panel.markpanel.setSize(Math.min(w, h));
        }
Ejemplo n.º 2
0
  public void clear() {

    for (int i = 0; i < Model.getPlaces(); i++) {

      codepanel.setGuess(i, null);
    }
    markpanel.set(null);
  }
Ejemplo n.º 3
0
  EntryPanel(View view, int i) {

    this.view = view;
    codepanel = new ColourCodePanel(i);
    markpanel = new MarkPanel();

    setBackground(Color.LIGHT_GRAY);

    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    add(Box.createHorizontalGlue());
    add(codepanel);
    if (i != Model.getMaxGuesses()) {

      add(Box.createHorizontalStrut(View.SPACING));
      add(markpanel);
    }
    add(Box.createHorizontalGlue());
    addComponentListener(resizeListener);
  }