Example #1
0
  /** Description of the Method */
  public void init() {
    // super.init();
    size = new Dimension(570, 570);
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);

    Dimension d = messagePanel.getSize();
    d.height += 20;
    messagePanel.setPreferredSize(d);
    contentPane.add(messagePanel, BorderLayout.SOUTH);

    contentPane.setOpaque(true);
    userPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);

    messagePanel.setLayout(borderLayout5);
    contentPane.setOpaque(true);
    contentPane.setBackground(Color.white);
    this.setSize(size);

    messagePanel.add(labelMessage, BorderLayout.NORTH);
    // Logg.logg("MhClient: Före XttTree-skapande", 6);
    this.mhTable = new MhTable(root, false, this.labelMessage);
    // Logg.logg("MhClient: mhTable-skapande klart", 6);
    this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
  }
Example #2
0
  /**
   * @param filenames
   * @exception Exception if internal error
   */
  public ChestImageViewer(String filenames[]) throws Exception {
    DisplayDeviceArea[] displayDeviceAreas = getPresentationAndImageDeviceAreas();
    if (displayDeviceAreas == null) {
      System.err.println("Cannot determine device display areas");
    } else {
      System.err.println("Found " + displayDeviceAreas.length + " device display areas");
      for (int i = 0; i < displayDeviceAreas.length; ++i) {
        System.err.println("[" + i + "] = " + displayDeviceAreas[i]);
        displayDeviceAreas[i].getFrame().setBackground(Color.black);
        displayDeviceAreas[i].getFrame().setVisible(true);
      }

      {
        // Need to actually add something to the unused left display frame, else background will not
        // be set to black on Windows
        JPanel backgroundPanel = new JPanel();
        backgroundPanel.setBackground(Color.black);
        displayDeviceAreas[0].getFrame().getContentPane().add(backgroundPanel);
        displayDeviceAreas[0].getFrame().validate();
      }

      frame = displayDeviceAreas[1].getFrame();

      Container content = frame.getContentPane();
      content.setLayout(new GridLayout(1, 1));
      multiPanel = new JPanel();
      // multiPanel.setBackground(Color.black);
      frameWidth = (int) frame.getWidth();
      frameHeight = (int) frame.getHeight();
      Dimension d = new Dimension(frameWidth, frameHeight);
      // multiPanel.setSize(d);
      multiPanel.setPreferredSize(d);
      multiPanel.setBackground(Color.black);
      content.add(multiPanel);
      // frame.pack();
      content.validate();

      loadMultiPanelFromSpecifiedFiles(filenames);
    }
  }
Example #3
0
  public void initUI(int x, int y) {
    setVisible(true);

    loadIcons();

    dx = x;
    dy = y;
    text_height = getFontMetrics(getFont()).getHeight();
    plane_width = icon_size;
    plane_height = icon_size + text_height + text_gap;
    radar_area_width = grid_size * dx;
    radar_area_height = grid_size * dy;

    getContentPane().setLayout(new BorderLayout());

    radarArea = new RadarPane();
    radarArea.setMinimumSize(new Dimension(radar_area_width, radar_area_height));
    radarArea.setPreferredSize(new Dimension(radar_area_width, radar_area_height));
    getContentPane().add(radarArea, BorderLayout.CENTER);

    radarArea.backImage =
        new BufferedImage(radar_area_width, radar_area_height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = radarArea.backImage.createGraphics();
    g.setBackground(back_color);
    g.setColor(rim_color);
    g.fillRect(0, 0, radar_area_width, radar_area_height);
    g.setColor(back_color);
    g.fillRect(convPos(0), convPos(0), radar_area_width - grid_size, radar_area_height - grid_size);
    g.setColor(line_color);
    int i, j;
    for (i = 0; i < dx; i++)
      for (j = 0; j < dy; j++) g.draw(new Rectangle(convPos(i) - 1, convPos(j) - 1, 1, 1));

    radarArea.backIcon = new ImageIcon(radarArea.backImage);
    radarArea.back = new JLabel(radarArea.backIcon);
    radarArea.back.setBounds(0, 0, radar_area_width, radar_area_height);
    radarArea.add(radarArea.back, new Integer(0));

    infoArea = new JPanel();
    infoArea.setMinimumSize(new Dimension(info_area_width, radar_area_height));
    infoArea.setPreferredSize(new Dimension(info_area_width, radar_area_height));
    infoArea.setLayout(new GridLayout(27, 1));
    infoTopLine = new Label(" ");
    infoArea.add(infoTopLine);
    getContentPane().add(infoArea, BorderLayout.EAST);

    inputArea = new JLabel("          ");
    getContentPane().add(inputArea, BorderLayout.SOUTH);

    controlArea = new JPanel();
    newButton = new JButton("New");
    newButton.setActionCommand("New");
    newButton.addActionListener(this);
    newButton.setEnabled(false);
    newButton.setFocusable(false);
    exitButton = new JButton("Exit");
    exitButton.setActionCommand("Exit");
    exitButton.addActionListener(this);
    exitButton.setFocusable(false);
    controlArea.add(newButton);
    controlArea.add(exitButton);
    getContentPane().add(controlArea, BorderLayout.NORTH);

    pack();
  }
Example #4
0
  public void createLayout() {
    top = new JPanel();
    wModel.panel.add(top, BorderLayout.NORTH);
    top.setLayout(new BorderLayout(0, 0));

    bottom = new JPanel();
    wModel.panel.add(bottom, BorderLayout.SOUTH);
    bottom.setLayout(new BorderLayout(0, 0));

    center = new JPanel();
    wModel.panel.add(center, BorderLayout.CENTER);
    center.setLayout(new BorderLayout(0, 0));

    // Spielfeld
    gameField = new JPanel();
    gameField.setPreferredSize(new Dimension(550, 800));
    wModel.panel.add(gameField, BorderLayout.WEST);
    gameField.setLayout(new GridLayout(4, 4, 5, 5));

    /**
     * *********************************************************** Sidebar
     * ************************************************************
     */
    dates = new JPanel();
    dates.setLayout(new BorderLayout());
    JLabel background = new JLabel(new ImageIcon("../gfx/datesBack.png"));
    dates.add(background);

    GridBagLayoutModel gblModel = new GridBagLayoutModel();
    GridBagLayout gbl = new GridBagLayout();
    background.setLayout(gbl);

    l1 = new JLabel(new ImageIcon("../gfx/spieler1.png"));
    points1 = new JLabel(new ImageIcon("../gfx/punkte.png"));
    points1Num = new JLabel("0");
    l2 = new JLabel(new ImageIcon("../gfx/spieler2.png"));
    points2 = new JLabel(new ImageIcon("../gfx/punkte.png"));
    points2Num = new JLabel("0");

    JLabel namePlayer1 = new JLabel(player1.getName());
    JLabel namePlayer2 = new JLabel(player2.getName());

    JButton end = new JButton("Beenden");

    gblModel.addComponent(background, gbl, l1, 0, 2, 1, 1, 1.0, 0.5);
    gblModel.addComponent(background, gbl, namePlayer1, 1, 2, 1, 1, 1.0, 0.5);
    gblModel.addComponent(background, gbl, points1, 0, 3, 1, 1, 1.0, 0.2);
    gblModel.addComponent(background, gbl, points1Num, 1, 3, 1, 1, 1.0, 0.2);
    gblModel.addComponent(background, gbl, l2, 0, 4, 1, 1, 1.0, 1.0);
    gblModel.addComponent(background, gbl, namePlayer2, 1, 4, 1, 1, 1.0, 1.0);
    gblModel.addComponent(background, gbl, points2, 0, 5, 1, 1, 1.0, 0.2);
    gblModel.addComponent(background, gbl, points2Num, 1, 5, 1, 1, 1.0, 0.2);
    gblModel.addComponent(background, gbl, end, 1, 6, 1, 1, 0.0, 0.2);

    wModel.panel.add(dates, BorderLayout.EAST);

    end.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });
  }