Ejemplo n.º 1
2
  /** Inicializace základních komponent okna */
  private void init() {

    krokLabel = new JLabel("Synchronizace s web aplikací");
    Font pismo = new Font("Arial", Font.BOLD, 14);
    krokLabel.setFont(pismo);
    NacitaciOkno.add(krokLabel);
    krokLabel.setBounds(90, 10, 250, 20);

    startButton = new JButton("Načíst");
    startButton.setActionCommand("start");
    startButton.setBounds(250, 110, 120, 25);
    startButton.addActionListener(new Start());

    progressBar = new JProgressBar(0, 100);
    progressBar.setBounds(20, 60, 350, 25);
    progressBar.setValue(0);

    progressBar.setStringPainted(true);

    taskOutput = new JTextArea(5, 20);
    taskOutput.setMargin(new Insets(5, 5, 5, 5));
    taskOutput.setEditable(false);

    NacitaciOkno.add(startButton);
    NacitaciOkno.add(progressBar);

    NacitaciOkno.setVisible(true);

    vybratButton = new JButton("Otevřít");
    NacitaciOkno.add(vybratButton);
    vybratButton.setBounds(20, 110, 120, 25);
    vybratButton.addActionListener(new Zpet());
  }
  private void initGUI() {

    JPanel pCommand = new JPanel();

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

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

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

    txtCommand = new JTextArea(5, 40);

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

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

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

    txtResultScroll = new JScrollPane(txtResult);

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

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

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

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

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

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

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

    fMain.getContentPane().add(ewSplitPane, BorderLayout.CENTER);
    doLayout();
    fMain.pack();
  }
Ejemplo n.º 3
0
  /**
   * Create a new Dialog with a title and a message.
   *
   * @param message
   * @param title
   */
  public ErrorDialog(String message, String title) {
    setTitle(title);
    setSize(new Dimension(600, 400));
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setLocationRelativeTo(null);

    Container container = getContentPane();
    container.setLayout(new BorderLayout());

    JTextArea textArea = new JTextArea();
    textArea.setText(message);
    textArea.setEditable(false);
    textArea.setMargin(new Insets(PADDING, PADDING, PADDING, PADDING));
    add(new JScrollPane(textArea), BorderLayout.CENTER);

    final JDialog dialog = this;
    JButton button =
        new JButton(
            new AbstractAction("OK") {
              @Override
              public void actionPerformed(ActionEvent e) {
                dialog.dispose();
              }
            });
    add(button, BorderLayout.SOUTH);
  }
  private void initComponent() {
    // Create the logger first, because the action listeners
    // need to refer to it.
    logger = new JTextArea(8, 50);
    logger.setMargin(new Insets(5, 5, 5, 5));
    logger.setEditable(false);

    JScrollPane logScrollPane = new JScrollPane(logger);

    // Create a file chooser
    fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    // Create the open button.  We use the image from the JLF
    // Graphics Repository (but we extracted it from the jar).
    openButton = new JButton("Chose NetBeans ...", createImageIcon("images/open.gif"));
    openButton.addActionListener(GuiFriendlizerApp.this);

    // Create the save button.  We use the image from the JLF
    // Graphics Repository (but we extracted it from the jar).
    patchButton = new JButton("Do Patch", createImageIcon("images/patch.gif"));
    patchButton.addActionListener(GuiFriendlizerApp.this);
    patchButton.setEnabled(false);

    // For layout purposes, put the buttons in a separate panel
    JPanel buttonPanel = new JPanel(); // use FlowLayout
    buttonPanel.add(openButton);
    buttonPanel.add(patchButton);

    // Add the buttons and the logger to this panel.
    add(buttonPanel, BorderLayout.PAGE_START);
    add(logScrollPane, BorderLayout.CENTER);
  }
Ejemplo n.º 5
0
  public BarUI(BarCntl theBarCntl) {
    this.theBarCntl = theBarCntl;
    this.newBar = new Bar();
    this.setSize(400, 300);
    this.setLocationRelativeTo(null);
    this.setResizable(false);
    this.setLayout(new BorderLayout());
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    topPanel = new JPanel();
    centerPanel = new JPanel();

    back = new JButton("< Back");
    back.setBounds(50, 50, 100, 50);
    back.addActionListener(this);
    topPanel.add(back);

    getBar = new JButton("Get Bar");
    getBar.setBounds(50, 50, 100, 50);
    getBar.addActionListener(this);
    topPanel.add(getBar);

    displayBar = new JTextArea("Press 'Get Bar'");
    displayBar.setMargin(new Insets(20, 20, 20, 50));
    displayBar.setFont(displayBar.getFont().deriveFont(18.0f));
    displayBar.setEditable(false);
    centerPanel.add(displayBar);

    this.add(topPanel, BorderLayout.NORTH);
    this.add(centerPanel, BorderLayout.CENTER);
  }
Ejemplo n.º 6
0
 /** Initialise the help tab. */
 private void initHelpTab() {
   help.setLayout(new BorderLayout());
   JTextArea helpText = new JTextArea();
   helpText.setText(Translator.localize("dialog.find.helptext"));
   helpText.setEditable(false);
   helpText.setMargin(new Insets(INSET_PX, INSET_PX, INSET_PX, INSET_PX));
   help.add(new JScrollPane(helpText), BorderLayout.CENTER);
 }
  /**
   * Create a new AddToDoItemDialog
   *
   * @param renderer the ListCellRenderer to use in order to display the offenders
   */
  public AddToDoItemDialog(ListCellRenderer renderer) {
    super(Translator.localize("dialog.title.add-todo-item"), Dialog.OK_CANCEL_OPTION, true);

    headLineTextField = new JTextField(TEXT_COLUMNS);
    priorityComboBox = new JComboBox(PRIORITIES);
    moreinfoTextField = new JTextField(TEXT_COLUMNS);
    descriptionTextArea = new JTextArea(TEXT_ROWS, TEXT_COLUMNS);

    DefaultListModel dlm = new DefaultListModel();
    Object[] offObj = TargetManager.getInstance().getModelTargets().toArray();
    for (int i = 0; i < offObj.length; i++) {
      if (offObj[i] != null) {
        dlm.addElement(offObj[i]);
      }
    }

    offenderList = new JList(dlm);
    offenderList.setCellRenderer(renderer);
    JScrollPane offenderScroll = new JScrollPane(offenderList);
    offenderScroll.setOpaque(true);

    JLabel headlineLabel = new JLabel(Translator.localize("label.headline"));
    JLabel priorityLabel = new JLabel(Translator.localize("label.priority"));
    JLabel moreInfoLabel = new JLabel(Translator.localize("label.more-info-url"));
    JLabel offenderLabel = new JLabel(Translator.localize("label.offenders"));
    priorityComboBox.setSelectedItem(PRIORITIES[0]);

    JPanel panel = new JPanel(new LabelledLayout(getLabelGap(), getComponentGap()));

    headlineLabel.setLabelFor(headLineTextField);
    panel.add(headlineLabel);
    panel.add(headLineTextField);

    priorityLabel.setLabelFor(priorityComboBox);
    panel.add(priorityLabel);
    panel.add(priorityComboBox);

    moreInfoLabel.setLabelFor(moreinfoTextField);
    panel.add(moreInfoLabel);
    panel.add(moreinfoTextField);

    offenderLabel.setLabelFor(offenderScroll);
    panel.add(offenderLabel);
    panel.add(offenderScroll);

    descriptionTextArea.setLineWrap(true); // MVW - Issue 2422
    descriptionTextArea.setWrapStyleWord(true); // MVW - Issue 2422
    descriptionTextArea.setText(Translator.localize("label.enter-todo-item") + "\n");
    descriptionTextArea.setMargin(new Insets(INSET_PX, INSET_PX, INSET_PX, INSET_PX));
    JScrollPane descriptionScroller = new JScrollPane(descriptionTextArea);
    descriptionScroller.setPreferredSize(descriptionTextArea.getPreferredSize());
    panel.add(descriptionScroller);

    setContent(panel);
  }
Ejemplo n.º 8
0
  public ImportClientsGUI(File file, Controller controller) {
    super();
    setOpaque(false);

    this.controller = controller;
    this.towns = new HashMap<String, TownDTO>();
    this.subcategories = new HashMap<String, SubcategoryDTO>();

    for (TownDTO town : controller.getAllTowns()) {
      this.towns.put(town.getName().toUpperCase(), town);
    }

    for (SubcategoryDTO subcategory : controller.getAllSubcategories()) {
      this.subcategories.put(subcategory.getDescription().toUpperCase(), subcategory);
    }

    this.file = file;
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] {0, 0};
    gridBagLayout.rowHeights = new int[] {0, 50, 0};
    gridBagLayout.columnWeights = new double[] {1.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[] {1.0, 0.0, Double.MIN_VALUE};
    setLayout(gridBagLayout);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setOpaque(false);
    GridBagConstraints gbc_scrollPane = new GridBagConstraints();
    gbc_scrollPane.insets = new Insets(15, 15, 10, 15);
    gbc_scrollPane.fill = GridBagConstraints.BOTH;
    gbc_scrollPane.gridx = 0;
    gbc_scrollPane.gridy = 0;
    add(scrollPane, gbc_scrollPane);

    textArea = new JTextArea();
    textArea.setEditable(false);
    textArea.setMargin(new Insets(10, 10, 10, 10));
    textArea.setWrapStyleWord(true);
    textArea.setLineWrap(true);
    textArea.setForeground(Color.GREEN);
    textArea.setFont(new Font("Lucida Grande", Font.PLAIN, 15));
    textArea.setBackground(new Color(0, 0, 0, 140));
    scrollPane.setViewportView(textArea);

    progressBar = new JProgressBar();
    progressBar.setStringPainted(true);
    progressBar.setForeground(Color.BLACK);
    progressBar.setFont(new Font("Lucida Grande", Font.PLAIN, 20));
    GridBagConstraints gbc_progressBar = new GridBagConstraints();
    gbc_progressBar.fill = GridBagConstraints.BOTH;
    gbc_progressBar.insets = new Insets(0, 15, 15, 15);
    gbc_progressBar.gridx = 0;
    gbc_progressBar.gridy = 1;
    add(progressBar, gbc_progressBar);
  }
Ejemplo n.º 9
0
 public CToolTipUI(Color background) {
   super();
   this.background = background;
   renderer = new CellRendererPane();
   textArea = new JTextArea();
   textArea.setMargin(new Insets(0, 3, 0, 0));
   renderer.removeAll();
   renderer.add(textArea);
   textArea.setFont(new Font("Ariel", Font.PLAIN, 11));
   textArea.setWrapStyleWord(true);
   textArea.setLineWrap(true);
   textArea.setWrapStyleWord(true);
 }
Ejemplo n.º 10
0
  static JPanel getPanel() {
    //Now layout the LogPanel.  It will be added to the tabs in the main class.

    //Create the log first, because the action listeners
    //need to refer to it.
    logArea = new JTextArea(30,20);
    logArea.setMargin(new Insets(5, 5, 5, 5));
    logArea.setEditable(false);
    JScrollPane logScrollPane = new JScrollPane(logArea);

    //Create a panel of the log and its label
    JPanel logPanel = new JPanel();
    logPanel.setLayout(new BorderLayout());
    logPanel.setBorder(BorderFactory.createTitledBorder(GT._("Log and Error Messages:")));
    logPanel.add(logScrollPane);
    return logPanel;
  }
Ejemplo n.º 11
0
  private void initializeFrame() {
    int padding = 5;
    // double ratio = 16.0/9.0;
    double ratio = (1.0 + Math.sqrt(5.0)) / 2.0;
    Dimension screenDims = Toolkit.getDefaultToolkit().getScreenSize();
    // setLocation((screenDims.width - getWidth())/2,(screenDims.height -
    // getHeight())/2);
    // TODO add server/client closing functionality on close

    JPanel panel = new JPanel();
    panel.setLayout(null);
    double height = screenDims.height / 2;
    Dimension panelDims = new Dimension((int) (height * ratio), (int) height);
    panel.setPreferredSize(panelDims);
    panel.setMaximumSize(panelDims);
    panel.setMinimumSize(panelDims);

    int textMargin = 3;
    textArea = new JTextArea();
    textArea.setMargin(new Insets(textMargin, textMargin, textMargin, textMargin));
    textArea.setSize(panelDims.width - 2 * padding, panelDims.height - 2 * padding);
    textArea.setLocation(padding, padding);
    textArea.setEditable(false);
    scrollPane = new JScrollPane(textArea);
    scrollPane.setSize(textArea.getSize());
    scrollPane.setLocation(textArea.getLocation());
    scrollPane
        .getVerticalScrollBar()
        .addAdjustmentListener(
            new AdjustmentListener() {
              public void adjustmentValueChanged(AdjustmentEvent e) {
                isAtBottom = e.getAdjustable().getValue() == e.getAdjustable().getMaximum();
              }
            });
    panel.add(scrollPane);

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLayout(new BorderLayout());
    add(panel, BorderLayout.CENTER);
    pack();
    setSize(getWidth() - 10, getHeight() - 10);
    setResizable(false);
    setLocationRelativeTo(null);
    this.setVisible(true);
  }
  public FileChooserDemo() {
    super(new BorderLayout());

    // Create the log first, because the action listeners
    // need to refer to it.
    log = new JTextArea(5, 20);
    log.setMargin(new Insets(5, 5, 5, 5));
    log.setEditable(false);
    JScrollPane logScrollPane = new JScrollPane(log);

    // Create a file chooser
    fc = new JFileChooser();

    // Uncomment one of the following lines to try a different
    // file selection mode.  The first allows just directories
    // to be selected (and, at least in the Java look and feel,
    // shown).  The second allows both files and directories
    // to be selected.  If you leave these lines commented out,
    // then the default mode (FILES_ONLY) will be used.
    //
    // fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    // fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    // Create the open button.  We use the image from the JLF
    // Graphics Repository (but we extracted it from the jar).
    openButton = new JButton("Open a File...", createImageIcon("images/Open16.gif"));
    openButton.addActionListener(this);

    // Create the save button.  We use the image from the JLF
    // Graphics Repository (but we extracted it from the jar).
    saveButton = new JButton("Save a File...", createImageIcon("images/Save16.gif"));
    saveButton.addActionListener(this);

    // For layout purposes, put the buttons in a separate panel
    JPanel buttonPanel = new JPanel(); // use FlowLayout
    buttonPanel.add(openButton);
    buttonPanel.add(saveButton);

    // Add the buttons and the log to this panel.
    add(buttonPanel, BorderLayout.PAGE_START);
    add(logScrollPane, BorderLayout.CENTER);
  }
 public void setComponent() {
   BorderLayout layout = new BorderLayout();
   layout.setHgap(10);
   layout.setVgap(10);
   frame.getContentPane().setLayout(layout);
   frame.getContentPane().add(textField, BorderLayout.NORTH);
   JScrollPane pane = new JScrollPane();
   //		pane.setLayout(layout);
   pane.setViewportView(textArea);
   frame.getContentPane().add(pane);
   Insets i = new Insets(10, 10, 10, 10);
   textArea.setMargin(i);
   pane.setPreferredSize(new Dimension(400, 600));
   textField.addKeyListener(
       new KeyAdapter() {
         public void keyReleased(KeyEvent e) {
           reload();
         }
       });
 }
Ejemplo n.º 14
0
  public Splitter() {
    super(new BorderLayout());

    // Create the demo's UI.
    startButton = new JButton("Start");
    startButton.setActionCommand("start");
    startButton.addActionListener(this);
    startButton.setVisible(false);

    taskOutput = new JTextArea(30, 130);
    taskOutput.setMargin(new Insets(5, 5, 5, 5));
    taskOutput.setEditable(false);

    JPanel panel = new JPanel();
    panel.add(startButton);

    add(panel, BorderLayout.PAGE_START);
    add(new JScrollPane(taskOutput), BorderLayout.CENTER);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

    startButton.doClick();
  }
Ejemplo n.º 15
0
  /** Creates a new instance of HistoryViewer */
  public RawDataViewer(FloatDataSet floatData) {
    // initialize content
    content = new JTextArea();
    content.setEditable(false);
    content.setMargin(new Insets(10, 10, 10, 10));
    content.setBackground(Color.white);
    content.setForeground(Color.DARK_GRAY);
    content.setFont(new Font("Arial", Font.BOLD, 12));

    // initialize popupMenu
    menu = new JPopupMenu();
    JMenuItem saveItem = new JMenuItem("Save to File"); // , GUIFactory.getIcon("save16.gif"));
    saveItem.setActionCommand("save");
    saveItem.addActionListener(new Listener());
    menu.add(saveItem);

    chooser = new JFileChooser();
    boolean denySaveSecurity = false;
    try {
      chooser.setFileFilter(
          new FileFilter() {
            public boolean accept(File f) {
              return f.isDirectory() || f.getName().endsWith(".txt");
            }

            public String getDescription() {
              return "TXT file";
            }
          });
      chooser.setSelectedFile(new File("rawDataSummary.txt"));
    } catch (AccessControlException ace) {
      denySaveSecurity = true;
    }

    addContent(floatData);

    content.addMouseListener(new Listener());
  }
Ejemplo n.º 16
0
  /** Metoda vytváří okno "Zálohování souborů" a jeho komponenty */
  private void init() {

    oknoVytvorPdf = new JDialog();
    oknoVytvorPdf.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
    oknoVytvorPdf.setTitle("Zálohování souborů");
    oknoVytvorPdf.setLocation(400, 350);
    oknoVytvorPdf.setSize(400, 200);
    oknoVytvorPdf.setLayout(null);

    krokLabel = new JLabel("Zálohuj vše na FTP");
    Font pismo = new Font("Arial", Font.BOLD, 14);
    krokLabel.setFont(pismo);
    oknoVytvorPdf.add(krokLabel);
    krokLabel.setBounds(90, 10, 250, 20);

    startButton = new JButton("Start");
    startButton.setActionCommand("start");
    startButton.setBounds(250, 110, 120, 25);
    startButton.addActionListener(new Start());

    progressBar = new JProgressBar(0, 100);
    progressBar.setBounds(20, 60, 350, 25);
    progressBar.setValue(0);

    progressBar.setStringPainted(true);

    taskOutput = new JTextArea(5, 20);
    taskOutput.setMargin(new Insets(5, 5, 5, 5));
    taskOutput.setEditable(false);

    oknoVytvorPdf.add(startButton);
    oknoVytvorPdf.add(progressBar);

    vybratButton = new JButton("Zpět");
    oknoVytvorPdf.add(vybratButton);
    vybratButton.setBounds(20, 110, 120, 25);
    vybratButton.addActionListener(new Zpet());
  }
Ejemplo n.º 17
0
  public ProcessFrame(Properties theProperties) {
    super(new BorderLayout());
    // myFile = theFile;
    myProperties = theProperties;
    Properties props = System.getProperties();
    props.put("http.proxyHost", myProperties.getProperty("PROXYHOST"));
    props.put("http.proxyPort", myProperties.getProperty("PROXYPORT"));

    // Create the demo's UI.
    StartButton = new JButton("Start");
    StartButton.setActionCommand("start");
    StartButton.addActionListener(this);
    cancelButton = new JButton("Cancel");
    cancelButton.setActionCommand("cancel");
    cancelButton.addActionListener(this);
    cancelButton.setEnabled(false);

    myDownloadOptions = new JComboBox(myDownloadOptionsStr);

    progressBar = new JProgressBar(0, 100);
    progressBar.setValue(0);
    progressBar.setStringPainted(true);
    progressBar2 = new JProgressBar(0, 100);
    progressBar2.setValue(0);
    progressBar2.setStringPainted(true);
    progressBar3 = new JProgressBar(0, 100);
    progressBar4 = new JProgressBar(0, 100);
    progressBar5 = new JProgressBar(0, 100);
    progressBar3.setValue(0);
    progressBar3.setStringPainted(true);
    progressBar4.setValue(0);
    progressBar4.setStringPainted(true);
    progressBar5.setValue(0);
    progressBar5.setStringPainted(true);

    taskOutput = new JTextArea(5, 20);

    final JPopupMenu taskPopupMenu = new JPopupMenu();
    JMenuItem clearMenuItem = new JMenuItem("Clear");
    clearMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            if (actionEvent.getActionCommand().equals("Clear")) {
              taskOutput.setText("");
            }
          }
        });
    taskPopupMenu.add(clearMenuItem);
    taskOutput.setMargin(new Insets(5, 5, 5, 5));
    taskOutput.setEditable(false);
    taskOutput.addMouseListener(
        new MouseAdapter() {
          private void showIfPopupTrigger(MouseEvent mouseEvent) {
            if (mouseEvent.isPopupTrigger()) {
              taskPopupMenu.show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY());
            }
          }

          public void mousePressed(MouseEvent mouseEvent) {
            showIfPopupTrigger(mouseEvent);
          }

          public void mouseReleased(MouseEvent mouseEvent) {
            showIfPopupTrigger(mouseEvent);
          }
        });

    JPanel panel = new JPanel();
    JPanel panel2 = new JPanel();
    panel.setLayout(new GridBagLayout());
    panel2.setLayout(new GridBagLayout());
    panel.add(
        progressBar4,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(11, 11, 0, 0),
            0,
            0));
    panel.add(
        new JLabel("TOTAL"),
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 11, 0, 0),
            0,
            0));
    panel.add(
        progressBar,
        new GridBagConstraints(
            2,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(11, 11, 0, 0),
            0,
            0));
    panel.add(
        new JLabel("REMOTE DOWNLOAD"),
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 11, 0, 0),
            0,
            0));
    panel.add(
        progressBar2,
        new GridBagConstraints(
            2,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(11, 11, 0, 0),
            0,
            0));
    panel.add(
        new JLabel("REMOTE SPLIT"),
        new GridBagConstraints(
            1,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 11, 0, 0),
            0,
            0));
    panel.add(
        progressBar3,
        new GridBagConstraints(
            2,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(11, 11, 0, 0),
            0,
            0));
    panel.add(
        new JLabel("LOCAL DOWNLOAD"),
        new GridBagConstraints(
            1,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 11, 0, 0),
            0,
            0));
    panel.add(
        progressBar5,
        new GridBagConstraints(
            2,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            new Insets(11, 11, 0, 0),
            0,
            0));
    panel.add(
        new JLabel("LOCAL JOIN"),
        new GridBagConstraints(
            1,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 11, 0, 0),
            0,
            0));
    panel2.add(
        myDownloadOptions,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 13, 4, 0),
            0,
            0));
    panel2.add(
        StartButton,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 13, 4, 0),
            0,
            0));
    panel2.add(
        cancelButton,
        new GridBagConstraints(
            3,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 13, 4, 0),
            0,
            0));

    add(panel, BorderLayout.PAGE_START);
    add(panel2, BorderLayout.CENTER);
    add(new JScrollPane(taskOutput), BorderLayout.PAGE_END);

    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
  }
Ejemplo n.º 18
0
  public fileBackupProgram(JFrame frame) {
    super(new BorderLayout());
    this.frame = frame;

    errorDialog = new CustomDialog(frame, "Please enter a new name for the error log", this);
    errorDialog.pack();

    moveDialog = new CustomDialog(frame, "Please enter a new name for the move log", this);
    moveDialog.pack();

    printer = new FilePrinter();
    timers = new ArrayList<>();
    log = new JTextArea(5, 20);
    log.setMargin(new Insets(5, 5, 5, 5));
    log.setEditable(false);
    JScrollPane logScrollPane = new JScrollPane(log);
    Object obj;
    copy = true;
    listModel = new DefaultListModel();
    // destListModel = new DefaultListModel();
    directoryList = new directoryStorage();

    // Create a file chooser
    fc = new JFileChooser();

    // Create the menu bar.
    menuBar = new JMenuBar();

    // Build the first menu.
    menu = new JMenu("File");
    menu.getAccessibleContext()
        .setAccessibleDescription("The only menu in this program that has menu items");
    menuBar.add(menu);

    editError = new JMenuItem("Save Error Log As...");
    editError
        .getAccessibleContext()
        .setAccessibleDescription("Change the name of the error log file");
    editError.addActionListener(new ErrorListener());
    menu.add(editError);

    editMove = new JMenuItem("Save Move Log As...");
    editMove
        .getAccessibleContext()
        .setAccessibleDescription("Change the name of the move log file");
    editMove.addActionListener(new MoveListener());
    menu.add(editMove);

    exit = new JMenuItem("Exit");
    exit.getAccessibleContext().setAccessibleDescription("Exit the Program");
    exit.addActionListener(new CloseListener());
    menu.add(exit);
    frame.setJMenuBar(menuBar);
    // Uncomment one of the following lines to try a different
    // file selection mode.  The first allows just directories
    // to be selected (and, at least in the Java look and feel,
    // shown).  The second allows both files and directories
    // to be selected.  If you leave these lines commented out,
    // then the default mode (FILES_ONLY) will be used.
    //
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    // fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    openButton = new JButton(openString);
    openButton.setActionCommand(openString);
    openButton.addActionListener(new OpenListener());

    destButton = new JButton(destString);
    destButton.setActionCommand(destString);
    destButton.addActionListener(new DestListener());

    // Create the save button.  We use the image from the JLF
    // Graphics Repository (but we extracted it from the jar).
    saveButton = new JButton(saveString);
    saveButton.setActionCommand(saveString);
    saveButton.addActionListener(new SaveListener());

    URL imageURL = getClass().getResource(greenButtonIcon);
    ImageIcon greenSquare = new ImageIcon(imageURL);
    startButton = new JButton("Start", greenSquare);
    startButton.setSize(60, 20);
    startButton.setHorizontalTextPosition(AbstractButton.LEADING);
    startButton.setActionCommand("Start");
    startButton.addActionListener(new StartListener());

    imageURL = getClass().getResource(redButtonIcon);
    ImageIcon redSquare = new ImageIcon(imageURL);
    stopButton = new JButton("Stop", redSquare);
    stopButton.setSize(60, 20);
    stopButton.setHorizontalTextPosition(AbstractButton.LEADING);
    stopButton.setActionCommand("Stop");
    stopButton.addActionListener(new StopListener());

    copyButton = new JRadioButton("Copy");
    copyButton.setActionCommand("Copy");
    copyButton.setSelected(true);
    copyButton.addActionListener(new RadioListener());

    moveButton = new JRadioButton("Move");
    moveButton.setActionCommand("Move");
    moveButton.addActionListener(new RadioListener());

    ButtonGroup group = new ButtonGroup();
    group.add(copyButton);
    group.add(moveButton);

    // For layout purposes, put the buttons in a separate panel

    JPanel optionPanel = new JPanel();

    GroupLayout layout = new GroupLayout(optionPanel);
    optionPanel.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout.createSequentialGroup().addComponent(copyButton).addComponent(moveButton));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(copyButton)
                    .addComponent(moveButton)));

    JPanel buttonPanel = new JPanel(); // use FlowLayout

    layout = new GroupLayout(buttonPanel);
    buttonPanel.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(openButton)
                    .addComponent(optionPanel))
            .addComponent(destButton)
            .addComponent(startButton)
            .addComponent(stopButton)
        // .addComponent(saveButton)
        );
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(openButton)
                    .addComponent(destButton)
                    .addComponent(startButton)
                    .addComponent(stopButton)
                // .addComponent(saveButton)
                )
            .addComponent(optionPanel));

    buttonPanel.add(optionPanel);
    /*
    buttonPanel.add(openButton);
    buttonPanel.add(destButton);
    buttonPanel.add(startButton);
    buttonPanel.add(stopButton);
    buttonPanel.add(saveButton);
    buttonPanel.add(listLabel);
    buttonPanel.add(copyButton);
    buttonPanel.add(moveButton);
    */
    destButton.setEnabled(false);
    startButton.setEnabled(false);
    stopButton.setEnabled(false);

    // Add the buttons and the log to this panel.

    // add(logScrollPane, BorderLayout.CENTER);

    JLabel listLabel = new JLabel("Monitored Directory:");
    listLabel.setLabelFor(list);

    // Create the list and put it in a scroll pane.
    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);
    list.addListSelectionListener(this);
    list.setVisibleRowCount(8);
    JScrollPane listScrollPane = new JScrollPane(list);
    JPanel listPane = new JPanel();
    listPane.setLayout(new BorderLayout());

    listPane.add(listLabel, BorderLayout.PAGE_START);
    listPane.add(listScrollPane, BorderLayout.CENTER);

    listSelectionModel = list.getSelectionModel();
    listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
    // monitored, destination, waitInt, check

    destination = new JLabel("Destination Directory: ");

    waitField = new JFormattedTextField();
    // waitField.setValue(240);
    waitField.setEditable(false);
    waitField.addPropertyChangeListener(new FormattedTextListener());

    waitInt = new JLabel("Wait Interval (in minutes)");
    // waitInt.setLabelFor(waitField);

    checkField = new JFormattedTextField();
    checkField.setSize(1, 10);
    // checkField.setValue(60);
    checkField.setEditable(false);
    checkField.addPropertyChangeListener(new FormattedTextListener());

    check = new JLabel("Check Interval (in minutes)");
    // check.setLabelFor(checkField);

    fireButton = new JButton(fireString);
    fireButton.setActionCommand(fireString);
    fireButton.addActionListener(new FireListener());

    JPanel fieldPane = new JPanel();
    // fieldPane.add(destField);
    layout = new GroupLayout(fieldPane);
    fieldPane.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(waitInt)
                    .addComponent(check))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(waitField, 60, 60, 60)
                    .addComponent(checkField, 60, 60, 60)));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(waitInt)
                    .addComponent(waitField))
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(check)
                    .addComponent(checkField)));

    JPanel labelPane = new JPanel();

    labelPane.setLayout(new BorderLayout());

    labelPane.add(destination, BorderLayout.PAGE_START);
    labelPane.add(fieldPane, BorderLayout.CENTER);

    layout = new GroupLayout(labelPane);
    labelPane.setLayout(layout);

    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(destination)
                    .addComponent(fieldPane)));

    layout.setVerticalGroup(
        layout.createSequentialGroup().addComponent(destination).addComponent(fieldPane));
    // labelPane.add(destination);
    // labelPane.add(fieldPane);

    try {
      // Read from disk using FileInputStream
      FileInputStream f_in = new FileInputStream(LOG_DIRECTORY + "\\save.data");

      // Read object using ObjectInputStream
      ObjectInputStream obj_in = new ObjectInputStream(f_in);

      // Read an object
      directoryList = (directoryStorage) obj_in.readObject();
      ERROR_LOG_NAME = (String) obj_in.readObject();
      MOVE_LOG_NAME = (String) obj_in.readObject();

      if (ERROR_LOG_NAME instanceof String) {
        printer.changeErrorLogName(ERROR_LOG_NAME);
      }

      if (MOVE_LOG_NAME instanceof String) {
        printer.changeMoveLogName(MOVE_LOG_NAME);
      }

      if (directoryList instanceof directoryStorage) {
        System.out.println("found object");
        // directoryList = (directoryStorage) obj;

        Iterator<Directory> directories = directoryList.getDirectories();
        Directory d;
        while (directories.hasNext()) {
          d = directories.next();

          try {
            listModel.addElement(d.getDirectory().toRealPath());
          } catch (IOException x) {
            printer.printError(x.toString());
          }

          int index = list.getSelectedIndex();
          if (index == -1) {
            list.setSelectedIndex(0);
          }

          index = list.getSelectedIndex();
          Directory dir = directoryList.getDirectory(index);

          destButton.setEnabled(true);
          checkField.setValue(dir.getInterval());
          waitField.setValue(dir.getWaitInterval());
          checkField.setEditable(true);
          waitField.setEditable(true);

          // directoryList.addNewDirectory(d);
          // try {
          // listModel.addElement(d.getDirectory().toString());
          // } catch (IOException x) {
          // printer.printError(x.toString());
          // }

          // timer = new Timer();
          // timer.schedule(new CopyTask(d.directory, d.destination, d.getWaitInterval(), printer,
          // d.copy), 0, d.getInterval());
        }

      } else {
        System.out.println("did not find object");
      }
      obj_in.close();
    } catch (ClassNotFoundException x) {
      printer.printError(x.getLocalizedMessage());
      System.err.format("Unable to read");
    } catch (IOException y) {
      printer.printError(y.getLocalizedMessage());
    }

    // Layout the text fields in a panel.

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

    buttonPane.add(fireButton);
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.add(new JSeparator(SwingConstants.VERTICAL));
    buttonPane.add(Box.createHorizontalStrut(5));
    buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    add(buttonPanel, BorderLayout.PAGE_START);
    add(listPane, BorderLayout.LINE_START);
    // add(destListScrollPane, BorderLayout.CENTER);

    add(fieldPane, BorderLayout.LINE_END);
    add(labelPane, BorderLayout.CENTER);
    add(buttonPane, BorderLayout.PAGE_END);
  }
Ejemplo n.º 19
0
  public BreakoutServer() {
    super();

    addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent evt) {
            dispose();
            System.exit(0);
          }
        });

    // prevents version info from printing
    // comment these out when debugging
    PipedOutputStream pipeOut = new PipedOutputStream();
    System.setOut(new PrintStream(pipeOut));

    fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    // get a references to the user preferences
    prefs = Preferences.userRoot().node(this.getClass().getName());
    netPort = prefs.getInt(PORT_KEY, DEFAULT_PORT);
    webRoot = prefs.get(ROOT_KEY, DEFAULT_ROOT);

    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    JTabbedPane tabbedPane = new JTabbedPane();

    JPanel settingsPane = new JPanel();
    JPanel statusPane = new JPanel(new BorderLayout());
    JPanel portSelectionPane = new JPanel(new FlowLayout(FlowLayout.LEFT));

    setTitle("Breakout Server");
    setSize(WIDTH, HEIGHT);
    setResizable(false);

    loggingArea = new JTextArea(16, 40);
    loggingArea.setEditable(false);
    loggingArea.setFont(new Font("Monospaced", Font.PLAIN, 12));
    loggingArea.setMargin(new Insets(5, 5, 5, 5));
    loggingArea.append(buildName + "\n\n");

    JScrollPane listScroller =
        new JScrollPane(
            loggingArea,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    listScroller.setPreferredSize(new Dimension(WIDTH, LOGGING_AREA_HEIGHT));
    statusPane.add(listScroller, BorderLayout.CENTER);

    webRootField = new JTextField(webRoot);
    webRootField.setEditable(false);
    // webRootField.setColumns(5);
    webRootField.setHorizontalAlignment(JTextField.LEADING);
    webRootLabel = new JLabel("Webserver Root Directory:");
    webRootField.addActionListener(this);

    rootBtn = new JButton("Choose New Webserver Root");
    rootBtn.addActionListener(this);

    serialLabel = new JLabel("Serial");
    serialPorts = new JComboBox();
    createPortList();

    serialPorts.addActionListener(this);

    portField = new JTextField(Integer.toString(netPort));
    portField.setColumns(5);
    portField.addActionListener(this);

    portLabel = new JLabel("Port");

    multiClientCB = new JCheckBox("Enable Multi-Client Connections");
    multiClientCB.addActionListener(this);

    connectBtn = new JButton("Connect");
    connectBtn.addActionListener(this);
    connectBtn.setActionCommand("connect");
    connectBtn.setMaximumSize(new Dimension(350, 25));

    portSelectionPane.add(serialLabel);
    portSelectionPane.add(serialPorts);
    portSelectionPane.add(portLabel);
    portSelectionPane.add(portField);

    webRootField.setAlignmentX(Component.LEFT_ALIGNMENT);
    webRootField.setMaximumSize(new Dimension(450, 20));
    portField.setAlignmentX(Component.LEFT_ALIGNMENT);
    portField.setMaximumSize(new Dimension(100, 20));

    settingsPane.setLayout(new BoxLayout(settingsPane, BoxLayout.PAGE_AXIS));
    settingsPane.setBorder(BorderFactory.createEmptyBorder(15, 10, 10, 10));
    settingsPane.add(webRootLabel);
    settingsPane.add(webRootField);
    settingsPane.add(Box.createRigidArea(new Dimension(0, 5)));
    settingsPane.add(rootBtn);
    settingsPane.add(Box.createRigidArea(new Dimension(0, 30)));
    settingsPane.add(multiClientCB);

    statusPane.add(portSelectionPane, BorderLayout.NORTH);

    tabbedPane.addTab("status", statusPane);
    tabbedPane.addTab("settings", settingsPane);

    contentPane.add(tabbedPane, BorderLayout.NORTH);
    contentPane.add(connectBtn, BorderLayout.AFTER_LAST_LINE);

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setVisible(true);

    startPortListTimer();
  }
Ejemplo n.º 20
0
  public Scripter() {
    setTitle("Runedev Script Editor");
    setVisible(true);
    setBackground(new Color(245, 245, 245));
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    addWindowListener(
        new WindowAdapter() {

          @Override
          public void windowClosing(final WindowEvent e) {
            // BotGUI.scripter = null;
          }
        });
    setResizable(false);
    final File icon = new File(GlobalConfiguration.Paths.getIconDirectory() + "/edit.png");
    setIconImage(GlobalConfiguration.getImageFile(icon));

    document = new HighLightedDocument();
    jSeparator1 = new JPopupMenu.Separator();

    textPane = new JTextPane(document);
    textPane.setCaretPosition(0);
    textPane.setMargin(new Insets(5, 5, 5, 5));
    textPane.setPreferredSize(new Dimension(minSize));
    final JScrollPane scrollPane = new JScrollPane(textPane);
    scrollPane.setPreferredSize(new Dimension(minSize));

    final JPanel contentPane = new JPanel(new BorderLayout());
    contentPane.add(scrollPane, BorderLayout.CENTER);
    setContentPane(contentPane);

    final JMenuBar menuBar = new JMenuBar();

    final JMenu fileMenu = new JMenu("File");
    final JMenuItem newScript = new JMenuItem("New");
    newScript.setAccelerator(
        KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
    newScript.setIcon(new ImageIcon(GlobalConfiguration.Paths.getIconDirectory() + "/pencil.png"));
    fileMenu.add(newScript);

    final JMenuItem openScript = new JMenuItem("Open");
    openScript.setAccelerator(
        KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
    final Image Open =
        (Toolkit.getDefaultToolkit().getImage(GlobalConfiguration.Paths.Resources.PLAY));
    openScript.setIcon(new ImageIcon(Open));
    fileMenu.add(openScript);

    final JMenuItem saveScript = new JMenuItem("Save");
    saveScript.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
    final Image Save =
        (Toolkit.getDefaultToolkit().getImage(GlobalConfiguration.Paths.Resources.SAVE));
    saveScript.setIcon(new ImageIcon(Save));
    fileMenu.add(saveScript);
    menuBar.add(fileMenu);

    final JMenu editMenu = new JMenu("Edit");
    final JMenuItem cut = new JMenuItem("Cut");
    cut.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
    final Image Cut =
        (Toolkit.getDefaultToolkit().getImage(GlobalConfiguration.Paths.Resources.CUT));
    cut.setIcon(new javax.swing.ImageIcon(Cut));
    editMenu.add(cut);

    final JMenuItem copy = new JMenuItem("Copy");
    copy.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
    final Image Copy =
        (Toolkit.getDefaultToolkit().getImage(GlobalConfiguration.Paths.Resources.COPY));
    copy.setIcon(new javax.swing.ImageIcon(Copy));
    editMenu.add(copy);

    final JMenuItem paste = new JMenuItem("Paste");
    paste.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
    final Image Paste =
        (Toolkit.getDefaultToolkit().getImage(GlobalConfiguration.Paths.Resources.PASTE));
    paste.setIcon(new javax.swing.ImageIcon(Paste));
    editMenu.add(paste);
    editMenu.add(jSeparator1);

    final JMenuItem selectAll = new JMenuItem("Select All");
    selectAll.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
    editMenu.add(selectAll);
    menuBar.add(editMenu);

    final JMenu infoMenu = new JMenu("Info");
    final JMenuItem troubleshooting = new JMenuItem("Troubleshooting");
    troubleshooting.setIcon(
        new ImageIcon(GlobalConfiguration.Paths.getIconDirectory() + "/web.png"));
    infoMenu.add(troubleshooting);

    final JMenuItem about = new JMenuItem("about");
    about.setAccelerator(
        javax.swing.KeyStroke.getKeyStroke(
            java.awt.event.KeyEvent.VK_F1, java.awt.event.InputEvent.CTRL_MASK));
    about.setIcon(new ImageIcon(GlobalConfiguration.Paths.getIconDirectory() + "/gui.png"));
    infoMenu.add(about);
    menuBar.add(infoMenu);

    class newClick implements ActionListener {

      public void actionPerformed(final ActionEvent e) {
        if (JOptionPane.showConfirmDialog(
                contentPane,
                "You really want to start a new script? \n"
                    + "All un-saved work on this script will be lost.")
            == 0) {
          try {
            document.remove(0, document.getLength());
            document.insertString(document.getLength(), defaultLayout, getStyle("text"));
          } catch (final BadLocationException e1) {
          }
        }
      }
    }

    class openClick implements ActionListener {

      public void actionPerformed(final ActionEvent e) {
        final JFileChooser fc = new JFileChooser(file);
        fc.setCurrentDirectory(new File("./scripts/"));
        fc.addChoosableFileFilter(new JavaFilter());
        if (fc.showOpenDialog(contentPane) == JFileChooser.APPROVE_OPTION) {
          file = fc.getSelectedFile();
          try {
            document.remove(0, document.getLength());
            final BufferedReader in = new BufferedReader(new FileReader(file));
            String line = null;
            while ((line = in.readLine()) != null) {
              if (document.getLength() != 0) {
                document.insertString(document.getLength(), "\n", getStyle("text"));
              }
              document.insertString(document.getLength(), line, getStyle("text"));
            }
          } catch (final Exception ee) {
          }
        }
      }
    }

    class saveClick implements ActionListener {

      public void actionPerformed(final ActionEvent e) {
        final JFileChooser fc = new JFileChooser(file);
        fc.setCurrentDirectory(new File("./scripts/"));
        fc.addChoosableFileFilter(new JavaFilter());
        if (fc.showSaveDialog(contentPane) == JFileChooser.APPROVE_OPTION) {
          try {
            file = fc.getSelectedFile();
            final BufferedWriter out = new BufferedWriter(new FileWriter(file));
            out.write(document.getText(0, document.getLength()));

            out.close();
          } catch (final Exception ee) {
          }
        }
      }
    }

    class Cut implements ActionListener {

      public void actionPerformed(final ActionEvent e) {
        textPane.cut();
      }
    }

    class Copy implements ActionListener {

      public void actionPerformed(final ActionEvent e) {
        textPane.copy();
      }
    }

    class Paste implements ActionListener {

      public void actionPerformed(final ActionEvent e) {
        textPane.paste();
      }
    }

    class SelectAll implements ActionListener {

      public void actionPerformed(final ActionEvent e) {
        textPane.selectAll();
      }
    }

    class tsClick implements ActionListener {

      public void actionPerformed(final ActionEvent e) {
        openURL("http://forum.runedev.info/viewtopic.php?f=40&t=2629");
      }

      public void openURL(final String url) {
        final OperatingSystem os = GlobalConfiguration.getCurrentOperatingSystem();
        try {
          if (os == OperatingSystem.MAC) {
            final Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
            final Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class});
            openURL.invoke(null, url);
          } else if (os == OperatingSystem.WINDOWS) {
            Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
          } else {
              /* assume Unix or Linux */
            final String[] browsers = {
              "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape"
            };
            String browser = null;
            for (int count = 0; (count < browsers.length) && (browser == null); count++) {
              if (Runtime.getRuntime().exec(new String[] {"which", browsers[count]}).waitFor()
                  == 0) {
                browser = browsers[count];
              }
            }
            if (browser == null) {
              throw new Exception("Could not find web browser");
            } else {
              Runtime.getRuntime().exec(new String[] {browser, url});
            }
          }
        } catch (final Exception e) {
        }
      }
    }

    class aboutClick implements ActionListener {

      public void actionPerformed(final ActionEvent e) {
        JOptionPane.showMessageDialog(
            contentPane,
            new String[] {
              "A Script Editor Made for RuneDev.",
              "\nThis Editor was designed by Sorcermus\n"
                  + "for the RuneDev gaming client\n"
                  + "For more information, \nvisit; "
                  + GlobalConfiguration.Paths.URLs.SITE
            },
            "\n" + "About this editor, and the game client",
            JOptionPane.INFORMATION_MESSAGE);
      }
    }

    newScript.addActionListener(new newClick());
    openScript.addActionListener(new openClick());
    saveScript.addActionListener(new saveClick());
    cut.addActionListener(new Cut());
    copy.addActionListener(new Copy());
    paste.addActionListener(new Paste());
    selectAll.addActionListener(new SelectAll());
    troubleshooting.addActionListener(new tsClick());
    about.addActionListener(new aboutClick());

    setJMenuBar(menuBar);

    final JTextArea lines = new JTextArea("");
    lines.setSelectionEnd(document.getLength());
    lines.setFont(new Font("Monospaced", Font.PLAIN, 12));
    lines.setBackground(new Color(210, 210, 210));
    lines.setEditable(false);
    lines.setMargin(new Insets(5, 2, 5, 2));

    document.addDocumentListener(
        new DocumentListener() {

          public void changedUpdate(final DocumentEvent de) {
            lines.setText(getText());
          }

          public String getText() {
            final int caretPosition = document.getEndPosition().getOffset();
            final Element root = document.getDefaultRootElement();
            String text = "1" + System.getProperty("line.separator");
            for (int i = 2; i < root.getElementIndex(caretPosition) + 2; i++) {
              text += i + System.getProperty("line.separator");
            }
            return text;
          }

          public void insertUpdate(final DocumentEvent de) {
            lines.setText(getText());
          }

          public void removeUpdate(final DocumentEvent de) {
            lines.setText(getText());
          }
        });

    scrollPane.setRowHeaderView(lines);

    colorer = new Colorer();
    colorer.start();

    initStyles(12);

    documentReader = new DocumentReader(document);

    initDocument();

    pack();
    setVisible(true);
  }
  /** The constructor. */
  ProjectSettingsTabProperties() {
    setLayout(new BorderLayout());
    JPanel top = new JPanel();
    top.setLayout(new GridBagLayout());

    GridBagConstraints labelConstraints = new GridBagConstraints();
    /* Labels at the left ... */
    labelConstraints.anchor = GridBagConstraints.LINE_START;
    labelConstraints.gridy = 0;
    labelConstraints.gridx = 0;
    labelConstraints.gridwidth = 1;
    labelConstraints.gridheight = 1;
    labelConstraints.insets = new Insets(2, 20, 2, 4);
    labelConstraints.anchor = GridBagConstraints.FIRST_LINE_START;

    GridBagConstraints fieldConstraints = new GridBagConstraints();
    /* ... and fields at the right. */
    fieldConstraints.anchor = GridBagConstraints.LINE_END;
    fieldConstraints.fill = GridBagConstraints.BOTH;
    fieldConstraints.gridy = 0;
    fieldConstraints.gridx = 1;
    fieldConstraints.gridwidth = 3;
    fieldConstraints.gridheight = 1;
    fieldConstraints.weightx = 1.0;
    fieldConstraints.insets = new Insets(2, 4, 2, 20);

    /* The user's full name: */
    labelConstraints.gridy = 0;
    fieldConstraints.gridy = 0;
    top.add(new JLabel(Translator.localize("label.user")), labelConstraints);
    userFullname = new JTextField();
    top.add(userFullname, fieldConstraints);

    /* The user's email: */
    labelConstraints.gridy = 1;
    fieldConstraints.gridy = 1;
    top.add(new JLabel(Translator.localize("label.email")), labelConstraints);
    userEmail = new JTextField();
    top.add(userEmail, fieldConstraints);

    /* The project description: */
    labelConstraints.gridy = 2;
    fieldConstraints.gridy = 2;
    fieldConstraints.weighty = 1.0;
    labelConstraints.weighty = 1.0;
    JLabel lblDescription = new JLabel(Translator.localize("label.project.description"));
    lblDescription.setVerticalAlignment(SwingConstants.TOP);
    top.add(lblDescription, labelConstraints);
    description = new JTextArea();
    JScrollPane area = new JScrollPane(description);
    area.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    description.setMargin(new Insets(3, 3, 3, 3));
    description.setLineWrap(true);
    description.setWrapStyleWord(true);
    top.add(area, fieldConstraints);

    /* This non-editable field shows
     * the version of the ArgoUML
     * that last saved this project: */
    labelConstraints.gridy = 3;
    fieldConstraints.gridy = 3;
    fieldConstraints.weighty = 0.0;
    labelConstraints.weighty = 0.0;
    top.add(new JLabel(Translator.localize("label.argouml.version")), labelConstraints);
    version = new JTextField();
    version.setEditable(false);
    top.add(version, fieldConstraints);

    /* We need to fill the whole pane,
     * so that the description field can
     * take all available space: */
    add(top, BorderLayout.CENTER);
  }
Ejemplo n.º 22
0
  public void setInputPanel() throws IOException {
    final String newline = "\n";
    final JTextArea log = new JTextArea(2, 28);

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    input.setLayout(gridbag);

    // Create the log first, because the action listeners
    // need to refer to it.

    log.setMargin(new Insets(1, 1, 1, 1));
    log.setEditable(false);
    JScrollPane logScrollPane = new JScrollPane(log);

    // Create a file chooser
    final JFileChooser fc = new JFileChooser();

    // Create the open button
    ImageIcon openIcon = new ImageIcon("Images/open.gif");
    JButton openButton = new JButton("Open a File...", openIcon);
    openButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            int returnVal = fc.showOpenDialog(prologApplet.this);

            if (returnVal == JFileChooser.APPROVE_OPTION) {
              File file = fc.getSelectedFile();
              String name = file.getName();
              String path = file.getAbsolutePath();
              try {
                FileInputStream inps = new FileInputStream(path);
                ch = 0;
                ss = "";
                while (ch != -1) {
                  ch = inps.read();
                  ss = ss + (char) ch;
                }
                inps.close();
              } catch (Exception exc) {
                System.out.println("" + e);
              }
              code.selectAll();
              code.cut();
              code.append(ss);

              log.append("Opening: " + name + "." + newline);
            } else {
              log.append("Open command cancelled by user." + newline);
            }
          }
        });

    // Create the save button
    ImageIcon saveIcon = new ImageIcon("Images/save.gif");
    JButton saveButton = new JButton("Save a File...", saveIcon);
    saveButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            int returnVal = fc.showSaveDialog(prologApplet.this);

            if (returnVal == JFileChooser.APPROVE_OPTION) {
              File file = fc.getSelectedFile();
              // this is where a real application would save the file.
              log.append("Saving: " + file.getName() + "." + newline);
            } else {
              log.append("Save command cancelled by user." + newline);
            }
          }
        });

    // For layout purposes, put the buttons in a separate panel
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(openButton);
    buttonPanel.add(saveButton);

    // Explicitly set the focus sequence.
    // rimossi poichè deprecati
    // openButton.setNextFocusableComponent(saveButton);
    // saveButton.setNextFocusableComponent(openButton);

    // Add the buttons and the log to the frame
    // Container contentPane = getContentPane();
    // contentPane.add(buttonPanel, BorderLayout.NORTH);
    // contentPane.add(logScrollPane, BorderLayout.CENTER);

    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.NONE;
    gridbag.setConstraints(buttonPanel, c);
    input.add(buttonPanel);

    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.NONE;
    gridbag.setConstraints(logScrollPane, c);
    input.add(logScrollPane);

    JLabel label1 = new JLabel("Codice:");
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.NONE;
    gridbag.setConstraints(label1, c);
    input.add(label1);

    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.HORIZONTAL;
    gridbag.setConstraints(scrollPaneC, c);
    input.add(scrollPaneC);

    JLabel label2 = new JLabel("GOAL clause:");
    c.gridx = 0;
    c.gridy = 4;
    // c.weightx=1;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.NONE;
    gridbag.setConstraints(label2, c);
    input.add(label2);

    c.gridx = 0;
    c.gridy = 5;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.HORIZONTAL;
    gridbag.setConstraints(gl, c);
    input.add(gl);

    c.gridx = 0;
    c.gridy = 6;
    c.weightx = 0.3;
    c.gridwidth = 1;
    gridbag.setConstraints(compile, c);
    input.add(compile);
    compile.addActionListener(this);

    c.gridx = 1;
    c.gridy = 6;
    c.weightx = 0.3;
    c.gridwidth = 1;
    gridbag.setConstraints(compileG, c);
    input.add(compileG);
    compileG.addActionListener(this);

    c.gridx = 2;
    c.gridy = 6;
    c.weightx = 0.3;
    c.gridwidth = 1;
    gridbag.setConstraints(run, c);
    input.add(run);
    run.addActionListener(this);

    Color c1 = new Color(166, 209, 241);
    code.setBackground(c1);
    code.setAutoscrolls(true);
    code.setEditable(true);

    /* mb1
     input.add(load);
     input.add(scrollPaneC); input.add(gl);
    */

    input.setBorder(BorderFactory.createEtchedBorder());
  }
Ejemplo n.º 23
0
  private void initializeComponents() {
    this.setTitle("Synchro - Kopierassistent");
    this.setBounds(0, 0, 550, 600);

    this.setResizable(true);
    this.setLayout(null);
    this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    this.addWindowListener(this);

    mainPanel = new JPanel();
    mainPanel.setBounds(0, 0, this.getWidth() - 20, 25);
    // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    mainPanel.setLayout(null);

    btnBackup = new JButton("Backup");
    btnBackup.setBounds(this.getWidth() / 2, 0, this.getWidth() / 2 - 20, mainPanel.getHeight());
    btnBackup.addActionListener(this);
    mainPanel.add(btnBackup);

    this.add(mainPanel);

    fcPanel = new JPanel();
    fcPanel.setBounds(10, 40, this.getWidth(), 260);
    // fcPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    fcPanel.setLayout(null);

    quellLabel = new JLabel("Bitte Quellverzeichnis auswählen");
    quellLabel.setBounds(10, 5, 320, 20);
    fcPanel.add(quellLabel);

    quellListModel = new DefaultListModel<>();
    quellJList = new JList<ListItem>(quellListModel);
    quellJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    quellJList.setLayoutOrientation(JList.VERTICAL);
    quellJList.addListSelectionListener(this);

    listBoxScroller = new JScrollPane(quellJList);
    listBoxScroller.setBounds(0, 30, 315, 100);
    fcPanel.add(listBoxScroller);

    btnQAuswahl = new JButton("Quellverz. hinzufügen");
    btnQAuswahl.setBounds(320, 30, 200, 25);
    btnQAuswahl.addActionListener(this);
    fcPanel.add(btnQAuswahl);
    btnQEntfernen = new JButton("Quellverz. entfernen");
    btnQEntfernen.setBounds(320, 60, 200, 25);
    btnQEntfernen.addActionListener(this);
    fcPanel.add(btnQEntfernen);

    zielLabel = new JLabel("Bitte Zielverzeichnis auswählen");
    zielLabel.setBounds(10, 135, 320, 20);
    fcPanel.add(zielLabel);

    zielListModel = new DefaultListModel<>();
    zielJList = new JList<ListItem>(zielListModel);
    zielJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    zielJList.setLayoutOrientation(JList.VERTICAL);
    zielJList.addListSelectionListener(this);

    listBoxScroller2 = new JScrollPane(zielJList);
    listBoxScroller2.setBounds(0, 160, 315, 100);
    fcPanel.add(listBoxScroller2);

    btnZAuswahl = new JButton("Zielverz. hinzufügen");
    btnZAuswahl.setBounds(320, 160, 200, 25);
    btnZAuswahl.addActionListener(this);
    fcPanel.add(btnZAuswahl);
    btnZEntfernen = new JButton("Zielverz. entfernen");
    btnZEntfernen.setBounds(320, 190, 200, 25);
    btnZEntfernen.addActionListener(this);
    fcPanel.add(btnZEntfernen);
    this.add(fcPanel);

    ButtonGroup bGrp = new ButtonGroup();

    optionPanel = new JPanel();
    optionPanel.setBounds(10, 300 + 10, this.getWidth() - 40, 90);
    optionPanel.setPreferredSize(new Dimension(this.getWidth() - 40, 90));
    // optionPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    optionPanel.setLayout(new GridLayout(3, 1));

    nUebSchr = new JRadioButton("Keine Dateien überschreiben");
    nUebSchr.addItemListener(this);
    bGrp.add(nUebSchr);
    optionPanel.add(nUebSchr);

    ueSchr = new JRadioButton("Neuere Dateien überschreiben");
    ueSchr.addItemListener(this);
    bGrp.add(ueSchr);
    optionPanel.add(ueSchr);

    aUeSchr = new JRadioButton("Alle Dateien überschreiben");
    aUeSchr.addItemListener(this);
    bGrp.add(aUeSchr);
    optionPanel.add(aUeSchr);

    this.add(optionPanel);

    syncPanel = new JPanel();
    syncPanel.setBounds(
        10, optionPanel.getY() + optionPanel.getHeight() + 10, this.getWidth() - 30, 25);
    // syncPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    syncPanel.setLayout(new BorderLayout());

    btnSync = new JButton("Sync it!");
    btnSync.setBounds(0, 0, 150, (syncPanel.getHeight() / 3));
    btnSync.addActionListener(this);
    btnSync.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3)));
    btnSync.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3)));
    syncPanel.add(btnSync, BorderLayout.LINE_START);

    btnAbbruch = new JButton("Abbrechen");
    btnAbbruch.setBounds(0, 0, 150, (syncPanel.getHeight() / 3));
    btnAbbruch.addActionListener(this);
    btnAbbruch.setPreferredSize(new Dimension(150, (syncPanel.getHeight() / 3)));
    btnAbbruch.setMaximumSize(new Dimension(150, (syncPanel.getHeight() / 3)));
    btnAbbruch.setVisible(false);
    syncPanel.add(btnAbbruch, BorderLayout.LINE_END);

    progressBar = new JProgressBar(JProgressBar.HORIZONTAL);
    progressBar.setBorderPainted(true);
    progressBar.setPreferredSize(new Dimension(300, (syncPanel.getHeight() / 3)));
    progressBar.setForeground(Color.RED);
    progressBar.setStringPainted(true);
    progressBar.setVisible(true);
    syncPanel.add(progressBar, BorderLayout.CENTER);
    this.add(syncPanel);

    logPanel = new JPanel();
    logPanel.setBounds(
        10, syncPanel.getY() + syncPanel.getHeight() + 10, this.getWidth() - 30, 105);
    logPanel.setLayout(new BorderLayout());

    textArea = new JTextArea();
    textArea.setMargin(new Insets(3, 3, 3, 3));
    textArea.setBackground(Color.black);
    textArea.setForeground(Color.LIGHT_GRAY);
    textArea.setAutoscrolls(true);
    textArea.setFocusable(false);
    textAreaScroller = new JScrollPane(textArea);
    DefaultCaret caret = (DefaultCaret) textArea.getCaret();
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    textAreaScroller.setBounds(0, 0, syncPanel.getWidth(), 50);

    logPanel.add(textAreaScroller, BorderLayout.CENTER);
    this.add(logPanel, BorderLayout.SOUTH);
  }
  public ProgressBarGeneticDialog(
      MainWindowInnerInterface mainWindow, DataLayerFacade dataLayer, Graph graph) {
    super(
        (JFrame) mainWindow,
        dataLayer.getString("GENETIC_ALGORITHM_RUNNING"),
        ModalityType.APPLICATION_MODAL);

    // create genetic graph from graph
    this.geneticGraph =
        new GeneticGraph(
            graph,
            graph.getAbstractHwComponentsCount()); // graph.getAbstractHwComponentsCount() * 2

    this.dataLayer = dataLayer;

    this.setLocationRelativeTo((JFrame) mainWindow);

    mainPanel = new JPanel(new BorderLayout());

    controlPanel = new JPanel();

    cancelButton = new JButton(dataLayer.getString("CANCEL"));
    cancelButton.addActionListener((ActionListener) this);
    cancelButton.setActionCommand(CANCEL_COMMAND);
    cancelButton.setEnabled(true);

    enoughQuality = new JButton(dataLayer.getString("ENOUGH_QUALITY"));
    enoughQuality.addActionListener((ActionListener) this);
    enoughQuality.setActionCommand(ENOUGH_QUALITY_COMMAND);
    enoughQuality.setEnabled(false);

    progressBar = new JProgressBar();
    progressBar.setIndeterminate(true);

    controlPanel.add(cancelButton);
    // controlPanel.add(enoughQuality);
    controlPanel.add(progressBar);

    taskOutput = new JTextArea(10, 35);
    taskOutput.setMargin(new Insets(5, 5, 5, 5));
    taskOutput.setEditable(false);
    DefaultCaret caret = (DefaultCaret) taskOutput.getCaret();
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    taskOutput.setFont(cancelButton.getFont());

    mainPanel.add(controlPanel, BorderLayout.PAGE_START);
    mainPanel.add(new JScrollPane(taskOutput), BorderLayout.CENTER);

    mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 20, 20, 20));

    this.add(mainPanel);

    this.setSize(new Dimension(400, 300));
    this.setResizable(false);

    this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            doCancelAction();
          }
        });
  }
Ejemplo n.º 25
0
  Console() throws IllegalAccessException, InvocationTargetException, IOException {
    super(new BorderLayout());

    history = new History();

    console = new JTextArea();
    console.setMargin(new Insets(5, 5, 5, 5));
    console.setFont(new Font("Monospaced", Font.PLAIN, SMALL_FONT));
    console.setForeground(Color.green);
    console.setBackground(Color.black);

    console.setDoubleBuffered(true);
    console.setEditable(false);
    console.setFocusable(false);
    console.setLineWrap(true);

    prompt = new JTextField();
    prompt.setMargin(new Insets(5, 5, 5, 5));
    prompt.setFont(new Font("Monospaced", Font.PLAIN, BIG_FONT));
    prompt.setForeground(Color.green);
    prompt.setCaretColor(Color.green);

    setPrompt(false);
    setEmacsKeyMap(prompt, history);

    add(new JScrollPane(console), BorderLayout.CENTER);
    add(prompt, BorderLayout.SOUTH);

    final Environment env = new Environment();
    final PrintWriter out = new PrintWriter(new TextAreaStream(console, true), true);
    final Log log = new StandardLog(out, out);
    final View view = new PrintView(out, log);
    final Controller controller =
        new Controller() {
          public final void exit(boolean interact) {
            if (!interact) throw new ExitException();
            EventQueue.invokeLater(
                new Runnable() {
                  public final void run() {
                    log.info("exiting...");
                    postWindowClosingEvent(getFrame(Console.this));
                  }
                });
          }

          public final void ready() {
            EventQueue.invokeLater(
                new Runnable() {
                  public final void run() {
                    setPrompt(true);
                  }
                });
          }
        };

    final Repo repo = new Repo(env.getRepo());
    repo.init();
    doogal =
        new AsyncDoogal(
            log, new PromptDoogal(controller, new SyncDoogal(env, view, controller, repo)));

    prompt.addActionListener(
        new ActionListener() {
          public final void actionPerformed(ActionEvent ev) {
            final String s = prompt.getText();
            history.add(s);
            final Reader reader = new StringReader(s);
            prompt.setText("");
            setPrompt(false);
            try {
              Shellwords.parse(reader, doogal);
            } catch (final EvalException e) {
              log.error(e.getLocalizedMessage());
            } catch (final IOException e) {
              log.error(e.getLocalizedMessage());
            } catch (final ParseException e) {
              log.error(e.getLocalizedMessage());
            }
          }
        });

    printResource("motd.txt", out);
  }
Ejemplo n.º 26
0
  /** Create the dialog. */
  private void init() {
    setBounds(100, 100, 550, 450);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    {
      JPanel panelTop = new JPanel();
      FlowLayout flowLayout = (FlowLayout) panelTop.getLayout();
      flowLayout.setAlignment(FlowLayout.LEADING);
      contentPanel.add(panelTop, BorderLayout.NORTH);
      {
        JLabel lblIcondistributer = new JLabel(IconFactory.DISTRIBUTOR48_ICON);
        panelTop.add(lblIcondistributer);
      }
      {
        JLabel lblProductForm = new JLabel("Distributor:");
        lblProductForm.setFont(new Font("Tahoma", Font.BOLD, 14));
        panelTop.add(lblProductForm);
      }

      lblProductname = new JLabel("ProductName");
      lblProductname.setFont(new Font("Tahoma", Font.PLAIN, 14));
      panelTop.add(lblProductname);
    }
    {
      {
        JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
        tabbedPane.setFont(new Font("Tahoma", Font.PLAIN, 14));
        contentPanel.add(tabbedPane, BorderLayout.CENTER);
        {
          JPanel panelMain = new JPanel();
          tabbedPane.addTab("Main", null, panelMain, null);
          panelMain.setLayout(null);

          JLabel lblName = new JLabel("Name");
          lblName.setFont(new Font("Tahoma", Font.PLAIN, 16));
          lblName.setBounds(10, 27, 46, 14);
          panelMain.add(lblName);

          txtName = new JTextField();
          txtName.setFont(new Font("Tahoma", Font.PLAIN, 14));
          txtName.setBounds(119, 22, 191, 25);
          panelMain.add(txtName);
          txtName.setColumns(10);
        }
        {
          JPanel panelAlias = new JPanel();
          tabbedPane.addTab("Alias", null, panelAlias, null);
          panelAlias.setLayout(new BorderLayout(0, 0));

          JToolBar toolBar = new JToolBar();
          panelAlias.add(toolBar, BorderLayout.NORTH);

          JButton btnAdd = new JButton(IconFactory.ADD24_ICON);
          btnAdd.addActionListener(
              new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent arg0) {
                  DistributorAliasForm dialog =
                      new DistributorAliasForm(
                          DistributorForm.this.getOwner(),
                          "",
                          new DistributorAlias(),
                          DistributorForm.this);
                  dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
                  dialog.setVisible(true);
                }
              });

          toolBar.add(btnAdd);

          JButton btnEdit = new JButton(IconFactory.EDIT24_ICON);
          btnEdit.addActionListener(
              new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent arg0) {

                  DistributorAlias alias = aliasList.getSelectedValue();
                  if (alias != null) {
                    DistributorAliasForm dialog =
                        new DistributorAliasForm(
                            DistributorForm.this.getOwner(), "", alias, DistributorForm.this);
                    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
                    dialog.setVisible(true);
                  }
                }
              });

          toolBar.add(btnEdit);

          JButton btnRemove = new JButton(IconFactory.DELETE24_ICON);
          toolBar.add(btnRemove);

          aliasList = new JList<DistributorAlias>();
          aliasList.setBorder(new MatteBorder(1, 0, 0, 0, (Color) Color.LIGHT_GRAY));
          panelAlias.add(aliasList);
        }
        {
          JPanel panelCharacteristic = new JPanel();
          tabbedPane.addTab("Characteristic", null, panelCharacteristic, null);
          panelCharacteristic.setLayout(null);

          JLabel lblColumnCount = new JLabel("Column count");
          lblColumnCount.setFont(new Font("Tahoma", Font.PLAIN, 14));
          lblColumnCount.setBounds(10, 11, 120, 20);
          panelCharacteristic.add(lblColumnCount);

          JLabel lblIdColumn = new JLabel("ID Column");
          lblIdColumn.setFont(new Font("Tahoma", Font.PLAIN, 14));
          lblIdColumn.setBounds(10, 42, 120, 20);
          panelCharacteristic.add(lblIdColumn);

          JLabel lblPriceColumn = new JLabel("Price Column");
          lblPriceColumn.setFont(new Font("Tahoma", Font.PLAIN, 14));
          lblPriceColumn.setBounds(10, 73, 120, 20);
          panelCharacteristic.add(lblPriceColumn);

          txtColumnCount = new JTextField();
          txtColumnCount.setBounds(140, 13, 86, 20);
          panelCharacteristic.add(txtColumnCount);
          txtColumnCount.setColumns(10);

          txtColumnId = new JTextField();
          txtColumnId.setColumns(10);
          txtColumnId.setBounds(140, 44, 86, 20);
          panelCharacteristic.add(txtColumnId);

          txtColumnPrice = new JTextField();
          txtColumnPrice.setColumns(10);
          txtColumnPrice.setBounds(140, 75, 86, 20);
          panelCharacteristic.add(txtColumnPrice);

          JLabel lblArtistColumn = new JLabel("Artist Column");
          lblArtistColumn.setFont(new Font("Tahoma", Font.PLAIN, 14));
          lblArtistColumn.setBounds(10, 104, 120, 20);
          panelCharacteristic.add(lblArtistColumn);

          txtArtist = new JTextField();
          txtArtist.setColumns(10);
          txtArtist.setBounds(140, 106, 86, 20);
          panelCharacteristic.add(txtArtist);

          JLabel lblTrackColumn = new JLabel("Track Column");
          lblTrackColumn.setFont(new Font("Tahoma", Font.PLAIN, 14));
          lblTrackColumn.setBounds(10, 137, 120, 20);
          panelCharacteristic.add(lblTrackColumn);

          txtTrack = new JTextField();
          txtTrack.setColumns(10);
          txtTrack.setBounds(140, 139, 86, 20);
          panelCharacteristic.add(txtTrack);

          JLabel lblTrackType = new JLabel("Track type");
          lblTrackType.setFont(new Font("Tahoma", Font.PLAIN, 14));
          lblTrackType.setBounds(10, 168, 120, 20);
          panelCharacteristic.add(lblTrackType);

          txtType = new JTextField();
          txtType.setColumns(10);
          txtType.setBounds(140, 170, 86, 20);
          panelCharacteristic.add(txtType);

          txtColumnquantity = new JTextField();
          txtColumnquantity.setColumns(10);
          txtColumnquantity.setBounds(396, 13, 86, 20);
          panelCharacteristic.add(txtColumnquantity);

          JLabel lblColumnQuantity = new JLabel("Column quantity");
          lblColumnQuantity.setFont(new Font("Tahoma", Font.PLAIN, 14));
          lblColumnQuantity.setBounds(266, 11, 120, 20);
          panelCharacteristic.add(lblColumnQuantity);
        }
      }
    }
    {
      JTextArea txtrComment = new JTextArea();
      txtrComment.setFont(new Font("Monospaced", Font.PLAIN, 14));
      txtrComment.setMaximumSize(new Dimension(4, 16));
      // contentPanel.add(txtrComment, BorderLayout.SOUTH);
      txtrComment.setMargin(new Insets(10, 10, 2, 2));
      txtrComment.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
      txtrComment.setRows(3);

      JScrollPane scrollPaneComment = new JScrollPane();
      scrollPaneComment.setBorder(new EmptyBorder(5, 0, 0, 0));
      scrollPaneComment.setViewportView(txtrComment);

      contentPanel.add(scrollPaneComment, BorderLayout.SOUTH);
    }
    {
      JPanel buttonPane = new JPanel();
      buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
      getContentPane().add(buttonPane, BorderLayout.SOUTH);
      {
        JButton okButton = new JButton("OK", IconFactory.OK_ICON);
        okButton.setActionCommand("OK");
        okButton.addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent arg0) {
                if (txtName.getText() == "") {
                  JOptionPane.showMessageDialog(null, "You can't save empty name");
                } else {
                  pushDataToProduct();
                  listener.saveDistributor(distributor);
                  dispose();
                }
              }
            });
        buttonPane.add(okButton);
        getRootPane().setDefaultButton(okButton);
      }
      {
        JButton cancelButton = new JButton("Cancel", IconFactory.CANCEL_ICON);
        cancelButton.setActionCommand("Cancel");
        cancelButton.addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent arg0) {
                dispose();
              }
            });
        buttonPane.add(cancelButton);
      }
    }
  }
Ejemplo n.º 27
0
  public AboutPanel(Gui aFrame) {
    super(new BorderLayout());
    buttons = new JPanel();
    linkPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    linkPanel.setAlignmentX(Component.RIGHT_ALIGNMENT);
    linkPanel.setOpaque(false);
    top = new JPanel();
    top.setBackground(GUIConstants.BACKGROUND_COLOR);
    center =
        new JPanel() {
          @Override
          public void paintComponent(Graphics g) {

            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            GradientPaint gp =
                new GradientPaint(
                    0, 0, GUIConstants.BACKGROUND_COLOR, 0, getHeight(), getBackground());
            Paint p = g2.getPaint();
            g2.setPaint(gp);
            g2.fillRect(0, 0, getWidth(), getHeight());
            g2.setPaint(p);
          }
        };
    center.setLayout(new BoxLayout(center, BoxLayout.PAGE_AXIS));
    frame = aFrame;
    textBottom = new JTextArea();
    textBottom.setOpaque(false);
    textBottom.setWrapStyleWord(true);
    textBottom.setEditable(false);
    textBottom.setLineWrap(true);
    textBottom.setFont(new Font("Sans/Serif", Font.PLAIN, 17));
    textBottom.setMargin(new Insets(10, 10, 0, 0));
    textBottom.setBackground(new Color(255, 255, 255, 0));
    textBottom.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 50, 50, 50));

    textTop = new JTextArea();
    textTop.setOpaque(false);
    textTop.setWrapStyleWord(true);
    textTop.setEditable(false);
    textTop.setLineWrap(true);
    textTop.setFont(new Font("Sans-Serif", Font.PLAIN, 17));
    textTop.setMargin(new Insets(10, 10, 0, 0));
    textTop.setBackground(new Color(255, 255, 255, 0));
    textTop.setBorder(javax.swing.BorderFactory.createEmptyBorder(50, 50, 5, 50));

    title = new JLabel();
    title.setFont(new Font("Sans-Serif", Font.PLAIN, 25));
    back = new JButton("Back to Main");
    back.setBackground(new Color(103, 180, 181));
    back.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (e.getSource() == back) {
              frame.ToMatrixScreen();
            }
          }
        });
    link = new JButton();
    link.setText(
        "<HTML><FONT color=\"#000099\"><U>http://www.businessballs.com/timemanagement.htm</U></FONT>"
            + "</HTML>");
    // link.setHorizontalAlignment(SwingConstants.LEFT);
    link.setBorderPainted(false);
    link.setOpaque(false);
    link.setBackground(Color.WHITE);
    link.setToolTipText("http://www.businessballs.com/timemanagement.htm");
    link.addActionListener(new URLOpener());
    buttons.add(back);
    linkPanel.add(link);
    top.add(title);
    center.add(textTop);
    center.add(linkPanel);
    center.add(textBottom);

    try {
      readFile();
    } catch (FileNotFoundException ex) {
      Logger.getLogger(AboutPanel.class.getName()).log(Level.SEVERE, null, ex);
      System.out.println(ex.getMessage());
    } catch (IOException ex) {
      Logger.getLogger(HelpPanel.class.getName()).log(Level.SEVERE, null, ex);
      System.out.println(ex.getMessage());
    }

    this.add(top, BorderLayout.NORTH);
    this.add(center, BorderLayout.CENTER);
    this.add(buttons, BorderLayout.SOUTH);
  }
  private void addComponents() {
    // preprocess panel components
    pPanel = new JPanel();
    pPanel.setBounds(20, 150, 310, 180);
    pPanel.setLayout(null);
    this.add(pPanel);

    heading2 = new JLabel("Preprocessing");
    heading2.setBounds(100, 5, 100, 30);
    pPanel.add(heading2);

    selectData = new JLabel("Select Dataset:");
    selectData.setBounds(50, 30, 100, 30);
    pPanel.add(selectData);
    String[] list = {"1", "2", "3", "4", "5", "6"};
    setList = new JComboBox(list);
    setList.setBounds(150, 30, 80, 25);
    pPanel.add(setList);

    sLabel = new JLabel("Select source folder:");
    sLabel.setBounds(40, 55, 150, 25);
    pPanel.add(sLabel);

    folder1 = new JTextField(10);
    folder1.setBounds(40, 75, 120, 25);
    pPanel.add(folder1);

    selectFolder1 = new ClassyButton("Browse", "white");
    selectFolder1.setBounds(170, 75, 100, 25);
    pPanel.add(selectFolder1);

    dLabel = new JLabel("Select destination folder:");
    dLabel.setBounds(40, 95, 200, 25);
    pPanel.add(dLabel);

    destination = new JTextField(10);
    destination.setBounds(40, 115, 120, 25);
    pPanel.add(destination);

    selectDest = new ClassyButton("Browse", "white");
    selectDest.setBounds(170, 115, 100, 25);
    pPanel.add(selectDest);

    crop = new ClassyButton("Crop", "blue");
    crop.setBounds(100, 145, 95, 30);
    pPanel.add(crop);

    srcFolder = new JFileChooser();
    srcFolder.setCurrentDirectory(new java.io.File("."));
    srcFolder.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    destFolder = new JFileChooser();
    destFolder.setCurrentDirectory(new java.io.File("."));
    destFolder.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    // train and test panel components
    tPanel = new JPanel();
    tPanel.setBounds(20, 340, 310, 210);
    //		tPanel.setBackground(Color.red);
    tPanel.setLayout(null);
    this.add(tPanel);

    status = new JLabel("");
    // status.setBackground(Color.red);
    status.setBounds(30, 10, 250, 30);
    tPanel.add(status);

    train = new JRadioButton("Train");
    test = new JRadioButton("Test");
    eval = new JRadioButton("Evaluate Models");
    ButtonGroup group = new ButtonGroup();
    group.add(train);
    group.add(test);
    group.add(eval);
    GridLayout layout = new GridLayout(1, 0);
    JPanel radioPanel = new JPanel();
    //  train.setBounds(0,0 , 10, 30);
    radioPanel.add(train);
    radioPanel.add(test);
    radioPanel.add(eval);

    radioPanel.setBounds(35, 15, 250, 30);
    tPanel.add(radioPanel);

    tFolder = new JFileChooser();
    tFolder.setCurrentDirectory(new java.io.File("."));
    tFolder.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    folder2 = new JTextField(10);
    folder2.setBounds(15, 55, 120, 25);
    tPanel.add(folder2);

    selectFolder2 = new ClassyButton("Browse", "white");
    selectFolder2.setBounds(140, 55, 60, 25);
    selectFolder2.setMargin(new java.awt.Insets(0, 2, 0, 2));
    tPanel.add(selectFolder2);

    run = new ClassyButton("Run", "blue");
    run.setBounds(210, 55, 90, 25);
    tPanel.add(run);

    console = new JTextArea();
    console.setEditable(false);
    console.setMargin(new java.awt.Insets(5, 5, 5, 5));
    JScrollPane scrolltextArea = new JScrollPane(console);
    scrolltextArea.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    scrolltextArea.setBounds(10, 90, 290, 100);
    tPanel.add(scrolltextArea);

    selectFolder1.addActionListener(this);
    selectFolder2.addActionListener(this);
    selectDest.addActionListener(this);
    run.addActionListener(this);
    crop.addActionListener(this);

    resultsPanel = new JPanel();
    resultsPanel.setLayout(new CardLayout());

    predictedPanel = new JPanel();
    predictedPanel.setLayout(null);
    // initialize table
    Image image;
    try {
      image = ImageIO.read(new File("images/data2/result_0.jpg"));
      ImageIcon imageIcon = new ImageIcon(image);
      String[] columnNames = {"Image", "Acutal", "ANN", "SVM", "NB"};
      Object[] row = {imageIcon, "", "", "", ""};
      Object[][] data = {row};
      TableModel model = new DefaultTableModel(data, columnNames);
      resultsTable =
          new JTable(model) {
            //  Returning the Class of each column will allow different
            //  renderers to be used based on Class
            public Class getColumnClass(int column) {
              return getValueAt(0, column).getClass();
            }
          };
      resultsTable.setRowHeight(60);
      TableColumnModel columnModel = resultsTable.getColumnModel();
      columnModel.getColumn(0).setPreferredWidth(80);
      columnModel.getColumn(1).setPreferredWidth(25);
      columnModel.getColumn(2).setPreferredWidth(25);
      columnModel.getColumn(3).setPreferredWidth(25);
      columnModel.getColumn(4).setPreferredWidth(25);
      resultsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
      JScrollPane scroll = new JScrollPane(resultsTable);
      scroll.setBounds(5, 5, 385, 380);
      predictedPanel.add(scroll);

    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    // create panel for confusion matrix
    cPanel = new JPanel();
    cPanel.setLayout(null);

    cTable =
        new JTable(NUM_CLASSES + 1, NUM_CLASSES + 1) {
          @Override
          public Component prepareRenderer(TableCellRenderer renderer, int row, int col) {
            Component comp = super.prepareRenderer(renderer, row, col);
            Object value = getModel().getValueAt(row, col);
            // if (getSelectedRow() == row) {
            if (col == 0) {
              comp.setBackground(Color.LIGHT_GRAY);
            } else if (row + 1 == col) {
              comp.setBackground(Color.GREEN);
            } else {
              comp.setBackground(Color.white);
            }

            if (getSelectedRow() == row) {
              if (row + 1 == col) {
                comp.setBackground(Color.GREEN);
              } else {
                comp.setBackground(Color.lightGray);
              }
            }
            return comp;
          }
        };
    TableColumn column = null;
    for (int i = 0; i <= NUM_CLASSES; i++) {
      column = cTable.getColumnModel().getColumn(i);
      if (i == 0) {
        column.setPreferredWidth(50); // sport column is bigger
      } else {
        column.setPreferredWidth(30);
      }
    }

    JScrollPane scroll2 =
        new JScrollPane(
            cTable,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    cTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    // scroll2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

    scroll2.setBounds(50, 70, 1100, 550);
    cPanel.add(scroll2);

    viewANN = new ClassyButton("ANN", "blue");
    viewSVM = new ClassyButton("SVM", "orange");
    viewBN = new ClassyButton("NB", "blue");

    viewANN.setBounds(400, 20, 100, 30);
    viewSVM.setBounds(550, 20, 100, 30);
    viewBN.setBounds(700, 20, 100, 30);

    viewANN.addActionListener(this);
    viewSVM.addActionListener(this);
    viewBN.addActionListener(this);

    d = new JDialog();
    d.setLayout(null);
    d.setTitle("Confusion Matrices");
    d.setSize(new Dimension(1200, 700));
    Container c = d.getContentPane();

    c.setBackground(Color.WHITE);
    d.add(scroll2);

    d.add(viewANN);
    d.add(viewSVM);
    d.add(viewBN);

    resultsDialog = new JDialog();
    // resultsDialog.setLayout(null);
    resultsDialog.setTitle("Confusion Matrices");
    resultsDialog.setSize(new Dimension(800, 700));
    c = resultsDialog.getContentPane();

    pGraphPanel = new JFXPanel();
    Platform.runLater(
        new Runnable() {
          @Override
          public void run() {
            final CategoryAxis xAxis = new CategoryAxis();
            final NumberAxis yAxis = new NumberAxis(0, 100, 10);
            xAxis.setLabel("Word");
            yAxis.setLabel("Recognition rate (%)");
            lineChart = new LineChart<String, Number>(xAxis, yAxis);

            for (int i = 0; i < 3; i++) {
              XYChart.Series series = new XYChart.Series();
              switch (i) {
                case 0:
                  series.setName("ANN");
                  break;
                case 1:
                  series.setName("SVM");
                  break;
                case 2:
                  series.setName("NB");
                  break;
              }
              for (int j = 0; j < NUM_CLASSES; j++) {
                series.getData().add(new XYChart.Data(wordClasses[j], 0));
              }
              lineChart.getData().add(series);
            }

            lineChart.getStylesheets().add("chart.css");
            Scene scene = new Scene(lineChart, 800, 600);
            pGraphPanel.setScene(scene);
          }
        });
    // pGraphPanel.setBounds(20,20,700,400);
    c.add(pGraphPanel);

    // create panel and table for accuracy results
    aPanel = new JPanel();
    aPanel.setLayout(null);
    String[] columnNames = {
      "Word",
      "ANN Precision",
      "ANN Recall",
      "SVM Precision",
      "SVM Recall",
      "BN Precision",
      "BN Recall"
    };
    Object[] row = {"", "", "", "", "", "", ""};
    Object[][] data = {row};
    TableModel model = new DefaultTableModel(data, columnNames);
    accuracyTable = new JTable(model);
    JScrollPane scroll3 = new JScrollPane(accuracyTable);
    scroll3.setBounds(5, 240, 380, 200);
    // aPanel.add(scroll3);

    String[] columnNames2 = {" ", "ANN", "SVM", "NB"};
    Object[][] data2 = {
      {"ACCURACY", "", "", ""}, {"BUILD TIME", "", "", ""}, {"RECALL", "", "", ""}
    };
    model = new DefaultTableModel(data2, columnNames2);
    TableModel model2 = new DefaultTableModel(data2, columnNames2);
    summaryTable = new JTable(model2);
    JScrollPane scroll4 = new JScrollPane(summaryTable);
    scroll4.setBounds(10, 250, 380, 70);
    aPanel.add(scroll4);

    viewConfButton = new ClassyButton("View Confusion Matrix", "blue");
    viewConfButton.setBounds(200, 350, 180, 30);
    viewConfButton.addActionListener(this);
    aPanel.add(viewConfButton);

    viewResults = new ClassyButton("View all results", "blue");
    viewResults.setBounds(20, 350, 160, 30);
    viewResults.addActionListener(this);
    aPanel.add(viewResults);

    aGraphPanel = new JFXPanel();
    Platform.runLater(
        new Runnable() {
          @Override
          public void run() {
            xAxis = new CategoryAxis();
            yAxis = new NumberAxis(0, 100, 10);
            bc = new BarChart<String, Number>(xAxis, yAxis);
            bc.setTitle("Recognition Rate Comparison");
            xAxis.setLabel("ML");
            yAxis.setLabel("Recognition rate");
            scene = new Scene(bc, 320, 200);
            XYChart.Series series1 = new XYChart.Series();
            series1.getData().add(new XYChart.Data(ann, 2));
            series1.getData().add(new XYChart.Data(svm, 3));
            series1.getData().add(new XYChart.Data(nb, 6));
            bc.getData().add(series1);
            //  bc.setStyle("CHART_COLOR_1: #e9967a;");

            bc.getStylesheets().add("chart.css");
            aGraphPanel.setScene(scene);
          }
        });

    aGraphPanel.setBackground(Color.green);
    aGraphPanel.setBounds(20, 20, 360, 200);
    aPanel.add(aGraphPanel);

    // System.out.println(aGraphPanel.getScene().rootProperty());
    resultsPanel.add(aPanel, "Accuracy");
    // resultsPanel.add(cPanel, "Confusion");
    resultsPanel.add(predictedPanel, "Predicted");
    resultsPanel.setBounds(350, 150, 400, 400);
    this.add(resultsPanel);

    //		CardLayout cl = (CardLayout)(this.card.getLayout());
    //        cl.show(this.card, "Document");

  }