예제 #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));
        }
예제 #2
0
  public void clear() {

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

      codepanel.setGuess(i, null);
    }
    markpanel.set(null);
  }
예제 #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);
  }