AccountInfoPanel() {
    m_lastUpdated.setHorizontalAlignment(SwingConstants.RIGHT);

    m_accounts.setPreferredSize(new Dimension(10000, 100));
    JScrollPane acctScroll = new JScrollPane(m_accounts);
    acctScroll.setBorder(new TitledBorder("Select Account"));

    JScrollPane marginScroll = new JScrollPane(m_marginTable);
    JScrollPane mvScroll = new JScrollPane(m_mktValTable);
    JScrollPane portScroll = new JScrollPane(m_portfolioTable);

    NewTabbedPanel tabbedPanel = new NewTabbedPanel();
    tabbedPanel.addTab("Balances and Margin", marginScroll);
    tabbedPanel.addTab("Market Value", mvScroll);
    tabbedPanel.addTab("Portfolio", portScroll);
    tabbedPanel.addTab("Account Summary", new AccountSummaryPanel());
    tabbedPanel.addTab("Market Value Summary", new MarketValueSummaryPanel());
    tabbedPanel.addTab("Positions (all accounts)", new PositionsPanel());

    setLayout(new BorderLayout());
    add(acctScroll, BorderLayout.NORTH);
    add(tabbedPanel);
    add(m_lastUpdated, BorderLayout.SOUTH);

    m_accounts.addListSelectionListener(
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {
            onChanged();
          }
        });
  }
예제 #2
0
 /** Create a radio button-type list with a compact layout. */
 private JList createPropertyTypeList() {
   JList list = new JList(getPropertyTypes());
   list.setPreferredSize(new Dimension(260, 40));
   list.setVisibleRowCount(0);
   list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
   list.setSelectedIndex(0);
   return list;
 }
 private MyWindow() {
   super(JScrollPaneFixture_constructor_withRobotAndName_Test.class);
   JList view = new JList(array("One", "Two", "Three"));
   view.setPreferredSize(new Dimension(100, 50));
   scrollPane.setName("scrollPane");
   scrollPane.setViewportView(view);
   addComponents(scrollPane);
 }
예제 #4
0
  @Override
  void createWindowPane(JPanel panel) {
    JLabel nameText = new JLabel("Name:");
    nameField = new JTextField(60);
    listObj = new JList<>();
    listObj.setPreferredSize(new Dimension(300, 400));
    searchField = new JTextField(30);
    JButton searchButton = new JButton("Search");
    searchResult = new JList<>();
    searchResult.setPreferredSize(new Dimension(200, 100));
    JButton addButton = new JButton("Add");

    panel.add(nameText);
    panel.add(nameField);
    panel.add(listObj);
    panel.add(searchField);
    panel.add(searchButton);
    panel.add(searchResult);
    panel.add(addButton);

    searchButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO ajouter une méthode permettant de chercher un WP par son nom.
            // searchResult.setListData(ContextUtil.getWorkPackage().findWP(wp)
            // SimulateWP.search(searchField.getText()));
            throw new UnsupportedOperationException();
          }
        });

    listObj.setModel(new DefaultListModel<Objet>());

    addButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            ((DefaultListModel<Objet>) listObj.getModel())
                .addElement(searchResult.getSelectedValue());
          }
        });
  }
예제 #5
0
  protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints constr;

    // list label
    constr = new GridBagConstraints();
    constr.gridy = 0;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(5, 5, 0, 5);
    panel.add(new JLabel(IdeBundle.message("label.macros")), constr);

    // macros list
    constr = new GridBagConstraints();
    constr.gridy = 1;
    constr.weightx = 1;
    constr.weighty = 1;
    constr.insets = new Insets(0, 5, 0, 5);
    constr.fill = GridBagConstraints.BOTH;
    constr.anchor = GridBagConstraints.WEST;
    panel.add(new JScrollPane(myMacrosList), constr);
    myMacrosList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    myMacrosList.setPreferredSize(null);

    // preview label
    constr = new GridBagConstraints();
    constr.gridx = 0;
    constr.gridy = 2;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(5, 5, 0, 5);
    panel.add(new JLabel(IdeBundle.message("label.macro.preview")), constr);

    // preview
    constr = new GridBagConstraints();
    constr.gridx = 0;
    constr.gridy = 3;
    constr.weightx = 1;
    constr.weighty = 1;
    constr.fill = GridBagConstraints.BOTH;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(0, 5, 5, 5);
    panel.add(new JScrollPane(myPreviewTextarea), constr);
    myPreviewTextarea.setEditable(false);
    myPreviewTextarea.setLineWrap(true);
    myPreviewTextarea.setPreferredSize(null);

    panel.setPreferredSize(new Dimension(400, 500));

    return panel;
  }
예제 #6
0
 private JList getValueList() {
   if (enumList == null) {
     enumList = new JList(enumListModel);
     enumList.setCellRenderer(new AlternatingRowColorListCellRenderer());
     enumList.setFixedCellHeight(20);
     enumList.setVisibleRowCount(10);
     enumList.setPreferredSize(new Dimension(200, 100));
     enumList.getSelectionModel().setSelectionMode(selectionMode);
     enumList.setBorder(null);
     for (E possibleValue : enumeration.getEnumConstants()) {
       enumListModel.addElement(possibleValue);
     }
   }
   return enumList;
 }
예제 #7
0
  public SettingsDialog(final MainWindow window, final Scene scene, final SceneRenderer renderer) {
    super(window);
    setResizable(false);
    setAlwaysOnTop(true);
    setSize(550, 420);
    setTitle("Settings");
    setLocationRelativeTo(window);
    getContentPane().setLayout(new BorderLayout());

    optionsPanel = new JPanel();
    optionsPanel.setLayout(optionsLayout = new CardLayout());
    optionsPanel.add(new RendererSettings(scene, renderer), menus[0]);
    optionsPanel.add(new SubSettings(scene, renderer), menus[1]);
    optionsPanel.add(new RobotSettings(scene, renderer), menus[2]);
    optionsPanel.add(new ObstacleSettings(scene, renderer), menus[3]);
    optionsPanel.add(new PathSettings(scene, renderer), menus[4]);
    optionsPanel.add(new SumSettings(scene, renderer), menus[5]);
    optionsPanel.add(new ContactSettings(scene, renderer), menus[6]);
    getContentPane().add(optionsPanel, BorderLayout.CENTER);

    JPanel bottomPanel = new JPanel();
    FlowLayout fl_bottomPanel = (FlowLayout) bottomPanel.getLayout();
    fl_bottomPanel.setAlignment(FlowLayout.RIGHT);
    bottomPanel.setBorder(new MatteBorder(1, 0, 0, 0, (Color) Color.GRAY));
    getContentPane().add(bottomPanel, BorderLayout.SOUTH);

    menuList = new JList(new MenuModel());
    menuList.setCellRenderer(new MenuRenderer());
    menuList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    menuList.setPreferredSize(new Dimension(100, 0));
    menuList.setBorder(new MatteBorder(0, 0, 0, 1, (Color) Color.GRAY));
    menuList.setBounds(17, 20, 99, 241);
    menuList.addListSelectionListener(new MenuListener());
    menuList.setSelectedIndex(0);
    getContentPane().add(menuList, BorderLayout.WEST);

    JButton btnOk = new JButton("OK");
    btnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            SettingsDialog.this.setVisible(false);
          }
        });
    bottomPanel.add(btnOk);
  }
예제 #8
0
  private void placeComponents() {
    this.getContentPane().add(hoved = new JPanel(new BorderLayout()));
    hoved.add(new JPanel().add(messages = new JTextArea()), BorderLayout.CENTER);
    hoved.add(new JPanel().add(loggedOn = new JList()), BorderLayout.EAST);
    hoved.add(new JPanel().add(inputFelt = new JTextField()), BorderLayout.SOUTH);
    loggedOn.setPreferredSize(new Dimension(100, 400));
    loggedOn.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    messages.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    inputFelt.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    loggedOn.setListData(new Vector());
    inputFelt.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent e) {
            if (e.getKeyChar() == KeyEvent.VK_ENTER) {
              sendMessage(inputFelt.getText());
              inputFelt.setText("");
            }
          }
        });

    MenuBar menubar = new MenuBar();
    Menu menu = new Menu("Settings");
    MenuItem item = new MenuItem("Change nick");
    item.addActionListener(
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            String newName =
                JOptionPane.showInputDialog(
                    Gui.this, "Enter new nick:", "Change nick", JOptionPane.PLAIN_MESSAGE);
            Gui.this.target.send("/newName: " + newName);
            Gui.this.target.setUsername(newName);
          }
        });
    menu.add(item);
    menubar.add(menu);
    this.setMenuBar(menubar);
  }
예제 #9
0
  public EditCircuitPaths(String title, CircuitBuilder parent, OBlock block) {
    _block = block;
    setTitle(java.text.MessageFormat.format(title, _block.getDisplayName()));
    _parent = parent;

    addWindowListener(
        new java.awt.event.WindowAdapter() {
          @Override
          public void windowClosing(java.awt.event.WindowEvent e) {
            closingEvent();
          }
        });
    addHelpMenu("package.jmri.jmrit.display.CircuitBuilder", true);

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

    contentPane.add(Box.createVerticalStrut(STRUT_SIZE));
    contentPane.add(makeContentPanel());
    contentPane.add(Box.createVerticalStrut(STRUT_SIZE));

    JPanel border = new JPanel();
    border.setLayout(new java.awt.BorderLayout(10, 10));
    border.add(contentPane);
    setContentPane(border);
    _pathList.setPreferredSize(
        new java.awt.Dimension(_pathList.getFixedCellWidth(), _pathList.getFixedCellHeight() * 4));
    pack();
    if (_firstInstance) {
      setLocationRelativeTo(_parent._editor);
      _firstInstance = false;
    } else {
      setLocation(_loc);
      setSize(_dim);
    }
    setVisible(true);
  }
예제 #10
0
  public MyFrame() {
    this.setSize(900, 600);
    this.setDefaultCloseOperation(2);
    this.setTitle("");

    panelLeft.setPreferredSize(new Dimension(250, 0));
    panelStatistic.setPreferredSize(new Dimension(0, 30));
    panelRight.setPreferredSize(new Dimension(280, 0));

    panelLeft.setBackground(Color.orange);
    panelRight.setBackground(Color.orange);
    panelButtons.setBackground(Color.yellow);
    panelPoisk.setBackground(Color.yellow);
    panelStatistic.setBackground(Color.cyan);

    this.getContentPane().add(panelLeft, BorderLayout.WEST);
    this.getContentPane().add(tabbedPane, BorderLayout.CENTER);
    this.getContentPane().add(panelStatistic, BorderLayout.SOUTH);
    this.getContentPane().add(panelRight, BorderLayout.EAST);

    tabbedPane.add(panelButtons, "Information about Videotechnik");
    tabbedPane.add(panelPoisk, "  Poisk  ");

    label1.setText("VideoTechnik в наличии");
    label1.setPreferredSize(new Dimension(150, 30));
    panelLeft.add(label1);

    label3.setText("Проданная VideoTechnik");
    label3.setPreferredSize(new Dimension(150, 30));
    panelRight.add(label3);

    label4.setText("Параметры VideoTechnik");
    label4.setPreferredSize(new Dimension(300, 30));
    panelButtons.add(label4);

    label2.setText("Количество наименований: ");
    label2.setPreferredSize(new Dimension(750, 27));
    panelStatistic.add(label2);

    listBefore.setBackground(Color.green);
    listBefore.setPreferredSize(new Dimension(230, 450));
    listAfter.setBackground(Color.green);
    listAfter.setPreferredSize(new Dimension(280, 450));

    scrollPane1.getViewport().add(listBefore);
    scrollPane1.setPreferredSize(new Dimension(220, 360));
    scrollPane2.getViewport().add(listAfter);
    scrollPane2.setPreferredSize(new Dimension(250, 360));
    panelLeft.add(scrollPane1, BorderLayout.CENTER);
    panelRight.add(scrollPane2);

    labelName.setText("Название");
    labelName.setPreferredSize(new Dimension(150, 30));
    labelProizvod.setText("Производитель");
    labelProizvod.setPreferredSize(new Dimension(150, 30));
    labelPrice.setText("Цена");
    labelPrice.setPreferredSize(new Dimension(150, 30));
    labelQuantity.setText("Количество");
    labelQuantity.setPreferredSize(new Dimension(150, 30));

    textName.setPreferredSize(new Dimension(170, 30));
    textProizvod.setPreferredSize(new Dimension(170, 30));
    textPrice.setPreferredSize(new Dimension(170, 30));
    textQuantity.setPreferredSize(new Dimension(170, 30));

    panelButtons.add(labelName);
    panelButtons.add(textName);
    panelButtons.add(labelProizvod);
    panelButtons.add(textProizvod);
    panelButtons.add(labelPrice);
    panelButtons.add(textPrice);
    panelButtons.add(labelQuantity);
    panelButtons.add(textQuantity);
    panelButtons.add(buttonRachet);
    panelButtons.add(buttonBuy);

    bg.add(butName);
    bg.add(butProizvod);
    bg.add(butPrice);
    bg.add(butQuan);

    butName.addActionListener(buttonsActListener);
    butProizvod.addActionListener(buttonsActListener);
    butPrice.addActionListener(buttonsActListener);
    butQuan.addActionListener(buttonsActListener);
    buttonPoisk.addActionListener(butPoiskActListener);

    butName.setPreferredSize(new Dimension(250, 30));
    butProizvod.setPreferredSize(new Dimension(250, 30));
    butPrice.setPreferredSize(new Dimension(250, 30));
    butQuan.setPreferredSize(new Dimension(250, 30));
    buttonPoisk.setPreferredSize(new Dimension(150, 30));

    butName.setBackground(Color.yellow);
    butProizvod.setBackground(Color.yellow);
    butPrice.setBackground(Color.yellow);
    butQuan.setBackground(Color.yellow);

    panelPoisk.add(butName);
    panelPoisk.add(butProizvod);
    panelPoisk.add(butPrice);
    panelPoisk.add(butQuan);
    panelPoisk.add(buttonPoisk);

    this.setJMenuBar(menuBar);
    menuBar.add(menuFile);
    menuBar.add(menuOtchet);
    menuBar.add(menuVideo);

    menuFile.add(menuItemNewFile);
    menuItemNewFile.addActionListener(newFileActListener);
    menuFile.add(menuItemOpenFile);
    menuItemOpenFile.addActionListener(openFileActListener);
    menuFile.add(menuItemSaveFile);
    menuItemSaveFile.addActionListener(saveFileActListener);

    menuOtchet.add(menuItemOpenOtchet);
    menuItemOpenOtchet.addActionListener(openOtchetActListener);
    menuOtchet.add(menuItemSaveOtchet);
    menuItemSaveOtchet.addActionListener(saveOtchetActListener);

    menuVideo.add(menuItemNewVideo);
    menuItemNewVideo.addActionListener(newVideoDiaActListener);
    menuVideo.add(menuItemChangeVideo);
    menuItemChangeVideo.addActionListener(changeVideoDiaActListener);
    menuVideo.add(menuItemDeleteVideo);
    menuItemDeleteVideo.addActionListener(delVideoActListener1);

    buttonRachet.setPreferredSize(new Dimension(200, 30));
    buttonRachet.addActionListener(buttonActionListener1);
    buttonBuy.setPreferredSize(new Dimension(200, 30));
    buttonBuy.addActionListener(buttonActionListener2);

    listBefore.addListSelectionListener(listBeforeListener);
    listAfter.addListSelectionListener(listAfterListener);

    buttonPoisk.setEnabled(false);
    buttonRachet.setEnabled(false);
    buttonBuy.setEnabled(false);
    menuItemSaveFile.setEnabled(false);
    menuVideo.setEnabled(false);
    menuItemSaveOtchet.setEnabled(false);

    this.setVisible(true);
  }
예제 #11
0
  public GUI() {

    super();

    try {
      sprites = ImageIO.read(new File("Sprites2.png"));
    } catch (IOException e) {
      e.printStackTrace();
    }

    lowerPane.setPreferredSize(new Dimension(384, 130));
    gameInfo.setEditable(false);

    boardPanel.setPreferredSize(new Dimension(384, 384));
    boardPanel.addMouseListener(new gameMouseListener());
    boardPanel.setBackground(Color.cyan);

    itemList.setPreferredSize(new Dimension(384, 80));

    gamePanel.setPreferredSize(new Dimension(400, 700));
    gamePanel.add(boardPanel);

    lowerPane.add("Info", gameInfo);
    chatPanel.setLayout(new BorderLayout());
    chatPanel.add(chatScrollPane, BorderLayout.CENTER);
    chatScrollPane.setVerticalScrollBar(new JScrollBar());
    chatArea.setEditable(false);
    chatPanel.add(chatField, BorderLayout.SOUTH);
    lowerPane.add("Chat", chatPanel);

    gamePanel.add(lowerPane);
    gamePanel.add(endTurnButton);
    gamePanel.add(itemList);
    gamePanel.add(useItemButton);
    gamePanel.add(surrenderButton);

    // login panel
    newAccountButton.addActionListener(new CreateAccountListener());
    failedLoginPanel.add(tryNewUser);
    failedLoginPanel.add(newAccountButton);
    loginButton.addActionListener(new LoginListener());
    loginPanel.setLayout(new GridLayout(2, 2));
    usernameHere.setEditable(false);
    passwordHere.setEditable(false);
    loginPanel.add(usernameHere);
    loginPanel.add(username);
    loginPanel.add(passwordHere);
    loginPanel.add(password);
    logisticsPanel.setPreferredSize(new Dimension(350, 300));
    loginButtonPanel.add(loginButton);
    logisticsPanel.add(loginPanel);
    logisticsPanel.add(loginButtonPanel);
    logisticsPanel.add(failedLoginPanel);
    mainPanel.add(logisticsPanel);

    possibleUnitList.setPreferredSize(new Dimension(200, 104));
    userUnitList.setPreferredSize(new Dimension(200, 87));

    setuploadoutPanel();
    setupGameRoomLobby();
    setupMainOptionsPanel();
    setUpUserInfoPanel();

    mainFrame.setResizable(false);
    mainFrame.add(mainPanel);
    mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    mainFrame.setSize(800, 800);
    mainFrame.setVisible(true);

    setListeners();
  }
예제 #12
0
    public DocumentPanel() {
      super(new BorderLayout());

      JLabel lblDocument = new JLabel("Document: " + document.getTitle());
      lblDocument.setBorder(new EtchedBorder());

      textPane = new JTextPane(document);
      textPane.setEditable(false);
      textPane.setMargin(new Insets(5, 20, 5, 5));
      textPane.setMaximumSize(new Dimension(364, 1000000000));
      textPane.setPreferredSize(new Dimension(364, 400));
      textPane.setMinimumSize(new Dimension(364, 10));
      textPane.addCaretListener(
          new CaretListener() {
            public void caretUpdate(CaretEvent e) {
              int length = document.getLength();
              int offset = e.getDot();

              if (e.getDot() == e.getMark()) textPane.getCaret().moveDot(offset + 1);

              Paragraph p = lockManager.getParFromOffset(offset);
              int pOffset = p.getOffset();

              lblCursor.setText(
                  "Document Length="
                      + String.valueOf(length)
                      + ", CaretOffset="
                      + String.valueOf(offset)
                      + ", Paragraph="
                      + p.toString()
                      + ", Offset in Paragraph="
                      + String.valueOf(offset - p.getOffset()));
            }
          });
      Box box = new Box(BoxLayout.X_AXIS);
      box.add(textPane);
      box.add(Box.createGlue());
      box.setBackground(Color.WHITE);
      box.setOpaque(true);
      box.setPreferredSize(new Dimension(600, 10000));

      lblCursor = new JLabel("Cursor");
      lblCursor.setBorder(new EtchedBorder());

      JPanel boxText = new JPanel(new BorderLayout());
      boxText.setBorder(new EmptyBorder(5, 5, 5, 5));
      boxText.add(lblDocument, BorderLayout.NORTH);
      boxText.add(new JScrollPane(box), BorderLayout.CENTER);
      boxText.add(lblCursor, BorderLayout.SOUTH);

      JLabel lblPars = new JLabel("Paragraphs: ");
      lblPars.setBorder(new EtchedBorder());

      parList = new JList();
      parList.setPreferredSize(new Dimension(100, 300));
      parList.setEnabled(false);

      JPanel boxPars = new JPanel(new BorderLayout());
      boxPars.setBorder(new EmptyBorder(5, 5, 5, 5));
      boxPars.add(lblPars, BorderLayout.NORTH);
      boxPars.add(new JScrollPane(parList), BorderLayout.CENTER);

      add(boxText, BorderLayout.CENTER);
      add(boxPars, BorderLayout.EAST);
    }
예제 #13
0
  public FormPanel() {
    // each component has a default size
    Dimension dim = getPreferredSize();

    // set the size of the formPanel
    dim.width = 250;
    setPreferredSize(dim);

    nameLabel = new JLabel("Name: ");
    occupationLabel = new JLabel("Occupation: ");
    // 10 is the default width in characters
    nameField = new JTextField(10);
    occupationField = new JTextField(10);
    okBtn = new JButton("OK");
    ageList = new JList();

    DefaultListModel ageModel = new DefaultListModel();
    ageModel.addElement("Under 18");
    ageModel.addElement("18 to 65");
    ageModel.addElement("over 65");

    ageList.setModel(ageModel);

    ageList.setPreferredSize(new Dimension(110, 68));
    Border ageListBorder = BorderFactory.createEtchedBorder();
    ageList.setBorder(ageListBorder);
    // set default value
    ageList.setSelectedIndex(1);

    /* when okBtn is clicked, submit the text entered
     * in the other 2 fields
     */
    okBtn.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            String name = nameField.getText();
            String occupation = occupationField.getText();
            FormEvent ev = new FormEvent(this, name, occupation);
            String ageCat = (String) ageList.getSelectedValue();

            if (formListener != null) {
              formListener.formEventOccurred(ev);
            }
          }
        });

    /* each graphic element can have a border, with setBorder. In this case, the
     * static method compoundBorder takes two border objects as parameters
     */
    Border innerBorder = BorderFactory.createTitledBorder("Add Person");
    Border outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5);
    setBorder(BorderFactory.createCompoundBorder(outerBorder, innerBorder));

    setLayout(new GridBagLayout());

    GridBagConstraints gc = new GridBagConstraints();

    ///////////////////// First Row //////////////////////////////////
    /* as in Android, the weight dictates the relative amount of space each element
     * takes in relation with the others.
     */
    gc.weightx = 1;
    gc.weighty = 0.2;
    gc.gridx = 0;
    gc.gridy = 0;
    gc.fill = GridBagConstraints.NONE;
    // the anchor method positions the content "inside" it's container
    gc.anchor = GridBagConstraints.LINE_END;
    add(nameLabel, gc);

    gc.gridx = 1;
    gc.gridy = 0;
    gc.anchor = GridBagConstraints.LINE_START;
    add(nameField, gc);

    ///////////////////// Second Row //////////////////////////////////
    gc.weightx = 1;
    gc.weighty = 0.2;
    gc.gridx = 0;
    gc.gridy = 1;
    gc.anchor = GridBagConstraints.LINE_END;
    add(occupationLabel, gc);

    gc.gridx = 1;
    gc.gridy = 1;
    gc.anchor = GridBagConstraints.LINE_START;
    add(occupationField, gc);

    ///////////////////// Third Row //////////////////////////////////
    gc.weightx = 1;
    gc.weighty = 4;
    gc.gridx = 1;
    gc.gridy = 2;
    gc.anchor = GridBagConstraints.FIRST_LINE_START;
    add(ageList, gc);

    ///////////////////// Foutrh Row //////////////////////////////////
    gc.weightx = 1;
    gc.weighty = 0.2;
    gc.gridx = 1;
    gc.gridy = 3;
    // at the top-left corner of it's container
    gc.anchor = GridBagConstraints.FIRST_LINE_START;
    add(okBtn, gc);
  }
예제 #14
0
  JPanel getPanel(int infoWidth, int infoHeight) {

    //For layout purposes, put things in separate panels
   
    //Create the list and list view to handle the list of 
    //Jmol Instances.
    instanceList = new JList(new DefaultListModel());
    instanceList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    instanceList.setTransferHandler(new ArrayListTransferHandler(this));
    instanceList.setCellRenderer(new InstanceCellRenderer());
    instanceList.setDragEnabled(true);
    instanceList.setPreferredSize(new Dimension(350, 200));

    JScrollPane instanceListView = new JScrollPane(instanceList);
    instanceListView.setPreferredSize(new Dimension(350, 200));
    JPanel instanceSet = new JPanel();
    instanceSet.setLayout(new BorderLayout());
    instanceSet.add(new JLabel(listLabel), BorderLayout.NORTH);
    instanceSet.add(instanceListView, BorderLayout.CENTER);
    instanceSet.add(new JLabel(GT._("double-click and drag to reorder")),
        BorderLayout.SOUTH);

    //Create the Instance add button.
    addInstanceButton = new JButton(GT._("Add Present Jmol State as Instance..."));
    addInstanceButton.addActionListener(this);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setMaximumSize(new Dimension(350, 50));
    showInstanceButton = new JButton(GT._("Show Selected"));
    showInstanceButton.addActionListener(this);
    deleteInstanceButton = new JButton(GT._("Delete Selected"));
    deleteInstanceButton.addActionListener(this);
    buttonPanel.add(showInstanceButton);
    buttonPanel.add(deleteInstanceButton);

    // width height or %width

    JPanel paramPanel = appletParamPanel();
    paramPanel.setMaximumSize(new Dimension(350, 70));

    //Instance selection
    JPanel instanceButtonPanel = new JPanel();
    instanceButtonPanel.add(addInstanceButton);
    instanceButtonPanel.setSize(300, 70);

    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.add(instanceButtonPanel, BorderLayout.NORTH);
    p.add(buttonPanel, BorderLayout.SOUTH);

    JPanel instancePanel = new JPanel();
    instancePanel.setLayout(new BorderLayout());
    instancePanel.add(instanceSet, BorderLayout.CENTER);
    instancePanel.add(p, BorderLayout.SOUTH);

    JPanel rightPanel = new JPanel();
    rightPanel.setLayout(new BorderLayout());
    rightPanel.setMinimumSize(new Dimension(350, 350));
    rightPanel.setMaximumSize(new Dimension(350, 1000));
    rightPanel.add(paramPanel, BorderLayout.NORTH);
    rightPanel.add(instancePanel, BorderLayout.CENTER);
    rightPanel.setBorder(BorderFactory.createTitledBorder(GT._("Jmol Instances:")));

    //Create the overall panel
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    JPanel leftPanel = getLeftPanel(infoWidth, infoHeight);
    leftPanel.setMaximumSize(new Dimension(350, 1000));

  
    //Add everything to this panel.
    panel.add(leftPanel, BorderLayout.CENTER);
    panel.add(rightPanel, BorderLayout.EAST);

    enableButtons(instanceList);
    return panel;
  }
예제 #15
0
파일: A.java 프로젝트: mcmhav/u
  public A(G g, D d) {
    this.g = g;
    s = new S(g);
    this.d = d;
    a = this;
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();

    max = d.getMaxhmSize();

    add = new JButton("+");
    add.addActionListener(new AL());
    close = new JButton("-");
    close.addActionListener(new AL2());
    l3 = new JList();
    l3.setSize(new Dimension(100, 100));
    l3.setPreferredSize(new Dimension(17, 50));
    adda = new JList();
    value = new JTextField();
    value.setPreferredSize(new Dimension(120, 45));
    value.setFont(new Font("sansserif", Font.BOLD, 40));
    tdate = new JTextField("");
    tdate.setPreferredSize(new Dimension(40, 20));
    tmon = new JTextField("");
    tyear = new JTextField("");
    tmon.setPreferredSize(new Dimension(40, 20));
    tyear.setPreferredSize(new Dimension(40, 20));
    sp = new JScrollPane(adda);
    sp.setPreferredSize(new Dimension(150, max * 18 - 14));
    model = new DefaultListModel();
    l3.setModel(model);
    l3.addListSelectionListener(new LS());
    model2 = new DefaultListModel();
    adda.setModel(model2);
    adda.addListSelectionListener(new LS2());
    neew = new JButton("new");
    neew.addActionListener(new AL3());
    totvalu = new JTextField();
    totvalu.setPreferredSize(new Dimension(120, 45));
    totvalu.setEditable(false);
    totvalu.setFont(new Font("sansserif", Font.BOLD, 40));

    model.addElement("T");
    model.addElement("F");
    model.addElement("M");

    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 0;
    c.gridheight = 3;
    add(l3, c);
    c.gridx = 1;
    add(sp, c);
    c.gridheight = 1;
    c.gridwidth = 3;
    c.gridx = 2;
    add(value, c);
    c.gridy = 1;
    add(totvalu, c);
    c.gridwidth = 1;
    c.gridy = 2;
    add(tdate, c);
    c.gridx = 3;
    add(tmon, c);
    c.gridx = 4;
    add(tyear, c);
    c.gridx = 0;
    c.gridy = 3;
    add(close, c);
    c.gridx = 1;
    c.gridy = 3;
    add(neew, c);
    c.gridx = 3;
    c.gridy = 3;
    add(add, c);
    pack();
  }
예제 #16
0
  public ContactsView(@Service ApplicationContext context, @Uses ContactsModel model) {
    super(new BorderLayout());

    this.model = model;

    ActionMap am = context.getActionMap(this);
    setActionMap(am);
    setPreferredSize(new Dimension(200, 0));

    this.setBorder(Borders.createEmptyBorder("2dlu, 2dlu, 2dlu, 2dlu"));

    contacts = new JList(new EventListModel<ContactDTO>(model.getEventList()));
    contacts.setPreferredSize(new Dimension(200, 1000));
    contacts.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane contactsScrollPane = new JScrollPane();
    contactsScrollPane.setViewportView(contacts);
    contacts.setCellRenderer(
        new DefaultListCellRenderer() {

          @Override
          public Component getListCellRendererComponent(
              JList jList, Object o, int i, boolean b, boolean b1) {
            ContactDTO contact = (ContactDTO) o;
            if ("".equals(contact.name().get())) {
              Component cell =
                  super.getListCellRendererComponent(
                      jList, i18n.text(WorkspaceResources.name_label), i, b, b1);
              cell.setForeground(Color.GRAY);
              return cell;
            }

            String text = contact.name().get();

            return super.getListCellRendererComponent(jList, text, i, b, b1);
          }
        });
    add(contactsScrollPane, BorderLayout.CENTER);

    JPanel toolbar = new JPanel();
    toolbar.add(new StreamflowButton(am.get("add")));
    toolbar.add(new StreamflowButton(am.get("remove")));
    add(toolbar, BorderLayout.SOUTH);

    model.addObserver(new RefreshComponents().visibleOn("add", toolbar));

    contacts
        .getSelectionModel()
        .addListSelectionListener(new SelectionActionEnabler(am.get("remove")));

    /*
          setFocusTraversalPolicy( new LayoutFocusTraversalPolicy() );
          setFocusCycleRoot( true );
          setFocusable( true );
          addFocusListener( new FocusListener()
          {
             public void focusGained( FocusEvent e )
             {
                Component defaultComp = getFocusTraversalPolicy().getDefaultComponent( contactView );
                if (defaultComp != null)
                {
                   defaultComp.requestFocusInWindow();
                }
             }

             public void focusLost( FocusEvent e )
             {
             }
          } );
    */

    new RefreshWhenShowing(this, this);
  }
예제 #17
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() {
    contentPane = new javax.swing.JSplitPane();
    leftPanel = new javax.swing.JSplitPane();
    projectListPanel = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jList1 = new javax.swing.JList();
    treePanel = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    jTree1 = new javax.swing.JTree();
    infoPanel = new javax.swing.JPanel();
    jMenuBar2 = new javax.swing.JMenuBar();
    fileMenu = new javax.swing.JMenu();
    newProjectMenu = new javax.swing.JMenuItem();
    openMenu = new javax.swing.JMenuItem();
    saveMenu = new javax.swing.JMenuItem();
    saveAsMenu = new javax.swing.JMenuItem();
    jSeparator1 = new javax.swing.JSeparator();
    importPSIMenu = new javax.swing.JMenuItem();
    jSeparator2 = new javax.swing.JSeparator();
    jSeparator3 = new javax.swing.JSeparator();
    quitMenu = new javax.swing.JMenuItem();
    projectMenu = new javax.swing.JMenu();
    indicsMenu = new javax.swing.JMenu();
    variationMenu = new javax.swing.JMenuItem();
    ressourceMenu = new javax.swing.JMenuItem();
    alertMenu = new javax.swing.JMenuItem();
    consoMenu = new javax.swing.JMenuItem();
    compareMenu = new javax.swing.JMenuItem();
    settingMenu = new javax.swing.JMenu();
    warningSettingMenu = new javax.swing.JMenuItem();
    helpMenu = new javax.swing.JMenu();
    helpContMenu = new javax.swing.JMenuItem();

    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(java.awt.event.WindowEvent evt) {
            exitForm(evt);
          }
        });

    leftPanel.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
    projectListPanel.setLayout(new java.awt.BorderLayout());

    jLabel1.setText("Projets");
    projectListPanel.add(jLabel1, java.awt.BorderLayout.NORTH);

    jList1.setPreferredSize(new java.awt.Dimension(0, 100));
    jList1.addListSelectionListener(
        new javax.swing.event.ListSelectionListener() {
          public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
            jList1ValueChanged(evt);
          }
        });

    projectListPanel.add(jList1, java.awt.BorderLayout.CENTER);

    leftPanel.setTopComponent(projectListPanel);

    treePanel.setLayout(new java.awt.BorderLayout());

    jLabel2.setText("Structure de projet");
    treePanel.add(jLabel2, java.awt.BorderLayout.NORTH);

    jTree1.addTreeSelectionListener(
        new javax.swing.event.TreeSelectionListener() {
          public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
            jTree1ValueChanged(evt);
          }
        });

    treePanel.add(jTree1, java.awt.BorderLayout.CENTER);

    leftPanel.setBottomComponent(treePanel);

    contentPane.setLeftComponent(leftPanel);

    infoPanel.setLayout(new java.awt.BorderLayout());

    contentPane.setRightComponent(infoPanel);

    getContentPane().add(contentPane, java.awt.BorderLayout.CENTER);

    fileMenu.setText("Fichier");

    openMenu.setText("Ouvrir environnement...");
    openMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            openMenuActionPerformed(evt);
          }
        });

    fileMenu.add(openMenu);

    saveMenu.setText("Enregistrer");
    saveMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveMenuActionPerformed(evt);
          }
        });

    fileMenu.add(saveMenu);

    saveAsMenu.setText("Enregistrer sous...");
    saveAsMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveAsMenuActionPerformed(evt);
          }
        });

    fileMenu.add(saveAsMenu);

    fileMenu.add(jSeparator1);

    quitMenu.setText("Quitter");
    quitMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            quitMenuActionPerformed(evt);
          }
        });

    fileMenu.add(quitMenu);

    jMenuBar2.add(fileMenu);

    projectMenu.setText("Projet");
    projectMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            projectMenuActionPerformed(evt);
          }
        });

    newProjectMenu.setText("Ajout projet");
    newProjectMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            newProjectMenuActionPerformed(evt);
          }
        });

    projectMenu.add(newProjectMenu);

    importPSIMenu.setText("Import une étape...");
    importPSIMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            importPSIMenuActionPerformed(evt);
          }
        });

    projectMenu.add(importPSIMenu);

    projectMenu.add(jSeparator2);

    indicsMenu.setText("Indicateurs");

    variationMenu.setText("Variation sur le projet");
    variationMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            variationMenuActionPerformed(evt);
          }
        });

    alertMenu.setText("alertes");
    alertMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            alertMenuActionPerformed(evt);
          }
        });
    projectMenu.add(alertMenu);
    ressourceMenu.setText("Ressources");
    ressourceMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ressourceMenuActionPerformed(evt);
          }
        });

    projectMenu.add(indicsMenu);

    indicsMenu.add(variationMenu);
    indicsMenu.add(ressourceMenu);

    consoMenu.setText("Consolidation...");
    consoMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            consoMenuActionPerformed(evt);
          }
        });
    projectMenu.add(consoMenu);

    projectMenu.add(jSeparator3);

    compareMenu.setText("Comparer les projets...");
    compareMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            compareMenuActionPerformed(evt);
          }
        });
    projectMenu.add(compareMenu);

    jMenuBar2.add(projectMenu);

    warningSettingMenu.setText("Réglages des seuils d'alertes");
    settingMenu.setText("Réglages");

    warningSettingMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            warningPropertiesMenuActionPerformed(evt);
          }
        });

    settingMenu.add(warningSettingMenu);
    jMenuBar2.add(settingMenu);

    helpMenu.setText("Aide");
    helpContMenu.setText("Sommaire");
    helpContMenu.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            helpContMenuActionPerformed(evt);
          }
        });

    helpMenu.add(helpContMenu);

    jMenuBar2.add(helpMenu);

    setJMenuBar(jMenuBar2);

    pack();
  }
 private static JList list(@Nonnull Object... elements) {
   JList list = new JList(elements);
   list.setPreferredSize(new Dimension(100, 50));
   return list;
 }