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;
  }
  private void initialize() {
    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    getTeamNameLabel().setAlignmentX(Component.LEFT_ALIGNMENT);
    add(getTeamNameLabel());
    JPanel p = new JPanel();

    p.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    p.setAlignmentX(Component.LEFT_ALIGNMENT);
    getTeamNameField().setAlignmentX(Component.LEFT_ALIGNMENT);
    getTeamNameField().setMaximumSize(getTeamNameField().getPreferredSize());
    // getVersionField().setMaximumSize(getVersionField().getPreferredSize());
    p.setMaximumSize(
        new Dimension(Integer.MAX_VALUE, getTeamNameField().getPreferredSize().height));
    p.add(getTeamPackageLabel());
    p.add(getTeamNameField());
    add(p);

    JLabel label = new JLabel(" ");

    label.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(label);
    label = new JLabel(" ");
    label.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(label);

    add(getDescriptionLabel());

    JScrollPane scrollPane =
        new JScrollPane(
            getDescriptionArea(),
            ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

    scrollPane.setMaximumSize(scrollPane.getPreferredSize());
    scrollPane.setMinimumSize(new Dimension(100, scrollPane.getPreferredSize().height));
    scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(scrollPane);
    label = new JLabel(" ");
    label.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(label);
    add(getAuthorLabel());
    getAuthorField().setAlignmentX(Component.LEFT_ALIGNMENT);
    getAuthorField().setMaximumSize(getAuthorField().getPreferredSize());
    add(getAuthorField());
    label = new JLabel(" ");
    label.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(label);
    add(getWebpageLabel());
    getWebpageField().setAlignmentX(Component.LEFT_ALIGNMENT);
    getWebpageField().setMaximumSize(getWebpageField().getPreferredSize());
    add(getWebpageField());
    getWebpageHelpLabel().setAlignmentX(Component.LEFT_ALIGNMENT);
    add(getWebpageHelpLabel());
    JPanel panel = new JPanel();

    panel.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(panel);
    addComponentListener(eventHandler);
  }
Example #3
0
  public ComboBoxDemo2() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    String[] patternExamples = {
      "dd MMMMM yyyy",
      "dd.MM.yy",
      "MM/dd/yy",
      "yyyy.MM.dd G 'at' hh:mm:ss z",
      "EEE, MMM d, ''yy",
      "h:mm a",
      "H:mm:ss:SSS",
      "K:mm a,z",
      "yyyy.MMMMM.dd GGG hh:mm aaa"
    };

    currentPattern = patternExamples[0];

    // Set up the UI for selecting a pattern.
    JLabel patternLabel1 = new JLabel("Enter the pattern string or");
    JLabel patternLabel2 = new JLabel("select one from the list:");

    JComboBox patternList = new JComboBox(patternExamples);
    patternList.setEditable(true);
    patternList.addActionListener(this);

    // Create the UI for displaying result.
    JLabel resultLabel = new JLabel("Current Date/Time", JLabel.LEADING); // == LEFT
    result = new JLabel(" ");
    result.setForeground(Color.black);
    result.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createLineBorder(Color.black),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    // Lay out everything.
    JPanel patternPanel = new JPanel();
    patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS));
    patternPanel.add(patternLabel1);
    patternPanel.add(patternLabel2);
    patternList.setAlignmentX(Component.LEFT_ALIGNMENT);
    patternPanel.add(patternList);

    JPanel resultPanel = new JPanel(new GridLayout(0, 1));
    resultPanel.add(resultLabel);
    resultPanel.add(result);

    patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(patternPanel);
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(resultPanel);

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

    reformat();
  } // constructor
Example #4
0
  protected JPanel createProgrammerSelection() {
    JPanel pane3a = new JPanel();
    pane3a.setLayout(new BoxLayout(pane3a, BoxLayout.Y_AXIS));
    // create the programmer box
    JPanel progFormat = new JPanel();
    progFormat.setLayout(new BoxLayout(progFormat, BoxLayout.X_AXIS));
    progFormat.add(new JLabel(Bundle.getMessage("ProgrammerFormat")));
    progFormat.setAlignmentX(JLabel.RIGHT_ALIGNMENT);

    programmerBox = new JComboBox<String>(ProgDefault.findListOfProgFiles());
    programmerBox.setSelectedIndex(0);
    if (ProgDefault.getDefaultProgFile() != null) {
      programmerBox.setSelectedItem(ProgDefault.getDefaultProgFile());
    }
    progFormat.add(programmerBox);

    go2 = new JButton(Bundle.getMessage("OpenProgrammer"));
    go2.addActionListener(
        new ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            if (log.isDebugEnabled()) {
              log.debug("Open programmer pressed");
            }
            openButton();
          }
        });
    go2.setAlignmentX(JLabel.RIGHT_ALIGNMENT);
    go2.setEnabled(false);
    go2.setToolTipText(Bundle.getMessage("SELECT A LOCOMOTIVE OR DECODER TO ENABLE"));
    pane3a.add(progFormat);
    pane3a.add(go2);
    return pane3a;
  }
Example #5
0
  public DateTimeView(DateTime time) {
    super();
    this.time = time;
    Font f = new Font("Monospaced", Font.BOLD, 13);
    Color c = new Color(44, 68, 152);
    month = new JLabel(strMonth(time.getMonthOfYear()));
    month.setFont(f);
    month.setForeground(c);
    year = new JLabel("" + time.getYear());
    year.setFont(f);
    year.setForeground(c);
    day = new JLabel("" + time.getDayOfMonth());
    day.setFont(new Font("Calibri", Font.BOLD, 26));
    day.setForeground(new Color(126, 148, 227));
    t = new JLabel(formatTime(time.getHourOfDay(), time.getMinuteOfHour()));
    t.setFont(f);
    t.setForeground(c);

    JPanel topPanel = new JPanel();
    topPanel.setLayout(new FlowLayout());
    topPanel.add(month);
    topPanel.add(year);

    this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    topPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
    this.add(topPanel);
    this.add(Box.createVerticalStrut(3));
    day.setAlignmentX(Component.CENTER_ALIGNMENT);
    this.add(day);
    t.setAlignmentX(Component.CENTER_ALIGNMENT);
    this.add(Box.createVerticalStrut(3));
    this.add(t);
    this.setBorder(BorderFactory.createRaisedBevelBorder());
  }
Example #6
0
  /**
   * Create the panel used to select the decoder
   *
   * @return a JPanel for handling the decoder-selection GUI
   */
  protected JPanel layoutDecoderSelection() {
    JPanel pane1a = new JPanel();
    pane1a.setLayout(new BoxLayout(pane1a, BoxLayout.X_AXIS));
    pane1a.add(new JLabel("Decoder installed: "));
    decoderBox = DecoderIndexFile.instance().matchingComboBox(null, null, null, null, null, null);
    decoderBox.insertItemAt("<from locomotive settings>", 0);
    decoderBox.setSelectedIndex(0);
    decoderBox.addActionListener(
        new ActionListener() {

          public void actionPerformed(java.awt.event.ActionEvent e) {
            if (decoderBox.getSelectedIndex() != 0) {
              // reset and disable loco selection
              locoBox.setSelectedIndex(0);
              go2.setEnabled(true);
              go2.setRequestFocusEnabled(true);
              go2.requestFocus();
              go2.setToolTipText(Bundle.getMessage("CLICK TO OPEN THE PROGRAMMER"));
            } else {
              go2.setEnabled(false);
              go2.setToolTipText(Bundle.getMessage("SELECT A LOCOMOTIVE OR DECODER TO ENABLE"));
            }
          }
        });
    pane1a.add(decoderBox);
    iddecoder = addDecoderIdentButton();
    if (iddecoder != null) {
      pane1a.add(iddecoder);
    }
    pane1a.setAlignmentX(JLabel.RIGHT_ALIGNMENT);
    return pane1a;
  }
  /** Constructor */
  public MapListCellRenderer() {
    JPanel pFirst = new JPanel();
    pFirst.setOpaque(false);
    pFirst.setLayout(new BorderLayout(5, 0));
    pFirst.add(mapNameLabel, BorderLayout.CENTER);
    pFirst.add(playerCountLabel, BorderLayout.EAST);
    pFirst.setAlignmentX(Component.LEFT_ALIGNMENT);
    rightPanelPart.add(pFirst);
    rightPanelPart.add(mapIdLabel);
    mapIdLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    rightPanelPart.add(descriptionLabel);
    descriptionLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

    rightPanelPart.setOpaque(false);
    rightPanelPart.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    mapNameLabel.setFont(mapNameLabel.getFont().deriveFont(Font.BOLD));
    mapNameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

    mapNameLabel.setForeground(FOREGROUND);
    mapIdLabel.setForeground(FOREGROUND);
    descriptionLabel.setForeground(FOREGROUND);
    playerCountLabel.setForeground(Color.BLUE);

    contentsPanel.setLayout(new BorderLayout());
    contentsPanel.add(rightPanelPart, BorderLayout.CENTER);
    contentsPanel.add(iconLabel, BorderLayout.WEST);
    contentsPanel.putClientProperty(ELFStyle.KEY, ELFStyle.PANEL_DRAW_BG_CUSTOM);

    iconLabel.setOpaque(false);
    iconLabel.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));

    // Update UI
    SwingUtilities.updateComponentTreeUI(contentsPanel);
  }
Example #8
0
  public SitesPanel(Connection dbConn) {
    this.dbConn = dbConn;
    this.setLayout(new BorderLayout());

    topPanel.setAlignmentX(CENTER_ALIGNMENT);
    topPanel.add(siteIDL);
    topPanel.add(siteIDF);
    topPanel.add(updateB);
    updateB.addActionListener(this);

    sitesTableModel.setColumnIdentifiers(
        new String[] {"Site ID", "Given Name", "Surname", "Suburb", "State"});
    sitesTableModel.addTableModelListener(this);
    sitesTableListModel.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
    sitesTable.setAutoCreateRowSorter(true);
    tableScroll.setPreferredSize(new Dimension(940, 600));
    tablePanel.add(tableScroll);

    updateSites();

    sitesTable
        .getColumnModel()
        .getColumn(4)
        .setCellEditor(
            new DefaultCellEditor(
                new JComboBox<String>(
                    new String[] {"", "NSW", "VIC", "QLD", "ACT", "WA", "SA", "TAS", "NT"})));

    this.add(topPanel, BorderLayout.NORTH);
    this.add(tablePanel, BorderLayout.CENTER);
  }
Example #9
0
  public JPanel getResetPanel() {
    final JPanel panel_2 = new JPanel();
    panel_2.setAlignmentY(Component.TOP_ALIGNMENT);
    panel_2.setAlignmentX(Component.LEFT_ALIGNMENT);
    panel_2.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3));
    panel_2.setBorder(
        BorderFactory.createCompoundBorder(
            spaceY,
            new TitledBorder(
                null,
                Messages.getString("ImageTool.reset"), // $NON-NLS-1$
                TitledBorder.DEFAULT_JUSTIFICATION,
                TitledBorder.DEFAULT_POSITION,
                TITLE_FONT,
                TITLE_COLOR)));
    final JComboBox resetComboBox = new JComboBox(ResetTools.values());
    panel_2.add(resetComboBox);

    final JButton resetButton = new JButton();
    resetButton.setText(Messages.getString("ImageTool.reset")); // $NON-NLS-1$
    resetButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            EventManager.getInstance().reset((ResetTools) resetComboBox.getSelectedItem());
          }
        });
    panel_2.add(resetButton);
    ActionState resetAction = EventManager.getInstance().getAction(ActionW.RESET);
    if (resetAction != null) {
      resetAction.registerActionState(resetButton);
    }
    return panel_2;
  }
Example #10
0
  public JPanel getSlicePanel() {

    final JPanel framePanel = new JPanel();
    framePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    framePanel.setAlignmentY(Component.TOP_ALIGNMENT);
    framePanel.setLayout(new BoxLayout(framePanel, BoxLayout.Y_AXIS));
    framePanel.setBorder(
        BorderFactory.createCompoundBorder(
            spaceY,
            new TitledBorder(
                null,
                Messages.getString("ImageTool.frame"), // $NON-NLS-1$
                TitledBorder.DEFAULT_JUSTIFICATION,
                TitledBorder.DEFAULT_POSITION,
                TITLE_FONT,
                TITLE_COLOR)));

    ActionState sequence = EventManager.getInstance().getAction(ActionW.SCROLL_SERIES);
    if (sequence instanceof SliderCineListener) {
      SliderCineListener cineAction = (SliderCineListener) sequence;
      final JSliderW frameSlider = cineAction.createSlider(4, true);
      framePanel.add(frameSlider.getParent());

      final JPanel panel_3 = new JPanel();
      panel_3.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3));
      final JLabel speedLabel = new JLabel();
      speedLabel.setText(
          Messages.getString("ImageTool.cine_speed") + StringUtil.COLON); // $NON-NLS-1$
      panel_3.add(speedLabel);

      final JSpinner speedSpinner = new JSpinner(cineAction.getSpeedModel());
      JMVUtils.formatCheckAction(speedSpinner);
      panel_3.add(speedSpinner);
      final JButton startButton = new JButton();
      startButton.setActionCommand(ActionW.CINESTART.cmd());
      startButton.setPreferredSize(JMVUtils.getBigIconButtonSize());
      startButton.setToolTipText(Messages.getString("ImageTool.cine_start")); // $NON-NLS-1$
      startButton.setIcon(
          new ImageIcon(
              MouseActions.class.getResource(
                  "/icon/22x22/media-playback-start.png"))); //$NON-NLS-1$
      startButton.addActionListener(EventManager.getInstance());
      panel_3.add(startButton);
      cineAction.registerActionState(startButton);

      final JButton stopButton = new JButton();
      stopButton.setActionCommand(ActionW.CINESTOP.cmd());
      stopButton.setPreferredSize(JMVUtils.getBigIconButtonSize());
      stopButton.setToolTipText(Messages.getString("ImageTool.cine_stop")); // $NON-NLS-1$
      stopButton.setIcon(
          new ImageIcon(
              MouseActions.class.getResource(
                  "/icon/22x22/media-playback-stop.png"))); //$NON-NLS-1$
      stopButton.addActionListener(EventManager.getInstance());
      panel_3.add(stopButton);
      cineAction.registerActionState(stopButton);
      framePanel.add(panel_3);
    }
    return framePanel;
  }
Example #11
0
  private void initZoomPalette() {
    mZoomPalettePanel = new JPanel();
    mZoomPalettePanel.setLayout(new BoxLayout(mZoomPalettePanel, BoxLayout.X_AXIS));
    mZoomPalettePanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
    mZoomPalettePanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    setPalette();
    add(mZoomPalettePanel);
  }
Example #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
Example #13
0
 /** Returns panel with checkbox. */
 protected final JPanel getComponentPanel(final String text, final JComponent component) {
   final JPanel mp = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
   mp.setBackground(Tools.getDefaultColor("ConfigDialog.Background"));
   mp.add(new JLabel(text));
   mp.add(new JLabel(" "));
   mp.add(component);
   mp.setAlignmentX(Component.LEFT_ALIGNMENT);
   return mp;
 }
Example #14
0
  public FindProf() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

    // Set up the UI for selecting a pattern.
    JLabel patternLabel1 = new JLabel("Search your campus!");
    JLabel patternLabel2 = new JLabel("");

    patternList = new JComboBox<Object>(searchNames);
    patternList.setEditable(true);
    patternList.setMaximumRowCount(5);
    patternList.addActionListener(this);

    // Create the UI for displaying result.
    JLabel resultLabel = new JLabel("Building Initials & Room Number:", JLabel.LEADING); // == LEFT
    result = new JLabel(" ");
    result.setHorizontalAlignment(SwingConstants.CENTER);
    result.setForeground(Color.black);
    result.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createLineBorder(Color.black),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    // Lay out everything.
    JPanel patternPanel = new JPanel();
    patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS));
    patternPanel.add(patternLabel1);
    patternPanel.add(patternLabel2);
    patternList.setAlignmentX(Component.LEFT_ALIGNMENT);
    patternPanel.add(patternList);

    JPanel resultPanel = new JPanel(new GridLayout(0, 1));
    resultPanel.add(resultLabel);
    resultPanel.add(result);

    patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(patternPanel);
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(resultPanel);

    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  } // constructor
Example #15
0
 public static JPanel createLabelPanel(String name, String label, JComponent content) {
   JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
   panel.setName("UIHelper.createLabelPanel");
   JLabel jlabel;
   panel.add(jlabel = UIFactory.getFactory().createLabel(name, label));
   jlabel.setHorizontalAlignment(JLabel.LEFT);
   panel.add(content);
   panel.setAlignmentX(JPanel.LEFT_ALIGNMENT);
   return panel;
 }
Example #16
0
  /**
   * Create the panel used to select an existing entry
   *
   * @return a JPanel for handling the entry-selection GUI
   */
  protected JPanel layoutRosterSelection() {
    JPanel pane2a = new JPanel();
    pane2a.setLayout(new BoxLayout(pane2a, BoxLayout.X_AXIS));
    pane2a.add(new JLabel(Bundle.getMessage("USE LOCOMOTIVE SETTINGS FOR: ")));
    locoBox.setNonSelectedItem(Bundle.getMessage("<NONE - NEW LOCO>"));
    Roster.getDefault().addPropertyChangeListener(this);
    pane2a.add(locoBox);
    locoBox.addPropertyChangeListener(
        RosterEntrySelector.SELECTED_ROSTER_ENTRIES,
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent pce) {
            if (locoBox.getSelectedRosterEntries().length != 0) {
              // reset and disable decoder selection
              setDecoderSelectionFromLoco(locoBox.getSelectedRosterEntries()[0].titleString());
              go2.setEnabled(true);
              go2.setRequestFocusEnabled(true);
              go2.requestFocus();
              go2.setToolTipText(Bundle.getMessage("CLICK TO OPEN THE PROGRAMMER"));
            } else {
              go2.setEnabled(false);
              go2.setToolTipText(Bundle.getMessage("SELECT A LOCOMOTIVE OR DECODER TO ENABLE"));
            }
          }
        });
    idloco = new JToggleButton(Bundle.getMessage("IDENT"));
    idloco.setToolTipText(
        Bundle.getMessage(
            "READ THE LOCOMOTIVE'S ADDRESS AND ATTEMPT TO SELECT THE RIGHT SETTINGS"));
    if (jmri.InstanceManager.getNullableDefault(jmri.ProgrammerManager.class) != null
        && jmri.InstanceManager.getDefault(jmri.ProgrammerManager.class).getGlobalProgrammer()
            != null
        && !jmri.InstanceManager.getDefault(jmri.ProgrammerManager.class)
            .getGlobalProgrammer()
            .getCanRead()) {
      // can't read, disable the button
      idloco.setEnabled(false);
      idloco.setToolTipText(
          Bundle.getMessage("BUTTON DISABLED BECAUSE CONFIGURED COMMAND STATION CAN'T READ CVS"));
    }
    idloco.addActionListener(
        new ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            if (log.isDebugEnabled()) {
              log.debug("Identify locomotive pressed");
            }
            startIdentifyLoco();
          }
        });
    pane2a.add(idloco);
    pane2a.setAlignmentX(JLabel.RIGHT_ALIGNMENT);
    return pane2a;
  }
Example #17
0
 public static JPanel createHorizontalMarginPanel(
     JComponent content, int leftMargin, int rightMargin) {
   JPanel panel = new JPanel();
   panel.setAlignmentX(JPanel.LEFT_ALIGNMENT);
   panel.setAlignmentY(JPanel.TOP_ALIGNMENT);
   panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
   panel.add(Box.createHorizontalStrut(leftMargin));
   panel.add(content);
   panel.add(Box.createHorizontalStrut(rightMargin));
   return panel;
 }
Example #18
0
  /**
   * Convenience method for creating a JPanel containing an okay and cancel button at the bottom of
   * the Dialog window. If cancel is pressed then the dialog window is disposed and nothing happens.
   * If okay is pressed then the appropriate input parameters should be grabbed and handled
   * appropriately. Some slight error checking is also implemented.
   */
  public JPanel initControls() {
    JPanel dialogControls = new JPanel();

    dialogControls.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);

    dialogControls.add(createOkayButton());
    dialogControls.add(createCancelButton());

    dialogControls.setAlignmentX(Component.CENTER_ALIGNMENT);

    return dialogControls;
  }
  public AllometryFunctionEditor(
      TreePopulation oPop, Allometry oAllom, AllometryParameterEdit oEdit) {
    super(oEdit, "Edit Allometry Functions", true);

    m_oPop = oPop;
    m_oAllom = oAllom;
    m_oParentEdit = oEdit;

    // Help ID
    m_oPop.getGUIManager().getHelpBroker().enableHelpKey(this.getRootPane(), m_sHelpID, null);

    Object[][] p_oTableData = null;
    Object[] p_oHeader;
    boolean[] p_bAppliesTo = new boolean[m_oPop.getNumberOfSpecies()];
    int i;

    for (i = 0; i < p_bAppliesTo.length; i++) {
      p_bAppliesTo[i] = true;
    }

    // Assemble the allometry functions data
    p_oTableData = Behavior.formatDataForTable(p_oTableData, m_oAllom.getWhatAdultHDFunction());
    p_oTableData = Behavior.formatDataForTable(p_oTableData, m_oAllom.getWhatSaplingHDFunction());
    p_oTableData = Behavior.formatDataForTable(p_oTableData, m_oAllom.getWhatSeedlingHDFunction());
    p_oTableData = Behavior.formatDataForTable(p_oTableData, m_oAllom.getWhatAdultCRDFunction());
    p_oTableData = Behavior.formatDataForTable(p_oTableData, m_oAllom.getWhatSaplingCRDFunction());
    p_oTableData = Behavior.formatDataForTable(p_oTableData, m_oAllom.getWhatAdultCDHFunction());
    p_oTableData = Behavior.formatDataForTable(p_oTableData, m_oAllom.getWhatSaplingCDHFunction());

    p_oHeader = Behavior.formatSpeciesHeaderRow(p_bAppliesTo, m_oPop);

    // Create the table from the data
    m_oTable = new EnhancedTable(p_oTableData, p_oHeader, this, "Allometry Functions");

    // Create a table panel with an empty panel in CENTER so that the
    // table won't automatically fill the space
    JPanel jTablePanel = new JPanel(new BorderLayout());
    jTablePanel.setName("Table Panel");
    jTablePanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
    jTablePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    jTablePanel.add(m_oTable, BorderLayout.LINE_START);
    jTablePanel.add(new JPanel(), BorderLayout.CENTER);

    // Assemble the window
    JPanel jContentPanel = (JPanel) getContentPane();
    jContentPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    getContentPane().setLayout(new java.awt.BorderLayout());
    getContentPane().add(jTablePanel, BorderLayout.CENTER);
    getContentPane()
        .add(
            new OKCancelButtonPanel(this, m_oPop.getGUIManager().getHelpBroker(), m_sHelpID),
            BorderLayout.PAGE_END);
  }
 public void init() {
   Dimension dim = new Dimension((int) lName.getPreferredSize().getWidth(), SHORT_ROW_HEIGHT);
   tfName = new TextField();
   tfName.setHeight(SHORT_ROW_HEIGHT);
   tfName.setName("tfName");
   lName.setPreferredSize(dim);
   lName.setMaximumSize(dim);
   lName.setVerticalAlignment(SwingConstants.CENTER);
   jpNameRow.setLayout(new BoxLayout(jpNameRow, BoxLayout.X_AXIS));
   jpNameRow.setAlignmentX(SwingConstants.LEFT);
   jpNameRow.add(lName);
   jpNameRow.add(tfName);
   add(jpNameRow);
   dim = new Dimension((int) lType.getPreferredSize().getWidth(), SHORT_ROW_HEIGHT);
   tfType = new LabelField();
   tfType.setHeight(SHORT_ROW_HEIGHT);
   tfType.setName("tfType");
   lType.setPreferredSize(dim);
   lType.setMaximumSize(dim);
   lType.setVerticalAlignment(SwingConstants.CENTER);
   jpTypeRow.setLayout(new BoxLayout(jpTypeRow, BoxLayout.X_AXIS));
   jpTypeRow.setAlignmentX(SwingConstants.LEFT);
   jpTypeRow.add(lType);
   jpTypeRow.add(tfType);
   add(jpTypeRow);
   dim = new Dimension((int) lDOField.getPreferredSize().getWidth(), SHORT_ROW_HEIGHT);
   cbDOField = new ComboBox();
   // cbDOField.setEditable( true); //rm when developed
   cbDOField.setHeight(SHORT_ROW_HEIGHT);
   cbDOField.setName("cbDOField");
   lDOField.setPreferredSize(dim);
   lDOField.setMaximumSize(dim);
   lDOField.setVerticalAlignment(SwingConstants.CENTER);
   jpDOFieldRow.setLayout(new BoxLayout(jpDOFieldRow, BoxLayout.X_AXIS));
   jpDOFieldRow.setAlignmentX(SwingConstants.LEFT);
   jpDOFieldRow.add(lDOField);
   jpDOFieldRow.add(cbDOField);
   add(jpDOFieldRow);
   cbDOField.addActionListener(cbListener);
 }
Example #21
0
  private void jbInit() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(getWindowLevelPanel());
    add(getTransformPanel());
    add(getSlicePanel());
    add(getResetPanel());

    final JPanel panel_1 = new JPanel();
    panel_1.setAlignmentY(Component.TOP_ALIGNMENT);
    panel_1.setAlignmentX(Component.LEFT_ALIGNMENT);
    panel_1.setLayout(new GridBagLayout());
    add(panel_1);
  }
  @Override
  protected JComponent createCenterPanel() {
    JPanel north = new JPanel();
    north.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, true));

    final JPanel namePanel = createNamePanel();
    namePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    north.add(namePanel);

    createCheckBoxes(north);

    myGetterPanel = createFieldPanel();
    myGetterPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    north.add(myGetterPanel);

    final JPanel root = new JPanel(new BorderLayout());
    mySignaturePanel = createSignaturePanel();
    root.add(mySignaturePanel, BorderLayout.CENTER);
    root.add(north, BorderLayout.NORTH);

    return root;
  }
Example #23
0
  private void initComponents() {
    LoadScreen.Update("Locaties instellen", 10);

    lblTitle = new javax.swing.JLabel();
    Vraag = new javax.swing.JPanel();
    lblVraag = new javax.swing.JLabel();
    pbTime = new javax.swing.JProgressBar();
    Antwoorde = new javax.swing.JPanel();

    // setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setAlwaysOnTop(true);
    setUndecorated(true);
    getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

    lblTitle.setText("{%TITLE}");
    getContentPane().add(lblTitle, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));

    Vraag.setBackground(new Color(0, 0, 128));

    lblVraag.setFont(new java.awt.Font("DejaVu Sans", 1, 24)); // NOI18N
    lblVraag.setForeground(new Color(255, 255, 0));
    lblVraag.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    lblVraag.setVerticalAlignment(javax.swing.SwingConstants.TOP);
    lblVraag.setText("{%VRAAG}");
    lblVraag.setBorder(null);

    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    getContentPane()
        .add(Vraag, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 15, dim.width, 200));

    lblVraag.setLocation(0, 0);
    lblVraag.setSize(Vraag.getSize());
    lblVraag.setVisible(true);
    Vraag.setAlignmentX(javax.swing.SwingConstants.LEFT);
    Vraag.add(lblVraag);

    Antwoorde.setBackground(new java.awt.Color(200, 200, 100));
    Antwoorde.setLayout(new java.awt.GridLayout(3, 2, 5, 5));

    getContentPane()
        .add(
            Antwoorde,
            new org.netbeans.lib.awtextra.AbsoluteConstraints(0, dim.height - 300, dim.width, 300));

    // pack();

    // Vraag.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

    this.setLocation(0, 0);
    this.setSize(dim);
  }
  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;
  }
  /**
   * Constructor.
   *
   * @param tileset A tileset.
   * @param oldPatternId The tile pattern id to change in this tileset.
   */
  public TilePatternIdRefactoringComponent(Tileset tileset, String oldPatternId) {
    super();

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

    JPanel patternIdPanel = new JPanel();
    patternIdPanel.setLayout(new BoxLayout(patternIdPanel, BoxLayout.LINE_AXIS));
    patternIdPanel.setAlignmentX(1.0f);
    JLabel patternIdLabel = new JLabel("Tile pattern id:");
    patternIdPanel.add(patternIdLabel);
    patternIdPanel.add(Box.createHorizontalStrut(10));
    patternIdField = new JTextField(oldPatternId, 20);
    patternIdField.selectAll();
    patternIdPanel.add(patternIdField);
    patternIdPanel.setAlignmentX(0.0f);
    add(patternIdPanel);
    add(Box.createVerticalStrut(10));
    updateMapsCheckBox = new JCheckBox("Update references in existing maps");
    updateMapsCheckBox.setSelected(true);
    updateMapsCheckBox.setAlignmentX(0.0f);
    add(updateMapsCheckBox);
  }
Example #26
0
  // type 'java Parallel' to run this application
  public static void main(String args[]) throws VisADException, RemoteException, IOException {

    RealType index = RealType.getRealType("index");
    RealType[] coords = new RealType[NCOORDS];
    for (int i = 0; i < NCOORDS; i++) {
      coords[i] = RealType.getRealType("coord" + i);
    }
    RealTupleType range = new RealTupleType(coords);
    FunctionType ftype = new FunctionType(index, range);
    Integer1DSet index_set = new Integer1DSet(NROWS);

    float[][] samples = new float[NCOORDS][NROWS];
    for (int i = 0; i < NCOORDS; i++) {
      for (int j = 0; j < NROWS; j++) {
        samples[i][j] = (float) Math.random();
      }
    }

    FlatField data = new FlatField(ftype, index_set);
    data.setSamples(samples, false);

    // create a 2-D Display using Java3D
    DisplayImpl display = new DisplayImplJ3D("display", new TwoDDisplayRendererJ3D());

    parallel(display, data);

    // create JFrame (i.e., a window) for display and slider
    JFrame frame = new JFrame("Parallel Coordinates VisAD Application");
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });

    // create JPanel in JFrame
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.setAlignmentY(JPanel.TOP_ALIGNMENT);
    panel.setAlignmentX(JPanel.LEFT_ALIGNMENT);
    frame.getContentPane().add(panel);

    // add display to JPanel
    panel.add(display.getComponent());

    // set size of JFrame and make it visible
    frame.setSize(500, 500);
    frame.setVisible(true);
  }
  public CategoryPanel(
      String name, List<ResourceLocator> locatorList, Set<String> loadedTrackNames) {

    expanded = true;

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setAlignmentX(LEFT_ALIGNMENT);
    // setLayout(null);

    labelBar = new JPanel();
    // labelBar.setBackground(Color.blue);
    labelBar.setLayout(new BoxLayout(labelBar, BoxLayout.X_AXIS));
    labelBar.setBorder(BorderFactory.createRaisedBevelBorder()); //  new LabelBorder(Color.black));
    labelBar.setAlignmentX(LEFT_ALIGNMENT);
    JideButton toggleButton = new JideButton(expanded ? " - " : " + ");
    toggleButton.setButtonStyle(ButtonStyle.HYPERLINK_STYLE);
    labelBar.add(toggleButton);

    labelBar.add(new JLabel(name));
    this.add(labelBar);

    listPanel = new JPanel();
    listPanel.setLayout(new GridLayout(0, 4));
    for (ResourceLocator loc : locatorList) {
      final String trackName = loc.getTrackName();
      JCheckBox cb = new JCheckBox(trackName);
      cb.setSelected(loadedTrackNames.contains(trackName));
      listPanel.add(cb);
    }
    this.add(listPanel);

    toggleButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            expanded = !expanded;
            listPanel.setVisible(expanded);
          }
        });
    labelBar.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent mouseEvent) {
            expanded = !expanded;
            listPanel.setVisible(expanded);
          }
        });
  }
  /** It has all the components of the inspector panel. */
  private void guiComponents() {
    desktop = new JScrollPane();
    pReceive = new JPanel();

    desktop.setBorder(null);
    desktop.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    desktop.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    desktop.setAlignmentX(0.0F);
    desktop.setAlignmentY(0.0F);

    pReceive.setAlignmentX(0.0F);
    pReceive.setAlignmentY(0.0F);
    pReceive.setLayout(new CardLayout());

    desktop.setViewportView(pReceive);
  }
Example #29
0
  private void initSelectedZoom() {
    JPanel selectedZoomPanel = new JPanel();
    selectedZoomPanel.setLayout(new BoxLayout(selectedZoomPanel, BoxLayout.X_AXIS));
    selectedZoomPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    JLabel zoomLabel = new JLabel("Zoom Level:");
    zoomLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
    selectedZoomPanel.add(zoomLabel);

    String displayedZoomName = getDisplayedZoomName(mInitialZoomLevel);
    mCurrentZoomLevelLabel = new JLabel(displayedZoomName);
    mCurrentZoomLevelLabel.setFont(
        new Font(Consts.UI.SMALL_FONT.getFontName(), Font.BOLD, Consts.UI.SMALL_FONT.getSize()));

    selectedZoomPanel.add(mCurrentZoomLevelLabel);

    add(selectedZoomPanel);
  }
  /**
   * Creates the dialog's look and feel panel.
   *
   * @return the dialog's look and feel panel.
   */
  private JPanel createLookAndFeelPanel() {
    JPanel lfPanel; // Look and feel panel.
    JPanel tempPanel; // Temporary panel used to hold the dialog's description.
    int selectedIndex; // Index of the current look and feel in the list.
    String currentLf; // Name of the current look&feel.
    String buffer; // Buffer for look&feel names.

    // Initialises the theme panel.
    lfPanel = new YBoxPanel();
    lfPanel.setAlignmentX(LEFT_ALIGNMENT);
    lfPanel.setBorder(
        BorderFactory.createTitledBorder(Translator.get("prefs_dialog.look_and_feel")));

    // Adds the panel description.
    tempPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tempPanel.add(new JLabel(Translator.get("setup.look_and_feel") + ':'));
    lfPanel.add(tempPanel);

    // Initialises the l&f combo box.
    lfComboBox = new JComboBox();
    lfInfo = UIManager.getInstalledLookAndFeels();
    currentLf = UIManager.getLookAndFeel().getName();
    selectedIndex = -1;
    // Goes through all available look&feels and selects the current one.
    for (int i = 0; i < lfInfo.length; i++) {
      buffer = lfInfo[i].getName();

      // Tries to select current L&F
      if (currentLf.equals(buffer)) selectedIndex = i;
      // Under Mac OS X, Mac L&F is either reported as 'MacOS' or 'MacOS Adaptative'
      // so we need this test
      else if (selectedIndex == -1
          && (currentLf.startsWith(buffer) || buffer.startsWith(currentLf))) selectedIndex = i;
      lfComboBox.addItem(buffer);
    }

    // If no match, selects first one
    if (selectedIndex == -1) selectedIndex = 0;
    lfComboBox.setSelectedIndex(selectedIndex);
    lfComboBox.addActionListener(this);
    lfPanel.add(lfComboBox);

    return lfPanel;
  }