public DisplayUserDirectory() {
      GridBagLayout gbl = new GridBagLayout();
      GridBagConstraints gbc = new GridBagConstraints();
      setLayout(gbl);

      gbc.anchor = GridBagConstraints.NORTHWEST;
      gbc.fill = GridBagConstraints.HORIZONTAL;

      hmlabel.setForeground(Color.black);
      add(hmlabel, gbc);
      add(Box.createHorizontalStrut(10), gbc);
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(hmdir, gbc);
      add(Box.createVerticalStrut(15), gbc);

      gbc.gridwidth = 1;
      vjlabel.setForeground(Color.black);
      add(vjlabel, gbc);
      add(Box.createHorizontalStrut(10), gbc);
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(vjdir, gbc);
      add(Box.createVerticalStrut(0), gbc);

      gbc.gridwidth = 1;
      vjlabel2.setForeground(Color.black);
      add(vjlabel2, gbc);
      setBorder(
          new CompoundBorder(
              // i18n
              // BorderFactory.createTitledBorder(" User_Directories "),
              BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
  public HelpUI(Frame parent, String title) {
    sidebar = new Sidebar();
    sidebar.setBorder(new EmptyBorder(10, 10, 10, 10));
    infoView = new JTextPane();
    Dimension d1 = sidebar.getPreferredSize();
    infoView.setPreferredSize(new Dimension(d1.width * 3, d1.height - 5));
    infoView.setEditable(false);

    MouseAdapter ma =
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent me) {
            SidebarOption sopt = (SidebarOption) me.getComponent();
            if (sel != null) {
              sel.setSelected(false);
              sel.repaint();
            }
            sel = sopt;
            sel.setSelected(true);
            sel.repaint();
            renderInfo();
          }
        };

    general = new SidebarOption("General Info", HELP_GENERAL_LOC);
    general.addMouseListener(ma);
    sidebar.add(general);

    sidebar.add(Box.createVerticalStrut(scy(10)));

    artifact = new SidebarOption("Artifacts", HELP_ARTIFACTS_LOC);
    artifact.addMouseListener(ma);
    sidebar.add(artifact);

    sidebar.add(Box.createVerticalStrut(scy(10)));

    net = new SidebarOption("Networking", HELP_NET_LOC);
    net.addMouseListener(ma);
    sidebar.add(net);

    sidebar.add(Box.createVerticalStrut(scy(10)));

    gpl = new SidebarOption("License", HELP_GPL_LOC);
    gpl.addMouseListener(ma);
    sidebar.add(gpl);

    general.setSelected(true);
    sel = general;

    sidebar.add(Box.createVerticalGlue());

    add(BorderLayout.WEST, sidebar);
    add(BorderLayout.CENTER, new JScrollPane(infoView));
    setResizable(false);
    pack();
    setLocationRelativeTo(parent);
    setTitle(title);

    renderInfo();
  }
 public ConstraintsPanel() {
   setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
   add(new DisplayUserDirectory());
   add(Box.createVerticalStrut(15));
   add(new DisplayParentDirectory("", "", false));
   add(Box.createVerticalStrut(15));
   add(new DisplayTemplate("", ""));
   add(Box.createVerticalStrut(15));
   add(new DisplayResults());
   add(Box.createVerticalStrut(15));
 }
    public DisplayResults() {
      GridBagLayout gbl = new GridBagLayout();
      GridBagConstraints gbc = new GridBagConstraints();
      setLayout(gbl);

      gbc.anchor = GridBagConstraints.NORTHWEST;
      gbc.fill = GridBagConstraints.HORIZONTAL;

      text.setForeground(Color.black);
      add(text, gbc);
      gbc.gridy = 0;
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(emptyLabel, gbc);
      add(Box.createVerticalStrut(0), gbc);
      add(emptyLabel, gbc);

      /*	 gbc.gridy = 1;
      VTextMsg result = new VTextMsg(sshare, vnmrif, null);
      result.setPreferredSize(new Dimension(300, 30));
      result.setForeground(Color.black);
      add( result, gbc );
      */
      setBorder(
          new CompoundBorder(
              BorderFactory.createTitledBorder("  Results  "),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
Example #5
0
  private static JPanel createTextFieldAndListPanel(
      String label, JTextField textField, JList list) {
    GridBagLayout layout = new GridBagLayout();
    JPanel panel = new JPanel(layout);

    GridBagConstraints cons = new GridBagConstraints();
    cons.gridx = cons.gridy = 0;
    cons.gridwidth = cons.gridheight = 1;
    cons.fill = GridBagConstraints.BOTH;
    cons.weightx = 1.0f;

    JLabel _label = new JLabel(jEdit.getProperty(label));
    layout.setConstraints(_label, cons);
    panel.add(_label);

    cons.gridy = 1;
    Component vs = Box.createVerticalStrut(6);
    layout.setConstraints(vs, cons);
    panel.add(vs);

    cons.gridy = 2;
    layout.setConstraints(textField, cons);
    panel.add(textField);

    cons.gridy = 3;
    vs = Box.createVerticalStrut(6);
    layout.setConstraints(vs, cons);
    panel.add(vs);

    cons.gridy = 4;
    cons.gridheight = GridBagConstraints.REMAINDER;
    cons.weighty = 1.0f;
    JScrollPane scroller = new JScrollPane(list);
    layout.setConstraints(scroller, cons);
    panel.add(scroller);

    return panel;
  }
  public void doInit() {

    final InviteResponseMessageBox _this = this;

    if (!this.message.isDealtWith()) {

      // Show the response.
      this.responseBox = new Box(BoxLayout.Y_AXIS);

      this.add(this.responseBox);

      JComponent l =
          UIUtils.createBoldSubHeader(
              String.format(
                  "%s the invitation", (this.message.isAccepted() ? "Accepted" : "Rejected")),
              (this.message.isAccepted()
                  ? Constants.ACCEPTED_ICON_NAME
                  : Constants.REJECTED_ICON_NAME));

      this.responseBox.add(l);
      this.responseBox.setBorder(UIUtils.createPadding(5, 5, 0, 5));

      if (this.message.isAccepted()) {

        if ((this.message.getEditorName() != null) || (this.message.getEditorAvatar() != null)) {

          JTextPane desc =
              UIUtils.createHelpTextPane(
                  "Additionally they provided the following name/avatar.", this.projectViewer);

          this.responseBox.add(Box.createVerticalStrut(5));

          this.responseBox.add(desc);
          desc.setBorder(null);
          desc.setSize(new Dimension(UIUtils.getPopupWidth() - 20, desc.getPreferredSize().height));

          Box editorInfo = new Box(BoxLayout.X_AXIS);
          editorInfo.setAlignmentX(Component.LEFT_ALIGNMENT);
          editorInfo.setBorder(UIUtils.createPadding(5, 5, 5, 5));

          this.responseBox.add(editorInfo);

          if (this.message.getEditorAvatar() != null) {

            JLabel avatar = new JLabel();

            avatar.setAlignmentY(Component.TOP_ALIGNMENT);
            avatar.setVerticalAlignment(SwingConstants.TOP);

            editorInfo.add(avatar);
            avatar.setOpaque(false);

            avatar.setIcon(
                new ImageIcon(UIUtils.getScaledImage(_this.message.getEditorAvatar(), 50)));

            avatar.setBorder(
                new CompoundBorder(UIUtils.createPadding(0, 0, 0, 5), UIUtils.createLineBorder()));
          }

          if (this.message.getEditorName() != null) {

            JLabel name = new JLabel(this.message.getEditorName());
            editorInfo.add(name);

            name.setBorder(null);
            name.setAlignmentY(Component.TOP_ALIGNMENT);
            name.setVerticalAlignment(JLabel.TOP);
            name.setAlignmentX(Component.LEFT_ALIGNMENT);
            name.setFont(
                name.getFont()
                    .deriveFont((float) UIUtils.getScaledFontSize(14))
                    .deriveFont(java.awt.Font.PLAIN));
          }
        }
      }

      final EditorEditor ed = this.message.getEditor();

      JButton ok = new JButton("Ok, got it");

      ok.addActionListener(
          new ActionAdapter() {

            public void actionPerformed(ActionEvent ev) {

              try {

                if (_this.message.isAccepted()) {

                  ed.setEditorStatus(EditorEditor.EditorStatus.current);

                  if (_this.message.getEditorName() != null) {

                    ed.setName(_this.message.getEditorName());
                  }

                  if (_this.message.getEditorAvatar() != null) {

                    ed.setAvatar(_this.message.getEditorAvatar());
                  }

                  EditorsEnvironment.updateEditor(ed);

                  // Is this response for an invite message or just out of the blue from a web
                  // service invite?
                  if (!EditorsEnvironment.hasSentMessageOfTypeToEditor(
                      ed, InviteMessage.MESSAGE_TYPE)) {

                    EditorsEnvironment.sendUserInformationToEditor(ed, null, null, null);
                  }

                } else {

                  ed.setEditorStatus(EditorEditor.EditorStatus.rejected);

                  EditorsEnvironment.updateEditor(ed);
                }

                _this.message.setDealtWith(true);

                EditorsEnvironment.updateMessage(_this.message);

                _this.responseBox.setVisible(false);

              } catch (Exception e) {

                Environment.logError("Unable to update editor: " + ed, e);

                UIUtils.showErrorMessage(
                    _this.projectViewer,
                    "Unable to update {editor}, please contact Quoll Writer support for assitance.");

                return;
              }
            }
          });

      JButton[] buts = new JButton[] {ok};

      JPanel bb = UIUtils.createButtonBar2(buts, Component.LEFT_ALIGNMENT);
      bb.setOpaque(false);
      bb.setAlignmentX(Component.LEFT_ALIGNMENT);
      bb.setBorder(UIUtils.createPadding(5, 0, 0, 0));

      this.responseBox.add(bb);

      return;
    }

    boolean accepted = this.message.isAccepted();
    String iconName = (accepted ? Constants.ACCEPTED_ICON_NAME : Constants.REJECTED_ICON_NAME);

    String message = "Accepted invitation to be {an editor}";

    if (!accepted) {

      message = "Rejected invitation to be {an editor}";
    }

    JComponent h = UIUtils.createBoldSubHeader(message, iconName);

    this.add(h);
  }
Example #7
0
  public JavaPanel() {
    super();
    setLayout(new BorderLayout());
    config = Configuration.getInstance();
    Properties props = config.props;
    running = false;
    Util.isRunning();

    JPanel main = new JPanel();
    main.setLayout(new BorderLayout());
    main.setBackground(bgColor);

    // North Panel
    JPanel np = new JPanel();
    np.setBackground(bgColor);
    JLabel title = new JLabel(config.programName);
    title.setFont(new Font("SansSerif", Font.BOLD, 24));
    title.setForeground(Color.BLUE);
    np.add(title);
    np.setBorder(BorderFactory.createEmptyBorder(10, 0, 20, 0));
    main.add(np, BorderLayout.NORTH);

    // Center Panel
    RowPanel javaPanel = new RowPanel("Java Parameters");
    javaPanel.setBackground(bgColor);
    javaPanel.addRow(initMemory = new Row("Initial memory pool:", props.getProperty("ms", "")));
    javaPanel.addRow(maxMemory = new Row("Maximum memory pool:", props.getProperty("mx", "")));
    javaPanel.addRow(stackSize = new Row("Thread stack size:", props.getProperty("ss", "")));
    javaPanel.addRow(extDirs = new Row("Extensions directory:", props.getProperty("ext", "")));
    javaPanel.addRow(
        debugSSL = new CBRow("Enable SSL debugging:", props.getProperty("ssl", "").equals("yes")));
    javaPanel.addRow(
        javaMonitor =
            new CBRow("Enable Java monitoring:", props.getProperty("mon", "").equals("yes")));

    RowPanel serverPanel = new RowPanel("Server Parameters");
    serverPanel.setBackground(bgColor);
    serverPanel.addRow(serverPort = new Row("Server port:", Integer.toString(config.port)));
    serverPanel.addRow(
        clearLogs = new CBRow("Clear logs on start:", props.getProperty("clr", "").equals("yes")));

    JPanel cp = new JPanel();
    cp.setLayout(new RowLayout());
    cp.setBackground(bgColor);

    cp.add(serverPanel);
    cp.add(RowLayout.crlf());
    cp.add(Box.createVerticalStrut(20));
    cp.add(RowLayout.crlf());
    cp.add(javaPanel);
    cp.add(RowLayout.crlf());

    JPanel ccp = new JPanel(new FlowLayout());
    ccp.setBackground(bgColor);
    ccp.add(cp);
    main.add(ccp, BorderLayout.CENTER);

    // South Panel
    JPanel sp = new JPanel();
    sp.setBorder(BorderFactory.createEmptyBorder(10, 0, 20, 0));
    sp.setBackground(bgColor);

    start = new JButton("Start");
    sp.add(start);
    start.addActionListener(this);
    sp.add(Box.createHorizontalStrut(15));

    stop = new JButton("Stop");
    sp.add(stop);
    stop.addActionListener(this);
    sp.add(Box.createHorizontalStrut(70));

    launchBrowser = new JButton(config.browserButtonName + " Home Page");
    sp.add(launchBrowser);
    launchBrowser.addActionListener(this);

    main.add(sp, BorderLayout.SOUTH);

    this.add(main, BorderLayout.CENTER);
    this.add(new StatusPanel(status), BorderLayout.SOUTH);

    running = Util.isRunning();
    setStatus();
  }
Example #8
0
 public void addRow(int height) {
   add(Box.createVerticalStrut(height));
   add(RowLayout.crlf());
 }
  protected boolean exportApplicationPrompt() throws IOException, SketchException {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(Box.createVerticalStrut(6));

    // Box panel = Box.createVerticalBox();

    // Box labelBox = Box.createHorizontalBox();
    //    String msg = "<html>Click Export to Application to create a standalone, " +
    //      "double-clickable application for the selected plaforms.";

    //    String msg = "Export to Application creates a standalone, \n" +
    //      "double-clickable application for the selected plaforms.";
    String line1 = "Export to Application creates double-clickable,";
    String line2 = "standalone applications for the selected plaforms.";
    JLabel label1 = new JLabel(line1, SwingConstants.CENTER);
    JLabel label2 = new JLabel(line2, SwingConstants.CENTER);
    label1.setAlignmentX(Component.LEFT_ALIGNMENT);
    label2.setAlignmentX(Component.LEFT_ALIGNMENT);
    //    label1.setAlignmentX();
    //    label2.setAlignmentX(0);
    panel.add(label1);
    panel.add(label2);
    int wide = label2.getPreferredSize().width;
    panel.add(Box.createVerticalStrut(12));

    final JCheckBox windowsButton = new JCheckBox("Windows");
    // windowsButton.setMnemonic(KeyEvent.VK_W);
    windowsButton.setSelected(Preferences.getBoolean("export.application.platform.windows"));
    windowsButton.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            Preferences.setBoolean(
                "export.application.platform.windows", windowsButton.isSelected());
          }
        });

    final JCheckBox macosxButton = new JCheckBox("Mac OS X");
    // macosxButton.setMnemonic(KeyEvent.VK_M);
    macosxButton.setSelected(Preferences.getBoolean("export.application.platform.macosx"));
    macosxButton.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            Preferences.setBoolean("export.application.platform.macosx", macosxButton.isSelected());
          }
        });

    final JCheckBox linuxButton = new JCheckBox("Linux");
    // linuxButton.setMnemonic(KeyEvent.VK_L);
    linuxButton.setSelected(Preferences.getBoolean("export.application.platform.linux"));
    linuxButton.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            Preferences.setBoolean("export.application.platform.linux", linuxButton.isSelected());
          }
        });

    JPanel platformPanel = new JPanel();
    // platformPanel.setLayout(new BoxLayout(platformPanel, BoxLayout.X_AXIS));
    platformPanel.add(windowsButton);
    platformPanel.add(Box.createHorizontalStrut(6));
    platformPanel.add(macosxButton);
    platformPanel.add(Box.createHorizontalStrut(6));
    platformPanel.add(linuxButton);
    platformPanel.setBorder(new TitledBorder("Platforms"));
    // Dimension goodIdea = new Dimension(wide, platformPanel.getPreferredSize().height);
    // platformPanel.setMaximumSize(goodIdea);
    wide = Math.max(wide, platformPanel.getPreferredSize().width);
    platformPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    panel.add(platformPanel);

    //  Box indentPanel = Box.createHorizontalBox();
    //  indentPanel.add(Box.createHorizontalStrut(new JCheckBox().getPreferredSize().width));
    final JCheckBox showStopButton = new JCheckBox("Show a Stop button");
    // showStopButton.setMnemonic(KeyEvent.VK_S);
    showStopButton.setSelected(Preferences.getBoolean("export.application.stop"));
    showStopButton.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            Preferences.setBoolean("export.application.stop", showStopButton.isSelected());
          }
        });
    showStopButton.setEnabled(Preferences.getBoolean("export.application.fullscreen"));
    showStopButton.setBorder(new EmptyBorder(3, 13, 6, 13));
    //  indentPanel.add(showStopButton);
    //  indentPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    final JCheckBox fullScreenButton = new JCheckBox("Full Screen (Present mode)");
    // fullscreenButton.setMnemonic(KeyEvent.VK_F);
    fullScreenButton.setSelected(Preferences.getBoolean("export.application.fullscreen"));
    fullScreenButton.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            boolean sal = fullScreenButton.isSelected();
            Preferences.setBoolean("export.application.fullscreen", sal);
            showStopButton.setEnabled(sal);
          }
        });
    fullScreenButton.setBorder(new EmptyBorder(3, 13, 3, 13));

    JPanel optionPanel = new JPanel();
    optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.Y_AXIS));
    optionPanel.add(fullScreenButton);
    optionPanel.add(showStopButton);
    //    optionPanel.add(indentPanel);
    optionPanel.setBorder(new TitledBorder("Options"));
    wide = Math.max(wide, platformPanel.getPreferredSize().width);
    // goodIdea = new Dimension(wide, optionPanel.getPreferredSize().height);
    optionPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    // optionPanel.setMaximumSize(goodIdea);
    panel.add(optionPanel);

    Dimension good;
    // label1, label2, platformPanel, optionPanel
    good = new Dimension(wide, label1.getPreferredSize().height);
    label1.setMaximumSize(good);
    good = new Dimension(wide, label2.getPreferredSize().height);
    label2.setMaximumSize(good);
    good = new Dimension(wide, platformPanel.getPreferredSize().height);
    platformPanel.setMaximumSize(good);
    good = new Dimension(wide, optionPanel.getPreferredSize().height);
    optionPanel.setMaximumSize(good);

    //    JPanel actionPanel = new JPanel();
    //    optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.X_AXIS));
    //    optionPanel.add(Box.createHorizontalGlue());

    //    final JDialog frame = new JDialog(editor, "Export to Application");

    //    JButton cancelButton = new JButton("Cancel");
    //    cancelButton.addActionListener(new ActionListener() {
    //      public void actionPerformed(ActionEvent e) {
    //        frame.dispose();
    //        return false;
    //      }
    //    });

    // Add the buttons in platform-specific order
    //    if (PApplet.platform == PConstants.MACOSX) {
    //      optionPanel.add(cancelButton);
    //      optionPanel.add(exportButton);
    //    } else {
    //      optionPanel.add(exportButton);
    //      optionPanel.add(cancelButton);
    //    }
    String[] options = {"Export", "Cancel"};
    final JOptionPane optionPane =
        new JOptionPane(
            panel,
            JOptionPane.PLAIN_MESSAGE,
            // JOptionPane.QUESTION_MESSAGE,
            JOptionPane.YES_NO_OPTION,
            null,
            options,
            options[0]);

    final JDialog dialog = new JDialog(this, "Export Options", true);
    dialog.setContentPane(optionPane);

    optionPane.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent e) {
            String prop = e.getPropertyName();

            if (dialog.isVisible()
                && (e.getSource() == optionPane)
                && (prop.equals(JOptionPane.VALUE_PROPERTY))) {
              // If you were going to check something
              // before closing the window, you'd do
              // it here.
              dialog.setVisible(false);
            }
          }
        });
    dialog.pack();
    dialog.setResizable(false);

    Rectangle bounds = getBounds();
    dialog.setLocation(
        bounds.x + (bounds.width - dialog.getSize().width) / 2,
        bounds.y + (bounds.height - dialog.getSize().height) / 2);
    dialog.setVisible(true);

    Object value = optionPane.getValue();
    if (value.equals(options[0])) {
      return jmode.handleExportApplication(sketch);
    } else if (value.equals(options[1]) || value.equals(new Integer(-1))) {
      // closed window by hitting Cancel or ESC
      statusNotice("Export to Application canceled.");
    }
    return false;
  }
Example #10
0
  public WizardStep getStage(String stage) {

    final WhatsNew _this = this;

    WizardStep ws = new WizardStep();

    int ind = stage.indexOf(":");

    Version v = new Version(stage.substring(0, ind));

    int lind = Integer.parseInt(stage.substring(ind + 1));

    java.util.List<WhatsNewItem> its = this.items.get(v);

    if (its == null) {

      return null;
    }

    WhatsNewItem item = its.get(lind);

    if (item == null) {

      return null;
    }

    ws.title = item.title;
    ws.helpText = this.getFirstHelpText();

    if ((item.description != null) || (item.component != null)) {

      final Box b = new Box(BoxLayout.Y_AXIS);

      if (item.description != null) {

        JTextPane hp = UIUtils.createHelpTextPane(item.description, this.projectViewer);

        hp.setBorder(null);
        hp.setSize(new Dimension(UIUtils.getPopupWidth() - 25, 500));

        Box hpb = new Box(BoxLayout.Y_AXIS);
        hpb.add(hp);
        hpb.setMaximumSize(hpb.getPreferredSize());
        hpb.setBorder(UIUtils.createPadding(0, 5, 0, 0));
        b.add(hpb);
      }

      if (item.component != null) {

        if (item.description != null) {

          b.add(Box.createVerticalStrut(5));
        }

        item.component.setAlignmentY(Component.TOP_ALIGNMENT);
        item.component.setBorder(UIUtils.createPadding(5, 10, 0, 0));

        b.add(item.component);
      }

      b.add(Box.createVerticalGlue());

      ws.panel = b;
    }

    return ws;
  }
  /** Initializes all GUI components */
  private void initComponents() {

    mainPanel = new JPanel();
    editPanel = new JPanel();
    editPanelLeft = new JPanel();
    editPanelCenter = new JPanel();
    editPanelRight = new JPanel();
    tablePanel = new JPanel();

    companyIdTextField = new JTextField();
    companyIdTextField.setEditable(false);
    companyNameTextField = new JTextField();
    urlTextField = new JTextField();
    insuranceTypesTextField = new JTextField();
    telephoneTextField = new JTextField();
    percentageTextField = new JTextField();
    percentageTextField.setToolTipText("<html>Only <b>numerical</b> values allowed</html>");
    searchTextField = new JTextField();
    searchTextField.setToolTipText(
        "<html>Use either <b>AND</b> or <b>OR</b> for combined search queries<br>You can also use <b>spaces</b> instead of <b>OR</b></html>");
    generalDescriptionTextField = new JTextField();

    companyIdLabel = new InsuranceCompanyLabel("ID");
    companyNameLabel = new InsuranceCompanyLabel("Company");
    urlLabel = new InsuranceCompanyLabel("Website");
    insuranceTypesLabel = new InsuranceCompanyLabel("Insurance Types");
    telephoneLabel = new InsuranceCompanyLabel("Telephone");
    percentageLabel = new InsuranceCompanyLabel("Broker Percentage");
    searchLabel = new InsuranceCompanyLabel("Search Insurance Types");
    generalDescriptionLabel = new InsuranceCompanyLabel("General Description");
    sortLabel = new InsuranceCompanyLabel("Sorting");

    addInsuranceCompanyButton = new InsuranceCompanyButton("New Insurance Company", 190, 45);
    addInsuranceCompanyButton.setToolTipText(
        "<html>Create a new <b>empty</b> Insurance Company</html>");
    saveInsuranceCompanyButton = new InsuranceCompanyButton("Save Insurance Company", 190, 45);
    saveInsuranceCompanyButton.setToolTipText(
        "<html>Save the <b>selected</b> Insurance Company<br>Hint: Press <b>Enter</b> to quickly save an entry</html>");
    saveInsuranceCompanyButton.setDefaultCapable(true);
    getRootPane()
        .setDefaultButton(
            saveInsuranceCompanyButton); // Set the save button as default button, so quicker
                                         // editing by pressing Enter is possible
    deleteInsuranceCompanyButton = new InsuranceCompanyButton("Delete Insurance Company", 190, 45);
    deleteInsuranceCompanyButton.setToolTipText(
        "<html>Delete the <b>selected</b> Insurance Company</html>");
    clearSearchButton = new InsuranceCompanyButton("x", 40, 35);
    clearSearchButton.setToolTipText("<html>Click to <b>clear</b> the search field</html>");

    String[] sortStrategies = {"ID", "Company Name", "Percentage"};
    sortComboBox = new JComboBox(sortStrategies);

    tableData = new InsuranceCompanyTableModel(model.getInsuranceCompanies());
    insuranceCompaniesTable = new JTable();

    insuranceCompanyScrollPane = new JScrollPane(insuranceCompaniesTable);

    // Set layout and add components to panels
    setLayout(new BorderLayout());
    add(mainPanel, BorderLayout.CENTER);
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(editPanel, BorderLayout.NORTH);
    editPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
    editPanel.setLayout(new BorderLayout());
    editPanel.add(editPanelLeft, BorderLayout.CENTER);
    editPanelLeft.setBorder(new EmptyBorder(0, 0, 5, 15));
    editPanelLeft.setLayout(new GridLayout(4, 4, 5, 0));
    editPanelLeft.add(companyIdLabel);
    editPanelLeft.add(companyNameLabel);
    editPanelLeft.add(urlLabel);
    editPanelLeft.add(telephoneLabel);
    editPanelLeft.add(companyIdTextField);
    editPanelLeft.add(companyNameTextField);
    editPanelLeft.add(urlTextField);
    editPanelLeft.add(telephoneTextField);
    editPanelLeft.add(percentageLabel);
    editPanelLeft.add(searchLabel);
    editPanelLeft.add(new JLabel());
    editPanelLeft.add(sortLabel);
    editPanelLeft.add(percentageTextField);
    editPanelLeft.add(searchTextField);
    Container searchBox = Box.createVerticalBox();
    searchBox.add(clearSearchButton);
    editPanelLeft.add(searchBox);
    editPanelLeft.add(sortComboBox);
    editPanel.add(editPanelRight, BorderLayout.EAST);
    Container box = Box.createVerticalBox();
    box.add(saveInsuranceCompanyButton);
    box.add(Box.createVerticalStrut(5));
    box.add(addInsuranceCompanyButton);
    box.add(Box.createVerticalStrut(5));
    box.add(deleteInsuranceCompanyButton);
    editPanelRight.add(box);
    editPanel.add(editPanelCenter, BorderLayout.SOUTH);
    editPanelCenter.setLayout(new GridLayout(4, 1));
    editPanelCenter.add(insuranceTypesLabel);
    editPanelCenter.add(insuranceTypesTextField);
    editPanelCenter.add(generalDescriptionLabel);
    editPanelCenter.add(generalDescriptionTextField);
    mainPanel.add(tablePanel, BorderLayout.CENTER);
    tablePanel.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createEmptyBorder(10, 10, 10, 10), "Insurance Companies Overview"));
    tablePanel.setLayout(new BorderLayout());
    tablePanel.add(insuranceCompanyScrollPane, BorderLayout.CENTER);

    setMinimumSize(new Dimension(800, 600));
    setPreferredSize(new Dimension(900, 600));
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    pack();
  }