/**
   * @param doc
   * @return
   */
  private JPanel createForwardBackPanel(Document doc) {
    JPanel panel = new JPanel();
    JButton prev = new JButton("Prev");
    prev.setFont(font);
    prev.addActionListener(
        new ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent e) {
            previousFile();
          };
        });
    JButton next = new JButton("Next");
    next.setFont(font);
    next.addActionListener(
        new ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent e) {
            nextFile();
          };
        });
    fileNameField = new JTextField(doc.getDocumentId());
    fileNameField.setEditable(false);
    fileNameField.setFont(font);

    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.add(prev);
    panel.add(Box.createHorizontalGlue());
    panel.add(fileNameField);
    panel.add(Box.createHorizontalGlue());
    panel.add(next);
    return panel;
  }
示例#2
0
  /** OptionPaneDemo Constructor */
  public OptionPaneDemo(SwingSet2 swingset) {
    // Set the title for this demo, and an icon used to represent this
    // demo inside the SwingSet2 app.
    super(swingset, "OptionPaneDemo", "toolbar/JOptionPane.gif");

    JPanel demo = getDemoPanel();

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

    JPanel bp =
        new JPanel() {
          public Dimension getMaximumSize() {
            return new Dimension(getPreferredSize().width, super.getMaximumSize().height);
          }
        };
    bp.setLayout(new BoxLayout(bp, BoxLayout.Y_AXIS));

    bp.add(Box.createRigidArea(VGAP30));
    bp.add(Box.createRigidArea(VGAP30));

    bp.add(createInputDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createWarningDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createMessageDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createComponentDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createConfirmDialogButton());
    bp.add(Box.createVerticalGlue());

    demo.add(Box.createHorizontalGlue());
    demo.add(bp);
    demo.add(Box.createHorizontalGlue());
  }
  private void initGui() {
    JComponent filler =
        new JComponent() {
          @Override
          public Dimension getPreferredSize() {
            return myTextLabel.getPreferredSize();
          }
        };
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(3, 20, 3, 20));

    add(myTextLabel, BorderLayout.WEST);
    Box box = Box.createHorizontalBox();
    box.add(Box.createHorizontalGlue());
    JPanel panel = new JPanel(new GridLayout(1, myLabels.size(), 0, 0));
    for (final JComponent myLabel : myLabels) {
      panel.add(myLabel);
    }
    panel.setMaximumSize(panel.getPreferredSize());
    box.add(panel);
    box.add(Box.createHorizontalGlue());
    add(box, BorderLayout.CENTER);

    add(filler, BorderLayout.EAST);
  }
示例#4
0
 /**
  * Creates a new wait dialog with the specified information
  *
  * @param owner Parent frame of the new dialog
  * @param title Title of the dialog
  * @param message Message to be displayed within the dialog.
  */
 public WaitDialog(Frame owner, String title, String message) {
   super(owner, title, false);
   this.title = title;
   this.message = message;
   this.setSize(300, 150);
   JPanel contentPanel = new JPanel();
   contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
   contentPanel.add(Box.createVerticalGlue());
   JLabel messageLabel = new JLabel(message);
   messageLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT);
   contentPanel.add(messageLabel);
   contentPanel.add(Box.createVerticalStrut(10));
   JProgressBar waitBar = new JProgressBar();
   waitBar.setIndeterminate(true);
   waitBar.setAlignmentX(JProgressBar.CENTER_ALIGNMENT);
   JPanel waitBarPanel = new JPanel();
   waitBarPanel.setOpaque(false);
   waitBarPanel.setLayout(new BoxLayout(waitBarPanel, BoxLayout.X_AXIS));
   waitBarPanel.add(Box.createHorizontalGlue());
   waitBarPanel.add(waitBar);
   waitBarPanel.add(Box.createHorizontalGlue());
   contentPanel.add(waitBarPanel);
   contentPanel.add(Box.createVerticalGlue());
   this.add(contentPanel);
   this.setLocationRelativeTo(owner);
 }
  /**
   * Constructs the Gui used to edit properties; called from each constructor. Constructs labels and
   * text fields for editing each property and adds appropriate listeners.
   */
  private void buildGui() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    if (alphaField != null) {
      Box b1 = Box.createHorizontalBox();
      b1.add(new JLabel("Alpha:"));
      b1.add(Box.createHorizontalStrut(10));
      b1.add(Box.createHorizontalGlue());
      b1.add(alphaField);
      add(b1);
    }

    Box b2 = Box.createHorizontalBox();
    b2.add(new JLabel("Depth:"));
    b2.add(Box.createHorizontalStrut(10));
    b2.add(Box.createHorizontalGlue());
    b2.add(depthField);
    add(b2);

    //        Box b4 = Box.createHorizontalBox();
    //        b4.add(Box.createHorizontalStrut(25));
    //        b4.add(new JLabel("(where possible)"));
    //        b4.add(Box.createHorizontalGlue());
    //        add(b4);

    add(Box.createHorizontalGlue());
  }
示例#6
0
	public Oczy() {
		super("Oczy");
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setLayout(new BorderLayout());
		oczy = new OczyPanel();
		add(oczy, BorderLayout.CENTER);
		JPanel toolBar = new JPanel();
		toolBar.setBackground(new Color(0, 200, 0));
		toolBar.add(Box.createHorizontalGlue());
		JButton b1 = new JButton("Kolor oczu");
		b1.setBackground(new Color(0, 150, 0));
		b1.setMnemonic('k');
		toolBar.add(b1);
		JButton b2 = new JButton("Kolor źrenic");
		b2.setBackground(new Color(0, 150, 0));
		b2.setMnemonic('o');
		toolBar.add(b2);
		JButton b3 = new JButton("Kolor tła");
		b3.setBackground(new Color(0, 150, 0));
		b3.setMnemonic('t');
		toolBar.add(b3);
		toolBar.add(Box.createHorizontalGlue());
		add(toolBar, BorderLayout.NORTH);
		pack();
		setVisible(true);
		addMou
	}
示例#7
0
 @Override
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   cellPanel.removeAll();
   TableCellUtilities.setToRowBackground(cellPanel, table, row);
   cellLabel.setForeground(table.getForeground());
   cellLabel.setFont(table.getFont());
   if (row == levels.getSize() - 1) {
     cellLabel.setText(value.toString());
     cellPanel.add(cellLabel);
     cellPanel.add(Box.createHorizontalGlue());
     cellPanel.add(removeLevelButton);
   } else if (row == levels.getSize()) {
     cellLabel.setText("Add Level");
     cellPanel.add(Box.createHorizontalGlue());
     cellPanel.add(cellLabel);
     cellPanel.add(Box.createHorizontalStrut(3));
     addLevelButton.setEnabled(classComboBox.getSelectedItem() != null);
     cellPanel.add(addLevelButton);
   } else {
     cellLabel.setText(value.toString());
     cellPanel.add(cellLabel);
   }
   return cellPanel;
 }
示例#8
0
 private JPanel center(JComponent x) {
   JPanel p = new JPanel();
   p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
   p.add(Box.createHorizontalGlue());
   p.add(x);
   p.add(Box.createHorizontalGlue());
   return p;
 }
示例#9
0
  protected void refreshCacheTab() {
    // refresh list of cache hosts
    cacheBox.removeAll();
    ArrayList<JLabel> labels = new ArrayList<JLabel>();
    File cache = ResourceLoader.getOSPCache();
    File[] hosts = cache == null ? new File[0] : cache.listFiles(ResourceLoader.OSP_CACHE_FILTER);
    clearCacheButton.setEnabled(hosts.length > 0);

    if (hosts.length == 0) {
      JLabel label = new JLabel(ToolsRes.getString("LibraryManager.Cache.IsEmpty")); // $NON-NLS-1$
      label.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
      Box box = Box.createHorizontalBox();
      box.add(label);
      box.add(Box.createHorizontalGlue());
      cacheBox.add(box);
      return;
    }

    for (File hostFile : hosts) {
      // eliminate the "osp-" that starts all cache host filenames
      String hostText = hostFile.getName().substring(4).replace('_', '.');
      long bytes = getFileSize(hostFile);
      long size = bytes / (1024 * 1024);
      if (bytes > 0) {
        if (size > 0) hostText += " (" + size + " MB)"; // $NON-NLS-1$ //$NON-NLS-2$
        else hostText += " (" + bytes / 1024 + " kB)"; // $NON-NLS-1$ //$NON-NLS-2$
      }
      JLabel label = new JLabel(hostText);
      label.setToolTipText(hostFile.getAbsolutePath());
      labels.add(label);

      ClearHostButton button = new ClearHostButton(hostFile);

      Box bar = Box.createHorizontalBox();
      bar.add(label);
      bar.add(button);
      bar.add(Box.createHorizontalGlue());

      cacheBox.add(bar);
      FontSizer.setFonts(cacheBox, FontSizer.getLevel());
    }

    // set label sizes
    FontRenderContext frc = new FontRenderContext(null, false, false);
    Font font = labels.get(0).getFont();
    int w = 0;
    for (JLabel next : labels) {
      Rectangle2D rect = font.getStringBounds(next.getText(), frc);
      w = Math.max(w, (int) rect.getWidth());
    }
    Dimension labelSize = new Dimension(w + 48, 20);
    for (JLabel next : labels) {
      next.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
      next.setPreferredSize(labelSize);
    }
  }
 public BasicCalendarHeader() {
   setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
   prevButton = createNavigationButton();
   nextButton = createNavigationButton();
   zoomOutLink = createZoomLink();
   add(prevButton);
   add(Box.createHorizontalGlue());
   add(zoomOutLink);
   add(Box.createHorizontalGlue());
   add(nextButton);
   setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4));
 }
  /**
   * Create the pixel location panel
   *
   * @param labelFont the font for the labels
   * @return the location panel
   */
  public JPanel createLocationPanel(Font labelFont) {

    // create a location panel
    JPanel locationPanel = new JPanel();
    locationPanel.setLayout(new FlowLayout());
    Box hBox = Box.createHorizontalBox();

    // create the labels
    rowLabel = new JLabel("Row:");
    colLabel = new JLabel("Column:");

    // create the text fields
    colValue = new JTextField(Integer.toString(colIndex + numberBase), 6);
    colValue.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            displayPixelInformation(colValue.getText(), rowValue.getText());
          }
        });
    rowValue = new JTextField(Integer.toString(rowIndex + numberBase), 6);
    rowValue.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            displayPixelInformation(colValue.getText(), rowValue.getText());
          }
        });

    // set up the next and previous buttons
    setUpNextAndPreviousButtons();

    // set up the font for the labels
    colLabel.setFont(labelFont);
    rowLabel.setFont(labelFont);
    colValue.setFont(labelFont);
    rowValue.setFont(labelFont);

    // add the items to the vertical box and the box to the panel
    hBox.add(Box.createHorizontalGlue());
    hBox.add(rowLabel);
    hBox.add(rowPrevButton);
    hBox.add(rowValue);
    hBox.add(rowNextButton);
    hBox.add(Box.createHorizontalStrut(10));
    hBox.add(colLabel);
    hBox.add(colPrevButton);
    hBox.add(colValue);
    hBox.add(colNextButton);
    locationPanel.add(hBox);
    hBox.add(Box.createHorizontalGlue());

    return locationPanel;
  }
示例#12
0
  MsMsBottomPanel(MsMsVisualizerWindow masterFrame, RawDataFile dataFile, ParameterSet parameters) {

    this.dataFile = dataFile;
    this.masterFrame = masterFrame;

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

    setBackground(Color.white);
    setBorder(new EmptyBorder(5, 5, 5, 0));

    add(Box.createHorizontalGlue());

    GUIUtils.addLabel(this, "Show: ", SwingConstants.RIGHT);

    thresholdCombo = new JComboBox<Object>(PeakThresholdMode.values());
    thresholdCombo.setSelectedItem(PeakThresholdMode.NONE);
    thresholdCombo.setBackground(Color.white);
    thresholdCombo.setFont(smallFont);
    thresholdCombo.addActionListener(this);
    add(thresholdCombo);

    JPanel peakThresholdPanel = new JPanel();
    peakThresholdPanel.setBackground(Color.white);
    peakThresholdPanel.setLayout(new BoxLayout(peakThresholdPanel, BoxLayout.X_AXIS));

    GUIUtils.addLabel(peakThresholdPanel, "Value: ", SwingConstants.RIGHT);

    peakTextField = new JTextField();
    peakTextField.setPreferredSize(new Dimension(50, 15));
    peakTextField.setFont(smallFont);
    peakTextField.addActionListener(this);
    peakThresholdPanel.add(peakTextField);
    add(peakThresholdPanel);

    GUIUtils.addLabel(this, " from peak list: ", SwingConstants.RIGHT);

    peakListSelector = new JComboBox<PeakList>();
    peakListSelector.setBackground(Color.white);
    peakListSelector.setFont(smallFont);
    peakListSelector.addActionListener(masterFrame);
    peakListSelector.setActionCommand("PEAKLIST_CHANGE");
    add(peakListSelector);

    thresholdSettings = parameters.getParameter(MsMsParameters.peakThresholdSettings);

    thresholdCombo.setSelectedItem(thresholdSettings.getMode());

    add(Box.createHorizontalStrut(10));

    add(Box.createHorizontalGlue());
  }
  private JPanel getSettingsButtonPnl() {
    if (settingsButtonPnl == null) {
      settingsButtonPnl = new JPanel();
      settingsButtonPnl.setLayout(new BoxLayout(settingsButtonPnl, BoxLayout.LINE_AXIS));
      settingsButtonPnl.setAlignmentX(Component.CENTER_ALIGNMENT);
      settingsButtonPnl.setOpaque(!LookAndFeelUtil.isAquaLAF()); // Transparent if Aqua

      settingsButtonPnl.add(Box.createHorizontalGlue());
      settingsButtonPnl.add(getApplyBtn());
      settingsButtonPnl.add(Box.createHorizontalGlue());
    }

    return settingsButtonPnl;
  }
  private void init() {
    setLayout(new BorderLayout());

    tableModel = new NotesTableModel(getCharacter());
    table = new JTable(tableModel);
    table.setRowHeight(50);
    tableModel.updateColumns(table);
    table.setDefaultRenderer(String.class, new NotesCellRenderer());
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent e) {
                updateControls();
              }
            });

    add(new JScrollPane(table), "Center");

    Box box = Box.createHorizontalBox();
    box.add(Box.createHorizontalGlue());
    addNoteButton = new JButton("Add Custom");
    addNoteButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            String note = JOptionPane.showInputDialog("Custom Note");
            getCharacter().addNote(getGameHandler().getClient().getClientName(), "Custom", note);
            updatePanel();
          }
        });
    box.add(addNoteButton);
    box.add(Box.createHorizontalGlue());
    deleteNoteButton = new JButton("Delete Custom");
    deleteNoteButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            Note note = getSelectedNote();
            if (note != null) {
              getCharacter().deleteNote(note.getId());
              updatePanel();
            }
          }
        });
    box.add(deleteNoteButton);
    box.add(Box.createHorizontalGlue());
    add(box, "South");

    updateControls();
  }
示例#15
0
  private void initComponents() {
    FlippingSplitPane upperPane = new FlippingSplitPane("SpellBooksTop");
    Box box = Box.createVerticalBox();
    JScrollPane pane = new JScrollPane(availableTable);
    pane.setPreferredSize(new Dimension(250, 300));
    box.add(pane);
    box.add(Box.createVerticalStrut(5));
    {
      Box hbox = Box.createHorizontalBox();
      hbox.add(Box.createHorizontalStrut(5));
      hbox.add(new JLabel(LanguageBundle.getString("InfoSpells.set.auto.book")));
      hbox.add(Box.createHorizontalGlue());
      box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    {
      Box hbox = Box.createHorizontalBox();
      hbox.add(Box.createHorizontalStrut(5));
      hbox.add(defaultBookCombo);
      hbox.add(Box.createHorizontalGlue());
      hbox.add(Box.createHorizontalStrut(5));
      hbox.add(addButton);
      hbox.add(Box.createHorizontalStrut(5));
      box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    upperPane.setLeftComponent(box);

    box = Box.createVerticalBox();
    box.add(new JScrollPane(selectedTable));
    box.add(Box.createVerticalStrut(5));
    {
      Box hbox = Box.createHorizontalBox();
      hbox.add(Box.createHorizontalStrut(5));
      hbox.add(removeButton);
      hbox.add(Box.createHorizontalGlue());
      box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    upperPane.setRightComponent(box);
    upperPane.setResizeWeight(0);
    setTopComponent(upperPane);

    FlippingSplitPane bottomPane = new FlippingSplitPane("SpellBooksBottom");
    bottomPane.setLeftComponent(spellsPane);
    bottomPane.setRightComponent(classPane);
    setBottomComponent(bottomPane);
    setOrientation(VERTICAL_SPLIT);
  }
示例#16
0
  public ColorMapVisualization(MRAPanel panel, String defaultEntity, String fieldToPlot) {
    this.logSource = panel.getSource();
    this.curEntity = defaultEntity;
    setLayout(new MigLayout());

    // Parse field to plot
    String part[] = fieldToPlot.split("\\.");
    messageName = part[0];
    varName = part[1];

    // Initialize entityList with the ALL shorthand
    entityList.add("ALL");

    // Misc setups and interface build
    redrawButton.addActionListener(this);
    entCombo.setModel(new DefaultComboBoxModel<String>(entityList));

    toolbar.add(Box.createHorizontalGlue());
    toolbar.add(cmapMinValue);
    toolbar.add(cmapMaxValue);
    toolbar.add(cmapCombo);
    toolbar.add(entCombo);
    toolbar.add(redrawButton);
    toolbar.add(savePng);
    toolbar.add(savePdf);

    add(toolbar, "w 100%, wrap");
    add(container, "w 100%, h 100%");

    cmapCombo.setSelectedItem(ColorMapFactory.createJetColorMap());
    cmapCombo.setRenderer(new ColorMapListRenderer());

    revalidate();
  }
示例#17
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);
  }
示例#18
0
  public Header() {

    super(BoxLayout.LINE_AXIS);

    this.label = new JLabel();

    this.label.setAlignmentY(Component.TOP_ALIGNMENT);
    this.label.setOpaque(false);
    // this.label.setVerticalAlignment (SwingConstants.TOP);

    // this.label.setVerticalTextPosition (SwingConstants.TOP);

    this.add(this.label);
    this.add(Box.createHorizontalGlue());

    this.paintProvider =
        new GradientPainter(Header.defaultPaintLeftColor, Header.defaultPaintRightColor);

    this.setPadding(Header.defaultPadding);

    Font f = this.getFont().deriveFont(Font.BOLD, 14);

    this.setFont(f);
    this.setTitleColor(Header.defaultTitleColor);
  }
示例#19
0
 public HeaderPanel(String heading) {
   super();
   this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
   this.setBackground(background);
   JLabel panelLabel = new JLabel(" " + heading, SwingConstants.LEFT);
   Font labelFont = new Font("Dialog", Font.BOLD, 18);
   panelLabel.setFont(labelFont);
   this.add(panelLabel);
   this.add(Box.createHorizontalGlue());
   refresh = new JButton("Refresh");
   refresh.addActionListener(this);
   this.add(refresh);
   this.add(Box.createHorizontalStrut(5));
   root = new JComboBox();
   Dimension d = root.getPreferredSize();
   d.width = 90;
   root.setPreferredSize(d);
   root.setMaximumSize(d);
   File[] roots = directoryPane.getRoots();
   for (int i = 0; i < roots.length; i++) root.addItem(roots[i].getAbsolutePath());
   this.add(root);
   root.setSelectedIndex(directoryPane.getCurrentRootIndex());
   root.addActionListener(this);
   this.add(Box.createHorizontalStrut(17));
 }
示例#20
0
  private void init() {
    Box hbox = Box.createHorizontalBox();
    hbox.add(Box.createHorizontalGlue());
    hbox.add(new JTextScrollPane(getXPathField()));
    hbox.add(Box.createHorizontalGlue());
    hbox.add(getCheckXPathButton());

    Box vbox = Box.createVerticalBox();
    vbox.add(hbox);
    vbox.add(Box.createVerticalGlue());
    vbox.add(getNegatedCheckBox());

    add(vbox);

    setDefaultValues();
  }
示例#21
0
  private JPanel createGroupsPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(new HeaderPanel("Groups"), BorderLayout.NORTH);

    JPanel box = new JPanel(new BorderLayout());
    mGroupsListModel = new ListListModel();
    mGroupsList = new JList(mGroupsListModel);
    mGroupsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    mGroupsList.getSelectionModel().addListSelectionListener(new OnGroupSelectionChanged());
    JScrollPane scrollPane = new JScrollPane(mGroupsList);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    box.add(scrollPane);
    box.setBorder(BorderFactory.createEmptyBorder(5, 30, 5, 5));
    panel.add(box, BorderLayout.CENTER);

    Box buttonBox = Box.createHorizontalBox();
    buttonBox.add(Box.createHorizontalGlue());
    mAddGroupButtonAction = new AddGroupButtonAction(this);
    buttonBox.add(new JButton(mAddGroupButtonAction));
    buttonBox.add(Box.createHorizontalStrut(5));
    mRemoveGroupButtonAction = new RemoveGroupButtonAction(this);
    buttonBox.add(new JButton(mRemoveGroupButtonAction));
    buttonBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.add(buttonBox, BorderLayout.SOUTH);
    return panel;
  }
 private void populateFieldsPanel() {
   fieldsPanel.removeAll();
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.BOTH;
   gbc.anchor = GridBagConstraints.NORTHWEST;
   boolean first = true;
   for (ServerDescriptor server : orderedServers) {
     gbc.insets.left = 0;
     gbc.weightx = 0.0;
     if (!first) {
       gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
     }
     gbc.gridwidth = 4;
     fieldsPanel.add(hmLabels.get(server.getId()), gbc);
     gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
     gbc.gridwidth--;
     fieldsPanel.add(hmFields.get(server.getId()), gbc);
     gbc.insets.left = UIFactory.LEFT_INSET_SECONDARY_FIELD;
     gbc.gridwidth = GridBagConstraints.RELATIVE;
     fieldsPanel.add(hmCbs.get(server.getId()), gbc);
     gbc.gridwidth = GridBagConstraints.REMAINDER;
     gbc.weightx = 1.0;
     fieldsPanel.add(Box.createHorizontalGlue(), gbc);
     first = false;
   }
   addVerticalGlue(fieldsPanel);
 }
  private Component createOptionsPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));

    hideButton =
        new JButton(
            new AbstractAction("Hide") {
              public void actionPerformed(ActionEvent e) {
                hideSelected();
              }
            });

    showButton =
        new JButton(
            new AbstractAction("Show") {
              public void actionPerformed(ActionEvent e) {
                showSelected();
              }
            });

    panel.add(showButton);
    panel.add(Box.createHorizontalStrut(10));
    panel.add(hideButton);
    panel.add(Box.createHorizontalGlue());
    panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));

    return panel;
  }
示例#24
0
  public void widgetLayout() {
    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    this.add(new JLabel(this.p.getDisplayName()));

    final PropertyWidget th = this;

    control = new JTextField();
    String startText = "" + ((PDouble) th.p.getValue()).doubleValue();
    control.setText(startText);
    control.setMaximumSize(new Dimension(70, 20));
    control.setPreferredSize(new Dimension(70, 20));

    readOnlyControl = new JLabel();

    readOnlyControl.setText(startText);
    // readOnlyControl.setMaximumSize(new Dimension(200,20));

    control.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            th.propertyUpdated(new PDouble(Double.parseDouble(control.getText())));
          }
        });

    // this.add(Box.createRigidArea(new Dimension(5,1)));
    this.add(Box.createHorizontalGlue());
    this.add(control);

    setPropertyReadOnly(p.getReadOnly());
  }
示例#25
0
  /**
   * Creates a dialog that is showing the histogram for the given node (if null one is selected for
   * you)
   */
  private JPanel createNormalityTestDialog(Node selected) {
    DataSet dataSet = (DataSet) dataEditor.getSelectedDataModel();

    QQPlot qqPlot = new QQPlot(dataSet, selected);
    NormalityTestEditorPanel editorPanel = new NormalityTestEditorPanel(qqPlot, dataSet);

    JTextArea display =
        new JTextArea(
            NormalityTests.runNormalityTests(
                dataSet, (ContinuousVariable) qqPlot.getSelectedVariable()),
            20,
            65);
    display.setEditable(false);
    editorPanel.addPropertyChangeListener(new NormalityTestListener(display));

    Box box = Box.createHorizontalBox();
    box.add(display);

    box.add(Box.createHorizontalStrut(3));
    box.add(editorPanel);
    box.add(Box.createHorizontalStrut(5));
    box.add(Box.createHorizontalGlue());

    Box vBox = Box.createVerticalBox();
    vBox.add(Box.createVerticalStrut(15));
    vBox.add(box);
    vBox.add(Box.createVerticalStrut(5));

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(vBox, BorderLayout.CENTER);

    return panel;
  }
示例#26
0
  public void addLayer(Layer layer, boolean showOnButtonList, String icon) {
    if (layer instanceof MapViewerLayer) {
      minZoom = Math.max(((MapViewerLayer) layer).getMinZoomLevel(), getMinZoom());
      maxZoom = Math.min(((MapViewerLayer) layer).getMaxZoomLevel(), getMaxZoom());
      if (zoomFactor > maxZoom || zoomFactor < minZoom) {
        zoomFactor = (maxZoom + minZoom) / 2;
      }
      zoomTo(center, zoom2Scale(zoomFactor));
    }
    if (showOnButtonList) {
      JToggleButton b = new JToggleButton(layer.name, LogicConstants.getIcon(icon), layer.visible);
      // b.setVerticalTextPosition(SwingConstants.BOTTOM);
      // b.setHorizontalTextPosition(SwingConstants.CENTER);
      b.setActionCommand(layer.name);
      b.addActionListener(layerControlListener);
      layerControls.add(b);
      layerControlPanel.removeAll();
      layerControlPanel.add(Box.createHorizontalStrut(10));
      for (JToggleButton bt : layerControls) {
        layerControlPanel.add(bt);
        layerControlPanel.add(Box.createHorizontalGlue());
      }
      layerControlPanel.updateUI();
    }

    super.addLayer(layer);
  }
  /**
   * The activation panel contains functions related to pausing, starting, and powering the steppers
   * up or down.
   */
  protected JComponent createActivationPanel() {
    JPanel activationPanel = new JPanel();
    activationPanel.setBorder(BorderFactory.createTitledBorder("Stepper Motor Controls"));
    activationPanel.setLayout(new BoxLayout(activationPanel, BoxLayout.LINE_AXIS));

    // / Enable/disable steppers.
    JButton enableButton = new JButton("Enable");
    enableButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            machine.runCommand(new replicatorg.drivers.commands.EnableDrives());
          }
        });
    activationPanel.add(enableButton);

    JButton disableButton = new JButton("Disable");
    disableButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            machine.runCommand(new replicatorg.drivers.commands.DisableDrives());
          }
        });
    activationPanel.add(disableButton);

    activationPanel.add(Box.createHorizontalGlue());

    return activationPanel;
  }
示例#28
0
 public SISCFrame(AppContext ctx) {
   setLayout(new BorderLayout());
   SchemePanel.SchemeDocument d = new SchemePanel.SchemeDocument();
   sp = new SchemePanel(ctx, d, new JTextPane(d));
   input = new JTextArea(4, 70);
   input.setText("; Enter s-expressions here");
   JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, sp, input);
   JPanel execPanel = new JPanel();
   execPanel.setLayout(new BoxLayout(execPanel, BoxLayout.X_AXIS));
   execPanel.add(Box.createHorizontalGlue());
   eval = new JButton("Evaluate");
   clear = new JButton("Clear");
   autoClear = new JCheckBox("Auto-Clear");
   submitOnEnter = new JCheckBox("Evaluate on Enter");
   autoClear.setSelected(true);
   submitOnEnter.setSelected(true);
   execPanel.add(submitOnEnter);
   execPanel.add(autoClear);
   execPanel.add(clear);
   execPanel.add(eval);
   add(split, BorderLayout.CENTER);
   add(execPanel, BorderLayout.SOUTH);
   eval.addActionListener(this);
   clear.addActionListener(this);
   input.addKeyListener(this);
   /*	addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
   System.exit(0);
         }
         });*/
 }
  public UnitListInternalFrame(String Title, Vector<Unit> units, UnitChangeListener ucl) {
    super(Title, true, true, true, true);

    m_UnitListPanel = new UnitListPanel(units);
    m_UnitListPanel.addUnitChangeListener(ucl);

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

    // m_UnitListPanel.setFocusable(false);
    getContentPane().add(m_UnitListPanel, BorderLayout.CENTER);

    m_ButtonPanel.setBorder(BorderFactory.createEtchedBorder());
    m_ButtonPanel.setLayout(new BoxLayout(m_ButtonPanel, BoxLayout.X_AXIS));

    m_NewButton.setAlignmentY(Component.CENTER_ALIGNMENT);
    m_NewButton.setActionCommand("New");
    m_NewButton.addActionListener(this);

    m_RemoveButton.setAlignmentY(Component.CENTER_ALIGNMENT);
    m_RemoveButton.setActionCommand("Remove");
    m_RemoveButton.addActionListener(this);

    m_EditButton.setAlignmentY(Component.CENTER_ALIGNMENT);
    m_EditButton.setActionCommand("Edit");
    m_EditButton.addActionListener(this);

    m_ButtonPanel.add(m_NewButton);
    m_ButtonPanel.add(m_EditButton);
    m_ButtonPanel.add(Box.createHorizontalBox());
    m_ButtonPanel.add(m_RemoveButton);
    m_ButtonPanel.add(Box.createHorizontalGlue());

    getContentPane().add(m_ButtonPanel, BorderLayout.SOUTH);
  }
  private static JPanel createJContentPane(JLabel statusLabel, JTable table) {
    // this is the main JPanel
    JPanel jContentPane = new JPanel();
    jContentPane.setBackground(Color.white);
    jContentPane.setLayout(new BoxLayout(jContentPane, BoxLayout.Y_AXIS));

    // we create a JPanel containing the status indicator, our logo and the demo name
    // we'll use this JPanel as first element on the main JPanel
    JPanel firstLine = new JPanel();
    firstLine.setBackground(Color.white);
    firstLine.setLayout(new BoxLayout(firstLine, BoxLayout.X_AXIS));

    firstLine.add(statusLabel);

    JLabel label = new JLabel(TITLE, LOGO, JLabel.LEFT);
    firstLine.add(label);

    firstLine.add(Box.createHorizontalGlue());

    // then we add the previously created first-line-JPanel and the JTable to
    // the main JPanel
    jContentPane.add(firstLine);
    // (we wrap the JTable in a JSCrollPane so that we have scrollbars)
    JScrollPane scrollPane = new JScrollPane(table);
    jContentPane.add(scrollPane);

    return jContentPane;
  }