Ejemplo n.º 1
0
 /** Builds and lays out the UI. */
 private void buildGUI() {
   setBackground(UIUtilities.BACKGROUND_COLOR);
   setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
   if (selectable) add(checkbox);
   add(label);
   JToolBar bar = new JToolBar();
   bar.setBackground(UIUtilities.BACKGROUND_COLOR);
   bar.setFloatable(false);
   bar.setRollover(true);
   bar.setBorder(null);
   bar.setOpaque(true);
   boolean b = setControlsEnabled(data != null);
   int count = 0;
   if (editButton != null) count++;
   if (unlinkButton != null) count++;
   if (downloadButton != null) count++;
   if (infoButton != null) count++;
   if (openButton != null) count++;
   if (count > 0 && data != null) {
     menuButton.setEnabled(true);
     if (model.isAcrossGroups()) menuButton.setEnabled(false);
     bar.add(menuButton);
     if (!b) bar.add(Box.createHorizontalStrut(8));
     add(bar);
   }
 }
Ejemplo n.º 2
0
  public JToolBar getToolBar() {
    JToolBar toolBar = new JToolBar();
    toolBar.setOpaque(false);
    toolBar.setBorder(null);
    toolBar.setFloatable(false);
    toolBar.setBorderPainted(false);

    Insets insets = new Insets(6, 0, 0, 0);
    JButton button = null;
    button = toolBar.add(new NovoAction(this));
    button.setMargin(insets);
    button = toolBar.add(new CancelarAction(this));
    button.setMargin(insets);
    button = toolBar.add(new SalvarAction(this));
    button.setMargin(insets);
    button = toolBar.add(new ExcluirAction(this));
    button.setMargin(insets);
    button = toolBar.add(new PesquisarAction(this));
    button.setMargin(insets);
    button = toolBar.add(new LimparAction(this));
    button.setMargin(insets);
    button = toolBar.add(new ImprimirAction(this));
    button.setMargin(insets);
    toolBar.addSeparator(new Dimension(20, 10));
    return toolBar;
  }
Ejemplo n.º 3
0
 /** Builds and lays out the UI. */
 private void buildGUI() {
   setBackground(UIUtilities.BACKGROUND_COLOR);
   JToolBar bar = new JToolBar();
   bar.setBackground(UIUtilities.BACKGROUND_COLOR);
   bar.setBorder(null);
   bar.setRollover(true);
   bar.setFloatable(false);
   JButton b = new JButton(control.getAction(RendererControl.SAVE));
   UIUtilities.unifiedButtonLookAndFeel(b);
   b.setText(ManageRndSettingsAction.NAME_SAVE);
   b.setBackground(UIUtilities.BACKGROUND_COLOR);
   bar.add(b);
   /*
   b = new JButton(control.getAction(RendererControl.VIEW));
   UIUtilities.unifiedButtonLookAndFeel(b);
   b.setBackground(UIUtilities.BACKGROUND_COLOR);
   bar.add(b);
   */
   setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
   add(bar);
   add(Box.createHorizontalStrut(5));
   JPanel p = UIUtilities.buildComponentPanelRight(selectedPlane);
   p.setBackground(UIUtilities.BACKGROUND_COLOR);
   add(p);
 }
Ejemplo n.º 4
0
 // Right toolbar for current scan results
 private JToolBar getToolbarRight() {
   if (footerToolbarRight == null) {
     footerToolbarRight = new JToolBar();
     footerToolbarRight.setEnabled(true);
     footerToolbarRight.setFloatable(false);
     footerToolbarRight.setRollover(true);
     footerToolbarRight.setName("Footer Toolbar Right");
     footerToolbarRight.setBorder(BorderFactory.createEmptyBorder());
   }
   return footerToolbarRight;
 }
Ejemplo n.º 5
0
 /**
  * Creates a tool bar and adds the passed buttons to it.
  *
  * @param addButton The button to add.
  * @param removeButton The button to add.
  * @return See above.
  */
 private JToolBar createBar(JButton addButton, JButton removeButton) {
   JToolBar bar = new JToolBar();
   bar.setFloatable(false);
   bar.setBorder(null);
   bar.setBackground(UIUtilities.BACKGROUND_COLOR);
   bar.add(addButton);
   if (removeButton != null) {
     // bar.add(Box.createHorizontalStrut(2));
     bar.add(removeButton);
   }
   return bar;
 }
Ejemplo n.º 6
0
 /**
  * Sets a new tool bar in the header.
  *
  * @param newToolBar the tool bar to be set in the header
  */
 public void setToolBar(JToolBar newToolBar) {
   JToolBar oldToolBar = getToolBar();
   if (oldToolBar == newToolBar) {
     return;
   }
   if (oldToolBar != null) {
     headerPanel.remove(oldToolBar);
   }
   if (newToolBar != null) {
     newToolBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
     headerPanel.add(newToolBar, BorderLayout.EAST);
   }
   updateHeader();
   firePropertyChange("toolBar", oldToolBar, newToolBar);
 }
Ejemplo n.º 7
0
 /**
  * Static component init.
  *
  * <pre>
  *  - panel
  *      - northPanel
  *          - parameterPanel
  *          - toolBar
  *      - gridController
  *      - confirmPanel
  *  - statusBar
  *  </pre>
  *
  * @throws Exception
  */
 void jbInit() throws Exception {
   // [ 1707303 ] Account Combination Form(VAccountDialog) translation issue
   titledBorder =
       new TitledBorder(
           BorderFactory.createEtchedBorder(Color.white, new Color(134, 134, 134)),
           Msg.getMsg(Env.getCtx(), "Parameter"));
   //
   panelLayout.setHgap(5);
   panelLayout.setVgap(5);
   northLayout.setHgap(5);
   northLayout.setVgap(5);
   //
   parameterPanel.setLayout(parameterLayout);
   parameterPanel.setBorder(titledBorder);
   northPanel.setLayout(northLayout);
   toolBar.setOrientation(JToolBar.VERTICAL);
   toolBar.setBorder(null);
   toolBar.setRequestFocusEnabled(false);
   toolBar.setBorderPainted(false);
   toolBar.setMargin(new Insets(5, 5, 5, 5));
   bSave.setIcon(new ImageIcon(ResourceFinder.getResource("images/Save24.gif")));
   bSave.setMargin(new Insets(2, 2, 2, 2));
   bSave.setToolTipText(Msg.getMsg(Env.getCtx(), "AccountNewUpdate"));
   bSave.addActionListener(this);
   bRefresh.setIcon(new ImageIcon(ResourceFinder.getResource("images/Refresh24.gif")));
   bRefresh.setMargin(new Insets(2, 2, 2, 2));
   bRefresh.setToolTipText(Msg.getMsg(Env.getCtx(), "Refresh"));
   bRefresh.addActionListener(this);
   bIgnore.setIcon(new ImageIcon(ResourceFinder.getResource("images/Ignore24.gif")));
   bIgnore.setMargin(new Insets(2, 2, 2, 2));
   bIgnore.setToolTipText(Msg.getMsg(Env.getCtx(), "Ignore"));
   bIgnore.addActionListener(this);
   //
   toolBar.addSeparator();
   toolBar.add(bRefresh, null);
   toolBar.add(bIgnore, null);
   toolBar.add(bSave, null);
   //
   getContentPane().add(panel);
   panel.setLayout(panelLayout);
   panel.add(confirmPanel, BorderLayout.SOUTH);
   panel.add(northPanel, BorderLayout.NORTH);
   northPanel.add(parameterPanel, BorderLayout.CENTER);
   northPanel.add(toolBar, BorderLayout.EAST);
   //
   this.getContentPane().add(statusBar, BorderLayout.SOUTH);
   confirmPanel.addActionListener(this);
 } //	jbInit
  private JPanel createToolPanel() {
    configurationOverrideCombo.setModel(configurationOverrideModel);
    final int preferredHeight = configurationOverrideCombo.getPreferredSize().height;
    configurationOverrideCombo.setPreferredSize(new Dimension(250, preferredHeight));
    configurationOverrideCombo.setMaximumSize(new Dimension(350, preferredHeight));

    treeModel = new ResultTreeModel();

    resultsTree = new Tree(treeModel);
    resultsTree.setRootVisible(false);

    final TreeSelectionListener treeSelectionListener = new ToolWindowSelectionListener();
    resultsTree.addTreeSelectionListener(treeSelectionListener);
    final MouseListener treeMouseListener = new ToolWindowMouseListener();
    resultsTree.addMouseListener(treeMouseListener);
    resultsTree.setCellRenderer(new ResultTreeRenderer());

    progressLabel = new JLabel(" ");
    progressBar = new JProgressBar(JProgressBar.HORIZONTAL);
    progressBar.setMinimum(0);
    final Dimension progressBarSize = new Dimension(100, progressBar.getPreferredSize().height);
    progressBar.setMinimumSize(progressBarSize);
    progressBar.setPreferredSize(progressBarSize);
    progressBar.setMaximumSize(progressBarSize);

    progressPanel = new JToolBar(JToolBar.HORIZONTAL);
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.add(new JLabel(CheckStyleBundle.message("plugin.toolwindow.override")));
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.add(configurationOverrideCombo);
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.addSeparator();
    progressPanel.add(Box.createHorizontalStrut(4));
    progressPanel.add(progressLabel);
    progressPanel.add(Box.createHorizontalGlue());
    progressPanel.setFloatable(false);
    progressPanel.setBackground(UIManager.getColor("Panel.background"));
    progressPanel.setBorder(null);

    final JPanel toolPanel = new JPanel(new BorderLayout());
    toolPanel.add(new JBScrollPane(resultsTree), BorderLayout.CENTER);
    toolPanel.add(progressPanel, BorderLayout.NORTH);

    ToolTipManager.sharedInstance().registerComponent(resultsTree);

    return toolPanel;
  }
  private Component crearToolBar() {
    JToolBar toolBar = new JToolBar();
    JButton boton;

    toolBar.setFloatable(false);

    toolBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    boton = (JButton) toolBar.add(new JButton(accVerResultados));
    toolBar.addSeparator(new Dimension(20, 0));
    boton = (JButton) toolBar.add(new JButton(accHacerEjercicio));

    toolBar.add(Box.createHorizontalGlue());

    boton = (JButton) toolBar.add(new JButton(accLogOut));

    return toolBar;
  }
Ejemplo n.º 10
0
  public JToolBar getToolbar() {
    JToolBar jtb = new JToolBar();
    jtb.setOpaque(false);
    jtb.setRollover(true);
    jtb.setBorder(null);
    jtb.setOpaque(false);

    gutbut[0] = new JButton();
    gutbut[0].setIcon(SystemConfig.hmSysIcons.get("neu"));
    gutbut[0].setToolTipText("Neues Gutachten erstellen");
    gutbut[0].setActionCommand("gutneu");
    gutbut[0].addActionListener(this);
    jtb.add(gutbut[0]);

    gutbut[1] = new JButton();
    gutbut[1].setIcon(SystemConfig.hmSysIcons.get("edit"));
    gutbut[1].setToolTipText("Bestehendes Gutachten ändern/editieren");
    gutbut[1].setActionCommand("gutedit");
    gutbut[1].addActionListener(this);
    jtb.add(gutbut[1]);

    gutbut[2] = new JButton();
    gutbut[2].setIcon(SystemConfig.hmSysIcons.get("delete"));
    gutbut[2].setToolTipText("Gutachten löschen");
    gutbut[2].setActionCommand("gutdelete");
    gutbut[2].addActionListener(this);
    jtb.add(gutbut[2]);

    jtb.addSeparator(new Dimension(30, 0));

    gutbut[3] = new JButton();
    gutbut[3].setIcon(SystemConfig.hmSysIcons.get("tools"));
    gutbut[3].setToolTipText("Werkzeuge für Gutachte");
    gutbut[3].setActionCommand("guttools");
    gutbut[3].addActionListener(this);
    jtb.add(gutbut[3]);
    for (int i = 0; i < 4; i++) {
      gutbut[i].setEnabled(false);
    }
    return jtb;
  }
Ejemplo n.º 11
0
  private Component crearToolBar() {
    toolBar = new JToolBar();
    toolBar.setBorder(BorderFactory.createRaisedBevelBorder());

    JButton boton;
    boton = (JButton) toolBar.add(new JButton(new ImageIcon("icons/window_new.png")));
    boton.setActionCommand("Añadir");
    //	boton.addActionListener(this);

    boton = (JButton) toolBar.add(new JButton(new ImageIcon("icons/editcut.png")));
    boton.setActionCommand("Borrar");
    //		boton.addActionListener(this);

    toolBar.add(Box.createHorizontalGlue());

    boton = (JButton) toolBar.add(new JButton(new ImageIcon("icons/exit.png")));
    boton.setActionCommand("Salir");
    //	boton.addActionListener(this);

    return toolBar;
  }
Ejemplo n.º 12
0
 /**
  * Adds a panel to this configuration panel.
  *
  * @param text the text to use on the toolbar button
  * @param icon the icon to use on the toolbar button
  * @param icon2 the icon to use on the toolbar button when the mouse button is held down
  * @param p the configuration panel page
  */
 public void addPanel(String text, Icon icon, Icon icon2, JPanel p) {
   JToggleButton button = new JToggleButton(text, icon);
   button.setVerticalTextPosition(AbstractButton.BOTTOM);
   button.setHorizontalTextPosition(AbstractButton.CENTER);
   button.setContentAreaFilled(false);
   try {
     // JDK 1.4+
     // button.setIconTextGap(0);
     AbstractButton.class
         .getMethod("setIconTextGap", new Class[] {Integer.TYPE})
         .invoke(button, new Object[] {new Integer(0)});
   } catch (Exception ex) {
   }
   button.setPressedIcon(icon2);
   group.add(button);
   toolbar.add(button);
   toolbar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray));
   button.addItemListener(
       new ItemListener() {
         public void itemStateChanged(ItemEvent e) {
           JToggleButton b = (JToggleButton) e.getSource();
           switch (e.getStateChange()) {
             case ItemEvent.SELECTED:
               select(b);
               break;
             case ItemEvent.DESELECTED:
               unselect(b);
               break;
           }
         }
       });
   if (panel.getComponentCount() == 0) {
     button.setSelected(true);
     page = 0;
   } else {
     unselect(button);
   }
   panel.add(p, text.intern());
 }
  private LoggingViewer(JTextPane textArea) {
    super(new BorderLayout());
    final Level level = getSpecifiedLogLevelIndex();
    handler.setLevel(level);
    LogService.getRoot().setLevel(level);
    maxRows = 1000;
    try {
      String maxRowsString =
          ParameterService.getParameterValue(
              MainFrame.PROPERTY_RAPIDMINER_GUI_MESSAGEVIEWER_ROWLIMIT);
      if (maxRowsString != null) maxRows = Integer.parseInt(maxRowsString);
    } catch (NumberFormatException e) {
      // LogService.getGlobal().log("Bad integer format for property '', using default number of
      // maximum rows for logging (1000).", LogService.WARNING);
      LogService.getRoot()
          .log(
              Level.WARNING,
              "com.rapidminer.gui.tools.LoggingViewer.bad_integer_format_for_property");
    }

    this.textArea = textArea;
    this.textArea.setToolTipText(
        "Displays logging messages according to the current log verbosity (parameter of root operator).");
    this.textArea.setEditable(false);
    this.textArea.addMouseListener(this);
    this.textArea.setFont(this.textArea.getFont().deriveFont(Font.PLAIN));
    LogService.getRoot().addHandler(handler);

    JToolBar toolBar = new ExtendedJToolBar();
    toolBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY));
    toolBar.add(SAVE_LOGFILE_ACTION);
    toolBar.add(CLEAR_MESSAGE_VIEWER_ACTION);
    toolBar.add(SEARCH_ACTION);
    add(toolBar, BorderLayout.NORTH);
    JScrollPane scrollPane = new ExtendedJScrollPane(textArea);
    scrollPane.setBorder(null);
    add(scrollPane, BorderLayout.CENTER);
  }
Ejemplo n.º 14
0
 private JToolBar createToolBar() {
   ActionMap actionMap = context.getActionMap(this);
   final JToolBar toolbar = new JToolBar();
   toolbar.setFloatable(false);
   toolbar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.GRAY));
   toolbar.setRollover(true);
   toolbar.add(actionMap.get("openProject"));
   toolbar.addSeparator();
   toolbar.add(application.getAction(NewRvConnection.COMMAND));
   toolbar.addSeparator();
   toolbar.add(application.getAction(ClearLedger.COMMAND));
   toolbar.addSeparator();
   toolbar.add(application.getAction(PauseAllConnections.COMMAND));
   final Component[] components = toolbar.getComponents();
   for (int i = 0, imax = components.length; i < imax; ++i) {
     Component component = components[i];
     if (component instanceof AbstractButton) {
       ((AbstractButton) component).setBorderPainted(false);
       ((AbstractButton) component).setOpaque(false);
     }
   }
   return toolbar;
 }
Ejemplo n.º 15
0
  @SuppressWarnings("serial")
  public static JToolBar newToolbar(boolean anchorRight) {
    JToolBar toolbar;

    if (anchorRight) {
      toolbar =
          new JToolBar() {
            @Override
            protected void addImpl(Component c, Object constraints, int index) {
              int reverseIndex;
              if (index == -1) {
                reverseIndex = 0;
              } else {
                int oldIndex = getComponentIndex(c);
                if (oldIndex >= 0 && index > oldIndex) {
                  index--;
                }

                reverseIndex = getComponentCount() - index;
              }

              super.addImpl(c, constraints, reverseIndex);
            }
          };
      toolbar.setComponentOrientation(RIGHT_TO_LEFT);
    } else {
      toolbar = new JToolBar();
    }

    toolbar.setBorder(null);
    toolbar.setBorderPainted(false);
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.setOpaque(false);
    return toolbar;
  }
Ejemplo n.º 16
0
  /** Creates the GUI. */
  protected void createGUI() {
    JButton throwaway = new JButton("by"); // $NON-NLS-1$
    throwaway.setBorder(LibraryBrowser.buttonBorder);
    int h = throwaway.getPreferredSize().height;
    sharedFont = throwaway.getFont();

    // create collections list
    ListModel collectionListModel =
        new AbstractListModel() {
          public int getSize() {
            return library.pathList.size();
          }

          public Object getElementAt(int i) {
            String path = library.pathList.get(i);
            return library.pathToNameMap.get(path);
          }
        };
    collectionList = new JList(collectionListModel);
    collectionList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            refreshGUI();
          }
        });
    collectionList.setFixedCellHeight(h);
    collectionList.setFont(sharedFont);
    collectionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    // create import list
    ListModel importListModel =
        new AbstractListModel() {
          public int getSize() {
            return library.importedPathList.size();
          }

          public Object getElementAt(int i) {
            String path = library.importedPathList.get(i);
            return library.importedPathToLibraryMap.get(path).getName();
          }
        };
    guestList = new JList(importListModel);
    guestList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            refreshGUI();
          }
        });
    guestList.setFont(sharedFont);
    guestList.setFixedCellHeight(h);
    guestList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    // create name action, field and label
    nameAction =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String path = pathField.getText();
            String prev = library.pathToNameMap.get(path);
            String input = nameField.getText().trim();
            if (input == null || input.equals("") || input.equals(prev)) { // $NON-NLS-1$
              return;
            }
            library.renameCollection(path, input);
            browser.refreshCollectionsMenu();
            collectionList.repaint();
            refreshGUI();
          }
        };
    nameField = new LibraryTreePanel.EntryField();
    nameField.addActionListener(nameAction);
    nameField.addFocusListener(
        new FocusAdapter() {
          public void focusGained(FocusEvent e) {
            nameField.selectAll();
          }

          public void focusLost(FocusEvent e) {
            nameAction.actionPerformed(null);
          }
        });
    nameField.setBackground(Color.white);

    nameLabel = new JLabel();
    nameLabel.setFont(sharedFont);
    nameLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 2));
    nameLabel.setHorizontalAlignment(SwingConstants.TRAILING);

    // create path action, field and label
    //		pathAction = new ActionListener() {
    //      public void actionPerformed(ActionEvent e) {
    //	    	int i = collectionList.getSelectedIndex();
    //      	String path = library.pathList.get(i);
    //  			String name = library.pathToNameMap.get(path);
    //      	String input = pathField.getText().trim();
    //        if(input==null || input.equals("") || input.equals(path)) { //$NON-NLS-1$
    //          return;
    //        }
    //        library.pathList.remove(i);
    //        library.pathList.add(i, input);
    //        library.pathToNameMap.remove(path);
    //        library.pathToNameMap.put(input, name);
    //
    //        browser.refreshCollectionsMenu();
    //  			collectionList.repaint();
    //  			refreshGUI();
    //     	}
    //    };
    pathField = new LibraryTreePanel.EntryField();
    pathField.setEditable(false);
    //  	pathField.addActionListener(pathAction);
    //  	pathField.addFocusListener(new FocusAdapter() {
    //      public void focusGained(FocusEvent e) {
    //      	pathField.selectAll();
    //      }
    //      public void focusLost(FocusEvent e) {
    //      	pathAction.actionPerformed(null);
    //      }
    //    });
    pathField.setBackground(Color.white);

    pathLabel = new JLabel();
    pathLabel.setFont(sharedFont);
    pathLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 2));
    pathLabel.setHorizontalAlignment(SwingConstants.TRAILING);

    // create buttons
    okButton = new JButton();
    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setVisible(false);
          }
        });

    moveUpButton = new JButton();
    moveUpButton.setOpaque(false);
    moveUpButton.setBorder(LibraryBrowser.buttonBorder);
    moveUpButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            boolean isImports = tabbedPane.getSelectedComponent() == importsPanel;
            JList list = isImports ? guestList : collectionList;
            ArrayList<String> paths = isImports ? library.importedPathList : library.pathList;
            int i = list.getSelectedIndex();
            String path = paths.get(i);
            paths.remove(path);
            paths.add(i - 1, path);
            list.setSelectedIndex(i - 1);
            browser.refreshCollectionsMenu();
            browser.refreshGUI();
          }
        });
    moveDownButton = new JButton();
    moveDownButton.setOpaque(false);
    moveDownButton.setBorder(LibraryBrowser.buttonBorder);
    moveDownButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            boolean isImports = tabbedPane.getSelectedComponent() == importsPanel;
            JList list = isImports ? guestList : collectionList;
            ArrayList<String> paths = isImports ? library.importedPathList : library.pathList;
            int i = list.getSelectedIndex();
            String path = paths.get(i);
            paths.remove(path);
            paths.add(i + 1, path);
            list.setSelectedIndex(i + 1);
            browser.refreshCollectionsMenu();
            browser.refreshGUI();
          }
        });
    addButton = new JButton();
    addButton.setOpaque(false);
    addButton.setBorder(LibraryBrowser.buttonBorder);
    addButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            boolean imported = tabbedPane.getSelectedComponent() == importsPanel;
            String message =
                imported
                    ? ToolsRes.getString("LibraryBrowser.Dialog.AddLibrary.Message")
                    : //$NON-NLS-1$
                    ToolsRes.getString(
                        "LibraryBrowser.Dialog.AddCollection.Message"); //$NON-NLS-1$
            String title =
                imported
                    ? ToolsRes.getString("LibraryBrowser.Dialog.AddLibrary.Title")
                    : //$NON-NLS-1$
                    ToolsRes.getString("LibraryBrowser.Dialog.AddCollection.Title"); // $NON-NLS-1$

            Object input =
                JOptionPane.showInputDialog(
                    browser, message, title, JOptionPane.QUESTION_MESSAGE, null, null, null);

            if (input == null || input.equals("")) { // $NON-NLS-1$
              return;
            }
            String path = input.toString();
            path = XML.forwardSlash(path);
            path = ResourceLoader.getNonURIPath(path);

            if (tabbedPane.getSelectedComponent() == collectionsPanel) {
              boolean isResource = false;
              if (!path.startsWith("http") && new File(path).isDirectory()) { // $NON-NLS-1$
                isResource = true;
              } else {
                XMLControl control = new XMLControlElement(path);
                if (!control.failedToRead()
                    && control.getObjectClass() == LibraryCollection.class) {
                  isResource = true;
                }
              }
              if (isResource) {
                browser.addToCollections(path);
                ListModel model = collectionList.getModel();
                collectionList.setModel(model);
                refreshGUI();
                collectionList.repaint();
                collectionList.setSelectedIndex(library.pathList.size() - 1);
                browser.refreshCollectionsMenu();
                return;
              }
            }
            if (tabbedPane.getSelectedComponent() == importsPanel) {
              boolean isLibrary = false;
              XMLControl control = new XMLControlElement(path);
              if (!control.failedToRead() && control.getObjectClass() == Library.class) {
                isLibrary = true;
              }
              if (isLibrary) {
                Library newLibrary = new Library();
                newLibrary.browser = LibraryManager.this.browser;
                control.loadObject(newLibrary);
                if (library.importLibrary(path, newLibrary)) {
                  ListModel model = guestList.getModel();
                  guestList.setModel(model);
                  refreshGUI();
                  guestList.repaint();
                  guestList.setSelectedIndex(library.importedPathList.size() - 1);
                  browser.refreshCollectionsMenu();
                }
                return;
              }
            }

            String s =
                ToolsRes.getString(
                    "LibraryBrowser.Dialog.CollectionNotFound.Message"); //$NON-NLS-1$
            JOptionPane.showMessageDialog(
                LibraryManager.this,
                s + ":\n" + path, // $NON-NLS-1$
                ToolsRes.getString("LibraryBrowser.Dialog.CollectionNotFound.Title"), // $NON-NLS-1$
                JOptionPane.WARNING_MESSAGE);
          }
        });
    removeButton = new JButton();
    removeButton.setOpaque(false);
    removeButton.setBorder(LibraryBrowser.buttonBorder);
    removeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            boolean isImports = tabbedPane.getSelectedComponent() == importsPanel;
            JList list = isImports ? guestList : collectionList;
            ArrayList<String> paths = isImports ? library.importedPathList : library.pathList;
            int i = list.getSelectedIndex();
            String path = paths.get(i);
            paths.remove(path);
            if (isImports) library.importedPathToLibraryMap.remove(path);
            else library.pathToNameMap.remove(path);
            list.repaint();
            if (i >= paths.size()) {
              list.setSelectedIndex(paths.size() - 1);
            }
            browser.refreshCollectionsMenu();
            refreshGUI();
            browser.refreshGUI();
          }
        });
    // create all and none buttons
    allButton = new JButton();
    allButton.setOpaque(false);
    allButton.setBorder(LibraryBrowser.buttonBorder);
    allButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            for (SearchCheckBox next : checkboxes) {
              next.setSelected(true);
            }
          }
        });
    noneButton = new JButton();
    noneButton.setOpaque(false);
    noneButton.setBorder(LibraryBrowser.buttonBorder);
    noneButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            for (SearchCheckBox next : checkboxes) {
              next.setSelected(false);
            }
          }
        });

    clearCacheButton = new JButton();
    clearCacheButton.setOpaque(false);
    clearCacheButton.setBorder(LibraryBrowser.buttonBorder);
    clearCacheButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            File cache = ResourceLoader.getOSPCache();
            ResourceLoader.clearOSPCache(cache, false);
            refreshCacheTab();
            tabbedPane.repaint();
          }
        });

    setCacheButton = new JButton();
    setCacheButton.setOpaque(false);
    setCacheButton.setBorder(LibraryBrowser.buttonBorder);
    setCacheButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            File newCache = ResourceLoader.chooseOSPCache(browser);
            ResourceLoader.setOSPCache(newCache);
            refreshCacheTab();
          }
        });
    Border emptyInside = BorderFactory.createEmptyBorder(1, 2, 1, 2);
    Border etched = BorderFactory.createEtchedBorder();
    Border buttonbarBorder = BorderFactory.createCompoundBorder(etched, emptyInside);

    libraryButtonbar = new JToolBar();
    libraryButtonbar.setFloatable(false);
    libraryButtonbar.setBorder(buttonbarBorder);
    libraryButtonbar.add(moveUpButton);
    libraryButtonbar.add(moveDownButton);
    libraryButtonbar.add(addButton);
    libraryButtonbar.add(removeButton);

    nameBox = Box.createHorizontalBox();
    nameBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 4));
    nameBox.add(nameLabel);
    nameBox.add(nameField);
    pathBox = Box.createHorizontalBox();
    pathBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 4));
    pathBox.add(pathLabel);
    pathBox.add(pathField);
    libraryEditBox = Box.createVerticalBox();
    libraryEditBox.add(nameBox);
    libraryEditBox.add(pathBox);

    // create and assemble tabs
    // collections tab
    collectionsPanel = new JPanel(new BorderLayout());
    JScrollPane scroller = new JScrollPane(collectionList);
    scroller.setViewportBorder(etched);
    scroller.getVerticalScrollBar().setUnitIncrement(8);
    collectionsTitleBorder = BorderFactory.createTitledBorder(""); // $NON-NLS-1$
    scroller.setBorder(collectionsTitleBorder);
    collectionsPanel.add(scroller, BorderLayout.CENTER);
    collectionsPanel.add(libraryEditBox, BorderLayout.SOUTH);
    collectionsPanel.add(libraryButtonbar, BorderLayout.NORTH);

    // imports tab
    importsPanel = new JPanel(new BorderLayout());
    scroller = new JScrollPane(guestList);
    scroller.setViewportBorder(etched);
    scroller.getVerticalScrollBar().setUnitIncrement(8);
    importsTitleBorder = BorderFactory.createTitledBorder(""); // $NON-NLS-1$
    scroller.setBorder(importsTitleBorder);
    importsPanel.add(scroller, BorderLayout.CENTER);

    // search tab
    searchPanel = new JPanel(new BorderLayout());
    searchBox = Box.createVerticalBox();
    searchBox.setBackground(Color.white);
    searchBox.setOpaque(true);
    refreshSearchTab();

    scroller = new JScrollPane(searchBox);
    scroller.setViewportBorder(etched);
    scroller.getVerticalScrollBar().setUnitIncrement(8);
    searchTitleBorder = BorderFactory.createTitledBorder(""); // $NON-NLS-1$
    scroller.setBorder(searchTitleBorder);
    searchPanel.add(scroller, BorderLayout.CENTER);
    JToolBar searchButtonbar = new JToolBar();
    searchButtonbar.setFloatable(false);
    searchButtonbar.setBorder(buttonbarBorder);
    searchButtonbar.add(allButton);
    searchButtonbar.add(noneButton);
    searchPanel.add(searchButtonbar, BorderLayout.NORTH);

    // cache tab
    cachePanel = new JPanel(new BorderLayout());
    cacheBox = Box.createVerticalBox();
    cacheBox.setBackground(Color.white);
    cacheBox.setOpaque(true);
    refreshCacheTab();

    scroller = new JScrollPane(cacheBox);
    scroller.setViewportBorder(etched);
    scroller.getVerticalScrollBar().setUnitIncrement(8);
    cacheTitleBorder = BorderFactory.createTitledBorder(""); // $NON-NLS-1$
    scroller.setBorder(cacheTitleBorder);
    cachePanel.add(scroller, BorderLayout.CENTER);
    JToolBar cacheButtonbar = new JToolBar();
    cacheButtonbar.setFloatable(false);
    cacheButtonbar.setBorder(buttonbarBorder);
    cacheButtonbar.add(clearCacheButton);
    cacheButtonbar.add(setCacheButton);
    cachePanel.add(cacheButtonbar, BorderLayout.NORTH);

    // create tabbedPane
    tabbedPane = new JTabbedPane();
    tabbedPane.addTab("", collectionsPanel); // $NON-NLS-1$
    //		tabbedPane.addTab("", importsPanel); //$NON-NLS-1$
    tabbedPane.addTab("", searchPanel); // $NON-NLS-1$
    tabbedPane.addTab("", cachePanel); // $NON-NLS-1$

    // add change listener last
    tabbedPane.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            if (tabbedPane.getSelectedComponent() == collectionsPanel) {
              collectionsPanel.add(libraryButtonbar, BorderLayout.NORTH);
              collectionsPanel.add(libraryEditBox, BorderLayout.SOUTH);
              refreshGUI();
            } else if (tabbedPane.getSelectedComponent() == importsPanel) {
              importsPanel.add(libraryButtonbar, BorderLayout.NORTH);
              importsPanel.add(libraryEditBox, BorderLayout.SOUTH);
              refreshGUI();
            }
          }
        });

    Border space = BorderFactory.createEmptyBorder(0, 2, 0, 2);
    listButtonBorder = BorderFactory.createCompoundBorder(etched, space);

    // assemble content pane
    JPanel contentPane = new JPanel(new BorderLayout());
    setContentPane(contentPane);
    contentPane.add(tabbedPane, BorderLayout.CENTER);
    JPanel south = new JPanel();
    south.add(okButton);
    contentPane.add(south, BorderLayout.SOUTH);
  }
Ejemplo n.º 17
0
  public void initUI() {
    // Search
    double[][] sizeSearch = new double[][] {{3, TableLayout.PREFERRED, 3, 100}, {25}};
    JPanel jpSearch = new JPanel(new TableLayout(sizeSearch));
    sbSearch = new SearchBox(CommandJPanel.this);
    JLabel jlSearch = new JLabel(IconLoader.ICON_SEARCH);
    jlSearch.setToolTipText(Messages.getString("CommandJPanel.23"));
    // Clear search text when clicking on the search icon
    jlSearch.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            sbSearch.setText("");
          }
        });
    jpSearch.add(jlSearch, "1,0");
    jpSearch.add(sbSearch, "3,0");

    // History
    JPanel jpHistory = new JPanel();
    jcbHistory = new SteppedComboBox();
    JLabel jlHistory = new JLabel(IconLoader.ICON_HISTORY);
    jlHistory.setToolTipText(Messages.getString("CommandJPanel.0"));
    // - Increase rating button
    ActionBase actionIncRate = ActionManager.getAction(JajukAction.INC_RATE);
    actionIncRate.setName(null);
    final JPopupMenu jpmIncRating = new JPopupMenu();
    for (int i = 1; i <= 10; i++) {
      final int j = i;
      JMenuItem jmi = new JMenuItem("+" + i);
      if (ConfigurationManager.getInt(CONF_INC_RATING) == i) {
        jmi.setFont(FontManager.getInstance().getFont(JajukFont.BOLD));
      }
      // Store selected value
      jmi.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              ConfigurationManager.setProperty(CONF_INC_RATING, "" + j);
            }
          });
      jpmIncRating.add(jmi);
    }
    jbIncRate =
        new DropDownButton(IconLoader.ICON_INC_RATING) {
          private static final long serialVersionUID = 1L;

          @Override
          protected JPopupMenu getPopupMenu() {
            return jpmIncRating;
          }
        };
    jbIncRate.setAction(actionIncRate);
    // we use a combo box model to make sure we get good performances after
    // rebuilding the entire model like after a refresh
    jcbHistory.setModel(new DefaultComboBoxModel(History.getInstance().getHistory()));
    // None selection because if we start in stop mode, a selection of the
    // first item will not launch the track because the selected item is
    // still the same and no action event is thrown (Java >= 1.6)
    jcbHistory.setSelectedItem(null);
    int iWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2);
    // size of popup
    jcbHistory.setPopupWidth(iWidth);
    // size of the combo itself, keep it! as text can be very long
    jcbHistory.setPreferredSize(new Dimension(250, 25));
    jcbHistory.setMinimumSize(new Dimension(0, 25));
    jcbHistory.setToolTipText(Messages.getString("CommandJPanel.0"));
    jcbHistory.addActionListener(CommandJPanel.this);
    JToolBar jtbIncRate = new JToolBar();
    jtbIncRate.setFloatable(false);
    jbIncRate.addToToolBar(jtbIncRate);
    double[][] sizeHistory =
        new double[][] {
          {3, TableLayout.PREFERRED, 3, TableLayout.FILL, 10, TableLayout.PREFERRED}, {25}
        };
    jpHistory.setLayout(new TableLayout(sizeHistory));
    jpHistory.add(jlHistory, "1,0");
    jpHistory.add(jcbHistory, "3,0");
    jpHistory.add(jtbIncRate, "5,0");

    // Mode toolbar
    // we need an inner toolbar to apply size properly
    JToolBar jtbModes = new JToolBar();
    jtbModes.setBorder(null);
    // make it not floatable as this behavior is managed by vldocking
    jtbModes.setFloatable(false);
    jtbModes.setRollover(true);
    jbRepeat =
        new JajukToggleButton(ActionManager.getAction(JajukAction.REPEAT_MODE_STATUS_CHANGE));
    jbRepeat.setSelected(ConfigurationManager.getBoolean(CONF_STATE_REPEAT));
    jbRandom =
        new JajukToggleButton(ActionManager.getAction(JajukAction.SHUFFLE_MODE_STATUS_CHANGED));
    jbRandom.setSelected(ConfigurationManager.getBoolean(CONF_STATE_SHUFFLE));
    jbContinue =
        new JajukToggleButton(ActionManager.getAction(JajukAction.CONTINUE_MODE_STATUS_CHANGED));
    jbContinue.setSelected(ConfigurationManager.getBoolean(CONF_STATE_CONTINUE));
    jbIntro = new JajukToggleButton(ActionManager.getAction(JajukAction.INTRO_MODE_STATUS_CHANGED));
    jbIntro.setSelected(ConfigurationManager.getBoolean(CONF_STATE_INTRO));
    jtbModes.add(jbRepeat);
    jtbModes.addSeparator();
    jtbModes.add(jbRandom);
    jtbModes.addSeparator();
    jtbModes.add(jbContinue);
    jtbModes.addSeparator();
    jtbModes.add(jbIntro);

    // Volume
    jpVolume = new JPanel();
    ActionUtil.installKeystrokes(
        jpVolume,
        ActionManager.getAction(JajukAction.DECREASE_VOLUME),
        ActionManager.getAction(JajukAction.INCREASE_VOLUME));

    jpVolume.setLayout(new BoxLayout(jpVolume, BoxLayout.X_AXIS));
    int iVolume = (int) (100 * ConfigurationManager.getFloat(CONF_VOLUME));
    if (iVolume > 100) { // can occur in some undefined cases
      iVolume = 100;
    }
    jsVolume = new JSlider(0, 100, iVolume);
    jpVolume.add(jsVolume);
    jpVolume.add(Box.createHorizontalStrut(5));
    jpVolume.add(jbMute);
    jsVolume.setToolTipText(Messages.getString("CommandJPanel.14"));
    jsVolume.addChangeListener(CommandJPanel.this);
    jsVolume.addMouseWheelListener(CommandJPanel.this);

    // Special functions toolbar
    // Ambience combo
    ambiencesCombo = new SteppedComboBox();
    iWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 4);
    ambiencesCombo.setPopupWidth(iWidth);
    ambiencesCombo.setFont(FontManager.getInstance().getFont(JajukFont.BOLD_L));
    // size of the combo itself
    ambiencesCombo.setRenderer(
        new BasicComboBoxRenderer() {
          private static final long serialVersionUID = -6943363556191659895L;

          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            JLabel jl = (JLabel) value;
            setIcon(jl.getIcon());
            setText(jl.getText());
            return this;
          }
        });
    ambiencesCombo.setToolTipText(Messages.getString("DigitalDJWizard.66"));
    populateAmbiences();
    ambienceListener = new AmbienceListener();
    ambiencesCombo.addActionListener(ambienceListener);
    jtbSpecial = new JToolBar();
    jtbSpecial.setBorder(null);
    jtbSpecial.setRollover(true);
    jtbSpecial.setFloatable(false);
    ddbGlobalRandom =
        new DropDownButton(IconLoader.ICON_SHUFFLE_GLOBAL) {
          private static final long serialVersionUID = 1L;

          @Override
          protected JPopupMenu getPopupMenu() {
            return popupGlobalRandom;
          }
        };
    ddbGlobalRandom.setAction(ActionManager.getAction(JajukAction.SHUFFLE_GLOBAL));
    popupGlobalRandom = new JPopupMenu();
    // Global shuffle
    jmiShuffleModeSong = new JRadioButtonMenuItem(Messages.getString("CommandJPanel.20"));
    jmiShuffleModeSong.addActionListener(this);
    // album / album
    jmiShuffleModeAlbum = new JRadioButtonMenuItem(Messages.getString("CommandJPanel.21"));
    jmiShuffleModeAlbum.addActionListener(this);
    // Shuffle album / album
    jmiShuffleModeAlbum2 = new JRadioButtonMenuItem(Messages.getString("CommandJPanel.22"));
    jmiShuffleModeAlbum2.addActionListener(this);
    if (ConfigurationManager.getProperty(CONF_GLOBAL_RANDOM_MODE).equals(MODE_TRACK)) {
      jmiShuffleModeSong.setSelected(true);
    } else if (ConfigurationManager.getProperty(CONF_GLOBAL_RANDOM_MODE).equals(MODE_ALBUM2)) {
      jmiShuffleModeAlbum2.setSelected(true);
    } else {
      jmiShuffleModeAlbum.setSelected(true);
    }
    ButtonGroup bgGlobalRandom = new ButtonGroup();
    bgGlobalRandom.add(jmiShuffleModeSong);
    bgGlobalRandom.add(jmiShuffleModeAlbum);
    bgGlobalRandom.add(jmiShuffleModeAlbum2);
    popupGlobalRandom.add(jmiShuffleModeSong);
    popupGlobalRandom.add(jmiShuffleModeAlbum);
    popupGlobalRandom.add(jmiShuffleModeAlbum2);
    ddbGlobalRandom.setText(""); // no text visible

    jbBestof = new JajukButton(ActionManager.getAction(JajukAction.BEST_OF));

    ddbNovelties =
        new DropDownButton(IconLoader.ICON_NOVELTIES) {
          private static final long serialVersionUID = 1L;

          @Override
          protected JPopupMenu getPopupMenu() {
            return popupNovelties;
          }
        };
    ddbNovelties.setAction(ActionManager.getAction(JajukAction.NOVELTIES));
    popupNovelties = new JPopupMenu();
    jmiNoveltiesModeSong = new JRadioButtonMenuItem(Messages.getString("CommandJPanel.20"));
    jmiNoveltiesModeSong.addActionListener(this);
    jmiNoveltiesModeAlbum = new JRadioButtonMenuItem(Messages.getString("CommandJPanel.22"));
    jmiNoveltiesModeAlbum.addActionListener(this);
    if (ConfigurationManager.getProperty(CONF_NOVELTIES_MODE).equals(MODE_TRACK)) {
      jmiNoveltiesModeSong.setSelected(true);
    } else {
      jmiNoveltiesModeAlbum.setSelected(true);
    }
    ButtonGroup bgNovelties = new ButtonGroup();
    bgNovelties.add(jmiNoveltiesModeSong);
    bgNovelties.add(jmiNoveltiesModeAlbum);
    popupNovelties.add(jmiNoveltiesModeSong);
    popupNovelties.add(jmiNoveltiesModeAlbum);
    ddbNovelties.setText(""); // no text visible

    jbNorm = new JajukButton(ActionManager.getAction(FINISH_ALBUM));
    popupDDJ = new JPopupMenu();
    ddbDDJ =
        new DropDownButton(IconLoader.ICON_DIGITAL_DJ) {
          private static final long serialVersionUID = 1L;

          @Override
          protected JPopupMenu getPopupMenu() {
            return popupDDJ;
          }
        };
    ddbDDJ.setAction(ActionManager.getAction(JajukAction.DJ));
    populateDJs();
    // no text visible
    ddbDDJ.setText("");

    popupWebRadio = new XJPopupMenu(Main.getWindow());
    ddbWebRadio =
        new DropDownButton(IconLoader.ICON_WEBRADIO) {
          private static final long serialVersionUID = 1L;

          @Override
          protected JPopupMenu getPopupMenu() {
            return popupWebRadio;
          }
        };
    ddbWebRadio.setAction(ActionManager.getAction(JajukAction.WEB_RADIO));
    populateWebRadios();
    // no text
    ddbWebRadio.setText("");

    ddbDDJ.addToToolBar(jtbSpecial);
    ddbNovelties.addToToolBar(jtbSpecial);
    ddbGlobalRandom.addToToolBar(jtbSpecial);
    jtbSpecial.add(jbBestof);
    jtbSpecial.add(jbNorm);

    // Radio tool bar
    JToolBar jtbWebRadio = new JToolBar();
    jtbWebRadio.setBorder(null);
    jtbWebRadio.setRollover(true);
    jtbWebRadio.setFloatable(false);
    ddbWebRadio.addToToolBar(jtbWebRadio);

    // Play toolbar
    JToolBar jtbPlay = new JToolBar();
    jtbPlay.setBorder(null);
    jtbPlay.setFloatable(false);
    // add some space to get generic size
    jtbPlay.setRollover(true);
    ActionUtil.installKeystrokes(
        jtbPlay, ActionManager.getAction(NEXT_ALBUM), ActionManager.getAction(PREVIOUS_ALBUM));
    jbPrevious = new JajukButton(ActionManager.getAction(PREVIOUS_TRACK));
    jbNext = new JajukButton(ActionManager.getAction(NEXT_TRACK));
    jbRew = new JPressButton(ActionManager.getAction(REWIND_TRACK));
    jbPlayPause = new JajukButton(ActionManager.getAction(PLAY_PAUSE_TRACK));
    jbStop = new JajukButton(ActionManager.getAction(STOP_TRACK));
    jbFwd = new JPressButton(ActionManager.getAction(FAST_FORWARD_TRACK));

    jtbPlay.add(jbPrevious);
    jtbPlay.add(jbRew);
    jtbPlay.add(jbPlayPause);
    jtbPlay.add(jbStop);
    jtbPlay.add(jbFwd);
    jtbPlay.add(jbNext);

    // Add items
    FormLayout layout =
        new FormLayout(
            // --columns
            "3dlu,fill:min(10dlu;p):grow(0.5), 3dlu, "
                + // ambience
                "left:p, 2dlu"
                + // smart toolbar
                ", min(0dlu;p):grow(0.04), 3dlu,"
                + // glue
                " right:p, 10dlu, "
                + // search /modes
                "fill:p, 5dlu, "
                + // history/player
                "fill:min(60dlu;p):grow(0.2),3dlu", // volume/part of
            // history
            // --rows
            "2dlu, p, 2dlu, p, 2dlu"); // rows
    PanelBuilder builder = new PanelBuilder(layout); // , new
    // FormDebugPanel() );
    CellConstraints cc = new CellConstraints();
    // Add items
    builder.add(jtbWebRadio, cc.xyw(2, 2, 3)); // grid width = 3
    builder.add(ambiencesCombo, cc.xy(2, 4));
    builder.add(jtbSpecial, cc.xy(4, 4));
    builder.add(jpSearch, cc.xyw(6, 2, 4));
    builder.add(jpHistory, cc.xyw(10, 2, 4));
    builder.add(jtbModes, cc.xy(8, 4));
    builder.add(jtbPlay, cc.xy(10, 4));
    builder.add(jpVolume, cc.xy(12, 4));
    JPanel p = builder.getPanel();
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(p);
    // register to player events
    ObservationManager.register(CommandJPanel.this);

    // if a track is playing, display right state
    if (FIFO.getInstance().getCurrentFile() != null) {
      // update initial state
      update(
          new Event(
              EventSubject.EVENT_PLAYER_PLAY,
              ObservationManager.getDetailsLastOccurence(EventSubject.EVENT_PLAYER_PLAY)));
      // update the history bar
      update(new Event(EventSubject.EVENT_FILE_LAUNCHED));
      // check if some track has been launched before the view has been
      // displayed
      update(new Event(EventSubject.EVENT_HEART_BEAT));
    }
    // start timer
    timer.start();
  }
Ejemplo n.º 18
0
  /**
   * Builds the UI component hosting the buttons.
   *
   * @return See above.
   */
  private JPanel buildLogin() {
    // server information
    JPanel p = new JPanel();
    p.setOpaque(false);
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(serverTextPane);
    p.add(connectionSpeedText);

    JToolBar bar = new JToolBar();
    bar.setOpaque(false);
    bar.setBorder(null);
    bar.setFloatable(false);
    if (UIUtilities.isWindowsOS()) {
      bar.add(Box.createHorizontalStrut(5));
      bar.add(encryptedButton);
      bar.add(Box.createHorizontalStrut(5));
      bar.add(configButton);
    } else {
      bar.add(encryptedButton);
      bar.add(configButton);
    }

    JPanel row = new JPanel();
    row.setOpaque(false);
    row.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
    row.add(p);
    row.add(bar);

    mainPanel.add(row);
    components.add(row);
    // user name
    JPanel group = new JPanel();
    group.setOpaque(false);
    group.setLayout(new BoxLayout(group, BoxLayout.Y_AXIS));
    JTextPane l = UIUtilities.buildTextPane(USER_TEXT, TEXT_COLOR);
    row = new JPanel();
    row.setOpaque(false);
    row.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
    row.add(l);
    row.add(user);
    group.add(row);

    // password
    l = UIUtilities.buildTextPane(" " + PASSWORD_TEXT, TEXT_COLOR);
    row = new JPanel();
    row.setOpaque(false);
    row.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
    row.add(l);
    row.add(pass);
    group.add(row);

    mainPanel.add(group);
    components.add(group);
    // controls
    JPanel controls = new JPanel();
    controls.setOpaque(false);
    controls.add(Box.createHorizontalGlue());
    controls.add(login);
    controls.add(cancel);
    p = UIUtilities.buildComponentPanelCenter(controls, 0, 0, false);
    mainPanel.add(p);
    components.add(p);

    return mainPanel;
  }
Ejemplo n.º 19
0
  /*
   * (non-Javadoc)
   *
   * @see org.jajuk.ui.views.IView#populate()
   */
  public void initUI() {
    jlLanguage = new JLabel(Messages.getString("WikipediaView.1"));
    jcbLanguage = new JComboBox();
    for (String sDesc : Messages.getDescs()) {
      jcbLanguage.addItem(sDesc);
    }
    // get stored language
    jcbLanguage.setSelectedItem(
        Messages.getDescForLocal(ConfigurationManager.getProperty(CONF_WIKIPEDIA_LANGUAGE)));
    jcbLanguage.addActionListener(this);
    // Buttons
    ActionBase aCopy = ActionManager.getAction(JajukAction.COPY_TO_CLIPBOARD);
    jbCopy = new JButton(aCopy);
    jbLaunchInExternalBrowser = new JButton(ActionManager.getAction(JajukAction.LAUNCH_IN_BROWSER));
    // Remove text inside the buttons
    jbLaunchInExternalBrowser.setText(null);
    jbCopy.setText(null);
    ButtonGroup bg = new ButtonGroup();
    jbAuthorSearch = new JToggleButton(IconLoader.ICON_AUTHOR, false);
    jbAuthorSearch.setToolTipText(Messages.getString("WikipediaView.5"));
    // Select author search (default)
    jbAuthorSearch.setSelected(true);
    jbAuthorSearch.addActionListener(this);
    jbAlbumSearch = new JToggleButton(IconLoader.ICON_ALBUM, true);
    jbAlbumSearch.setToolTipText(Messages.getString("WikipediaView.6"));
    jbAlbumSearch.addActionListener(this);
    jbTrackSearch = new JToggleButton(IconLoader.ICON_TRACK, false);
    jbTrackSearch.setToolTipText(Messages.getString("WikipediaView.7"));
    jbTrackSearch.addActionListener(this);
    // Group this three mutual exclusive buttons
    bg.add(jbAuthorSearch);
    bg.add(jbAlbumSearch);
    bg.add(jbTrackSearch);

    JToolBar jtb = new JToolBar();
    jtb.setFloatable(false);
    jtb.setRollover(true);
    jtb.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    // Add items
    jtb.add(jbAuthorSearch);
    jtb.add(jbAlbumSearch);
    jtb.add(jbTrackSearch);
    jtb.addSeparator();
    jtb.add(jbCopy);
    jtb.add(jbLaunchInExternalBrowser);
    jtb.addSeparator();
    jtb.add(jcbLanguage);

    JPanel jpCommand = new JPanel();
    jpCommand.setBorder(BorderFactory.createEtchedBorder());
    jpCommand.setLayout(new FlowLayout(FlowLayout.LEFT));
    jpCommand.add(jtb);

    // global layout
    double size[][] = {{2, TableLayout.FILL, 5}, {TableLayout.PREFERRED, 5, TableLayout.FILL}};
    setLayout(new TableLayout(size));
    browser = new JajukHtmlPanel();
    add(jpCommand, "1,0");
    add(browser, "1,2");

    // Display default page at startup is none track launch
    // avoid to launch this if a track is playing
    // to avoid thread concurrency
    if (FIFO.getInstance().getCurrentFile() == null) {
      reset();
    }

    // subscriptions to events
    ObservationManager.register(WikipediaView.this);

    // force event
    update(
        new Event(
            EventSubject.EVENT_FILE_LAUNCHED,
            ObservationManager.getDetailsLastOccurence(EventSubject.EVENT_FILE_LAUNCHED)));
  }
Ejemplo n.º 20
0
  public void init() {
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    loginButton = new RPCButton("Login");
    logoffButton = new RPCButton("Quit");
    userButton = new RPCButton("Set User");
    connectButton = new RPCButton("Set Connection");
    exitButton = new RPCButton("Exit UI");

    toolBar.setBackground(UIConfig.dialogbackground);
    toolBar.setBorder(new EmptyBarBorder());
    toolBar.add(userButton);
    toolBar.add(connectButton);
    toolBar.addSeparator();
    toolBar.add(loginButton);
    toolBar.add(logoffButton);
    toolBar.addSeparator();
    toolBar.add(exitButton);
    contentPane.add(toolBar, BorderLayout.NORTH);
    checkbox = new RPCheckBox("Secret");
    checkbox.setBackground(UIConfig.dialogbackground);
    checkbox.setSelected(false);
    actionlist = new RPComboBox();
    actionlist.addItem("O(∩_∩)O");
    actionlist.addItem(">_<|||");
    actionlist.addItem("⊙﹏⊙‖");
    actionlist.addItem("→_→");
    actionlist.addItem("…(⊙_⊙;)…");
    actionlist.addItem("( ^_^ )?");
    actionlist.setSelectedIndex(0);

    loginButton.setEnabled(true);
    logoffButton.setEnabled(false);

    loginButton.addActionListener(this);
    logoffButton.addActionListener(this);
    userButton.addActionListener(this);
    connectButton.addActionListener(this);
    exitButton.addActionListener(this);
    combobox = new RPComboBox();
    combobox.insertItemAt("all", 0);
    combobox.setSelectedIndex(0);
    messageShow = new RPTextArea();
    messageShow.setEditable(false);

    messageScrollPane =
        new JScrollPane(
            messageShow,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    messageScrollPane.setPreferredSize(new Dimension(400, 400));
    messageScrollPane.revalidate();

    clientMessage = new RPTextBox(23);
    clientMessage.setEnabled(false);
    clientMessageButton = new RPCButton();
    clientMessageButton.setText(UIMessage.send);
    clientMessageButton.setFont(UIRes.getFont());

    clientMessage.addActionListener(this);
    clientMessageButton.addActionListener(this);
    sendToLabel = new RPLabel("Send To:");
    express = new RPLabel("Face:");
    messageLabel = new RPLabel("Message:");
    downPanel = new JPanel();

    downPanel.setPreferredSize(new Dimension((int) faceSize.getWidth(), 155));
    downPanel.setLayout(null);

    downPanel.add(sendToLabel);
    sendToLabel.setBounds(10, 5, 70, 30);

    downPanel.add(combobox);
    combobox.setBounds(80, 5, 90, 30);

    downPanel.add(express);
    express.setBounds(190, 5, 90, 30);

    downPanel.add(actionlist);
    actionlist.setBounds(240, 5, 110, 30);

    downPanel.add(checkbox);
    checkbox.setBounds(5, 35, 70, 30);

    downPanel.add(messageLabel);
    messageLabel.setBounds(10, 65, 70, 30);

    downPanel.add(clientMessage);
    clientMessage.setBounds(80, 65, (int) faceSize.getWidth() - 90, 30);

    downPanel.add(clientMessageButton);
    clientMessageButton.setBounds(80, 115, 90, 30);

    contentPane.add(messageScrollPane, BorderLayout.CENTER);
    contentPane.add(downPanel, BorderLayout.SOUTH);
    messageScrollPane.setBackground(UIConfig.dialogbackground);
    downPanel.setBackground(UIConfig.dialogbackground);

    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            if (type == 1) {
              disConnect();
            }
            SwingUtils.close(RPChatClientDialog.this);
          }
        });
  }
  @SuppressWarnings("static-access")
  public editSalary(SalaryVO vo, JFrame main, LoginPO loginPO) {
    editSalary editSalary = this;
    setBounds(100, 100, 750, 600);
    setLayout(null);
    this.setVisible(true);
    // first
    rdbtnNewRadioButton = new JRadioButton("\u6309\u6708");
    rdbtnNewRadioButton.setOpaque(false);
    rdbtnNewRadioButton.setBorder(null);
    rdbtnNewRadioButton.setBounds(371, 290, 83, 23);
    rdbtnNewRadioButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = SalaryModel.ByMonth;
          }
        });
    add(rdbtnNewRadioButton);

    // second
    radioButton = new JRadioButton("\u6309\u6B21");
    radioButton.setBounds(371, 326, 83, 23);
    radioButton.setOpaque(false);
    radioButton.setBorder(null);
    radioButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = salaryModel.ByTimes;
          }
        });
    add(radioButton);

    // third
    radioButton_1 = new JRadioButton("\u6309\u63D0\u6210");
    radioButton_1.setBounds(371, 366, 100, 23);
    radioButton_1.setOpaque(false);
    radioButton_1.setBorder(null);
    radioButton_1.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = salaryModel.ByBenefit;
          }
        });
    add(radioButton_1);

    buttonGroup = new ButtonGroup();
    buttonGroup.add(rdbtnNewRadioButton);
    buttonGroup.add(radioButton);
    buttonGroup.add(radioButton_1);

    if (vo.getTypeOfStrategy() == SalaryModel.ByMonth) {
      rdbtnNewRadioButton.setSelected(true);
      salaryModel = SalaryModel.ByMonth;
    } else if (vo.getTypeOfStrategy() == salaryModel.ByTimes) {
      radioButton.setSelected(true);
      salaryModel = salaryModel.ByTimes;
    } else {
      radioButton_1.setSelected(true);
      salaryModel = salaryModel.ByBenefit;
    }

    JButton btnNewButton = new JButton("\u786E\u5B9A");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int n = JOptionPane.showConfirmDialog(null, "确认修改?", "no", JOptionPane.YES_NO_OPTION);
            if (n == JOptionPane.YES_OPTION) {
              if (textField_1.getText().equals("")) {
                label_4.setText("请输入价格");
                Thread thread = new Thread(editSalary);
                thread.start();
              } else {
                SalaryVO salaryVO =
                    new SalaryVO(
                        textField.getText(),
                        Double.parseDouble(textField_1.getText()),
                        salaryModel);
                SalaryPolicybl salaryPolicybl = new SalaryPolicybl();
                salaryPolicybl.editSalary(salaryVO);
                Salary salary = new Salary(salaryVO, main, loginPO);
                main.remove(editSalary);
                main.getContentPane().add(salary);
                main.invalidate();
                main.repaint();
                main.setVisible(true);
              }
            }
          }
        });
    btnNewButton.setBounds(283, 419, 52, 52);
    ImageIcon image1 = new ImageIcon("image/transparent_circle.png");
    Image temp1 =
        image1
            .getImage()
            .getScaledInstance(
                btnNewButton.getWidth(), btnNewButton.getHeight(), image1.getImage().SCALE_DEFAULT);
    image1 = new ImageIcon(temp1);
    btnNewButton.setIcon(image1);
    btnNewButton.setContentAreaFilled(false);
    btnNewButton.setBorderPainted(false);
    add(btnNewButton);

    JButton button = new JButton("");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Salary salary = new Salary(vo, main, loginPO);
            main.remove(editSalary);
            main.getContentPane().add(salary);
            main.invalidate();
            main.repaint();
            main.setVisible(true);
          }
        });
    button.setBounds(13, -9, 63, 63);
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setIcon(new ImageIcon("image/transparent_circle.png"));
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            button.setIcon(new ImageIcon("image/mask_circle.png"));
          }
        });

    add(button);

    textField = new JTextField();
    textField.setColumns(10);
    textField.setBounds(373, 189, 108, 21);
    textField.setText(vo.getTypeOfStaff());
    textField.setEnabled(false);
    textField.setForeground(new Color(88, 93, 103));
    textField.setCaretColor(new Color(88, 93, 103));
    textField.setOpaque(false);
    textField.setBorder(null);
    add(textField);

    textField_1 = new JTextField();
    textField_1.setColumns(10);
    textField_1.setDocument(new JTextFieldLimit(7));
    textField_1.setBounds(373, 239, 108, 21);
    textField_1.addKeyListener(new InputNumber());
    textField_1.setText(vo.getSalary() + "");
    textField_1.setForeground(new Color(88, 93, 103));
    textField_1.setCaretColor(new Color(88, 93, 103));
    textField_1.setOpaque(false);
    textField_1.setBorder(null);
    add(textField_1);

    JToolBar toolBar = new JToolBar();
    toolBar.setBounds(8, 541, 750, 35);
    toolBar.setOpaque(false);
    toolBar.setBorder(null);
    add(toolBar);

    label_4 = new JLabel("\u72B6\u6001\u680F");
    label_4.setForeground(Color.WHITE);
    toolBar.add(label_4);

    JButton button2 = new JButton("取消");
    button2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            editSalary neweditSalary = new editSalary(vo, main, loginPO);
            main.remove(editSalary);
            main.getContentPane().add(neweditSalary);
            main.invalidate();
            main.repaint();
            main.setVisible(true);
          }
        });

    button2.setBounds(416, 418, 52, 52);
    ImageIcon image2 = new ImageIcon("image/transparent_circle.png");
    Image temp2 =
        image2
            .getImage()
            .getScaledInstance(
                button2.getWidth(), button2.getHeight(), image2.getImage().SCALE_DEFAULT);
    image2 = new ImageIcon(temp2);
    button2.setIcon(image2);
    button2.setContentAreaFilled(false);
    button2.setBorderPainted(false);
    add(button2);
  }
Ejemplo n.º 22
0
  /**
   * Creates a new PluginManagerPane object.
   *
   * @param manager the plugin mananager
   * @param context context
   */
  public PluginManagerPane(
      PluginManager manager, PluginHostContext context, boolean showBuiltInPlugins) {
    super(new BorderLayout());

    // Initialise
    this.context = context;
    this.showBuiltInPlugins = showBuiltInPlugins;
    this.manager = manager;

    // Connection state
    JPanel sp = new JPanel(new BorderLayout());
    sp.setOpaque(false);
    sp.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("Plugin updates"),
            BorderFactory.createEmptyBorder(4, 4, 4, 4)));
    status = new JLabel("Click on Refresh to check for new plugins and updates", JLabel.LEFT);
    status.setIcon(IDLE_ICON);
    sp.add(status, BorderLayout.CENTER);
    refresh = new JButton("Refresh");
    refresh.setMnemonic('r');
    refresh.addActionListener(this);
    sp.add(refresh, BorderLayout.EAST);

    // Create the toolbar
    JToolBar toolBar = new JToolBar("Plugin manager tools");
    toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE);
    toolBar.setBorder(null);
    toolBar.setFloatable(false);
    toolBar.add(new ToolButton(installAction = new InstallAction(), false));
    toolBar.add(new ToolButton(updateAction = new UpdateAction(), false));
    toolBar.add(new ToolButton(removeAction = new RemoveAction(), false));
    toolBar.add(new ToolButton(configureAction = new ConfigureAction(), false));

    // Create the text area
    table =
        new PluginManagerTable(model = new PluginManagerTableModel()) {
          public Dimension getPreferredSize() {
            return new Dimension(super.getPreferredSize().width, 180);
          }
        };
    table.setBorder(null);
    table.getSelectionModel().addListSelectionListener(this);

    // Information panel
    JPanel ip = new JPanel(new BorderLayout());
    ip.setOpaque(false);
    // ip.setBorder(BorderFactory.createTitledBorder("Information"));
    ip.add(new JLabel(INFORMATION_ICON), BorderLayout.WEST);
    JPanel tp =
        new JPanel(new BorderLayout()) {
          public Dimension getPreferredSize() {
            return new Dimension(super.getPreferredSize().width, 72);
          }
        };
    tp.setOpaque(false);
    tp.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
    url = new JLabel(" ", JLabel.CENTER);
    url.setFont(url.getFont().deriveFont(Font.BOLD).deriveFont(12f));
    url.setForeground(Color.blue);
    url.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    url.setBorder(BorderFactory.createEmptyBorder(4, 0, 4, 0));
    url.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent evt) {
            try {
              PluginManagerPane.this.context.openURL(new URL(url.getText()));
            } catch (Exception e) {
            }
          }
        });
    tp.add(url, BorderLayout.SOUTH);
    info =
        new JTextArea(" ") {
          public Dimension getPreferredSize() {
            return new Dimension(400, 130);
          }
        };
    info.setOpaque(false);
    info.setWrapStyleWord(true);
    info.setLineWrap(true);
    info.setEditable(false);
    info.setFont(UIManager.getFont("Label.font"));
    tp.add(info, BorderLayout.CENTER);
    ip.add(tp, BorderLayout.CENTER);

    // Build this
    add(sp, BorderLayout.NORTH);
    add(
        new ToolBarTablePane(toolBar, table) {
          public Dimension getPreferredSize() {
            return new Dimension(480, 260);
          }
        },
        BorderLayout.CENTER);
    add(ip, BorderLayout.SOUTH);

    // Create the progress dialog
    JPanel progressPanel = new JPanel(new BorderLayout());
    progressPanel.setOpaque(false);
    Window parentWindow = (Window) SwingUtilities.getAncestorOfClass(Window.class, this);
    if (parentWindow instanceof JFrame)
      progressDialog = new JDialog((JFrame) parentWindow, "Downloading", true);
    else if (parentWindow instanceof JDialog)
      progressDialog = new JDialog((JDialog) parentWindow, "Downloading", true);
    else progressDialog = new JDialog((JFrame) null, "Downloading", true);
    JPanel progressDetailPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1.0;
    jGridBagAdd(progressDetailPanel, status1Text = new JLabel(), gbc, GridBagConstraints.REMAINDER);
    jGridBagAdd(progressDetailPanel, status2Text = new JLabel(), gbc, GridBagConstraints.REMAINDER);
    jGridBagAdd(
        progressDetailPanel, progress = new JProgressBar(), gbc, GridBagConstraints.REMAINDER);
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weighty = 1.0;
    jGridBagAdd(
        progressDetailPanel,
        cancelDownload = new JButton("Cancel"),
        gbc,
        GridBagConstraints.REMAINDER);
    cancelDownload.addActionListener(this);
    cancelDownload.setMnemonic('c');
    progressPanel.add(statusIcon = new JLabel(), BorderLayout.WEST);
    progressPanel.add(progressDetailPanel, BorderLayout.CENTER);
    progressDialog.getContentPane().setLayout(new GridLayout(1, 1));
    progressDialog.getContentPane().add(progressPanel);
    progressDialog.setSize(220, 160);
    progressDialog.setResizable(false);
    centerComponent(progressDialog);

    // Set the intially available actions
    setAvailableActions();
  }
  /** Create the panel. */
  public Receiveui(JFrame m, JPanel jp, LoginPO loginPO) {
    main = m;
    JPanel lastui = jp;
    Receiveui nowPanel = this;
    setLayout(null);
    ImageIcon image1 = new ImageIcon("image/transparent_circle.png");

    JButton button = new JButton("");
    button.setBounds(13, -9, 63, 63);
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setIcon(image1);
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            button.setIcon(new ImageIcon("image/mask_circle.png"));
          }
        });
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            main.remove(nowPanel);
            main.getContentPane().add(lastui);
            main.invalidate();
            main.repaint();
            main.setVisible(true);
          }
        });
    add(button);

    JLabel lblHello = new JLabel("Hello! " + loginPO.getName());
    lblHello.setForeground(Color.WHITE);
    lblHello.setBounds(655, 12, 100, 15);
    add(lblHello);

    JToolBar toolBar = new JToolBar();
    toolBar.setEnabled(false);
    toolBar.setBounds(8, 540, 750, 35);
    toolBar.setOpaque(false);
    toolBar.setBorder(null);
    add(toolBar);

    JLabel label_4 = new JLabel("״̬À¸");
    label_4.setForeground(Color.WHITE);
    toolBar.add(label_4);

    textField = new JTextField("ÊäÈë×°Ô˵¥±àºÅ");
    textField.setOpaque(false);
    textField.setBorder(null);
    textField.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 18));
    textField.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent e) {
            label_4.setText("״̬À¸");
            if (!(Character.isDigit(e.getKeyChar()))) {
              e.consume();
            }
          }
        });
    textField.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            textField.setText("");
          }
        });
    textField.setBounds(205, 244, 347, 44);
    textField.setForeground(new Color(255, 255, 255, 200));
    textField.setCaretColor(new Color(248, 179, 28));
    add(textField);
    textField.setColumns(10);

    JButton button_1 = new JButton("");
    button_1.setContentAreaFilled(false);
    button_1.setBorderPainted(false);
    button_1.setBounds(349, 316, 52, 52);
    ImageIcon image2 = new ImageIcon("image/transparent_circle.png");
    @SuppressWarnings("static-access")
    Image temp1 =
        image2
            .getImage()
            .getScaledInstance(
                button_1.getWidth(), button_1.getHeight(), image2.getImage().SCALE_DEFAULT);
    image2 = new ImageIcon(temp1);
    button_1.setIcon(image2);
    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (textField.getText().length() != 10) {
              label_4.setText("ÇëÊäÈëÕýÈ·×°Ô˵¥ºÅ");
            } else {
              ReceiveBLService rbs = new ReceiveBL();
              LoadorderVO lv = rbs.checkUnreceive_loadorderPO(textField.getText());
              if (lv == null) {
                label_4.setText("δ¼ì²âµ½¸Ã×°Ô˵¥");
              } else {
                Arriverorder a = new Arriverorder(main, nowPanel, lv, loginPO);
                main.remove(nowPanel);
                main.getContentPane().add(a);
                main.invalidate();
                main.repaint();
                main.setVisible(true);
              }
            }
          }
        });
    add(button_1);
  }
Ejemplo n.º 24
0
  public UserInterfaceImpl() {
    super();
    LookAndFeelManager.instance()
        .setFont(ConfigurationManager.getGlobalConfiguration().getGuiFont());
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    enableComponents = new EnableComponents();

    preferencesDialog = new ConfigurationDialog(this);
    preferencesDialog.setTitle("Preferences");
    preferencesDialog.getContentPane().setLayout(new BorderLayout());
    preferencesDialog.setModal(true);
    preferencesDialog.setSize(new Dimension(675, 475));
    LookAndFeelManager.instance().register(preferencesDialog);

    configurationPane = new JTabbedPane();
    preferencesDialog.getContentPane().add(configurationPane, BorderLayout.CENTER);
    globalConfigurationUI =
        new ConfigurationUI<GlobalConfiguration>(
            preferencesDialog,
            ConfigurationManager.getGlobalConfigurationBean(),
            ConfigurationManager.GLOBAL_DEFAULT,
            null,
            "Restore defaults|Changes the current global preferences so that they are equal to the default preferences",
            "<html>In this tab you can change global preferences. On exit, they are stored in the"
                + " file <tt>"
                + Constants.GLOBAL_CONF_FILE.getAbsolutePath()
                + "</tt>.");
    globalConfigurationUI.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15));
    preferencesDialog.addConfigurationUI(globalConfigurationUI);

    ConfigurationUI<Configuration> defaultCUI =
        new ConfigurationUI<Configuration>(
            preferencesDialog,
            ConfigurationManager.getDefaultConfigurationBean(),
            ConfigurationManager.LOCAL_DEFAULT,
            null,
            "Restore defaults|Changes the initial preferences (to be used for newly created diagrams) such that they are equal to the default settings",
            "<html>This tab is for adjusting the (initial) preferences that are used for"
                + " newly created diagrams. They are stored along with the global preferences.");
    defaultCUI.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15));
    preferencesDialog.addConfigurationUI(defaultCUI);

    localConfigurationUI =
        new ConfigurationUI<Configuration>(
            preferencesDialog,
            ConfigurationManager.createNewDefaultConfiguration(),
            ConfigurationManager.getDefaultConfigurationBean(),
            "Save as initial|Saves the current diagram's preferences as the initial preferences (to be used for all newly created diagrams)",
            "Restore initial|Changes the current diagram's preferences such that they are equal to the initial preferences",
            "<html>This tab is for changing the preferences for the diagram"
                + " currently being displayed.<br>They will be stored "
                + " when the diagram is saved as an <tt>.sdx</tt>-file.");
    localConfigurationUI.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15));

    for (JPanel panel : localConfigurationUI.getCategoryPanels()) {
      LookAndFeelManager.instance().registerOrphan(panel);
    }

    preferencesDialog.addConfigurationUI(localConfigurationUI);

    configurationPane.add("Global preferences", globalConfigurationUI);
    configurationPane.add("Initial diagram preferences", defaultCUI);
    configurationPane.addTab("Current diagram preferences", localConfigurationUI);

    for (JPanel panel : globalConfigurationUI.getCategoryPanels()) {
      LookAndFeelManager.instance().registerOrphan(panel);
    }
    for (JPanel panel : defaultCUI.getCategoryPanels()) {
      LookAndFeelManager.instance().registerOrphan(panel);
    }

    listeners = new LinkedList<UserInterfaceListener>();
    redrawThread = new RedrawThread(this);
    redrawThread.start();
    menuBar = new MenuBar();
    toolbar = new JToolBar();
    toolbar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    toolbar.setFloatable(false);
  }
Ejemplo n.º 25
0
  // initializes the internal component of the translator
  protected void jbInit() {
    this.getContentPane().setLayout(new GridBagLayout());

    loadButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            loadButton_actionPerformed(e);
          }
        });
    loadButton.setMaximumSize(new Dimension(39, 39));
    loadButton.setMinimumSize(new Dimension(39, 39));
    loadButton.setPreferredSize(new Dimension(39, 39));
    loadButton.setSize(new Dimension(39, 39));
    loadButton.setToolTipText("Load Source File");
    loadButton.setIcon(loadIcon);

    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            saveButton_actionPerformed(e);
          }
        });
    saveButton.setMaximumSize(new Dimension(39, 39));
    saveButton.setMinimumSize(new Dimension(39, 39));
    saveButton.setPreferredSize(new Dimension(39, 39));
    saveButton.setSize(new Dimension(39, 39));
    saveButton.setToolTipText("Save Destination File");
    saveButton.setIcon(saveIcon);

    singleStepButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            singleStepButton_actionPerformed(e);
          }
        });
    singleStepButton.setMaximumSize(new Dimension(39, 39));
    singleStepButton.setMinimumSize(new Dimension(39, 39));
    singleStepButton.setPreferredSize(new Dimension(39, 39));
    singleStepButton.setSize(new Dimension(39, 39));
    singleStepButton.setToolTipText("Single Step");
    singleStepButton.setIcon(singleStepIcon);

    ffwdButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ffwdButton_actionPerformed(e);
          }
        });
    ffwdButton.setMaximumSize(new Dimension(39, 39));
    ffwdButton.setMinimumSize(new Dimension(39, 39));
    ffwdButton.setPreferredSize(new Dimension(39, 39));
    ffwdButton.setSize(new Dimension(39, 39));
    ffwdButton.setToolTipText("Fast Forward");
    ffwdButton.setIcon(ffwdIcon);

    rewindButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            rewindButton_actionPerformed(e);
          }
        });
    rewindButton.setMaximumSize(new Dimension(39, 39));
    rewindButton.setMinimumSize(new Dimension(39, 39));
    rewindButton.setPreferredSize(new Dimension(39, 39));
    rewindButton.setSize(new Dimension(39, 39));
    rewindButton.setToolTipText("Rewind");
    rewindButton.setIcon(rewindIcon);

    stopButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stopButton_actionPerformed(e);
          }
        });
    stopButton.setMaximumSize(new Dimension(39, 39));
    stopButton.setMinimumSize(new Dimension(39, 39));
    stopButton.setPreferredSize(new Dimension(39, 39));
    stopButton.setSize(new Dimension(39, 39));
    stopButton.setToolTipText("Stop");
    stopButton.setIcon(stopIcon);

    fullTranslationButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            fullTranslationButton_actionPerformed(e);
          }
        });
    fullTranslationButton.setMaximumSize(new Dimension(39, 39));
    fullTranslationButton.setMinimumSize(new Dimension(39, 39));
    fullTranslationButton.setPreferredSize(new Dimension(39, 39));
    fullTranslationButton.setSize(new Dimension(39, 39));
    fullTranslationButton.setToolTipText("Fast Translation");
    fullTranslationButton.setIcon(fullTranslationIcon);

    messageLbl.setFont(Utilities.statusLineFont);
    messageLbl.setLineWrap(true);
    messageLbl.setEditable(false);
    messageLbl.setCursor(null);
    messageLbl.setOpaque(false);
    messageLbl.setFocusable(false);
    messageLblPane.setBorder(BorderFactory.createLoweredBevelBorder());
    // messageLblPane.setBounds(new Rectangle(0, 672, TRANSLATOR_WIDTH - 8, 20));
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 3;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 2;
    this.getContentPane().add(messageLblPane, c);

    // arrowLabel.setBounds(new Rectangle(290, 324, 88, 71));
    arrowLabel.setIcon(arrowIcon);

    // source.setVisibleRows(31);
    // destination.setVisibleRows(31);
    // source.setBounds(new Rectangle(35,100,source.getWidth(),source.getHeight()));
    // destination.setBounds(new Rectangle(375,100,destination.getWidth(),destination.getHeight()));

    c.fill = GridBagConstraints.BOTH;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 1;
    this.getContentPane().add(source, c);

    c.fill = GridBagConstraints.NONE;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 1;
    c.gridy = 1;
    this.getContentPane().add(arrowLabel, c);

    c.fill = GridBagConstraints.BOTH;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 2;
    c.gridy = 1;
    this.getContentPane().add(destination, c);

    // Adding the tool bar to this container.
    toolBar.setFloatable(false);
    toolBar.setLocation(0, 0);
    toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0));
    toolBar.setBorder(BorderFactory.createEtchedBorder());
    arrangeToolBar();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.ipadx = 0;
    c.ipady = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 3;
    c.anchor = GridBagConstraints.CENTER;
    c.gridx = 0;
    c.gridy = 0;
    this.getContentPane().add(toolBar, c);
    toolBar.revalidate();
    toolBar.repaint();
    repaint();

    // Creating the menu bar
    arrangeMenu();
    setJMenuBar(menuBar);

    // initializing the window size and visibility
    setDefaultCloseOperation(3);
    setSize(new Dimension(TRANSLATOR_WIDTH, TRANSLATOR_HEIGHT));
    setVisible(true);
  }
Ejemplo n.º 26
0
  /**
   * Customization of external program paths.
   *
   * @param prefs a <code>JabRefPreferences</code> value
   */
  public TableColumnsTab(JabRefPreferences prefs, JabRefFrame frame) {
    _prefs = prefs;
    this.frame = frame;
    setLayout(new BorderLayout());

    TableModel tm =
        new AbstractTableModel() {
          public int getRowCount() {
            return rowCount;
          }

          public int getColumnCount() {
            return 2;
          }

          public Object getValueAt(int row, int column) {
            if (row == 0) return (column == 0 ? GUIGlobals.NUMBER_COL : "" + ncWidth);
            row--;
            if (row >= tableRows.size()) return "";
            Object rowContent = tableRows.elementAt(row);
            if (rowContent == null) return "";
            TableRow tr = (TableRow) rowContent;
            switch (column) {
              case 0:
                return tr.name;
              case 1:
                return ((tr.length > 0) ? Integer.toString(tr.length) : "");
            }
            return null; // Unreachable.
          }

          public String getColumnName(int col) {
            return (col == 0 ? Globals.lang("Field name") : Globals.lang("Column width"));
          }

          public Class<?> getColumnClass(int column) {
            if (column == 0) return String.class;
            else return Integer.class;
          }

          public boolean isCellEditable(int row, int col) {
            return !((row == 0) && (col == 0));
          }

          public void setValueAt(Object value, int row, int col) {
            tableChanged = true;
            // Make sure the vector is long enough.
            while (row >= tableRows.size()) tableRows.add(new TableRow("", -1));

            if ((row == 0) && (col == 1)) {
              ncWidth = Integer.parseInt(value.toString());
              return;
            }

            TableRow rowContent = tableRows.elementAt(row - 1);

            if (col == 0) {
              rowContent.name = value.toString();
              if (((String) getValueAt(row, 1)).equals(""))
                setValueAt("" + GUIGlobals.DEFAULT_FIELD_LENGTH, row, 1);
            } else {
              if (value == null) rowContent.length = -1;
              else rowContent.length = Integer.parseInt(value.toString());
            }
          }
        };

    colSetup = new JTable(tm);
    TableColumnModel cm = colSetup.getColumnModel();
    cm.getColumn(0).setPreferredWidth(140);
    cm.getColumn(1).setPreferredWidth(80);

    FormLayout layout =
        new FormLayout(
            "1dlu, 8dlu, left:pref, 4dlu, fill:pref", // , 4dlu, fill:60dlu, 4dlu, fill:pref",
            "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    JPanel pan = new JPanel();
    JPanel tabPanel = new JPanel();
    tabPanel.setLayout(new BorderLayout());
    JScrollPane sp =
        new JScrollPane(
            colSetup,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    colSetup.setPreferredScrollableViewportSize(new Dimension(250, 200));
    sp.setMinimumSize(new Dimension(250, 300));
    tabPanel.add(sp, BorderLayout.CENTER);
    JToolBar tlb = new JToolBar(SwingConstants.VERTICAL);
    tlb.setFloatable(false);
    // tlb.setRollover(true);
    // tlb.setLayout(gbl);
    AddRowAction ara = new AddRowAction();
    DeleteRowAction dra = new DeleteRowAction();
    MoveRowUpAction moveUp = new MoveRowUpAction();
    MoveRowDownAction moveDown = new MoveRowDownAction();
    tlb.setBorder(null);
    tlb.add(ara);
    tlb.add(dra);
    tlb.addSeparator();
    tlb.add(moveUp);
    tlb.add(moveDown);
    // tlb.addSeparator();
    // tlb.add(new UpdateWidthsAction());
    tabPanel.add(tlb, BorderLayout.EAST);

    showOneLetterHeadingForIconColumns =
        new JCheckBox(Globals.lang("Show one letter heading for icon columns"));

    fileColumn = new JCheckBox(Globals.lang("Show file column"));
    pdfColumn = new JCheckBox(Globals.lang("Show PDF/PS column"));
    urlColumn = new JCheckBox(Globals.lang("Show URL/DOI column"));
    preferUrl = new JRadioButton(Globals.lang("Show URL first"));
    preferDoi = new JRadioButton(Globals.lang("Show DOI first"));
    preferUrlDoiGroup = new ButtonGroup();
    preferUrlDoiGroup.add(preferUrl);
    preferUrlDoiGroup.add(preferDoi);

    urlColumn.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent arg0) {
            preferUrl.setEnabled(urlColumn.isSelected());
            preferDoi.setEnabled(urlColumn.isSelected());
          }
        });
    arxivColumn = new JCheckBox(Globals.lang("Show ArXiv column"));

    /** * begin: special table columns and special fields ** */
    HelpAction help = new HelpAction(frame.helpDiag, GUIGlobals.specialFieldsHelp);
    hlb = new JButton(GUIGlobals.getImage("helpSmall"));
    hlb.setToolTipText(Globals.lang("Help on special fields"));
    hlb.addActionListener(help);

    specialFieldsEnabled = new JCheckBox(Globals.lang("Enable special fields"));
    //		.concat(". ").concat(Globals.lang("You must restart JabRef for this to come into
    // effect.")));
    specialFieldsEnabled.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent event) {
            boolean isEnabled = specialFieldsEnabled.isSelected();
            rankingColumn.setEnabled(isEnabled);
            compactRankingColumn.setEnabled(isEnabled ? rankingColumn.isSelected() : false);
            qualityColumn.setEnabled(isEnabled);
            priorityColumn.setEnabled(isEnabled);
            relevanceColumn.setEnabled(isEnabled);
            syncKeywords.setEnabled(isEnabled);
            writeSpecialFields.setEnabled(isEnabled);
          }
        });
    rankingColumn = new JCheckBox(Globals.lang("Show rank"));
    rankingColumn.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent event) {
            compactRankingColumn.setEnabled(rankingColumn.isSelected());
          }
        });
    compactRankingColumn = new JCheckBox(Globals.lang("Compact rank"));
    qualityColumn = new JCheckBox(Globals.lang("Show quality"));
    priorityColumn = new JCheckBox(Globals.lang("Show priority"));
    relevanceColumn = new JCheckBox(Globals.lang("Show relevance"));

    // "sync keywords" and "write special" fields may be configured mutually exclusive only
    // The implementation supports all combinations (TRUE+TRUE and FALSE+FALSE, even if the latter
    // does not make sense)
    // To avoid confusion, we opted to make the setting mutually exclusive
    syncKeywords = new JRadioButton(Globals.lang("Synchronize with keywords"));
    writeSpecialFields =
        new JRadioButton(
            Globals.lang("Write values of special fields as separate fields to BibTeX"));
    ButtonGroup group = new ButtonGroup();
    group.add(syncKeywords);
    group.add(writeSpecialFields);

    builder.appendSeparator(Globals.lang("Special table columns"));
    builder.nextLine();
    builder.append(pan);

    DefaultFormBuilder specialTableColumnsBuilder =
        new DefaultFormBuilder(
            new FormLayout(
                "8dlu, 8dlu, 8cm, 8dlu, 8dlu, left:pref:grow",
                "pref, pref, pref, pref, pref, pref, pref, pref, pref, pref"));
    CellConstraints cc = new CellConstraints();

    specialTableColumnsBuilder.add(specialFieldsEnabled, cc.xyw(1, 1, 3));
    specialTableColumnsBuilder.add(rankingColumn, cc.xyw(2, 2, 2));
    specialTableColumnsBuilder.add(compactRankingColumn, cc.xy(3, 3));
    specialTableColumnsBuilder.add(relevanceColumn, cc.xyw(2, 4, 2));
    specialTableColumnsBuilder.add(qualityColumn, cc.xyw(2, 5, 2));
    specialTableColumnsBuilder.add(priorityColumn, cc.xyw(2, 6, 2));
    specialTableColumnsBuilder.add(syncKeywords, cc.xyw(2, 7, 2));
    specialTableColumnsBuilder.add(writeSpecialFields, cc.xyw(2, 8, 2));
    specialTableColumnsBuilder.add(showOneLetterHeadingForIconColumns, cc.xyw(1, 9, 5));
    specialTableColumnsBuilder.add(hlb, cc.xyw(1, 10, 2));

    specialTableColumnsBuilder.add(fileColumn, cc.xyw(5, 1, 2));
    specialTableColumnsBuilder.add(pdfColumn, cc.xyw(5, 2, 2));
    specialTableColumnsBuilder.add(urlColumn, cc.xyw(5, 3, 2));
    specialTableColumnsBuilder.add(preferUrl, cc.xy(6, 4));
    specialTableColumnsBuilder.add(preferDoi, cc.xy(6, 5));
    specialTableColumnsBuilder.add(arxivColumn, cc.xyw(5, 6, 2));

    builder.append(specialTableColumnsBuilder.getPanel());
    builder.nextLine();

    /** * end: special table columns and special fields ** */
    builder.appendSeparator(Globals.lang("Entry table columns"));
    builder.nextLine();
    builder.append(pan);
    builder.append(tabPanel);
    builder.nextLine();
    //	lab = new JLabel("<HTML>("+Globals.lang("this button will update the column width
    // settings<BR>"
    //						+"to match the current widths in your table")+")</HTML>");
    //        lab = new JLabel("<HTML>("+Globals.lang("this_button_will_update") +")</HTML>") ;
    builder.append(pan);
    JButton buttonWidth = new JButton(new UpdateWidthsAction());
    JButton buttonOrder = new JButton(new UpdateOrderAction());
    builder.append(buttonWidth);
    builder.nextLine();
    builder.append(pan);
    builder.append(buttonOrder);
    builder.nextLine();
    builder.append(pan);
    // builder.append(lab);
    builder.nextLine();
    pan = builder.getPanel();
    pan.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(pan, BorderLayout.CENTER);
  }
  // Initializes this component.
  private void jbInit() {
    fileChooser.setFileFilter(new ScriptFileFilter());
    this.getContentPane().setLayout(null);

    Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();

    JLabel slowLabel = new JLabel("Slow");
    slowLabel.setFont(Utilities.thinLabelsFont);
    JLabel fastLabel = new JLabel("Fast");
    fastLabel.setFont(Utilities.thinLabelsFont);
    labelTable.put(1, slowLabel);
    labelTable.put(5, fastLabel);

    speedSlider.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            SpeedSlider_stateChanged(e);
          }
        });
    speedSlider.setLabelTable(labelTable);
    speedSlider.setMajorTickSpacing(1);
    speedSlider.setPaintTicks(true);
    speedSlider.setPaintLabels(true);
    speedSlider.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
    speedSlider.setPreferredSize(new Dimension(95, 50));
    speedSlider.setMinimumSize(new Dimension(95, 50));
    speedSlider.setToolTipText("Speed");
    speedSlider.setMaximumSize(new Dimension(95, 50));

    final Dimension buttonSize = new Dimension(39, 39);

    loadProgramButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            loadProgramButton_actionPerformed();
          }
        });
    loadProgramButton.setMaximumSize(buttonSize);
    loadProgramButton.setMinimumSize(buttonSize);
    loadProgramButton.setPreferredSize(buttonSize);
    loadProgramButton.setSize(buttonSize);
    loadProgramButton.setToolTipText("Load Program");
    loadProgramButton.setIcon(loadProgramIcon);

    ffwdButton.setMaximumSize(buttonSize);
    ffwdButton.setMinimumSize(buttonSize);
    ffwdButton.setPreferredSize(buttonSize);
    ffwdButton.setToolTipText("Run");
    ffwdButton.setIcon(ffwdIcon);
    ffwdButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ffwdButton_actionPerformed();
          }
        });

    stopButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stopButton_actionPerformed();
          }
        });
    stopButton.setMaximumSize(buttonSize);
    stopButton.setMinimumSize(buttonSize);
    stopButton.setPreferredSize(buttonSize);
    stopButton.setToolTipText("Stop");
    stopButton.setIcon(stopIcon);

    rewindButton.setMaximumSize(buttonSize);
    rewindButton.setMinimumSize(buttonSize);
    rewindButton.setPreferredSize(buttonSize);
    rewindButton.setToolTipText("Reset");
    rewindButton.setIcon(rewindIcon);
    rewindButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            rewindButton_actionPerformed();
          }
        });

    scriptButton.setMaximumSize(buttonSize);
    scriptButton.setMinimumSize(buttonSize);
    scriptButton.setPreferredSize(buttonSize);
    scriptButton.setToolTipText("Load Script");
    scriptButton.setIcon(scriptIcon);
    scriptButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            scriptButton_actionPerformed();
          }
        });

    breakButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            breakButton_actionPerformed();
          }
        });
    breakButton.setMaximumSize(buttonSize);
    breakButton.setMinimumSize(buttonSize);
    breakButton.setPreferredSize(buttonSize);
    breakButton.setToolTipText("Open breakpoint panel");
    breakButton.setIcon(breakIcon);

    breakpointWindow.addBreakpointListener(this);

    singleStepButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            singleStepButton_actionPerformed();
          }
        });
    singleStepButton.setMaximumSize(buttonSize);
    singleStepButton.setMinimumSize(buttonSize);
    singleStepButton.setPreferredSize(buttonSize);
    singleStepButton.setSize(buttonSize);
    singleStepButton.setToolTipText("Single Step");
    singleStepButton.setIcon(singleStepIcon);

    stepOverButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            stepOverButton_actionPerformed();
          }
        });
    stepOverButton.setMaximumSize(buttonSize);
    stepOverButton.setMinimumSize(buttonSize);
    stepOverButton.setPreferredSize(buttonSize);
    stepOverButton.setSize(buttonSize);
    stepOverButton.setToolTipText("Step Over");
    stepOverButton.setIcon(stepOverIcon);

    animationCombo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            animationCombo_actionPerformed();
          }
        });

    formatCombo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            formatCombo_actionPerformed();
          }
        });

    additionalDisplayCombo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            additionalDisplayCombo_actionPerformed();
          }
        });

    messageLbl.setFont(Utilities.statusLineFont);
    messageLbl.setBorder(BorderFactory.createLoweredBevelBorder());
    messageLbl.setBounds(new Rectangle(0, 667, CONTROLLER_WIDTH - 8, 25));

    toolBar = new JToolBar();
    toolBar.setSize(new Dimension(TOOLBAR_WIDTH, TOOLBAR_HEIGHT));
    toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 0));
    toolBar.setFloatable(false);
    toolBar.setLocation(0, 0);
    toolBar.setBorder(BorderFactory.createEtchedBorder());
    arrangeToolBar();
    this.getContentPane().add(toolBar, null);
    toolBar.revalidate();
    toolBar.repaint();
    repaint();

    // Creating the menu bar
    menuBar = new JMenuBar();
    arrangeMenu();
    setJMenuBar(menuBar);

    this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    this.getContentPane().add(messageLbl, null);

    setControllerSize();

    // sets the frame to be visible.
    setVisible(true);
  }