Example #1
0
  @Override
  protected void layoutComponents() {
    batchPanel = new JPanel();
    batchPanel.setLayout(new GridBagLayout());

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

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

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

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

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

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

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

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

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

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

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

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

    setMaximumSize(batchPanel);

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

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

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

    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    this.add(splitPane);
  }
Example #2
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 #3
0
  /** Constructor. */
  public TilePatternsView() {
    super();

    tilePatternIcons = new ArrayList<TilePatternIcon>();

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

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

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

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

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

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

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

    add(tilesetPropertiesView);
    add(Box.createRigidArea(new Dimension(0, 5)));
    add(listScroller);
    add(Box.createRigidArea(new Dimension(0, 5)));
    add(tilePatternView);
  }
Example #4
0
  // Create the primary panel with sub panels.
  private void createMainPanel() {

    // Create the panels in each tab.
    JPanel capturePanel = createCapturePanel();
    JPanel replayPanel = createReplayPanel();

    // Create the tabs and add the new panels to them.
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Capture", capturePanel);
    tabbedPane.addTab("Replay", replayPanel);

    // Create the buttons that always show to select app.
    JPanel topButtons = new JPanel();
    topButtons.setLayout(new BoxLayout(topButtons, BoxLayout.X_AXIS));
    JButton selectApp = new JButton("Select Application");
    JLabel selectedApp = new JLabel("Selected App: ");
    appName = new JLabel();
    topButtons.add(selectApp);
    topButtons.add(Box.createRigidArea(new Dimension(10, 0)));
    topButtons.add(selectedApp);
    topButtons.add(appName);

    selectApp.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            displayAppFrame();
          }
        });

    // Add the buttons and tab structure.
    add(topButtons, BorderLayout.NORTH);
    add(tabbedPane, BorderLayout.CENTER);
  }
 public ModeConfigurationPanel(String mode) {
   this.mode = mode;
   notes = new NotePlayerConfigurationPanel();
   parameters = new CombinedParameterConfigurationPanel();
   setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
   add(notes);
   add(Box.createRigidArea(new Dimension(10, 0)));
   add(parameters);
 }
Example #6
0
  /** Constructor */
  public WPart11Dialog() {
    super(null);
    setVisible(false);

    m_pnlDisplay = new JPanel();
    m_pcsTypesMgr = new PropertyChangeSupport(this);
    JScrollPane spDisplay = new JScrollPane(m_pnlDisplay);
    m_pnlDisplay.setLayout(new WGridLayout(0, 2));
    addComp(spDisplay);
    initBlink();

    buttonPane.removeAll();
    // Add the buttons to the panel with space between buttons.
    m_btnChecksum = new JButton("Make new checksum");
    buttonPane.add(m_btnChecksum);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(validateButton);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(closeButton);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(abandonButton);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(helpButton);
    setHelpEnabled(false);

    closeButton.setActionCommand("close");
    closeButton.addActionListener(this);
    validateButton.setActionCommand("validate");
    validateButton.addActionListener(this);
    abandonButton.setActionCommand("cancel");
    abandonButton.addActionListener(this);
    helpButton.setActionCommand("help");
    helpButton.addActionListener(this);
    m_btnChecksum.setActionCommand("checksum");
    m_btnChecksum.addActionListener(this);

    setCloseEnabled(true);
    setAbandonEnabled(true);

    setTitle("Configuration");
    setLocation(300, 500);
    setResizable(true);
    setSize(450, 300);
  }
Example #7
0
  // constructor of TextFrame
  public TextFrame() {
    // this.message = message;
    message = "Click to Edit Text";
    messageFont = new Font("Arial", Font.PLAIN, 30);
    foreground = Color.black;
    background = Color.white;

    // custom dialog (it's a private class inside TextFrame)
    cd = new CustomDialog(this);

    messageField = new JTextField();
    messageField.setPreferredSize(new Dimension(300, 200));
    messageField.setEditable(false);
    messageField.setHorizontalAlignment(SwingConstants.CENTER);
    messageField.setAlignmentX(Component.CENTER_ALIGNMENT);
    updateMessage();

    customize = new JButton("Customize");
    customize.setMaximumSize(customize.getPreferredSize());
    customize.setAlignmentX(Component.CENTER_ALIGNMENT);

    apply = new JButton("Apply");
    apply.setMaximumSize(customize.getPreferredSize());
    apply.setAlignmentX(Component.CENTER_ALIGNMENT);

    /*add the listeners*/
    customize.addActionListener(this);
    apply.addActionListener(this);
    messageField.addMouseListener(new PopUpClass());

    // customize
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(customize);
    p.add(Box.createRigidArea(new Dimension(0, 25)));
    p.add(messageField);
    p.add(Box.createRigidArea(new Dimension(0, 25)));
    p.add(apply);
    p.setBorder(BorderFactory.createEmptyBorder(25, 25, 25, 25));

    // make panel this JFrame's content pane

    this.setContentPane(p);
  }
Example #8
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
  public static void graphicSetup(DecisionPromptEditor toBuild) {

    toBuild.setLayout(new BoxLayout(toBuild, BoxLayout.PAGE_AXIS));

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

    toBuild.add(row);
    toBuild.add(Box.createRigidArea(new Dimension(0, 10)));
  }
  /**
   * Update the dialog contents.
   *
   * @param jheader The job portion of the dialog header.
   * @param job The queue job.
   * @param info The current job status information.
   */
  public void updateContents(
      String jheader, QueueJob job, QueueJobInfo info, SubProcessExecDetails details) {
    ActionAgenda agenda = job.getActionAgenda();
    QueueJobResults results = info.getResults();

    String dir = "-";
    if ((agenda != null) && (info.getOsType() != null))
      dir = agenda.getTargetPath(info.getOsType()).toString();

    String hostname = "";
    if (info.getHostname() != null) hostname = (" [" + info.getHostname() + "]");

    String command = "-";
    if (details != null) command = details.getCommand();

    TreeMap<String, String> env = new TreeMap<String, String>();
    if (details != null) env = details.getEnvironment();

    setHeader("Execution Details -" + jheader + hostname);

    pWorkingDirField.setText(dir);

    BaseAction action = job.getAction();
    pCommandLineLabel.setText(
        "Action Command:  " + action.getName() + " (v" + action.getVersionID() + ")");
    pCommandLineArea.setText(command);

    {
      Component comps[] = UIFactory.createTitledPanels();
      {
        JPanel tpanel = (JPanel) comps[0];
        JPanel vpanel = (JPanel) comps[1];

        if (!env.isEmpty()) {
          String last = env.lastKey();
          for (String key : env.keySet()) {
            String value = env.get(key);

            JTextField field =
                UIFactory.createTitledTextField(tpanel, key + ":", sTSize, vpanel, value, sVSize);
            field.setHorizontalAlignment(JLabel.LEFT);

            if (!key.equals(last)) UIFactory.addVerticalSpacer(tpanel, vpanel, 3);
          }
        } else {
          tpanel.add(Box.createRigidArea(new Dimension(sTSize, 0)));
          vpanel.add(Box.createHorizontalGlue());
        }
      }

      pEnvLabel.setText("Toolset Environment:  " + agenda.getToolset());
      pEnvScroll.setViewportView(comps[2]);
    }
  }
Example #11
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());
  }
  public void createFileChooserDemo() {
    theImage = new JLabel("");
    jpgIcon = createImageIcon("filechooser/jpgIcon.jpg", "jpg image");
    gifIcon = createImageIcon("filechooser/gifIcon.gif", "gif image");

    JPanel demoPanel = getDemoPanel();
    demoPanel.setLayout(new BoxLayout(demoPanel, BoxLayout.Y_AXIS));

    JPanel innerPanel = new JPanel();
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS));

    demoPanel.add(Box.createRigidArea(VGAP20));
    demoPanel.add(innerPanel);
    demoPanel.add(Box.createRigidArea(VGAP20));

    innerPanel.add(Box.createRigidArea(HGAP20));

    // Create a panel to hold buttons
    JPanel buttonPanel =
        new JPanel() {
          public Dimension getMaximumSize() {
            return new Dimension(getPreferredSize().width, super.getMaximumSize().height);
          }
        };
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));

    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createPlainFileChooserButton());
    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createPreviewFileChooserButton());
    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createCustomFileChooserButton());
    buttonPanel.add(Box.createVerticalGlue());

    // Create a panel to hold the image
    JPanel imagePanel = new JPanel();
    imagePanel.setLayout(new BorderLayout());
    imagePanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
    JScrollPane scroller = new JScrollPane(theImage);
    scroller.getVerticalScrollBar().setUnitIncrement(10);
    scroller.getHorizontalScrollBar().setUnitIncrement(10);
    imagePanel.add(scroller, BorderLayout.CENTER);

    // add buttons and image panels to inner panel
    innerPanel.add(buttonPanel);
    innerPanel.add(Box.createRigidArea(HGAP30));
    innerPanel.add(imagePanel);
    innerPanel.add(Box.createRigidArea(HGAP20));
  }
  /**
   * The constructor.
   *
   * @param parent The parent window.
   * @param idata The installation data.
   */
  public SudoPanel(InstallerFrame parent, InstallData idata) {
    super(parent, idata);

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

    add(
        new JLabel(
            /*parent.langpack.getString("SudoPanel.info")*/ "For installing administrator privileges are necessary",
            JLabel.TRAILING));

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

    add(
        new JLabel(
            /*parent.langpack.getString("SudoPanel.tip")*/ "Please note that passwords are case-sensitive",
            parent.icons.getImageIcon("tip"),
            JLabel.TRAILING));

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

    JPanel spacePanel = new JPanel();
    spacePanel.setAlignmentX(LEFT_ALIGNMENT);
    spacePanel.setAlignmentY(CENTER_ALIGNMENT);
    spacePanel.setBorder(BorderFactory.createEmptyBorder(80, 30, 0, 50));
    spacePanel.setLayout(new BorderLayout(5, 5));
    spacePanel.add(
        new JLabel(
            /*parent.langpack.getString("SudoPanel.specifyAdminPassword")*/ "Please specify your password:"),
        BorderLayout.NORTH);
    passwordField = new JPasswordField();
    passwordField.addActionListener(this);
    JPanel space2Panel = new JPanel();
    space2Panel.setLayout(new BorderLayout());
    space2Panel.add(passwordField, BorderLayout.NORTH);
    space2Panel.add(Box.createRigidArea(new Dimension(0, 5)), BorderLayout.CENTER);
    spacePanel.add(space2Panel, BorderLayout.CENTER);
    add(spacePanel);
  }
      public CombinedParameterConfigurationPanel() {
        setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
        ParameterConfigurationPanel panel =
            new ParameterConfigurationPanel("X parameter", SensorType.X_SENSOR);
        panels.put(SensorType.X_SENSOR, panel);
        add(panel);
        add(Box.createRigidArea(new Dimension(10, 0)));

        panel = new ParameterConfigurationPanel("Y parameter", SensorType.Y_SENSOR);
        panels.put(SensorType.Y_SENSOR, panel);
        add(panel);
        add(Box.createRigidArea(new Dimension(10, 0)));

        panel = new ParameterConfigurationPanel("Knob", SensorType.POT_SENSOR);
        panels.put(SensorType.POT_SENSOR, panel);
        add(panel);
        add(Box.createRigidArea(new Dimension(10, 0)));

        panel = new ParameterConfigurationPanel("Button", SensorType.BUTTON1_SENSOR);
        panels.put(SensorType.BUTTON1_SENSOR, panel);
        add(panel);
        add(Box.createRigidArea(new Dimension(10, 0)));
      }
Example #15
0
  @Override
  protected JPanel createButtonPanel() {
    JButton cancel = new JButton("Storno");
    cancel.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            actionCancel();
          }
        });

    JButton save = new JButton("Uložit změny");
    save.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            try {
              saveSettings();
              close();
            } catch (InvalidAttributeValueException ex) {
              MessageDialog.error("Nesprávně vyplněný formulář", ex.getMessage(), instance);
            }
          }
        });

    Box buttons = Box.createHorizontalBox();
    buttons.add(Box.createRigidArea(new Dimension(WINDOW_WIDTH - 190, 0)));
    buttons.add(cancel);
    buttons.add(Box.createRigidArea(new Dimension(10, 0)));
    buttons.add(save);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(buttons);

    return buttonPanel;
  }
  /**
   * Initialize the common user interface components.
   *
   * <p>
   */
  protected JButton[] initUI(
      String title, JComponent extraComps, String confirm, String[][] extra, String cancel) {
    JButton[] extraBtns = null;

    /* create dialog body components */
    {
      JPanel body = new JPanel();
      body.setName("MainDialogPanel");

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

      body.add(UIFactory.createPanelLabel("Existing Layouts:"));

      body.add(Box.createRigidArea(new Dimension(0, 4)));

      {
        DefaultMutableTreeNode root = new DefaultMutableTreeNode(new TreeData(), true);
        DefaultTreeModel model = new DefaultTreeModel(root, true);

        JTree tree = new JFancyTree(model);
        pTree = tree;
        tree.setName("DarkTree");

        tree.setCellRenderer(new JLayoutTreeCellRenderer());
        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

        {
          JScrollPane scroll =
              UIFactory.createScrollPane(
                  pTree,
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED,
                  ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                  new Dimension(230, 120),
                  new Dimension(230, 150),
                  null);

          body.add(scroll);
        }
      }

      if (extraComps != null) body.add(extraComps);

      extraBtns = super.initUI(title, body, confirm, null, extra, cancel);
    }

    return extraBtns;
  }
Example #17
0
 public Instruction(int x, int y) {
   this.setSize(x, y);
   try {
     intro = new ImageIcon("introScreen.jpg");
   } catch (Exception e) {
   }
   this.add(Box.createRigidArea(new Dimension(10, 15)));
   this.setLayout(new FlowLayout(FlowLayout.CENTER, this.getWidth(), 25));
   for (int i = 0; i < allIns.length; i++) {
     allIns[i].setFont(new Font("Serif", Font.BOLD, 18));
     allIns[i].setForeground(Color.yellow);
     this.add(allIns[i]);
   }
   back.setPreferredSize(new Dimension(80, 40));
   back.addActionListener(this);
   this.add(back);
 }
Example #18
0
  /** Constructor. */
  public TilePatternAnimationView() {
    super();

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

    // list for the animation sequence
    sequenceField = new EnumerationChooser<Animation>(Animation.class);
    sequenceField.addActionListener(this);

    // list for the separation
    separationField = new EnumerationIconChooser<AnimationSeparation>(AnimationSeparation.class);
    separationField.addActionListener(this);

    // add the two lists
    add(sequenceField);
    add(Box.createRigidArea(new Dimension(5, 0)));
    add(separationField);
  }
Example #19
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 #20
0
 public TitleScreen(int x, int y) {
   this.setSize(x, y);
   try {
     intro = new ImageIcon("introScreen.jpg");
     tetris = new ImageIcon("tetrisWord.png");
   } catch (Exception e) {
   }
   ;
   start.setPreferredSize(new Dimension(80, 40));
   highScore.setPreferredSize(new Dimension(150, 40));
   instructions.setPreferredSize(new Dimension(150, 40));
   exit.setPreferredSize(new Dimension(80, 40));
   start.addActionListener(this);
   highScore.addActionListener(this);
   instructions.addActionListener(this);
   exit.addActionListener(this);
   this.add(Box.createRigidArea(new Dimension(10, this.getHeight() / 2 - 50)));
   this.setLayout(new FlowLayout(FlowLayout.CENTER, this.getWidth(), 25));
   this.add(start);
   this.add(instructions);
   this.add(highScore);
   this.add(exit);
 }
Example #21
0
  /** @param args */
  public static void main(String[] args) {
    JPanel boxPane = new JPanel(new BorderLayout());
    // boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.LINE_AXIS));
    // boxPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
    // boxPane.add(Box.createVerticalGlue());
    Example1 ex = new Example1();
    // boxPane.add(ex);

    boxPane.add(Box.createRigidArea(new Dimension(10, 0)));
    Button btnStartStop = new Button("Start / Stop");
    btnStartStop.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            log.info("Suspending / Resuming the simulation thread, current state = " + helper.stop);
            if (helper.stop == true) helper.unpause();
            else helper.pause();
          }
        });
    // btnStartStop.setMaximumSize(new Dimension(100, 100));
    boxPane.add(btnStartStop, BorderLayout.PAGE_START);

    JScrollPane worldScrollPane = new JScrollPane(ex);

    final JSplitPane splitPane =
        new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, worldScrollPane, boxPane);
    splitPane.setResizeWeight(0.5);
    splitPane.setOneTouchExpandable(true);
    splitPane.setContinuousLayout(true);

    worldScrollPane.addAncestorListener(
        new AncestorListener() {
          @Override
          public void ancestorRemoved(AncestorEvent arg0) {
            splitPane.repaint();
          }

          @Override
          public void ancestorMoved(AncestorEvent arg0) {
            splitPane.repaint();
          }

          @Override
          public void ancestorAdded(AncestorEvent arg0) {
            splitPane.repaint();
          }
        });

    JFrame f = new JFrame();
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
    f.add(splitPane, BorderLayout.CENTER);
    // f.add(boxPane);
    f.pack();
    f.setVisible(true);

    helper = new SimulationHelper(ex.getGraphics());

    helper.start();

    // layeredPane.setBorder(BorderFactory.createTitledBorder("Move the Mouse to Move Duke"));

  }
  public CPLayersPalette(CPCommonController controller) {
    super(controller);

    title = "Layers";

    // Widgets creation

    Image icons = controller.loadImage("smallicons.png");

    addButton = new CPIconButton(icons, 16, 16, 0, 1);
    addButton.addController(this);
    addButton.setCPActionCommand(CPCommandId.AddLayer);

    removeButton = new CPIconButton(icons, 16, 16, 1, 1);
    removeButton.addController(this);
    removeButton.setCPActionCommand(CPCommandId.RemoveLayer);

    alphaSlider = new CPAlphaSlider();

    blendCombo = new JComboBox<String>(modeNames);
    blendCombo.addActionListener(this);

    lw = new CPLayerWidget();
    renameField = new CPRenameField();
    lw.add(renameField);
    scrollPane = new JScrollPane(lw);

    cbSampleAllLayers = new JCheckBox("Sample All Layers");
    cbSampleAllLayers.setSelected(controller.artwork.isSampleAllLayers());
    cbSampleAllLayers.addItemListener(this);

    cbLockAlpha = new JCheckBox("Lock Alpha");
    cbLockAlpha.setSelected(controller.artwork.isLockAlpha());
    cbLockAlpha.addItemListener(this);

    // Layout

    // Add/Remove Layer
    Box hb = Box.createHorizontalBox();
    hb.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    hb.add(addButton);
    hb.add(Box.createRigidArea(new Dimension(5, 0)));
    hb.add(removeButton);
    hb.add(Box.createHorizontalGlue());

    // blend mode
    blendCombo.setPreferredSize(new Dimension(100, 16));

    Box hb2 = Box.createHorizontalBox();
    hb2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    hb2.add(blendCombo);
    hb2.add(Box.createHorizontalGlue());

    // layer opacity
    alphaSlider.setPreferredSize(new Dimension(100, 16));
    alphaSlider.setMaximumSize(new Dimension(100, 16));

    Box hb3 = Box.createHorizontalBox();
    hb3.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    hb3.add(alphaSlider);
    hb3.add(Box.createRigidArea(new Dimension(0, 16)));
    hb3.add(Box.createHorizontalGlue());

    Box hb4 = Box.createHorizontalBox();
    hb4.add(cbSampleAllLayers);
    hb4.add(Box.createHorizontalGlue());

    Box hb5 = Box.createHorizontalBox();
    hb5.add(cbLockAlpha);
    hb5.add(Box.createHorizontalGlue());

    Box vb = Box.createVerticalBox();
    vb.add(hb2);
    vb.add(hb3);
    vb.add(hb4);
    vb.add(hb5);

    setLayout(new BorderLayout());
    add(scrollPane, BorderLayout.CENTER);
    add(vb, BorderLayout.PAGE_START);
    add(hb, BorderLayout.PAGE_END);

    // Set initial values
    CPArtwork artwork = controller.getArtwork();
    alphaSlider.setValue(artwork.getActiveLayer().getAlpha());

    // add listeners

    addListener();
    // validate();
    // pack();
  }
Example #23
0
  public ShowResults(SharkPanel _sp, String _files[], double _scores[], int _nrpairs[]) {
    sp = _sp;
    files = _files;
    scores = _scores;
    nrpairs = _nrpairs;
    LogFile lf = new LogFile("SearchResults_");
    DefaultListModel listModel = new DefaultListModel();
    for (int i = 0; i < files.length; i++) {
      GetImageFile gif = new GetImageFile(files[i]);
      Integer ii = new Integer(_nrpairs[i]);
      int tmpval = (int) (1000.0 * _scores[i]);
      Double dd = new Double((double) tmpval / 1000.0);
      String tmp = gif.getImageString();
      String s =
          tmp.substring(tmp.lastIndexOf('\\') + 1, tmp.length())
              + "\t"
              + ii.toString()
              + "\t"
              + dd.toString();
      String ddval = dd.toString();
      while (ddval.length() < 5) ddval += "0";
      if (i < 9)
        listModel.addElement(
            "  "
                + (i + 1)
                + ".  "
                + ddval
                + "   "
                + tmp.substring(tmp.lastIndexOf('\\') + 1, tmp.length()));
      else
        listModel.addElement(
            (i + 1)
                + ".  "
                + ddval
                + "   "
                + tmp.substring(tmp.lastIndexOf('\\') + 1, tmp.length()));
      lf.write(s);
    }
    lf.close();

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

    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setDragEnabled(false);
    list.addMouseListener(new MouseClickListener());

    JScrollPane listView = new JScrollPane(list);
    listView.setPreferredSize(new Dimension(250, 250));

    showButton = new JButton("Visual comparison");
    showButton.addActionListener(this);
    showButton.setMnemonic('V');
    showButton.setEnabled(false);

    JButton closeButton = new JButton("Close");
    closeButton.addActionListener(this);
    closeButton.setMnemonic('C');

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.add(listView, BorderLayout.CENTER);
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    JPanel panel2 = new JPanel();
    panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
    panel2.add(showButton);
    panel2.add(Box.createRigidArea(new Dimension(10, 1)));
    panel2.add(closeButton);

    add(panel);
    add(Box.createRigidArea(new Dimension(1, 10)));
    add(panel2);

    if (frame != null) frame.dispose();
    frame = new JFrame("I3S: Search results");
    frame.setContentPane(this);
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            frame.dispose();
            frame = null;
          }
        });
    frame.setSize(new Dimension(400, 300));
    frame.setLocation(200, 200);

    ImageIcon imageIcon = new ImageIcon(this.getClass().getResource("/Simages/icon.gif"));
    frame.setIconImage(imageIcon.getImage());

    frame.pack();
    frame.setVisible(true);
  }
Example #24
0
    public PlayerView(String player) {
      playerName = new String(player);

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

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

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

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

      //
      // topPanel.setLayout( new BorderLayout());
      // topPanel.add(namePanel, BorderLayout.WEST);
      // topPanel.add(scorePanel, BorderLayout.EAST);
      //
      // Create bordering for top panel
      Border raisedBevel, loweredBevel, compound;

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

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

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

      setLayout(new BorderLayout(30, 30));
      add(topPanel, BorderLayout.NORTH);
      add(wordPanel, BorderLayout.CENTER);
    }
  /** Create GUI elements */
  private void loadGUI() {
    setTitle("Wifi QRCode Generator");

    mainPanel = new JPanel();
    BoxLayout vBoxLayout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS);
    mainPanel.setLayout(vBoxLayout);

    int LABEL_WIDTH = 100;
    int LABEL_HEIGHT = 30;

    int EDIT_WIDTH = 200;
    int EDIT_HEIGHT = 30;

    // guide label
    {
      // This layout simply makes label looks left-alignmented
      JPanel barPanel = new JPanel();
      BoxLayout barHLayout = new BoxLayout(barPanel, BoxLayout.X_AXIS);
      barPanel.setLayout(barHLayout);

      JLabel ssoGuideLabel = new JLabel("Enter your SSO and click button below to login");
      ssoGuideLabel.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));
      barPanel.add(ssoGuideLabel);
      mainPanel.add(barPanel);
    }

    Font gFont = new Font(Font.SANS_SERIF, Font.PLAIN, 13);

    Config config = Config.instance();

    // email password remember password
    {
      JPanel userPanel = new JPanel();
      BoxLayout hBoxLayout = new BoxLayout(userPanel, BoxLayout.X_AXIS);
      userPanel.setLayout(hBoxLayout);
      JLabel emailLabel = new JLabel("Email:");
      Dimension labelDimension = new Dimension(LABEL_WIDTH, LABEL_HEIGHT);
      emailLabel.setMinimumSize(labelDimension);
      emailLabel.setPreferredSize(labelDimension);
      emailLabel.setMaximumSize(labelDimension);
      userPanel.add(emailLabel);
      userPanel.add(Box.createRigidArea(new Dimension(5, 0)));
      emailField = new TextField();
      emailField.setMinimumSize(new Dimension(EDIT_WIDTH, EDIT_HEIGHT));
      emailField.setMaximumSize(new Dimension(EDIT_WIDTH + 300, EDIT_HEIGHT));
      emailField.setFont(gFont);
      emailField.setText(config.getEmail());

      userPanel.add(emailField);

      mainPanel.add(userPanel);

      JPanel passwordPanel = new JPanel();
      BoxLayout hBoxLayout2 = new BoxLayout(passwordPanel, BoxLayout.X_AXIS);
      passwordPanel.setLayout(hBoxLayout2);
      JLabel passwordLabel = new JLabel("SSO Password:"******"Remember password", false);
      rememberPasswordCheckbox.setState(config.getRememberPassword());

      mainPanel.add(rememberPasswordCheckbox);
      mainPanel.add(Box.createHorizontalGlue());
    }

    JPanel centerPanel = new JPanel();
    BorderLayout bLayout = new BorderLayout();
    centerPanel.setLayout(bLayout);

    buttonGetPassword = new JButton(idleButtonText);
    Font font = new Font(Font.SERIF, Font.BOLD, 18);
    buttonGetPassword.setFont(font);
    buttonGetPassword.setMinimumSize(new Dimension(300, 50));
    buttonGetPassword.setPreferredSize(new Dimension(300, 50));
    buttonGetPassword.setMaximumSize(new Dimension(300, 50));

    centerPanel.add(buttonGetPassword, BorderLayout.CENTER);

    hintLabel = new JLabel("Enter your SSO and click button to start");
    hintLabel.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 15));

    centerPanel.add(hintLabel, BorderLayout.SOUTH);
    mainPanel.add(centerPanel);

    wifiPasswordField = new TextField("Wifi password has not been generated");
    mainPanel.add(wifiPasswordField);

    JPanel qrCenterPanel = new JPanel();
    BorderLayout bLayout2 = new BorderLayout();
    qrCenterPanel.setLayout(bLayout2);
    qrCodeLabel = new JLabel("");
    qrCodeLabel.setMinimumSize(new Dimension(400, 400));
    qrCodeLabel.setPreferredSize(new Dimension(400, 400));
    qrCodeLabel.setMaximumSize(new Dimension(400, 400));
    qrCodeLabel.setHorizontalAlignment(JLabel.CENTER);
    qrCodeLabel.setVerticalAlignment(JLabel.CENTER);
    qrCodeLabel.setIcon(idleIcon);

    qrCenterPanel.add(qrCodeLabel, BorderLayout.CENTER);
    mainPanel.add(qrCenterPanel);

    // client download section
    {
      Font clientFont = new Font(Font.SANS_SERIF, Font.BOLD, 15);
      Dimension clientDimension = new Dimension(200, 30);
      JPanel clientPanel = new JPanel();
      BorderLayout cp_bLayout = new BorderLayout();
      clientPanel.setLayout(cp_bLayout);
      HyberLinkLabel androidLabel =
          new HyberLinkLabel(
              " [ Android Client ] ",
              "https://github.com/tangyanhan/ClrGstAutoLogin-/blob/master/ClrGstAutoConnect/bin/ClrGstAutoConnect.apk");
      androidLabel.setMinimumSize(clientDimension);
      androidLabel.setFont(clientFont);
      clientPanel.add(androidLabel, BorderLayout.WEST);

      HyberLinkLabel iosLabel = new HyberLinkLabel(" [ iOS Client ] ", "");
      iosLabel.setMinimumSize(clientDimension);
      iosLabel.setFont(clientFont);
      clientPanel.add(iosLabel, BorderLayout.EAST);

      mainPanel.add(clientPanel);
    }

    add(mainPanel);

    this.pack();
    this.setVisible(true);
    this.setLocation(300, 100);
    this.setSize(500, 730);

    buttonGetPassword.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {

            long elapsed = Calendar.getInstance().getTimeInMillis() - lastClickTime;

            // If we got the successfull password 5 minutes ago
            if (((elapsed / 1000) / 60) < 5) {
              hintLabel.setText("Take a rest! You have got the QR code already!");
              return;
            }

            fetchPassword();

            if (!Config.instance().getWifiPassword().isEmpty())
              lastClickTime = Calendar.getInstance().getTimeInMillis();
          }
        });
  }
  /**
   * Make a GUI for the battleship game.
   *
   * @param game Game object that keeps up with the current state of the game.
   */
  public BattleshipGUI(Battleship game) {
    this.game = game;

    this.game = game;
    // Ships are visible on the human grid but not on the computer grid
    // (last argument)
    humanGrid = new Grid(game.getHumanBoard(), this, true);
    computerGrid = new Grid(game.getComputerBoard(), this, false);
    setTitle("Battleship Game");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLayout(new BorderLayout());

    // Add a message field centered below the game
    Box gamePanel = new Box(BoxLayout.X_AXIS);
    add(gamePanel, BorderLayout.CENTER);
    message = new JLabel("Game begins", JLabel.CENTER);
    message.setFont(DEFAULT_FONT);
    add(message, BorderLayout.SOUTH);

    // Add human and computer panels to the game; the human panel has a
    // title, grid, and buttons; the computer panel has only a title and a
    // grid
    JPanel human = new JPanel();
    human.setLayout(new BoxLayout(human, BoxLayout.Y_AXIS));
    JPanel computer = new JPanel();
    computer.setLayout(new BoxLayout(computer, BoxLayout.Y_AXIS));
    human.setAlignmentY(Component.TOP_ALIGNMENT);
    gamePanel.add(human);
    gamePanel.add(Box.createRigidArea(new Dimension(5, 0)));
    computer.setAlignmentY(Component.TOP_ALIGNMENT);
    gamePanel.add(computer);

    // Add three parts to the human panel
    JLabel humanLabel = new JLabel("Human", JLabel.CENTER);
    humanLabel.setFont(DEFAULT_FONT);
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    human.add(humanLabel);
    human.add(humanGrid);
    human.add(buttonPanel);

    // Set up the buttons
    hButton = new JButton("Horizontal");
    hButton.setFont(DEFAULT_FONT);
    hButton.addActionListener(this);
    vButton = new JButton("Vertical");
    vButton.setFont(DEFAULT_FONT);
    vButton.addActionListener(this);
    buttonPanel.add(hButton);
    buttonPanel.add(vButton);

    // Add two parts to the computer panel
    JLabel computerLabel = new JLabel("Computer", JLabel.CENTER);
    computerLabel.setFont(DEFAULT_FONT);
    computer.add(computerLabel);
    computer.add(computerGrid);

    updateStatus();

    pack();
    setVisible(true);
  }
  private void InitUI() {
    System.out.println("Create new Opportunity");

    setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
    add(Box.createRigidArea(new Dimension(0, 35)));

    eventTsText = new JTextField("2011-07-11 11:00:00.000 +0:00");
    eventTsLabel = new JLabel();

    try {
      ownerId =
          new JComboBox(
              tools.readLines("D:\\DataGenerator\\DataGenerator\\resources\\employees.txt"));
      ownerId.setSelectedIndex(-1);
    } catch (IOException e) {
      e.printStackTrace();
    }

    ownerIdLabel = new JLabel();

    try {
      accountId =
          new JComboBox(
              tools.readLines("D:\\DataGenerator\\DataGenerator\\resources\\accounts.txt"));
      accountId.setSelectedIndex(-1);
    } catch (IOException e) {
      e.printStackTrace();
    }
    accountIdLabel = new JLabel();

    try {
      leadSource =
          new JComboBox(
              tools.readLines("D:\\DataGenerator\\DataGenerator\\resources\\leadSources.txt"));
      leadSource.setSelectedIndex(-1);
    } catch (IOException e) {
      e.printStackTrace();
    }
    leadSourceLabel = new JLabel();

    ECDText = new JTextField("2011-07-11");
    ECDLabel = new JLabel();

    amountText = new JTextField("1000");
    amountLabel = new JLabel();

    nameText = new JTextField("");
    nameLabel = new JLabel();

    descriptionText = new JTextField("");
    descriptionLabel = new JLabel();

    stageNameText = new JTextField("");
    stageNameLabel = new JLabel();

    stageDescrText = new JTextField("");
    stageDescrLabel = new JLabel();

    statusText = new JTextField("");
    statusLabel = new JLabel();

    resultText = new JTextField("");
    resultLabel = new JLabel();

    isClosed = new JCheckBox("IsClosed");
    isWon = new JCheckBox("IsWon");

    createButton = new JButton("Create");
    cleanFormButton = new JButton("Clean Form");
    generateSQLButton = new JButton("Generate SQL");

    ownerId.setBounds(210, 20, 190, 30);
    ownerIdLabel.setBounds(30, 20, 150, 30);
    ownerIdLabel.setText("Owner ID");

    accountId.setBounds(210, 50, 190, 30);
    accountIdLabel.setBounds(30, 50, 150, 30);
    accountIdLabel.setText("Account ID");

    leadSource.setBounds(210, 80, 190, 30);
    leadSourceLabel.setBounds(30, 80, 150, 30);
    leadSourceLabel.setText("Lead Source");

    eventTsText.setBounds(210, 110, 190, 30);
    eventTsLabel.setBounds(30, 110, 150, 30);
    eventTsLabel.setText("Event TS");

    ECDText.setBounds(210, 140, 190, 30);
    ECDLabel.setBounds(30, 140, 150, 30);
    ECDLabel.setText("Expected Close Date");

    amountText.setBounds(210, 170, 150, 30);
    amountLabel.setBounds(30, 170, 80, 30);
    amountLabel.setText("Amount");

    nameText.setBounds(210, 200, 150, 30);
    nameLabel.setBounds(30, 200, 80, 30);
    nameLabel.setText("Name");

    descriptionText.setBounds(210, 230, 150, 30);
    descriptionLabel.setBounds(30, 230, 80, 30);
    descriptionLabel.setText("Description");

    stageNameText.setBounds(210, 260, 150, 30);
    stageNameLabel.setBounds(30, 260, 80, 30);
    stageNameLabel.setText("Stage Name");

    stageDescrText.setBounds(210, 290, 150, 30);
    stageDescrLabel.setBounds(30, 290, 80, 30);
    stageDescrLabel.setText("Stage Description");

    statusText.setBounds(210, 320, 150, 30);
    statusLabel.setBounds(30, 320, 80, 30);
    statusLabel.setText("Status");

    resultText.setBounds(210, 350, 150, 30);
    resultLabel.setBounds(30, 350, 80, 30);
    resultLabel.setText("Result");

    isClosed.setBounds(30, 380, 90, 30);
    isWon.setBounds(210, 380, 90, 30);

    createButton.setBounds(20, 420, 90, 30);
    cleanFormButton.setBounds(125, 420, 120, 30);
    generateSQLButton.setBounds(260, 420, 120, 30);

    setLayout(null);

    add(ownerId);
    add(ownerIdLabel);

    add(accountId);
    add(accountIdLabel);

    add(leadSource);
    add(leadSourceLabel);

    add(eventTsLabel);
    add(eventTsText);

    add(ECDText);
    add(ECDLabel);

    add(amountText);
    add(amountLabel);

    add(nameText);
    add(nameLabel);

    add(descriptionText);
    add(descriptionLabel);

    add(stageNameText);
    add(stageNameLabel);

    add(stageDescrText);
    add(stageDescrLabel);

    add(statusText);
    add(statusLabel);

    add(resultText);
    add(resultLabel);

    add(isClosed);
    add(isWon);

    add(createButton);
    add(cleanFormButton);
    add(generateSQLButton);

    setSize(420, 510);
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setLocationRelativeTo(null);
    setVisible(true);
  }
  /** Construct a new dialog. */
  public JExecDetailsDialog() {
    super("Execution Details");

    /* create dialog body components */
    {
      JPanel body = new JPanel();
      body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS));

      {
        JPanel panel = new JPanel();
        panel.setName("MainDialogPanel");
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

        /* working directory */
        {
          panel.add(UIFactory.createPanelLabel("Working Directory:"));

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

          JTextField field = UIFactory.createTextField(null, 100, JLabel.LEFT);
          pWorkingDirField = field;

          panel.add(field);
        }

        body.add(panel);
      }

      {
        JPanel panel = new JPanel();
        panel.setName("HorizontalBar");

        Dimension size = new Dimension(100, 7);
        panel.setPreferredSize(size);
        panel.setMinimumSize(size);
        panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 7));

        body.add(panel);
      }

      /* command line */
      JPanel above = new JPanel();
      {
        above.setName("MainDialogPanel");
        above.setLayout(new BoxLayout(above, BoxLayout.Y_AXIS));

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createRigidArea(new Dimension(4, 0)));

          {
            JLabel label = new JLabel("X");
            pCommandLineLabel = label;

            label.setName("PanelLabel");

            hbox.add(label);
          }

          hbox.add(Box.createHorizontalGlue());

          above.add(hbox);
        }

        above.add(Box.createRigidArea(new Dimension(0, 4)));

        {
          JTextArea area = new JTextArea(null, 5, 70);
          pCommandLineArea = area;

          area.setName("CodeTextArea");
          area.setLineWrap(true);
          area.setWrapStyleWord(true);
          area.setEditable(false);
        }

        {
          JScrollPane scroll =
              UIFactory.createScrollPane(
                  pCommandLineArea,
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER,
                  ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                  new Dimension(100, 27),
                  null,
                  null);

          above.add(scroll);
        }
      }

      /* environment */
      JPanel below = new JPanel();
      {
        below.setName("MainDialogPanel");
        below.setLayout(new BoxLayout(below, BoxLayout.Y_AXIS));

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createRigidArea(new Dimension(4, 0)));

          {
            JLabel label = new JLabel("X");
            pEnvLabel = label;

            label.setName("PanelLabel");

            hbox.add(label);
          }

          hbox.add(Box.createHorizontalGlue());

          below.add(hbox);
        }

        below.add(Box.createRigidArea(new Dimension(0, 4)));

        Component comps[] = UIFactory.createTitledPanels();
        {
          JPanel tpanel = (JPanel) comps[0];
          JPanel vpanel = (JPanel) comps[1];

          tpanel.add(Box.createRigidArea(new Dimension(sTSize, 0)));
          vpanel.add(Box.createHorizontalGlue());
        }

        {
          pEnvScroll =
              UIFactory.createScrollPane(
                  comps[2],
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER,
                  ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                  new Dimension(100, 50),
                  new Dimension(100, 300),
                  null);

          below.add(pEnvScroll);
        }
      }

      {
        JVertSplitPanel split = new JVertSplitPanel(above, below);
        split.setResizeWeight(0.0);
        split.setAlignmentX(0.5f);

        body.add(split);
      }

      super.initUI("X", body, null, null, null, "Close", null);
    }
  }
Example #29
0
  /** Construct a new dialog. */
  public JArchiveDialog() {
    super("Archive Tool");

    pPrivilegeDetails = new PrivilegeDetails();

    /* create dialog body components */
    {
      JPanel cpanel = new JPanel();
      {
        cpanel.setName("ButtonDialogPanel");
        cpanel.setLayout(new BoxLayout(cpanel, BoxLayout.Y_AXIS));

        cpanel.add(UIFactory.createPanelLabel("Candidate Versions:"));

        cpanel.add(Box.createRigidArea(new Dimension(0, 4)));

        {
          ArchiveCandidateTableModel model = new ArchiveCandidateTableModel();
          pCandidateTableModel = model;

          JTablePanel tpanel = new JTablePanel(model);
          pCandidateTablePanel = tpanel;

          cpanel.add(tpanel);
        }

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

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createHorizontalGlue());
          hbox.add(Box.createRigidArea(new Dimension(10, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Search...",
                    "candidate-search",
                    this,
                    "Search for new candidate checked-in versions to archive.");

            hbox.add(btn);
          }

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

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Clear",
                    "clear-candidate",
                    this,
                    "Clear the displayed candidate checked-in versions.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(10, 0)));
          hbox.add(Box.createHorizontalGlue());

          cpanel.add(hbox);
        }
      }

      JPanel apanel = new JPanel();
      {
        apanel.setName("ButtonDialogPanel");
        apanel.setLayout(new BoxLayout(apanel, BoxLayout.Y_AXIS));

        {
          Box box = new Box(BoxLayout.X_AXIS);

          box.add(Box.createRigidArea(new Dimension(4, 0)));

          {
            JLabel label = new JLabel("Versions to Archive:");
            label.setName("PanelLabel");
            box.add(label);
          }

          box.add(Box.createHorizontalGlue());

          {
            JLabel label = new JLabel("Total Size: ???");
            pArchiveSizeLabel = label;
            label.setName("PanelLabel");
            box.add(label);
          }

          box.add(Box.createRigidArea(new Dimension(23, 0)));

          apanel.add(box);
        }

        apanel.add(Box.createRigidArea(new Dimension(0, 4)));

        {
          NodeVersionSizeTableModel model = new NodeVersionSizeTableModel(880);
          pArchiveTableModel = model;

          JTablePanel tpanel = new JTablePanel(model);
          pArchiveTablePanel = tpanel;

          apanel.add(tpanel);
        }

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

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createHorizontalGlue());
          hbox.add(Box.createRigidArea(new Dimension(10, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Add",
                    "add-archive",
                    this,
                    "Add the selected candidate versions to the list of versions to be "
                        + "archived.");

            hbox.add(btn);
          }

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

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Add All",
                    "add-all-archive",
                    this,
                    "Add all candidate versions to the list of versions to be archived.");

            hbox.add(btn);
          }

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

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Remove",
                    "remove-archive",
                    this,
                    "Remove the selected versions from the list of versions to be archived.");

            hbox.add(btn);
          }

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

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Clear",
                    "remove-all-archive",
                    this,
                    "Clear the list of versions to be archived.");

            hbox.add(btn);
          }

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

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Calc Sizes",
                    "calc-archive",
                    this,
                    "Calculate the amount of disk space needed to archive the files "
                        + "associated with the checked-in versions.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(10, 0)));
          hbox.add(Box.createHorizontalGlue());

          apanel.add(hbox);
        }
      }

      JSplitPane body = new JVertSplitPanel(cpanel, apanel);
      body.setAlignmentX(0.5f);

      String extra[][] = {{"Archive...", "archive"}};

      JButton btns[] = super.initUI("Archive Tool:", body, null, null, extra, "Close", null);

      pArchiveButton = btns[0];
      pArchiveButton.setEnabled(false);

      updatePanel();
      pack();
    }

    pQueryDialog = new JArchiveQueryDialog(this);
    pArchiveParamsDialog = new JArchiveParamsDialog(this);
  }
Example #30
0
  /** Initialize the common user interface components. */
  private void initUI() {
    /* initialize fields */
    {
      pFileSeqPanels = new TreeMap<FileSeq, JFileSeqPanel>();
    }

    /* initialize the popup menus */
    {
      initBasicMenus(true, false);
      updateMenuToolTips();
    }

    /* initialize the panel components */
    {
      setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

      /* header */
      {
        pApplyToolTipText = "Replace the working area files with the selected checked-in files.";
        pUnApplyToolTipText = "There are no unsaved changes to Apply at this time.";

        JPanel panel = initHeader(true);
        add(panel);
      }

      add(Box.createRigidArea(new Dimension(0, 4)));

      /* full node name */
      {
        LinkedList<Component> extra = new LinkedList<Component>();
        extra.add(Box.createRigidArea(new Dimension(4, 0)));
        {
          JButton btn = new JButton();
          pSeqLayoutButton = btn;
          btn.setName(pIsListLayout ? "ListLayoutButton" : "TabbedLayoutButton");

          Dimension size = new Dimension(19, 19);
          btn.setMinimumSize(size);
          btn.setMaximumSize(size);
          btn.setPreferredSize(size);

          btn.setActionCommand("seq-layout-changed");
          btn.addActionListener(this);

          extra.add(btn);
        }

        initNameField(this, extra);

        pNodeNameField.setFocusable(true);
        pNodeNameField.addKeyListener(this);
        pNodeNameField.addMouseListener(this);
      }

      add(Box.createRigidArea(new Dimension(0, 4)));

      {
        JTabbedPane tab = new JTabbedPane();
        pFileSeqsTab = tab;
        tab.setVisible(!pIsListLayout);
        add(tab);
      }

      {
        Box vbox = new Box(BoxLayout.Y_AXIS);
        pFileSeqsBox = vbox;

        {
          JScrollPane scroll = UIFactory.createVertScrollPane(vbox);
          pFileSeqsScroll = scroll;
          scroll.setVisible(!pIsListLayout);

          add(scroll);
        }
      }

      Dimension size = new Dimension(sSize + 22, 120);
      setMinimumSize(size);
      setPreferredSize(size);

      setFocusable(true);
      addKeyListener(this);
      addMouseListener(this);
    }

    updateNodeStatus(null, null, null);
  }