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
  public RollResultView() {

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

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

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

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

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

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

    // add some spacing
    this.add(Box.createRigidArea(new Dimension(50, 50)), BorderLayout.EAST);
    this.add(Box.createRigidArea(new Dimension(50, 50)), BorderLayout.WEST);
  }
Example #5
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);
  }
Example #6
0
  /**
   * Creates the button panel with the query and reset buttons in a box layout.
   *
   * @return The constructed button panel.
   */
  public JPanel createButtonPane() {
    // Set up the panel.
    buttonPane = new JPanel();
    queryBtn = new JButton("Query");

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

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

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

    return buttonPane;
  }
  public ParamsPanel(String label) {
    super();

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

    add(Box.createRigidArea(DOUBLE_HSPACE));
    add(new JLabel(label));
    add(Box.createRigidArea(SINGLE_HSPACE));

    textField = new JTextField(60);
    textField.setMinimumSize(textField.getPreferredSize());
    add(textField);
    add(Box.createRigidArea(TRIPLE_HSPACE));

    searchButton = new JButton("Search");
    add(searchButton);
  }
 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 #9
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 #10
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 #11
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 #12
0
 public ButtonPanel(String scanButtonLabel, String resetButtonLabel) {
   super();
   scanButton = new JButton(scanButtonLabel);
   scanButton.setPreferredSize(SIZE);
   add(scanButton);
   add(Box.createRigidArea(MARGIN));
   resetButton = new JButton(resetButtonLabel);
   resetButton.setPreferredSize(SIZE);
   add(resetButton);
 }
  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]);
    }
  }
  public JPanel createContentPane() {

    // We create a bottom JPanel to place everything on.
    JPanel totalGUI = new JPanel();

    // We set the layout of the main JPanel to be BoxLayout.
    // LINE_AXIS sets them left to right, PAGE_AXIS sets them
    // from top to bottom.
    totalGUI.setLayout(new BoxLayout(totalGUI, BoxLayout.LINE_AXIS));

    JPanel redPanel = new JPanel();
    redPanel.setBackground(Color.red);
    redPanel.setMinimumSize(new Dimension(50, 50));
    redPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(redPanel);

    // This is the first spacer. This creates a spacer 10px wide that
    // will never get bigger or smaller.
    totalGUI.add(Box.createRigidArea(new Dimension(10, 0)));

    JPanel yellowPanel = new JPanel();
    yellowPanel.setBackground(Color.yellow);
    yellowPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(yellowPanel);

    // This spacer takes any spare space and places it as part of the spacer
    // If you drag the window wider, the space will get wider.
    totalGUI.add(Box.createHorizontalGlue());

    JPanel greenPanel = new JPanel();
    greenPanel.setBackground(Color.green);
    greenPanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(greenPanel);

    // This spacer is a custom spacer.
    // The minimum size acts like a rigid area that
    // will not get any smaller than 10 pixels on the x-axis (horizontal)
    // and not get any smaller than 50 pixels on the y axis (vertical).
    // The way the maximum size is set up means the spacer acts like glue
    // and will expand to fit the available space.

    Dimension minSize = new Dimension(10, 50);
    Dimension prefSize = new Dimension(10, 50);
    Dimension maxSize = new Dimension(Short.MAX_VALUE, 50);
    totalGUI.add(new Box.Filler(minSize, prefSize, maxSize));

    JPanel bluePanel = new JPanel();
    bluePanel.setBackground(Color.blue);
    bluePanel.setPreferredSize(new Dimension(50, 50));
    totalGUI.add(bluePanel);

    totalGUI.setOpaque(true);
    return totalGUI;
  }
Example #16
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());
  }
Example #17
0
  /**
   * Creates the query panel and returns it to the content pane to be added.
   *
   * @return The constructed query panel.
   */
  public JPanel createQueryPane() {
    // Set up the panel.
    queryPane = new JPanel();

    // Create the comboboxes
    catCb1 = new JComboBox<String>(categories);
    catCb2 = new JComboBox<String>(categories);

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

    // Add components to the panel.
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));
    queryPane.add(new JLabel("Are there more users who looked at "));
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));
    queryPane.add(catCb1);
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));
    queryPane.add(new JLabel(" than "));
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));
    queryPane.add(catCb2);
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));
    queryPane.add(new JLabel("?"));
    queryPane.add(Box.createRigidArea(new Dimension(10, 0)));

    return queryPane;
  }
  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));
  }
  @Override
  protected JPanel createContentPanel() {
    JPanel mainPanel = new JPanel();
    mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

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

    mainPanel.add(createInfoPanel());
    mainPanel.add(Box.createRigidArea(new Dimension(0, 6)));
    mainPanel.add(createParametersPanel());

    return mainPanel;
  }
  /**
   * 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);
  }
Example #21
0
  public ImageScrolledPane(String pozaScanata) {
    super();

    JPanel panel = new JPanel();
    this.image = new ImageIcon(pozaScanata);
    label1 = new JLabel(image);
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(label1);
    panel.add(Box.createRigidArea(new Dimension(0, 20)));
    JLabel jlc = new JLabel();
    jlc.setPreferredSize(new Dimension(255, 100));

    this.getViewport().add(panel);
  }
      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 #23
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 #25
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 #26
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 #27
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 #28
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);
 }
  private void initPanel() {
    final JLabel qualityLabel = new JLabel("Preferred video quality:");
    final JComboBox<VideoQuality> qualityList =
        new JComboBox<VideoQuality>(VideoQuality.getItems());
    qualityLabel.setLabelFor(qualityList);
    qualityLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    qualityList.setAlignmentX(Component.LEFT_ALIGNMENT);
    qualityList.setSelectedItem(config.getVideoQuality());

    qualityList.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            config.setVideoQuality((VideoQuality) qualityList.getSelectedItem());
          }
        });

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(qualityLabel);
    add(qualityList);
    add(Box.createRigidArea(new Dimension(0, 15)));
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
  }
Example #30
0
  /*
   * Create and set up a new CoreqPanel that is the correct size. Do not allow the user to modify any
   * of the characteristics of the panel; the panel will be the same for any course.
   */
  public CoreqPanel() {
    this.setMinimumSize(new Dimension(800, 25));
    this.setMaximumSize(new Dimension(2600, 26));
    this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    coreqField = new JTextField();
    coreqField.setMinimumSize(new Dimension(300, 20));
    coreqField.setMaximumSize(new Dimension(2000, 21));

    coreqType = new JComboBox();
    coreqType.addItem("Credits");
    coreqType.addItem("Course");
    coreqType.addItem("Requirement");

    coreqType.setMinimumSize(new Dimension(100, 20));
    coreqType.setMaximumSize(new Dimension(100, 21));
    JLabel coreqName = new JLabel("Name of Corequisite: ");

    this.add(coreqName);
    this.add(coreqField);
    this.add(Box.createRigidArea(new Dimension(10, 0)));
    this.add(coreqType);
    this.add(Box.createGlue());
  }