Example #1
2
 /**
  * This function is used to re-run the analyser, and re-create the rows corresponding the its
  * results.
  */
 private void refreshReviewTable() {
   reviewPanel.removeAll();
   rows.clear();
   GridBagLayout gbl = new GridBagLayout();
   reviewPanel.setLayout(gbl);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.gridy = 0;
   try {
     Map<String, Long> sums =
         analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate());
     for (Entry<String, Long> entry : sums.entrySet()) {
       String project = entry.getKey();
       double hours = 1.0 * entry.getValue() / (1000 * 3600);
       addRow(gbl, gbc, project, hours);
     }
     for (String project : main.getProjectsTree().getTopLevelProjects())
       if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0);
     gbc.insets = new Insets(10, 0, 0, 0);
     addLeftLabel(gbl, gbc, "TOTAL");
     gbc.gridx = 1;
     gbc.weightx = 1;
     totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
     gbl.setConstraints(totalLabel, gbc);
     reviewPanel.add(totalLabel);
     gbc.weightx = 0;
     addRightLabel(gbl, gbc);
   } catch (IOException e) {
     e.printStackTrace();
   }
   recomputeTotal();
   pack();
 }
  private JPanel createDynamicCenterPanel(PrimitiveForm primitiveForm, DOTProperty property) {
    final JTable theTable = new JTable();
    PrimitiveFormPropertyPair pfpPair =
        new PrimitiveFormPropertyPair(primitiveForm.getName(), property);
    _dynamicTables.put(pfpPair, theTable);
    DOTPoint dotPoint = (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType();
    final DynamicDOTItemManager tableModel =
        (DynamicDOTItemManager) dotPoint.getTableModel(primitiveForm, property);
    theTable.setModel(tableModel);

    class NumberComparator implements Comparator<Number> {

      public int compare(Number o1, Number o2) {
        final double d1 = o1.doubleValue();
        final double d2 = o2.doubleValue();
        if (d1 < d2) {
          return -1;
        }
        if (d1 == d2) {
          return 0;
        }
        return 1;
      }
    }
    TableRowSorter<DynamicDOTItemManager> tableRowSorter =
        new TableRowSorter<DynamicDOTItemManager>();
    tableRowSorter.setModel(tableModel);
    tableRowSorter.setComparator(4, new NumberComparator());
    tableRowSorter.setComparator(5, new NumberComparator());
    theTable.setRowSorter(tableRowSorter);

    JButton newDOTItemButton = new JButton("Neue Zeile");
    newDOTItemButton.setEnabled(_dotDefinitionDialogFrame.isEditable());
    JButton deleteDOTItemButton = new JButton("Zeile löschen");
    deleteDOTItemButton.setEnabled(false);
    JButton showConflictsButton = new JButton("Zeige Konflikte");

    addButtonListeners(
        primitiveForm, property, newDOTItemButton, deleteDOTItemButton, showConflictsButton);
    addListSelectionListener(theTable, deleteDOTItemButton);

    JPanel dotButtonsPanel = new JPanel();
    dotButtonsPanel.setLayout(new SpringLayout());

    dotButtonsPanel.add(newDOTItemButton);
    dotButtonsPanel.add(deleteDOTItemButton);
    dotButtonsPanel.add(showConflictsButton);

    dotButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
    SpringUtilities.makeCompactGrid(dotButtonsPanel, 1, 5, 20);

    JPanel thePanel = new JPanel();
    thePanel.setLayout(new SpringLayout());
    thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK));
    thePanel.add(new JScrollPane(theTable));
    thePanel.add(dotButtonsPanel);
    SpringUtilities.makeCompactGrid(thePanel, 2, 20, 5);

    return thePanel;
  }
  public RobonoboFrame(RobonoboController control, String[] args) {
    this.control = control;
    this.cmdLineArgs = args;

    setTitle("robonobo");
    setIconImage(GUIUtils.getImage("/icon/robonobo-64x64.png"));
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    addWindowListener(new CloseListener());

    menuBar = Platform.getPlatform().getMenuBar(this);
    setJMenuBar(menuBar);

    JPanel contentPane = new JPanel();
    double[][] cellSizen = {{5, 200, 5, TableLayout.FILL, 5}, {3, TableLayout.FILL, 5}};
    contentPane.setLayout(new TableLayout(cellSizen));
    setContentPane(contentPane);
    leftSidebar = new LeftSidebar(this);
    contentPane.add(leftSidebar, "1,1");
    mainPanel = new MainPanel(this);
    contentPane.add(mainPanel, "3,1");
    setPreferredSize(new Dimension(1024, 723));
    pack();
    leftSidebar.selectMyMusic();
    guiConfig = (GuiConfig) control.getConfig("gui");
    addListeners();
  }
 private void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20);
   contentPane.setBorder(border1);
   contentPane.setLayout(borderLayout1);
   controlsPane.setLayout(gridLayout1);
   gridLayout1.setColumns(1);
   gridLayout1.setHgap(10);
   gridLayout1.setRows(0);
   gridLayout1.setVgap(10);
   okButton.setVerifyInputWhenFocusTarget(true);
   okButton.setMnemonic('O');
   okButton.setText("OK");
   buttonsPane.setLayout(flowLayout1);
   flowLayout1.setAlignment(FlowLayout.CENTER);
   messagePane.setEditable(false);
   messagePane.setText("");
   borderLayout1.setHgap(10);
   borderLayout1.setVgap(10);
   this.setTitle("Subscription Authorization");
   this.getContentPane().add(contentPane, BorderLayout.CENTER);
   contentPane.add(controlsPane, BorderLayout.SOUTH);
   controlsPane.add(responsesComboBox, null);
   controlsPane.add(buttonsPane, null);
   buttonsPane.add(okButton, null);
   contentPane.add(messageScrollPane, BorderLayout.CENTER);
   messageScrollPane.getViewport().add(messagePane, null);
 }
Example #5
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());
  }
 /** Show the filter dialog */
 public void showDialog() {
   empty_border = new EmptyBorder(5, 5, 0, 5);
   indent_border = new EmptyBorder(5, 25, 5, 5);
   include_panel =
       new ServiceFilterPanel("Include messages based on target service:", filter_include_list);
   exclude_panel =
       new ServiceFilterPanel("Exclude messages based on target service:", filter_exclude_list);
   status_box = new JCheckBox("Filter messages based on status:");
   status_box.addActionListener(this);
   status_active = new JRadioButton("Active messages only");
   status_active.setSelected(true);
   status_active.setEnabled(false);
   status_complete = new JRadioButton("Complete messages only");
   status_complete.setEnabled(false);
   status_group = new ButtonGroup();
   status_group.add(status_active);
   status_group.add(status_complete);
   if (filter_active || filter_complete) {
     status_box.setSelected(true);
     status_active.setEnabled(true);
     status_complete.setEnabled(true);
     if (filter_complete) {
       status_complete.setSelected(true);
     }
   }
   status_options = new JPanel();
   status_options.setLayout(new BoxLayout(status_options, BoxLayout.Y_AXIS));
   status_options.add(status_active);
   status_options.add(status_complete);
   status_options.setBorder(indent_border);
   status_panel = new JPanel();
   status_panel.setLayout(new BorderLayout());
   status_panel.add(status_box, BorderLayout.NORTH);
   status_panel.add(status_options, BorderLayout.CENTER);
   status_panel.setBorder(empty_border);
   ok_button = new JButton("Ok");
   ok_button.addActionListener(this);
   cancel_button = new JButton("Cancel");
   cancel_button.addActionListener(this);
   buttons = new JPanel();
   buttons.setLayout(new FlowLayout());
   buttons.add(ok_button);
   buttons.add(cancel_button);
   panel = new JPanel();
   panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
   panel.add(include_panel);
   panel.add(exclude_panel);
   panel.add(status_panel);
   panel.add(buttons);
   dialog = new JDialog();
   dialog.setTitle("SOAP Monitor Filter");
   dialog.setContentPane(panel);
   dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
   dialog.setModal(true);
   dialog.pack();
   Dimension d = dialog.getToolkit().getScreenSize();
   dialog.setLocation((d.width - dialog.getWidth()) / 2, (d.height - dialog.getHeight()) / 2);
   ok_pressed = false;
   dialog.show();
 }
Example #7
0
  /** Description of the Method */
  public void init() {
    // super.init();
    size = new Dimension(570, 570);
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(borderLayout1);

    Dimension d = messagePanel.getSize();
    d.height += 20;
    messagePanel.setPreferredSize(d);
    contentPane.add(messagePanel, BorderLayout.SOUTH);

    contentPane.setOpaque(true);
    userPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);

    messagePanel.setLayout(borderLayout5);
    contentPane.setOpaque(true);
    contentPane.setBackground(Color.white);
    this.setSize(size);

    messagePanel.add(labelMessage, BorderLayout.NORTH);
    // Logg.logg("MhClient: Före XttTree-skapande", 6);
    this.mhTable = new MhTable(root, false, this.labelMessage);
    // Logg.logg("MhClient: mhTable-skapande klart", 6);
    this.contentPane.add(this.mhTable.splitPane, BorderLayout.CENTER);
  }
Example #8
0
  private void CreateAndDisplayGUI() {
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

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

    // buildOptionsMenu() needs to come first because it initializes
    // currTileImg which buildDisplay uses.
    JPanel buttonArea = buildOptionsMenu();

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

    JPanel palette = loadTileset();

    JComponent display = buildDisplay();

    topHalf.add(display);
    topHalf.add(palette);
    topHalf.add(new JPanel());
    content.add(topHalf);
    content.add(buttonArea);

    this.add(content);
    parentPanel = content;
    this.pack();
    this.setVisible(true);
  }
  private void initGUI() {

    JPanel pCommand = new JPanel();

    pResult = new JPanel();
    nsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, pCommand, pResult);

    pCommand.setLayout(new BorderLayout());
    pResult.setLayout(new BorderLayout());

    Font fFont = new Font("Dialog", Font.PLAIN, 12);

    txtCommand = new JTextArea(5, 40);

    txtCommand.setMargin(new Insets(5, 5, 5, 5));
    txtCommand.addKeyListener(this);

    txtCommandScroll = new JScrollPane(txtCommand);
    txtResult = new JTextArea(20, 40);

    txtResult.setMargin(new Insets(5, 5, 5, 5));

    txtResultScroll = new JScrollPane(txtResult);

    txtCommand.setFont(fFont);
    txtResult.setFont(new Font("Courier", Font.PLAIN, 12));
    /*
    // button replaced by toolbar
            butExecute = new JButton("Execute");

            butExecute.addActionListener(this);
            pCommand.add(butExecute, BorderLayout.EAST);
    */
    pCommand.add(txtCommandScroll, BorderLayout.CENTER);

    gResult = new GridSwing();
    gResultTable = new JTable(gResult);
    gScrollPane = new JScrollPane(gResultTable);

    // getContentPane().setLayout(new BorderLayout());
    pResult.add(gScrollPane, BorderLayout.CENTER);

    // Set up the tree
    rootNode = new DefaultMutableTreeNode("Connection");
    treeModel = new DefaultTreeModel(rootNode);
    tTree = new JTree(treeModel);
    tScrollPane = new JScrollPane(tTree);

    tScrollPane.setPreferredSize(new Dimension(120, 400));
    tScrollPane.setMinimumSize(new Dimension(70, 100));
    txtCommandScroll.setPreferredSize(new Dimension(360, 100));
    txtCommandScroll.setMinimumSize(new Dimension(180, 100));
    gScrollPane.setPreferredSize(new Dimension(460, 300));

    ewSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tScrollPane, nsSplitPane);

    fMain.getContentPane().add(ewSplitPane, BorderLayout.CENTER);
    doLayout();
    fMain.pack();
  }
  public CopyFileToTable() {
    JPanel jPane1 = new JPanel();
    jPane1.setLayout(new BorderLayout());
    jPane1.add(new JLabel("Filename"), BorderLayout.WEST);
    jPane1.add(jbtViewFile, BorderLayout.EAST);
    jPane1.add(jtfFilename, BorderLayout.CENTER);

    JPanel jPane2 = new JPanel();
    jPane2.setLayout(new BorderLayout());
    jPane2.setBorder(new TitledBorder("Source Text File"));
    jPane2.add(jPane1, BorderLayout.NORTH);
    jPane2.add(new JScrollPane(jtaFile), BorderLayout.CENTER);

    JPanel jPane3 = new JPanel();
    jPane3.setLayout(new GridLayout(5, 0));
    jPane3.add(new JLabel("JDBC Driver"));
    jPane3.add(new JLabel("Database URL"));
    jPane3.add(new JLabel("Username"));
    jPane3.add(new JLabel("Password"));
    jPane3.add(new JLabel("Table Name"));

    JPanel jPane4 = new JPanel();
    jPane4.setLayout(new GridLayout(5, 0));
    jcboDriver.setEditable(true);
    jPane4.add(jcboDriver);
    jcboURL.setEditable(true);
    jPane4.add(jcboURL);
    jPane4.add(jtfUsername);
    jPane4.add(jtfPassword);
    jPane4.add(jtfTableName);

    JPanel jPane5 = new JPanel();
    jPane5.setLayout(new BorderLayout());
    jPane5.setBorder(new TitledBorder("Target Database Table"));
    jPane5.add(jbtCopy, BorderLayout.SOUTH);
    jPane5.add(jPane3, BorderLayout.WEST);
    jPane5.add(jPane4, BorderLayout.CENTER);

    add(jlblStatus, BorderLayout.SOUTH);
    add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jPane2, jPane5), BorderLayout.CENTER);

    jbtViewFile.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            showFile();
          }
        });

    jbtCopy.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            try {
              copyFile();
            } catch (Exception ex) {
              jlblStatus.setText(ex.toString());
            }
          }
        });
  }
Example #11
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
  public SpinnerModelEditorDemo() {
    // Group labels
    JPanel panel1 = new JPanel();
    panel1.setLayout(new GridLayout(4, 1));
    panel1.add(new JLabel("Date"));
    panel1.add(new JLabel("Day"));
    panel1.add(new JLabel("Month"));
    panel1.add(new JLabel("Year"));

    // Group spinners
    JPanel panel2 = new JPanel();
    panel2.setLayout(new GridLayout(4, 1));
    panel2.add(jspDate);
    panel2.add(jspDay);
    panel2.add(jspMonth);
    panel2.add(spinnerYear);

    // Add spinner and label to the UI
    add(panel1, BorderLayout.WEST);
    add(panel2, BorderLayout.CENTER);

    // Set editor for date
    JSpinner.DateEditor dateEditor = new JSpinner.DateEditor(jspDate, "MMM dd, yyyy");
    jspDate.setEditor(dateEditor);

    // Set editor for year
    JSpinner.NumberEditor yearEditor = new JSpinner.NumberEditor(spinnerYear, "####");
    spinnerYear.setEditor(yearEditor);

    // Update date to synchronize with the day, month, and year
    updateDate();

    // Register and create a listener for jspDay
    jspDay.addChangeListener(
        new ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent e) {
            updateDate();
          }
        });

    // Register and create a listener for jspMonth
    jspMonth.addChangeListener(
        new ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent e) {
            updateDate();
          }
        });

    // Register and create a listener for spinnerYear
    spinnerYear.addChangeListener(
        new ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent e) {
            updateDate();
          }
        });
  }
  private void initUI() {

    this.setLayout(new BorderLayout());

    JPanel infoPanel = new JPanel();
    infoPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    infoPanel.setBackground(Color.WHITE);
    infoPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));

    infoPanel.add(
        new JLabel(
            new ImageIcon(
                Thread.currentThread().getContextClassLoader().getResource("siw-logo3_2.gif"))));

    JLabel infoLabel =
        new JLabel("<html>Please select a project and context<br> Version must be a number</html>");
    infoPanel.add(infoLabel);

    this.add(infoPanel, BorderLayout.NORTH);

    JPanel entryPanel = new JPanel();
    entryPanel.setLayout(null);

    projectNameField.setText("");
    JLabel projectNameLabel = new JLabel("Project Name");
    projectNameLabel.setBounds(new Rectangle(30, 80, 135, 20));
    projectNameField.setBounds(new Rectangle(180, 80, 175, 20));

    JLabel projectVersionLabel = new JLabel("Project Version");
    projectVersionLabel.setBounds(new Rectangle(30, 125, 135, 20));
    projectVersionField.setBounds(new Rectangle(180, 125, 175, 20));

    JLabel contextLabel = new JLabel("Context");
    contextLabel.setBounds(new Rectangle(30, 165, 135, 20));
    contextComboBox.setBounds(new Rectangle(180, 165, 175, 20));

    JLabel packageLabel = new JLabel("Select Package");
    packageLabel.setBounds(new Rectangle(30, 210, 135, 20));
    packageComboBox.setBounds(new Rectangle(180, 210, 250, 20));

    entryPanel.add(projectNameLabel, null);
    entryPanel.add(projectNameField, null);
    entryPanel.add(projectVersionLabel, null);
    entryPanel.add(projectVersionField, null);
    entryPanel.add(contextLabel, null);
    entryPanel.add(contextComboBox, null);
    entryPanel.add(packageLabel, null);
    entryPanel.add(packageComboBox, null);

    this.add(entryPanel, BorderLayout.CENTER);

    projectVersionField.addKeyListener(this);
    projectNameField.addKeyListener(this);
  }
Example #14
0
  void initComponents() {
    JPanel mainPanel = new JPanel(new BorderLayout());
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    Color bgColor = Color.getHSBColor(0.58f, 0.17f, 0.95f);
    buttonPanel.setBackground(bgColor);
    Border empty = BorderFactory.createEmptyBorder(5, 5, 5, 5);
    buttonPanel.setBorder(empty);

    textField = new JTextField(75);
    buttonPanel.add(textField);

    buttonPanel.add(Box.createHorizontalStrut(10));
    searchPHI = new JButton("Search PHI");
    searchPHI.addActionListener(this);
    buttonPanel.add(searchPHI);

    buttonPanel.add(Box.createHorizontalStrut(10));
    searchTrial = new JButton("Search Trial IDs");
    searchTrial.addActionListener(this);
    buttonPanel.add(searchTrial);

    buttonPanel.add(Box.createHorizontalStrut(20));
    buttonPanel.add(Box.createHorizontalGlue());
    saveAs = new JCheckBox("Save As...");
    saveAs.setBackground(bgColor);
    buttonPanel.add(saveAs);

    mainPanel.add(buttonPanel, BorderLayout.NORTH);

    JScrollPane scrollPane = new JScrollPane();
    textPane = new ColorPane();
    // textPane.setEditable(false);
    scrollPane.setViewportView(textPane);
    mainPanel.add(scrollPane, BorderLayout.CENTER);

    JPanel footerPanel = new JPanel();
    footerPanel.setLayout(new BoxLayout(footerPanel, BoxLayout.X_AXIS));
    footerPanel.setBackground(bgColor);
    message = new JLabel("Ready...");
    footerPanel.add(message);
    mainPanel.add(footerPanel, BorderLayout.SOUTH);

    setTitle(windowTitle);
    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent evt) {
            System.exit(0);
          }
        });
    getContentPane().add(mainPanel, BorderLayout.CENTER);
    pack();
    centerFrame();
  }
Example #15
0
 public void addConstant(ConstantLine pl) {
   rows.add(pl);
   JPanel containPl = new JPanel();
   containPl.setLayout(new BorderLayout());
   containPl.setBorder(new CompoundBorder(pl.new BottomBorder(), new LineBorder(Color.white, 2)));
   containPl.add(pl, BorderLayout.CENTER);
   nextPanel.add(containPl, BorderLayout.NORTH);
   JPanel np = new JPanel();
   np.setLayout(new BorderLayout());
   nextPanel.add(np, BorderLayout.CENTER);
   nextPanel = np;
 }
Example #16
0
  /** Constructs a panel containing an options menu, then returns said panel. */
  public JPanel buildOptionsMenu() {
    JPanel options = new JPanel();

    // Create the height/width section
    JPanel dimensions = new JPanel();
    dimensions.setLayout(new BoxLayout(dimensions, BoxLayout.Y_AXIS));

    JLabel widthLabel = new JLabel("X:");
    JTextField widthBox = new JTextField(10);
    widthField = widthBox;
    JPanel width = new JPanel();
    width.add(widthLabel);
    width.add(widthBox);

    JLabel heightLabel = new JLabel("Y:");
    JTextField heightBox = new JTextField(10);
    heightField = heightBox;
    JPanel height = new JPanel();
    height.add(heightLabel);
    height.add(heightBox);

    dimensions.add(width);
    dimensions.add(height);

    // "Apply changes" button
    JButton apply = new JButton("Apply Changes");
    apply.addActionListener(new ApplyHWChanges());

    // Fill option
    JButton fill = new JButton("Fill with current tile");
    fill.addActionListener(new FillButton());
    options.add(fill);

    // Current selected tile
    JPanel tileArea = new JPanel();
    tileArea.setLayout(new BoxLayout(tileArea, BoxLayout.Y_AXIS));
    tileArea.add(new JLabel("Current Tile"));

    tileArea.add(currTileDisplay);

    // remove once testing is done
    backEnd.setTestImage(currTileImg);

    // Save button
    JButton save = new JButton("Save");
    save.addActionListener(new SaveButton());

    options.add(dimensions);
    options.add(apply);
    options.add(tileArea);
    options.add(save);
    return options;
  }
 /** Constructor */
 public ServiceFilterPanel(String text, Vector list) {
   empty_border = new EmptyBorder(5, 5, 0, 5);
   indent_border = new EmptyBorder(5, 25, 5, 5);
   service_box = new JCheckBox(text);
   service_box.addActionListener(this);
   service_data = new Vector();
   if (list != null) {
     service_box.setSelected(true);
     service_data = (Vector) list.clone();
   }
   service_list = new JList(service_data);
   service_list.setBorder(new EtchedBorder());
   service_list.setVisibleRowCount(5);
   service_list.addListSelectionListener(this);
   service_list.setEnabled(service_box.isSelected());
   service_scroll = new JScrollPane(service_list);
   service_scroll.setBorder(new EtchedBorder());
   remove_service_button = new JButton("Remove");
   remove_service_button.addActionListener(this);
   remove_service_button.setEnabled(false);
   remove_service_panel = new JPanel();
   remove_service_panel.setLayout(new FlowLayout());
   remove_service_panel.add(remove_service_button);
   service_area = new JPanel();
   service_area.setLayout(new BorderLayout());
   service_area.add(service_scroll, BorderLayout.CENTER);
   service_area.add(remove_service_panel, BorderLayout.EAST);
   service_area.setBorder(indent_border);
   add_service_field = new JTextField();
   add_service_field.addActionListener(this);
   add_service_field.getDocument().addDocumentListener(this);
   add_service_field.setEnabled(service_box.isSelected());
   add_service_button = new JButton("Add");
   add_service_button.addActionListener(this);
   add_service_button.setEnabled(false);
   add_service_panel = new JPanel();
   add_service_panel.setLayout(new BorderLayout());
   JPanel dummy = new JPanel();
   dummy.setBorder(empty_border);
   add_service_panel.add(dummy, BorderLayout.WEST);
   add_service_panel.add(add_service_button, BorderLayout.EAST);
   add_service_area = new JPanel();
   add_service_area.setLayout(new BorderLayout());
   add_service_area.add(add_service_field, BorderLayout.CENTER);
   add_service_area.add(add_service_panel, BorderLayout.EAST);
   add_service_area.setBorder(indent_border);
   setLayout(new BorderLayout());
   add(service_box, BorderLayout.NORTH);
   add(service_area, BorderLayout.CENTER);
   add(add_service_area, BorderLayout.SOUTH);
   setBorder(empty_border);
 }
  /**
   * Constructor of class Wizard
   *
   * @param parent the parent frame
   * @param name the title of the dialog
   * @param modal whether the dialog should be modal
   */
  public Wizard(JFrame parent, String name, boolean modal) {
    super(parent, name, modal);

    // Code inspired by http://java.sun.com/developer/technicalArticles/GUI/swing/wizard/

    listeners = new LinkedList<WizardListener>();
    returnCode = -1;
    this.parent = parent;

    panelMap = new HashMap<Object, WizardPanel>();
    panels = new Vector<WizardPanel>();
    firstPanel = null;
    currentPanel = null;

    handler = new EventHandler();

    // Create the main panel

    JPanel buttonPanel = new JPanel();
    Box buttonBox = new Box(BoxLayout.X_AXIS);

    cardPanel = new JPanel();
    cardPanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));

    cardLayout = new CardLayout();
    cardPanel.setLayout(cardLayout);
    backButton = new JButton("Back");
    nextButton = new JButton("Next");
    cancelButton = new JButton("Cancel");

    backButton.addActionListener(handler);
    nextButton.addActionListener(handler);
    cancelButton.addActionListener(handler);

    backButton.setEnabled(false);

    buttonPanel.setLayout(new BorderLayout());
    buttonPanel.add(new JSeparator(), BorderLayout.NORTH);

    buttonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
    buttonBox.add(backButton);
    buttonBox.add(Box.createHorizontalStrut(10));
    buttonBox.add(nextButton);
    buttonBox.add(Box.createHorizontalStrut(30));
    buttonBox.add(cancelButton);
    buttonPanel.add(buttonBox, java.awt.BorderLayout.EAST);
    getContentPane().add(buttonPanel, java.awt.BorderLayout.SOUTH);
    getContentPane().add(cardPanel, java.awt.BorderLayout.CENTER);

    pack();
  }
  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));
  }
Example #20
0
 // Set up the quiz window
 Quiz() {
   initializeData();
   setTitle("FOSS Quiz App");
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   setSize(440, 400);
   setLocation(300, 100);
   setResizable(true);
   Container cont = getContentPane();
   cont.setLayout(null);
   cont.setBackground(Color.WHITE);
   bg = new ButtonGroup();
   choice1 = new JRadioButton("Choice1", true);
   choice2 = new JRadioButton("Choice2", false);
   choice3 = new JRadioButton("Choice3", false);
   choice4 = new JRadioButton("Choice4", false);
   bg.add(choice1);
   bg.add(choice2);
   bg.add(choice3);
   bg.add(choice4);
   lblmess = new JLabel("Choose a correct anwswer");
   lblmess.setForeground(Color.BLACK);
   lblmess.setFont(new Font("Sans_Serif", Font.BOLD, 15));
   btnext = new JButton("Next");
   btnext.setForeground(Color.WHITE);
   btnext.setFont(new Font("Sans_Serif", Font.BOLD, 17));
   btnext.setBackground(Color.DARK_GRAY);
   btnext.addActionListener(this);
   panel = new JPanel();
   panel.setBackground(Color.WHITE);
   panel.setLocation(10, 60);
   panel.setSize(400, 300);
   panel.setLayout(new GridLayout(0, 1));
   title = new JPanel();
   title.setBackground(Color.WHITE);
   title.setLocation(10, 10);
   title.setSize(1000, 50);
   title.setLayout(new GridLayout(1, 0));
   title.add(lblmess);
   panel.add(choice1);
   panel.add(choice2);
   panel.add(choice3);
   panel.add(choice4);
   panel.add(btnext);
   cont.add(title);
   cont.add(panel);
   setVisible(true);
   quizAnswerID = 0;
   readQuestionAnswer(quizAnswerID);
 }
Example #21
0
  public AboutDialog(View view) {
    super(view, jEdit.getProperty("about.title"), true);

    JPanel content = new JPanel(new BorderLayout());
    content.setBorder(new EmptyBorder(12, 12, 12, 12));
    setContentPane(content);

    content.add(BorderLayout.CENTER, new AboutPanel());

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.setBorder(new EmptyBorder(12, 0, 0, 0));

    buttonPanel.add(Box.createGlue());
    close = new JButton(jEdit.getProperty("common.close"));
    close.addActionListener(new ActionHandler());
    getRootPane().setDefaultButton(close);
    buttonPanel.add(close);
    buttonPanel.add(Box.createGlue());
    content.add(BorderLayout.SOUTH, buttonPanel);

    pack();
    setResizable(false);
    setLocationRelativeTo(view);
    show();
  }
Example #22
0
  public PostTestFrame() {
    setTitle("PostTest");

    northPanel = new JPanel();
    add(northPanel, BorderLayout.NORTH);
    northPanel.setLayout(new GridLayout(0, 2));
    northPanel.add(new JLabel("Host: ", SwingConstants.TRAILING));
    final JTextField hostField = new JTextField();
    northPanel.add(hostField);
    northPanel.add(new JLabel("Action: ", SwingConstants.TRAILING));
    final JTextField actionField = new JTextField();
    northPanel.add(actionField);
    for (int i = 1; i <= 8; i++) northPanel.add(new JTextField());

    final JTextArea result = new JTextArea(20, 40);
    add(new JScrollPane(result));

    JPanel southPanel = new JPanel();
    add(southPanel, BorderLayout.SOUTH);
    JButton addButton = new JButton("More");
    southPanel.add(addButton);
    addButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            northPanel.add(new JTextField());
            northPanel.add(new JTextField());
            pack();
          }
        });

    JButton getButton = new JButton("Get");
    southPanel.add(getButton);
    getButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            result.setText("");
            final Map<String, String> post = new HashMap<String, String>();
            for (int i = 4; i < northPanel.getComponentCount(); i += 2) {
              String name = ((JTextField) northPanel.getComponent(i)).getText();
              if (name.length() > 0) {
                String value = ((JTextField) northPanel.getComponent(i + 1)).getText();
                post.put(name, value);
              }
            }
            new SwingWorker<Void, Void>() {
              protected Void doInBackground() throws Exception {
                try {
                  String urlString = hostField.getText() + "/" + actionField.getText();
                  result.setText(doPost(urlString, post));
                } catch (IOException e) {
                  result.setText("" + e);
                }
                return null;
              }
            }.execute();
          }
        });

    pack();
  }
  public void buildPanel() {
    input.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (input.getText().isEmpty() == false) {
              outputLabel.setText("");
              outputLabel.append(sumNumbers(input.getText()));
              outputLabel.setEditable(false);
            }
          }
        });

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());

    JLabel header = new JLabel("Sum of all digits");
    JPanel headerFrame = new JPanel();
    headerFrame.add(header);
    mainPanel.add(headerFrame, BorderLayout.NORTH);

    inputPanel.add(inputLabel);
    inputPanel.add(input);
    mainPanel.add(inputPanel, BorderLayout.CENTER);

    outputPanel.add(outputLabel);
    mainPanel.add(outputPanel, BorderLayout.SOUTH);

    topPanel.add(mainPanel);
  }
Example #24
0
  private JPanel createCentrePanel(YDataStateException exception) {
    JPanel centrePanel = new JPanel(new GridLayout(1, 2));

    JPanel msgPanel = new JPanel(new BorderLayout());
    msgPanel.setBackground(YAdminGUI._apiColour);
    msgPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(), "Schema for completing task"),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    JTextPane msgTextPane = new JTextPane();
    msgTextPane.setContentType("text/plain");
    msgTextPane.setFont(new Font("courier", Font.PLAIN, 12));
    msgTextPane.setForeground(Color.RED);

    msgTextPane.setText(exception.getMessage());
    msgTextPane.setEditable(false);
    msgTextPane.setBackground(Color.LIGHT_GRAY);
    JPanel noWrapPanel = new JPanel();
    noWrapPanel.setLayout(new BorderLayout());
    noWrapPanel.add(msgTextPane);
    msgPanel.add(new JScrollPane(noWrapPanel));

    centrePanel.add(msgPanel, BorderLayout.NORTH);
    return centrePanel;
  }
  private JPanel getClickableTagsPanel() {
    JPanel pnl = new JPanel();

    pnl.setLayout(new GridLayout(0, 3));

    ArrayList<Commontags> listTags = new ArrayList<>(mapAllTags.values());
    Collections.sort(listTags);

    for (final Commontags ctag : listTags) {
      JCheckBox cb = new JCheckBox(ctag.getText());

      cb.setForeground(GUITools.getColor(ctag.getColor()));
      cb.setFont(ctag.getType() == 0 ? SYSConst.ARIAL12 : SYSConst.ARIAL12BOLD);

      cb.setSelected(listSelectedTags.contains(ctag));

      cb.addItemListener(
          e -> {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              listSelectedTags.add(ctag);
              add(createButton(ctag));
            } else {
              listSelectedTags.remove(ctag);
              mapButtons.remove(ctag);
            }
            notifyListeners(ctag);
          });

      pnl.add(cb);
    }
    return pnl;
  }
Example #26
0
 /** Creates a new instance of ConstantPickerList */
 public ConstantPickerList() {
   setLayout(new BorderLayout());
   nextPanel = new JPanel();
   nextPanel.setLayout(new BorderLayout());
   add(nextPanel, BorderLayout.CENTER);
   rows = new ArrayList();
 }
Example #27
0
  private Component createCurrentDirectoryPanel() {
    currentDirectoryTextField = new JTextField();
    currentDirectoryTextField.setEditable(false);

    String currentDirectory = settingsNode.getValueOfChild(CURRENT_DIRECTORY, null);
    if (currentDirectory == null || "".equals(currentDirectory.trim())) {
      currentDirectory = gradlePluginLord.getCurrentDirectory().getAbsolutePath();
    }

    currentDirectoryTextField.setText(currentDirectory);
    gradlePluginLord.setCurrentDirectory(new File(currentDirectory));

    JButton browseButton =
        new JButton(
            new AbstractAction("Browse...") {
              public void actionPerformed(ActionEvent e) {
                File file = browseForDirectory(gradlePluginLord.getCurrentDirectory());
                if (file != null) {
                  setCurrentDirectory(file);
                }
              }
            });

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

    panel.add(Utility.addLeftJustifiedComponent(new JLabel("Current Directory")));
    panel.add(createSideBySideComponent(currentDirectoryTextField, browseButton));

    return panel;
  }
Example #28
0
  private Component createOptionsPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

    onlyShowOutputOnErrorCheckBox = new JCheckBox("Only Show Output When Errors Occur");

    onlyShowOutputOnErrorCheckBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            updateShowOutputOnErrorsSetting();
            settingsNode.setValueOfChildAsBoolean(
                SHOW_OUTPUT_ON_ERROR, onlyShowOutputOnErrorCheckBox.isSelected());
          }
        });

    // initialize its default value
    boolean valueAsBoolean =
        settingsNode.getValueOfChildAsBoolean(
            SHOW_OUTPUT_ON_ERROR, onlyShowOutputOnErrorCheckBox.isSelected());
    onlyShowOutputOnErrorCheckBox.setSelected(valueAsBoolean);

    updateShowOutputOnErrorsSetting();

    panel.add(Utility.addLeftJustifiedComponent(onlyShowOutputOnErrorCheckBox));

    return panel;
  }
Example #29
0
  private void setupUI() {
    mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    mainPanel.add(createCurrentDirectoryPanel());
    mainPanel.add(Box.createVerticalStrut(10));
    mainPanel.add(createLogLevelPanel());
    mainPanel.add(Box.createVerticalStrut(10));
    mainPanel.add(createStackTracePanel());
    mainPanel.add(Box.createVerticalStrut(10));
    mainPanel.add(createOptionsPanel());
    mainPanel.add(Box.createVerticalStrut(10));
    mainPanel.add(createCustomExecutorPanel());
    mainPanel.add(Box.createVerticalStrut(10));

    // add a panel that can be used to add custom things to the setup tab
    customPanelPlaceHolder = new JPanel(new BorderLayout());
    mainPanel.add(customPanelPlaceHolder);

    // Glue alone doesn't work in this situation. This forces everything to the top.
    JPanel expandingPanel = new JPanel(new BorderLayout());
    expandingPanel.add(Box.createVerticalGlue(), BorderLayout.CENTER);
    mainPanel.add(expandingPanel);

    mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  }
  /**
   * Return the JFrameContentPane property value.
   *
   * @return javax.swing.JPanel
   */
  private
  /* WARNING: THIS METHOD WILL BE REGENERATED. */
  javax.swing.JPanel getMainPanel() {
    if (ivjMainPanel == null) {
      try {
        ivjMainPanel = new javax.swing.JPanel();
        ivjMainPanel.setName("MainPanel");
        ivjMainPanel.setLayout(new java.awt.GridBagLayout());
        ivjMainPanel.setBackground(java.awt.SystemColor.control);

        java.awt.GridBagConstraints constraintsProfileBrowserPanel =
            new java.awt.GridBagConstraints();
        constraintsProfileBrowserPanel.gridx = 1;
        constraintsProfileBrowserPanel.gridy = 1;
        constraintsProfileBrowserPanel.fill = java.awt.GridBagConstraints.BOTH;
        constraintsProfileBrowserPanel.weightx = 1.0;
        constraintsProfileBrowserPanel.weighty = 1.0;
        constraintsProfileBrowserPanel.insets = new java.awt.Insets(2, 2, 2, 2);
        getMainPanel().add(getProfileBrowserPanel(), constraintsProfileBrowserPanel);
        // user code begin {1}
        // user code end
      } catch (java.lang.Throwable ivjExc) {
        // user code begin {2}
        // user code end
        handleException(ivjExc);
      }
    }
    return ivjMainPanel;
  }