public NotificationsPanel(MainFrame owner) {
    this.owner = owner;
    this.setPreferredSize(new Dimension(0, 50));
    this.setLayout(new GridLayout(1, 3, 5, 0));
    this.updater = Updater.getInstance();
    this.updater.registerObserver(this);

    JPanel pnlStocks = new JPanel();
    pnlStocks.setLayout(new BorderLayout());
    add(pnlStocks);

    lblStocks = new JLabel("");
    pnlStocks.add(lblStocks);
    pnlStocks.add(Box.createRigidArea(new Dimension(5, 5)), BorderLayout.WEST);

    JPanel pnlExpiring = new JPanel();
    pnlExpiring.setLayout(new BorderLayout());
    add(pnlExpiring);

    lblExpiring = new JLabel("");
    pnlExpiring.add(lblExpiring);

    JPanel pnlWasted = new JPanel();
    pnlWasted.setLayout(new BorderLayout());
    add(pnlWasted);

    lblWasted = new JLabel("");
    pnlWasted.add(lblWasted);
    pnlWasted.add(Box.createRigidArea(new Dimension(5, 5)), BorderLayout.EAST);

    this.checkStatus();
  }
Exemplo n.º 2
0
  public JPanel creerHaut() {
    JPanel panneauHaut = new JPanel();
    panneauHaut.setLayout(new BoxLayout(panneauHaut, BoxLayout.Y_AXIS));

    JLabel fonction = new JLabel("Stocks");
    fonction.setFont(new Font("Helvetica", Font.ITALIC, 48));
    fonction.setAlignmentX(CENTER_ALIGNMENT);
    panneauHaut.add(fonction);

    panneauHaut.add(Box.createRigidArea(new Dimension(0, 20)));

    combobox = new ComboBoxes(cets, 1);
    panneauHaut.add(combobox.getBox());

    panneauHaut.add(Box.createRigidArea(new Dimension(0, 20)));

    JButton ok = new JButton("OK");
    ControlJButtonOkDirection controlOk = new ControlJButtonOkDirection(cets, this, modele);
    ok.addActionListener(controlOk);
    ok.setAlignmentX(CENTER_ALIGNMENT);
    panneauHaut.add(ok);
    panneauHaut.add(Box.createRigidArea(new Dimension(0, 20)));

    return panneauHaut;
  }
  /**
   * Adds fill components to empty cells in the first row and first column of the grid. This ensures
   * that the grid spacing will be the same as shown in the designer.
   *
   * @param cols an array of column indices in the first row where fill components should be added.
   * @param rows an array of row indices in the first column where fill components should be added.
   */
  void addFillComponents(Container panel, int[] cols, int[] rows) {
    Dimension filler = new Dimension(10, 10);

    boolean filled_cell_11 = false;
    CellConstraints cc = new CellConstraints();
    if (cols.length > 0 && rows.length > 0) {
      if (cols[0] == 1 && rows[0] == 1) {
        /** add a rigid area */
        panel.add(Box.createRigidArea(filler), cc.xy(1, 1));
        filled_cell_11 = true;
      }
    }

    for (int index = 0; index < cols.length; index++) {
      if (cols[index] == 1 && filled_cell_11) {
        continue;
      }
      panel.add(Box.createRigidArea(filler), cc.xy(cols[index], 1));
    }

    for (int index = 0; index < rows.length; index++) {
      if (rows[index] == 1 && filled_cell_11) {
        continue;
      }
      panel.add(Box.createRigidArea(filler), cc.xy(1, rows[index]));
    }
  }
Exemplo n.º 4
0
  private void generateContent(JPanel buttonJP) {

    buttonJP.setLayout(new BoxLayout(buttonJP, BoxLayout.LINE_AXIS));
    buttonJP.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    JButton save = new JButton("Save");
    save.setSize(100, 50);
    save.setMaximumSize(save.getSize());
    save.addMouseListener(generateSaveMouseListener());
    save.setFocusable(false);

    JButton load = new JButton("Load");
    load.setSize(100, 50);
    load.setMaximumSize(load.getSize());
    load.addMouseListener(generateLoadMouseListener());
    load.setFocusable(false);

    this.fileNameTF = new JTextField();
    this.fileNameTF.setSize(190, 50);
    this.fileNameTF.setMaximumSize(this.fileNameTF.getSize());
    this.fileNameTF.setText("Mr.Freezer");

    buttonJP.add(save);
    buttonJP.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonJP.add(load);
    buttonJP.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonJP.add(this.fileNameTF);
  }
Exemplo n.º 5
0
  public JPanel creerHaut() {
    JPanel panneauHaut = new JPanel();
    panneauHaut.setLayout(new BoxLayout(panneauHaut, BoxLayout.Y_AXIS));
    JLabel fonction = new JLabel("STOCK");
    fonction.setFont(new Font("Helvetica", Font.ITALIC, 48));
    fonction.setAlignmentX(CENTER_ALIGNMENT);
    panneauHaut.add(Box.createRigidArea(new Dimension(0, 20)));
    panneauHaut.add(fonction);
    panneauHaut.add(Box.createRigidArea(new Dimension(0, 20)));

    JPanel cl = new JPanel();
    JLabel client = new JLabel("Client: ");
    Vector<String> clients = cets.findAllClients();
    comboClients = new JComboBox<String>(clients);
    comboClients.setPreferredSize(new Dimension(150, 20));
    comboClients.setEditable(false);
    cl.add(client);
    cl.add(comboClients);
    ControlJComboBoxClientVanessaStock controlComboClients =
        new ControlJComboBoxClientVanessaStock(cets, this, modele);
    comboClients.addActionListener(controlComboClients);

    panneauHaut.add(cl);

    return panneauHaut;
  }
Exemplo n.º 6
0
  private void createButtonArea(JPanel windowPanel) {

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
    buttonPanel.add(Box.createHorizontalGlue());

    JButton okButton = new JButton("OK");
    okButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            okButtonPressed();
          }
        });
    buttonPanel.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPanel.add(okButton);

    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent paramActionEvent) {
            // DO nothing, just close the dialog
            setVisible(false);
          }
        });

    buttonPanel.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPanel.add(cancelButton);
    buttonPanel.add(Box.createRigidArea(new Dimension(5, 0)));
    windowPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    windowPanel.add(buttonPanel, BorderLayout.LINE_END);
    windowPanel.add(Box.createRigidArea(new Dimension(0, 5)));
  }
Exemplo n.º 7
0
  private void initComponents() {

    JPanel windowPanel = new JPanel();
    windowPanel.setLayout(new BoxLayout(windowPanel, BoxLayout.PAGE_AXIS));

    JTabbedPane localSettingsTabbedPane = new javax.swing.JTabbedPane();
    localSettingsTabbedPane.setName("localSettingsTab"); // $NON-NLS-1$

    JPanel tabs = new JPanel();
    tabs.setLayout(new BoxLayout(tabs, BoxLayout.LINE_AXIS));

    windowPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    windowPanel.add(tabs);

    tabs.add(Box.createRigidArea(new Dimension(5, 0)));
    tabs.add(localSettingsTabbedPane);
    tabs.add(Box.createRigidArea(new Dimension(5, 0)));

    localSettingsTab = new LocalSettingsTab(this);
    localSettingsTab.setLayout(new BoxLayout(localSettingsTab, BoxLayout.PAGE_AXIS));

    localSettingsTabbedPane.addTab(
        Language.getString("local_game"), localSettingsTab); // $NON-NLS-1$

    createButtonArea(windowPanel);

    add(windowPanel);
    pack();
  }
Exemplo n.º 8
0
    public PlayerView(String player) {
      playerName = new String(player);

      // Set-Up Top of Score Area
      namePanel = new JPanel();
      nameText = new JLabel(player);
      nameText.setFont(ScoreFont);
      namePanel.setLayout(new BorderLayout());
      namePanel.add(nameText, BorderLayout.CENTER);

      scorePanel = new JPanel();
      scoreText = new JLabel("  0");
      scoreText.setFont(ScoreFont);
      scorePanel.setLayout(new BorderLayout());
      scorePanel.add(scoreText, BorderLayout.CENTER);

      topPanel = new JPanel();
      BoxLayout layout = new BoxLayout(topPanel, BoxLayout.LINE_AXIS);

      topPanel.setLayout(layout);
      topPanel.add(namePanel);
      topPanel.add(Box.createRigidArea(new Dimension(10, 0)));
      topPanel.add(scorePanel);
      topPanel.add(Box.createRigidArea(new Dimension(10, 0)));

      // Create bordering for top panel
      Border raisedBevel, loweredBevel, compound;

      raisedBevel = BorderFactory.createRaisedBevelBorder();
      loweredBevel = BorderFactory.createLoweredBevelBorder();
      compound = BorderFactory.createCompoundBorder(raisedBevel, loweredBevel);
      topPanel.setBorder(compound);

      // Set-Up area to display word list
      wordPanel = new JPanel();
      Border etched = BorderFactory.createEtchedBorder();
      TitledBorder etchedTitle = BorderFactory.createTitledBorder(etched, "Word List");
      etchedTitle.setTitleJustification(TitledBorder.RIGHT);
      wordPanel.setBorder(etchedTitle);
      myWordList = new ExpandableList();
      myWordList.addActionListener(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
              String word = e.getActionCommand();
              java.util.List<BoardCell> list = myFinder.cellsForWord(myBoard, word);
              myBoardPanel.highlightDice(list);
            }
          });
      wordPanel.add(
          new JScrollPane(
              myWordList,
              JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
              JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED));

      setLayout(new BorderLayout(30, 30));
      add(topPanel, BorderLayout.NORTH);
      add(wordPanel, BorderLayout.CENTER);
    }
Exemplo n.º 9
0
  public SplitButton(final Icon icon) {
    mainText = new JLabel(icon);
    final JLabel menuIcon = new JLabel("\u25be");
    super.setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    super.add(mainText);
    super.add(Box.createRigidArea(new Dimension(GAP, 0)));
    super.add(new JSeparator(JSeparator.VERTICAL));
    super.add(Box.createRigidArea(new Dimension(GAP, 0)));
    super.add(menuIcon);

    super.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(final MouseEvent e) {
            if (!SplitButton.this.isEnabled()) return;
            final int x = e.getX();
            final int w = e.getComponent().getWidth();
            if (x >= (2 * w / 3)) {
              actionListenersEnabled = false;
              if (menu != null) {
                menu.show(e.getComponent(), e.getX(), e.getY());
              }
            } else {
              actionListenersEnabled = true;
            }
          }
        });
  }
  public LayeredPaneDemo2() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

    // Create and load the duke icon.
    final ImageIcon icon = createImageIcon("images/dukeWaveRed.gif");

    // Create and set up the layered pane.
    layeredPane = new JLayeredPane();
    layeredPane.setPreferredSize(new Dimension(300, 310));
    layeredPane.setBorder(BorderFactory.createTitledBorder("Move the Mouse to Move Duke"));
    layeredPane.addMouseMotionListener(this);

    // Add several labels to the layered pane.
    layeredPane.setLayout(new GridLayout(2, 3));
    for (int i = 0; i < layerStrings.length; i++) {
      JLabel label = createColoredLabel(layerStrings[i], layerColors[i]);
      layeredPane.add(label, new Integer(i));
    }

    // Create and add the Duke label to the layered pane.
    dukeLabel = new JLabel(icon);
    if (icon == null) {
      System.err.println("Duke icon not found; using black rectangle instead.");
      dukeLabel.setOpaque(true);
      dukeLabel.setBackground(Color.BLACK);
    }
    layeredPane.add(dukeLabel, new Integer(2), 0);

    // Add control pane and layered pane to this JPanel.
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(createControlPanel());
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(layeredPane);
  }
Exemplo n.º 11
0
  @Override
  protected void layoutComponents() {
    batchPanel = new JPanel();
    batchPanel.setLayout(new GridBagLayout());

    GridBagConstraintsExt c = new GridBagConstraintsExt();
    c.ipadx = 2;
    c.ipady = 2;
    c.insets = new Insets(5, 5, 5, 5);

    c.place(0, 1, 1, 1);
    batchPanel.add(entryDateLabel, c);

    c.place(1, 1, 2, 1);
    batchPanel.add(entryDateSpinner, c);

    c.place(3, 1, 1, 1);
    batchPanel.add(countLabel, c);

    c.place(4, 1, 1, 1);
    batchPanel.add(countField, c);

    c.place(0, 0, 1, 1);
    batchPanel.add(barcodeLabel, c);

    c.place(1, 0, 2, 1);
    batchPanel.add(barcodeField, c);

    c.place(3, 0, 2, 1);
    batchPanel.add(scannerBox, c);

    c.place(1, 2, 1, 1);
    batchPanel.add(itemActionButton, c);

    c.place(2, 2, 1, 1);
    batchPanel.add(undoButton, c);

    c.place(3, 2, 1, 1);
    batchPanel.add(redoButton, c);

    c.place(4, 2, 1, 1);
    batchPanel.add(doneButton, c);

    setMaximumSize(batchPanel);

    productPanel = new JPanel();
    productPanel.setLayout(new BoxLayout(productPanel, BoxLayout.Y_AXIS));

    productPanel.add(Box.createRigidArea(new Dimension(10, 10)));
    productPanel.add(batchPanel);
    productPanel.add(Box.createRigidArea(new Dimension(10, 10)));
    productPanel.add(productTableScrollPane);

    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, productPanel, itemTableScrollPane);

    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    this.add(splitPane);
  }
Exemplo n.º 12
0
  public void buildPopulationBox() {
    rebuilding = true;
    populationBox.removeAll();
    peopleList = new ArrayList<Object>();
    famList = new ArrayList<Family>();
    peopleList.addAll(ctxt.individualCensus);
    String plur = (peopleList.size() == 1 ? "" : "s");
    populationBox.setLayout(new BoxLayout(populationBox, BoxLayout.PAGE_AXIS));
    populationBox.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.blue), "Current Population"));
    populationBox.setAlignmentX(0.5f);
    populationBox.add(Box.createRigidArea(new Dimension(8, 0)));
    indivLabel = new JLabel("Contains " + peopleList.size() + " Individual" + plur);
    indivLabel.setAlignmentX(0.5f);
    populationBox.add(indivLabel);
    if (peopleList.size() > 0) {
      JPanel indivBtnBox = new JPanel();
      indivBtnBox.setLayout(new BoxLayout(indivBtnBox, BoxLayout.LINE_AXIS));
      Dimension sizer2 = new Dimension(350, 50);
      String[] indMenu = genIndMenu(peopleList);
      indPick = new JComboBox(indMenu);
      indPick.addActionListener(listener);
      indPick.setActionCommand("view/edit person");
      indPick.setMinimumSize(sizer2);
      indPick.setMaximumSize(sizer2);
      indPick.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createLineBorder(Color.blue), "View/Edit Person"));
      indivBtnBox.add(indPick);
      populationBox.add(indivBtnBox);
    } //  end of if-any-people-exist

    famList.addAll(ctxt.familyCensus); //  end of filtering deleted records
    plur = (famList.size() == 1 ? "y" : "ies");
    famLabel = new JLabel("Contains " + famList.size() + " Famil" + plur);
    famLabel.setAlignmentX(0.5f);
    populationBox.add(Box.createRigidArea(new Dimension(0, 4)));
    populationBox.add(famLabel);
    if (famList.size() > 0) {
      JPanel famBtnBox = new JPanel();
      famBtnBox.setLayout(new BoxLayout(famBtnBox, BoxLayout.LINE_AXIS));
      Dimension sizer2 = new Dimension(350, 50);
      String[] famMenu = genFamMenu(famList);
      famPick = new JComboBox(famMenu);
      famPick.addActionListener(listener);
      famPick.setActionCommand("view/edit family");
      famPick.setMinimumSize(sizer2);
      famPick.setMaximumSize(sizer2);
      famPick.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createLineBorder(Color.blue), "View/Edit Family"));
      famBtnBox.add(famPick);
      populationBox.add(famBtnBox);
    } //  end of if-any-families-exist
    rebuilding = false;
  } //  end of method buildPopulationBox
Exemplo n.º 13
0
  private JSeparator createButUpSeparator() {
    butUp.add(Box.createRigidArea(GV.DIM_RA));
    JSeparator jSep = new JSeparator();
    jSep.setOrientation(SwingConstants.VERTICAL);
    jSep.setMaximumSize(new Dimension(2, 18));
    butUp.add(jSep);
    butUp.add(Box.createRigidArea(GV.DIM_RA));

    return jSep;
  }
Exemplo n.º 14
0
  /** Constructor. */
  public TilePatternsView() {
    super();

    tilePatternIcons = new ArrayList<TilePatternIcon>();

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    // tileset properties
    // the tile pattern list
    // view of the current tile pattern

    // tileset properties
    tilesetPropertiesView = new TilesetPropertiesView();
    tilesetPropertiesView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 120));
    tilesetPropertiesView.setAlignmentX(Component.LEFT_ALIGNMENT);

    // list
    tilePatternsListModel = new TilePatternsListModel();
    tilePatternsList = new JList(tilePatternsListModel);
    tilePatternsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tilePatternsList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
    tilePatternsList.setVisibleRowCount(-1); // make the rows as wide as possible
    tilePatternsList
        .getSelectionModel()
        .addListSelectionListener(new TilePatternListSelectionListener());
    tilePatternsList.setCellRenderer(new TilePatternListRenderer());

    tilePatternsList.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.VK_DELETE) {
              if (tileset != null && tileset.getSelectedTilePattern() != null) {
                tileset.removeTilePattern();
              }
            }
          }
        });

    JScrollPane listScroller = new JScrollPane(tilePatternsList);
    listScroller.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    listScroller.setAlignmentX(Component.LEFT_ALIGNMENT);

    // tile view
    tilePatternView = new TilePatternView();
    tilePatternView.setMaximumSize(new Dimension(Integer.MAX_VALUE, 300));
    tilePatternView.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(tilesetPropertiesView);
    add(Box.createRigidArea(new Dimension(0, 5)));
    add(listScroller);
    add(Box.createRigidArea(new Dimension(0, 5)));
    add(tilePatternView);
  }
Exemplo n.º 15
0
  public StartupForm() {
    setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));

    // ======================
    // Add the title JPanel.
    // ======================

    JPanel titlePanel = new JPanel();
    {
      JLabel titleLabel = new JLabel("Keck Lab Banner!");
      titleLabel.setForeground(Color.LIGHT_GRAY);
      titleLabel.setFont(new Font("Sans serif", Font.BOLD, 28));
      titlePanel.add(Box.createRigidArea(new Dimension(1, 30)));
      titlePanel.add(titleLabel);
      titlePanel.setBackground(Color.gray);
    }
    add(titlePanel);

    // ==============================
    // Add the host/connect buttons.
    // ==============================

    hostButton = new JButton("Start a new session");
    hostButton.addActionListener(this);
    joinButton = new JButton("Join existing session");
    joinButton.addActionListener(this);

    add(Box.createRigidArea(new Dimension(1, 25)));
    add(hostButton);
    add(Box.createRigidArea(new Dimension(1, 5)));
    add(joinButton);
    add(Box.createRigidArea(new Dimension(1, 35)));

    // ================
    // Add the footer.
    // ================

    JPanel footerPanel = new JPanel();
    {
      JLabel footerLabel = new JLabel("Version 1.0 / created by Phillip Cohen");
      footerLabel.setForeground(Color.gray);
      footerPanel.add(footerLabel);
    }
    add(footerPanel);

    // Other attributes...
    setTitle("Keck Lab Banner!");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setSize(400, 230);
    setResizable(false);
    setVisible(true);
  }
 /**
  * This method initializes listPanel
  *
  * @return javax.swing.JPanel
  */
 private JPanel getListPanel() {
   if (listPanel == null) {
     listPanel = new JPanel();
     listPanel.setLayout(new BorderLayout());
     listPanel.setPreferredSize(new Dimension(225, 400));
     listPanel.add(getPublicListPanel().getPanel(), BorderLayout.SOUTH);
     listPanel.add(Box.createRigidArea(new Dimension(5, 5)));
     listPanel.add(getPrivateListPanel().getPanel(), BorderLayout.NORTH);
     listPanel.add(Box.createRigidArea(new Dimension(5, 5)));
     listPanel.setBackground(Color.orange);
   }
   return listPanel;
 }
Exemplo n.º 17
0
  /** Creation */
  public JCellInt(CellInt p_data, boolean p_editable) {
    logger = Logger.getLogger(JCellInt.class);

    data = p_data;
    if (data == null) {
      logger.warn("Not able to deal with null data");
    }

    // create the BoxLayout
    BoxLayout layout = new BoxLayout(this, BoxLayout.X_AXIS);
    this.setLayout(layout);

    // rigid area
    this.add(Box.createRigidArea(new Dimension(5, 0)));

    // label
    JLabel label = new JLabel(data.getLabel() + " : ");
    this.add(label);

    // check box
    checkBox = new JCheckBox();
    checkBox.addItemListener(new MyCheckBoxListener());
    // usable only if has parent
    if (data.hasParent() == false) {
      setEnabled(false);
    }
    this.add(checkBox);

    // rigid area
    this.add(Box.createRigidArea(new Dimension(5, 0)));

    // text field
    text = new JTextField(WIDTH_FIELD);
    text.setText(data.displayData());
    text.setEditable(p_editable);
    text.addActionListener(new MyTextFieldListener());
    text.getDocument().addDocumentListener(new MyTextFieldChangeListener());
    this.add(text);

    // rigid area
    this.add(Box.createRigidArea(new Dimension(5, 0)));

    // if inheriting
    if (data.isInherit()) {
      setChecked(true);
      checkBox.setSelected(true);
    } else {
      setChecked(false);
      checkBox.setSelected(false);
    }
  }
Exemplo n.º 18
0
  public RollResultView() {

    this.setOpaque(true);
    this.setLayout(new BorderLayout());
    this.setBorder(BorderFactory.createLineBorder(Color.black, BORDER_WIDTH));

    // add the title label to the panel
    titleLabel = new JLabel("Roll Results");
    Font titleLabelFont = titleLabel.getFont();
    titleLabelFont = titleLabelFont.deriveFont(titleLabelFont.getStyle(), TITLE_TEXT_SIZE);
    titleLabel.setFont(titleLabelFont);
    this.add(titleLabel, BorderLayout.NORTH);

    // add the button to the panel
    okayButton = new JButton("Okay");
    okayButton.addActionListener(actionListener);
    Font okayButtonFont = okayButton.getFont();
    okayButtonFont = okayButtonFont.deriveFont(okayButtonFont.getStyle(), BUTTON_TEXT_SIZE);
    okayButton.setFont(okayButtonFont);
    this.add(okayButton, BorderLayout.SOUTH);

    // create the rollLabel
    rollLabel =
        new JLabel(
            "ERROR: YOU FORGOT TO SET THE ROLL VALUE BEFORE DISPLAYING THIS WINDOW... NAUGHTY, NAUGHTY");
    Font rollLabelFont = rollLabel.getFont();
    rollLabelFont = rollLabelFont.deriveFont(rollLabelFont.getStyle(), LABEL_TEXT_SIZE);
    rollLabel.setFont(rollLabelFont);
    rollLabel.setHorizontalAlignment(SwingConstants.CENTER);
    rollLabel.setBorder(BorderFactory.createEmptyBorder(25, 0, 25, 0));

    // create the picture
    picture =
        new ImageIcon(
            ImageUtils.loadImage("images/resources/resources.png")
                .getScaledInstance(250, 250, Image.SCALE_SMOOTH));
    pictureLabel = new JLabel();
    pictureLabel.setIcon(picture);

    // create the center label
    centerPanel = new JPanel();
    centerPanel.setLayout(new BorderLayout());
    centerPanel.add(pictureLabel, BorderLayout.NORTH);
    centerPanel.add(Box.createRigidArea(new Dimension(25, 25)));
    centerPanel.add(rollLabel, BorderLayout.SOUTH);
    this.add(centerPanel, BorderLayout.CENTER);

    // add some spacing
    this.add(Box.createRigidArea(new Dimension(50, 50)), BorderLayout.EAST);
    this.add(Box.createRigidArea(new Dimension(50, 50)), BorderLayout.WEST);
  }
Exemplo n.º 19
0
  /** Constructeur par défaut. Construit une fenêtre permettant de modifier le thème. */
  public ThemeView() {
    super("Configuration Theme");

    /*
     *Initialisation des composants et attribution des titres à chaque composant
     */
    selectionColor = new JColorChooser(GridView.getBackgroundColor());
    bordersColor = new JRadioButton("Bordure des cases");
    selectedCaseColor = new JRadioButton("Bordure de la case courante");
    alreadyViewColor = new JRadioButton("Fond des cases déjà vues");
    caseBackground = new JRadioButton("Fond des cases");
    caseBackground.setSelected(true);

    // Création du groupe de bouttons
    options = new ButtonGroup();
    options.add(bordersColor);
    options.add(selectedCaseColor);
    options.add(alreadyViewColor);
    options.add(caseBackground);

    // Disposition des composants dans le panneau
    this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
    // création d'une boite horizontale pour placer les composants du thème
    Box b = Box.createHorizontalBox();

    b.add(caseBackground);
    b.add(bordersColor);
    this.add(Box.createRigidArea(new Dimension(0, 20)));
    this.add(b);
    this.add(Box.createRigidArea(new Dimension(0, 20)));

    b = Box.createHorizontalBox();
    b.add(selectedCaseColor);
    b.add(alreadyViewColor);

    this.add(b);
    this.add(Box.createRigidArea(new Dimension(0, 20)));
    this.add(selectionColor);

    this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    this.pack();

    /*
     *Ajout d'ecouteurs
     */
    caseBackground.addActionListener(this);
    bordersColor.addActionListener(this);
    selectionColor.getSelectionModel().addChangeListener(this);
  }
Exemplo n.º 20
0
  public void initComponents(Hashtable<Glyph, List<Glyph>> intersectionTable) {
    JPanel messageLblPan = new JPanel();
    messageLblPan.setLayout(new BoxLayout(messageLblPan, BoxLayout.X_AXIS));
    JLabel messageLbl = new JLabel(Strings.nestChoiceDiagMSG);
    messageLbl.setBorder(BorderFactory.createTitledBorder(Strings.infoMSG));
    messageLblPan.add(messageLbl);

    JPanel sharedGroupPan = new JPanel();
    sharedGroupPan.setLayout(new GridLayout(0, 3));

    JPanel buttonGroup = null;
    JRadioButton selectionRadBtn = null;
    ButtonGroup radioGroup = null;
    Map<Glyph, Glyph> nestMap = new HashMap<Glyph, Glyph>();

    for (Glyph i : intersectionTable.keySet()) { // for each draged component
      buttonGroup = new JPanel();
      buttonGroup.setLayout(new BoxLayout(buttonGroup, BoxLayout.Y_AXIS));
      buttonGroup.setBorder(BorderFactory.createTitledBorder(i.getName()));
      radioGroup = new ButtonGroup();

      for (Glyph j : intersectionTable.get(i)) { // for each entity it intersects with
        selectionRadBtn = new JRadioButton(j.getName());
        selectionRadBtn.addActionListener(
            FacadeController.getInstance().nestDialog_RadioListener(nestMap, i, j));
        buttonGroup.add(selectionRadBtn);
        radioGroup.add(selectionRadBtn);
      }
      selectionRadBtn.doClick();
      sharedGroupPan.add(buttonGroup);
    }
    JPanel okBtnPan = new JPanel();
    okBtnPan.setLayout(new BoxLayout(okBtnPan, BoxLayout.X_AXIS));

    JButton okBtn = new JButton("Ok");
    okBtnPan.add(okBtn);
    okBtn.addActionListener(FacadeController.getInstance().nestDialog_OkListener(nestMap, this));

    JButton cancelBtn = new JButton("Cancel");
    okBtnPan.add(cancelBtn);
    cancelBtn.addActionListener(FacadeController.getInstance().nestDialog_cancelBtnListener(this));

    contentPane.add(Box.createRigidArea(new Dimension(0, 5)));
    contentPane.add(messageLblPan);
    contentPane.add(Box.createRigidArea(new Dimension(0, 5)));
    contentPane.add(sharedGroupPan);
    contentPane.add(okBtnPan);
    centerDialog();
  }
Exemplo n.º 21
0
  private void initUI() {

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    add(Box.createVerticalGlue());

    add(Box.createRigidArea(new Dimension(0, idm.scale(100))));
    add(stockpile);
    add(Box.createRigidArea(new Dimension(0, idm.scale(115))));
    add(diePanel);
    rigidArea = Box.createRigidArea(new Dimension(0, idm.scale(60)));
    add(rigidArea);
    add(swapArea);
    add(statusBar);
  }
  public InOut() {
    sdf = new SimpleDateFormat("HH:mm:ss");
    list = new ArrayList<Attendance>();
    // reading data in list
    try {
      list = AttendanceStorge.readingFromUserAttendanceDB();
    } catch (Exception e) {
      JOptionPane.showMessageDialog(btnintime, "File not found");
    }

    // GUI INTERFACE
    btnadimlogin = new JButton("      Work as Admin      ");
    btninfo = new JButton("Employee Information");
    btnintime = new JButton("IN Time");
    btnchangepass = new JButton("Change Password");
    btnintime.setMaximumSize(btninfo.getMaximumSize());
    btnouttime = new JButton("OUT Time");
    btnchangepass.setMaximumSize(btninfo.getMaximumSize());
    btnouttime.setMaximumSize(btninfo.getMaximumSize());
    btnleaverequest = new JButton("Leave Request");
    btnleaverequest.setMaximumSize(btninfo.getMaximumSize());
    boxbutton = Box.createVerticalBox();
    boxbutton.add(Box.createRigidArea(new Dimension(60, 20)));
    boxbutton.add(btnintime);
    boxbutton.add(Box.createRigidArea(new Dimension(60, 20)));
    boxbutton.add(btnouttime);
    boxbutton.add(Box.createRigidArea(new Dimension(60, 20)));
    boxbutton.add(btnleaverequest);
    boxbutton.add(Box.createRigidArea(new Dimension(60, 20)));
    boxbutton.add(btnchangepass);
    boxbutton.add(Box.createRigidArea(new Dimension(60, 20)));
    boxbutton.add(btnadimlogin);

    btnintime.addActionListener(this);
    btnouttime.addActionListener(this);
    btnleaverequest.addActionListener(this);
    btnchangepass.addActionListener(this);
    btnadimlogin.addActionListener(this);
    add(boxbutton, BorderLayout.CENTER);
    setSize(240, 290);
    setVisible(true);
    setTitle("ATTENDENCE");
    setLocationRelativeTo(null);
    setResizable(false);

    // button enable check
    initialdata();
  }
Exemplo n.º 23
0
  private JPanel createNewMapPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    final MapHeaderEditor headerEditor = new MapHeaderEditor(DEFAULT, true);
    panel.add(headerEditor);
    headerEditor.setBorder(BorderFactory.createTitledBorder("Map settings"));

    JPanel ground = new JPanel();
    ground.setBorder(BorderFactory.createTitledBorder("Ground type"));
    panel.add(ground);

    final SpinnerListModel groundType = new SpinnerListModel(Arrays.asList(GROUND_TYPES));
    JSpinner groundTypes = new JSpinner(groundType);
    ground.add(groundTypes);

    JButton createMapButton = new JButton("Create map");
    panel.add(createMapButton);
    createMapButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            new EditorWindow(
                headerEditor.getHeader(), ELandscapeType.valueOf(groundType.getValue().toString()));
            close();
          }
        });
    panel.add(Box.createRigidArea(new Dimension(20, 20)));
    return panel;
  }
Exemplo n.º 24
0
  /**
   * Creates the button panel with the query and reset buttons in a box layout.
   *
   * @return The constructed button panel.
   */
  public JPanel createButtonPane() {
    // Set up the panel.
    buttonPane = new JPanel();
    queryBtn = new JButton("Query");

    // Create and add action listener to query and reset buttons.
    queryBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            parentCS.requestQuery(2, catCb1.getSelectedIndex(), catCb2.getSelectedIndex());
          }
        });
    resetBtn = new JButton("Reset");
    resetBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            parentCS.switchContext(-1);
          }
        });

    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));

    // Add buttons to panel.
    buttonPane.add(queryBtn);
    buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonPane.add(resetBtn);

    return buttonPane;
  }
Exemplo n.º 25
0
  private void addContols(final Container pane) {

    JButton cancel = new JButton("Cancel");

    final JPanel panel = new JPanel();

    // GridLayout layout = new GridLayout(1, 2);
    BoxLayout layout = new BoxLayout(panel, BoxLayout.LINE_AXIS);
    // Lay out the buttons from left to right.

    panel.setLayout(layout);

    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    panel.add(Box.createHorizontalGlue());
    panel.add(ok);

    panel.add(Box.createRigidArea(new Dimension(5, 0)));
    panel.add(cancel);

    // layout.setVgap(GAP);
    // layout.layoutContainer(panel);

    cancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cancel_actionPerformed(e);
          }
        });

    pane.add(panel, BorderLayout.CENTER);
  }
  private JPanel createGraphSelectionSubPane() {
    Font font = new Font("SansSerif", Font.PLAIN, 10);
    // Search field
    JPanel searchPanel = new JPanel();
    searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS));
    searchPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));

    searchPanel.add(columnSelection);
    columnMatchLabel.setEnabled(false);
    applyFilterBtn.setEnabled(false);
    caseChkBox.setEnabled(false);
    regexpChkBox.setEnabled(false);
    columnSelection.addActionListener(this);

    searchPanel.add(columnMatchLabel);
    searchPanel.add(Box.createRigidArea(new Dimension(5, 0)));

    // Button
    applyFilterBtn.setFont(font);
    applyFilterBtn.addActionListener(this);
    searchPanel.add(applyFilterBtn);

    // checkboxes
    caseChkBox.setFont(font);
    searchPanel.add(caseChkBox);
    regexpChkBox.setFont(font);
    searchPanel.add(regexpChkBox);

    return searchPanel;
  }
Exemplo n.º 27
0
  private JComponent makeCheckBoxPanel(AbstractComponent repository) {
    JPanel p = new JPanel();

    p.setBorder(BorderFactory.createTitledBorder(repository.getDisplayName()));
    p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
    for (AbstractComponent child : repository.getComponents()) {
      String id = child.getComponentId();
      loadedComponents.put(id, child);

      JCheckBox checkBox = new JCheckBox(child.getDisplayName());
      checkBox.setSelected(selectedIds.contains(id));
      checkBox.addActionListener(new Selector(id));
      checkBox.setAlignmentX(LEFT_ALIGNMENT);
      p.add(checkBox);
    }
    JPanel rigid = new JPanel();
    p.add(rigid);
    rigid.setAlignmentX(LEFT_ALIGNMENT);
    rigid.add(Box.createRigidArea(new Dimension(240, 1)));

    p.setAlignmentX(CENTER_ALIGNMENT);

    JScrollPane pane = new JScrollPane();
    pane.getViewport().add(p);

    return pane;
  }
Exemplo n.º 28
0
  private void initLayout() {
    displayPanel.setLayout(new BoxLayout(displayPanel, BoxLayout.LINE_AXIS));

    JPanel subPanel = new JPanel();
    subPanel.setLayout(new BoxLayout(subPanel, BoxLayout.PAGE_AXIS));

    robotButton = new JButton("Robot");
    robotButton.addActionListener(this);
    subPanel.add(robotButton);
    robotMenu = new JPopupMenu();
    robotMenu.addPopupMenuListener(this);
    subPanel.add(robotMenu);
    subPanel.add(Box.createRigidArea(new Dimension(10, 10)));

    createUpdateButtons(subPanel);
    createStreamingButtons(subPanel);
    displayPanel.add(subPanel);

    subPanel = new JPanel();
    subPanel.setLayout(new BoxLayout(subPanel, BoxLayout.PAGE_AXIS));
    subPanel.add(Box.createHorizontalGlue());
    subPanel.add(imagePanel);

    displayPanel.add(subPanel);
  }
Exemplo n.º 29
0
 private void addElements() {
   this.add(central_area, BorderLayout.CENTER);
   for (Map.Entry<Integer, JLabel> entry : left_captions.entrySet()) {
     left_panel.add(Box.createRigidArea(new Dimension(0, 55)));
     left_panel.add(entry.getValue());
   }
   for (Map.Entry<Integer, JLabel> entry : right_captions.entrySet()) {
     right_panel.add(Box.createRigidArea(new Dimension(0, 55)));
     right_panel.add(entry.getValue());
   }
   left_panel.add(Box.createRigidArea(new Dimension(0, 35)));
   right_panel.add(Box.createRigidArea(new Dimension(0, 35)));
   this.add(left_panel, BorderLayout.LINE_START);
   this.add(right_panel, BorderLayout.LINE_END);
   return;
 }
 /**
  * Create the JMeter tool bar pane containing the running indicator.
  *
  * @return a panel containing the running indicator
  */
 protected Component createToolBar() {
   Box toolPanel = new Box(BoxLayout.X_AXIS);
   toolPanel.add(Box.createRigidArea(new Dimension(10, 15)));
   toolPanel.add(Box.createGlue());
   toolPanel.add(runningIndicator);
   return toolPanel;
 }