示例#1
0
  // Remove a test case from testBox and tests array.
  private void removeTest() {

    // Make sure they want to remove the checked tests.
    String message = "Are you sure you would like to remove the selected tests?";
    int decision =
        JOptionPane.showConfirmDialog(null, message, "Remove", JOptionPane.OK_CANCEL_OPTION);

    // If they definitely do want to remove.
    if (decision == JOptionPane.OK_OPTION) {

      // Make array list copy, so as to avoid index errors.
      ArrayList<JCheckBox> newTests = (ArrayList<JCheckBox>) tests.clone();
      int removed = 0;

      for (int i = 0; i < tests.size(); i++) {
        if (tests.get(i).isSelected()) {
          // Remove from the tests copy.
          newTests.remove(i - removed);
          // Remove from the GUI box.
          testBox.setEditable(true);
          testBox.remove(tests.get(i));
          testBox.repaint();
          testBox.setEditable(false);
        }
      }

      // Update the tests with the newly made list.
      tests = newTests;
    }
  }
示例#2
0
  private JPanel createCentrePanel(YDataStateException exception) {
    JPanel centrePanel = new JPanel(new GridLayout(1, 2));

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

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

    centrePanel.add(msgPanel, BorderLayout.NORTH);
    return centrePanel;
  }
  public HelpUI(Frame parent, String title) {
    sidebar = new Sidebar();
    sidebar.setBorder(new EmptyBorder(10, 10, 10, 10));
    infoView = new JTextPane();
    Dimension d1 = sidebar.getPreferredSize();
    infoView.setPreferredSize(new Dimension(d1.width * 3, d1.height - 5));
    infoView.setEditable(false);

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

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

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

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

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

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

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

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

    general.setSelected(true);
    sel = general;

    sidebar.add(Box.createVerticalGlue());

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

    renderInfo();
  }
  public SurrenderUI() {
    setType(Type.UTILITY);

    ExitB = new JButton("Exit");
    ExitB.setFont(new Font("Tahoma", Font.BOLD, 12));
    ExitB.setBackground(new Color(255, 215, 0));
    ExitB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dispose();
            new HSmain();
          }
        });
    ExitB.setBounds(461, 427, 296, 60);

    setTitle("Surrendering a Pet");
    Container pane = getContentPane();
    getContentPane().setLayout(null);
    pane.add(ExitB);

    txtSurrender = new JTextField();
    txtSurrender.setEditable(false);
    txtSurrender.setForeground(new Color(0, 0, 0));
    txtSurrender.setBackground(new Color(255, 215, 0));
    txtSurrender.setBounds(10, 11, 764, 50);
    txtSurrender.setHorizontalAlignment(SwingConstants.CENTER);
    txtSurrender.setFont(new Font("Lucida Handwriting", Font.BOLD, 18));
    txtSurrender.setText("Surrendering a Pet");
    getContentPane().add(txtSurrender);
    txtSurrender.setColumns(10);

    BackB = new JButton("Back");
    BackB.setFont(new Font("Tahoma", Font.BOLD, 12));
    BackB.setBackground(new Color(255, 215, 0));
    BackB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new AnimalServiceUI();
            dispose();
          }
        });
    BackB.setBounds(26, 427, 320, 60);
    getContentPane().add(BackB);

    scrollPane = new JScrollPane();
    scrollPane.setBounds(0, 72, 764, 329);
    getContentPane().add(scrollPane);

    JTextPane txtSurrenderInfo = new JTextPane();
    scrollPane.setViewportView(txtSurrenderInfo);
    txtSurrenderInfo.setForeground(new Color(0, 0, 0));
    txtSurrenderInfo.setEditable(false);
    txtSurrenderInfo.setFont(new Font("Times New Roman", Font.BOLD, 15));
    txtSurrenderInfo.setText(
        "\tThe Humane Society of Lamar cannot accept every animal brought to our shelter immediately. \r\nWe respect the difficult decision of owners to relinquish their pets, and the hard choices of those \r\ngood citizens who are trying to help a stray. We accept the surrender of pets as space allows. \r\nWe maintain a waiting list for all animals needing to be admitted to the shelter.\r\nAnimals are surrendered to our facility by appointment.\r\nWe admit at least 12 animals per week. We accept more animals as adoptions and space allow.\r\nNote that we cannot accept aggressive, sick or pregnant animals.\r\nPlease call 409-225-7981, and one of our adoption specialists will speak to you.\r\nAt times our waiting list will have up to 100 animals waiting for admission and it can take several weeks \r\nbefore we can admit your pet.\r\nPlease understand that our primary goal is to place as many animals in forever homes as possible, \r\ntherefore we must give every pet admitted to the shelter enough time to find a loving home. \r\nWe cannot guarantee placement of every animal admitted to the shelter.\r\n\t\r\n\tAdmission of any animal into the Humane Society of Lamar  is based on the animal\u2019s health, \r\nbehavior, and adoptability. When you bring your pets, please have:\r\n\r\n    *Any veterinary records\r\n    *Your pet\u2019s medications\r\n    *Special food or treats that your pet needs\r\n    *Your pet\u2019s bed, toys, leash and other belongings from home\r\n\r\nA staff member will evaluate the temperament of your pet. Once your pet has been screened, \r\nand the Humane Society of Lamar decides to accept your pet, we ask a donation to our shelter to be made. \r\nThis is not required, but will greatly help us care for your pet.");

    setSize(800, 553);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
  public EditorConsolePane() {
    super();
    textArea = new JTextPane();
    textArea.setEditorKit(new HTMLEditorKit());
    textArea.setTransferHandler(new JTextPaneHTMLTransferHandler());
    String css = PreferencesUser.getInstance().getConsoleCSS();
    ((HTMLEditorKit) textArea.getEditorKit()).getStyleSheet().addRule(css);
    textArea.setEditable(false);

    setLayout(new BorderLayout());
    add(new JScrollPane(textArea), BorderLayout.CENTER);

    if (ENABLE_IO_REDIRECT) {
      Debug.log(3, "EditorConsolePane: starting redirection to message area");
      int npipes = 2;
      NUM_PIPES = npipes * ScriptRunner.scriptRunner.size();
      pin = new PipedInputStream[NUM_PIPES];
      reader = new Thread[NUM_PIPES];
      for (int i = 0; i < NUM_PIPES; i++) {
        pin[i] = new PipedInputStream();
      }

      int irunner = 0;
      for (IScriptRunner srunner : ScriptRunner.scriptRunner.values()) {
        Debug.log(3, "EditorConsolePane: redirection for %s", srunner.getName());
        if (srunner.doSomethingSpecial(
            "redirect", Arrays.copyOfRange(pin, irunner * npipes, irunner * npipes + 2))) {
          Debug.log(3, "EditorConsolePane: redirection success for %s", srunner.getName());
          quit = false; // signals the Threads that they should exit
          // TODO Hack to avoid repeated redirect of stdout/err
          ScriptRunner.systemRedirected = true;

          // Starting two seperate threads to read from the PipedInputStreams
          for (int i = irunner * npipes; i < irunner * npipes + npipes; i++) {
            reader[i] = new Thread(this);
            reader[i].setDaemon(true);
            reader[i].start();
          }
          irunner++;
        }
      }
    }

    // Create the popup menu.
    popup = new JPopupMenu();
    JMenuItem menuItem = new JMenuItem("Clear messages");
    // Add ActionListener that clears the textArea
    menuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            textArea.setText("");
          }
        });
    popup.add(menuItem);

    // Add listener to components that can bring up popup menus.
    MouseListener popupListener = new PopupListener(popup);
    textArea.addMouseListener(popupListener);
  }
  private void initDebugTextPane() {
    HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
    HTMLDocument htmlDocument = new HTMLDocument();

    debugTextPane.setEditable(false);
    debugTextPane.setBackground(Color.WHITE);
    debugTextPane.setEditorKit(htmlEditorKit);
    htmlEditorKit.install(debugTextPane);
    debugTextPane.setDocument(htmlDocument);
  }
示例#7
0
  public Container CreateContentPane() {
    // Create the content-pane-to-be.
    JPanel contentPane = new JPanel(new BorderLayout());
    contentPane.setOpaque(true);

    // the log panel
    log = new JTextPane();
    log.setEditable(false);
    log.setBackground(Color.BLACK);
    logPane = new JScrollPane(log);
    kit = new HTMLEditorKit();
    doc = new HTMLDocument();
    log.setEditorKit(kit);
    log.setDocument(doc);
    DefaultCaret c = (DefaultCaret) log.getCaret();
    c.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    ClearLog();

    // the preview panel
    previewPane = new DrawPanel();
    previewPane.setPaperSize(paper_top, paper_bottom, paper_left, paper_right);

    // status bar
    statusBar = new StatusBar();
    Font f = statusBar.getFont();
    statusBar.setFont(f.deriveFont(Font.BOLD, 15));
    Dimension d = statusBar.getMinimumSize();
    d.setSize(d.getWidth(), d.getHeight() + 30);
    statusBar.setMinimumSize(d);

    // layout
    Splitter split = new Splitter(JSplitPane.VERTICAL_SPLIT);
    split.add(previewPane);
    split.add(logPane);
    split.setDividerSize(8);

    contentPane.add(statusBar, BorderLayout.SOUTH);
    contentPane.add(split, BorderLayout.CENTER);

    // open the file
    if (recentFiles[0].length() > 0) {
      OpenFileOnDemand(recentFiles[0]);
    }

    // connect to the last port
    ListSerialPorts();
    if (Arrays.asList(portsDetected).contains(recentPort)) {
      OpenPort(recentPort);
    }

    return contentPane;
  }
示例#8
0
  /** Creates the text area. */
  private void initTextArea() {
    textArea.setOpaque(false);
    textArea.setEditable(false);
    StyledDocument doc = textArea.getStyledDocument();

    MutableAttributeSet standard = new SimpleAttributeSet();
    StyleConstants.setAlignment(standard, StyleConstants.ALIGN_CENTER);
    StyleConstants.setFontFamily(standard, textArea.getFont().getFamily());
    StyleConstants.setFontSize(standard, 12);
    doc.setParagraphAttributes(0, 0, standard, true);

    parentWindow.addSearchFieldListener(this);
  }
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Windows Form
   * Designer. Otherwise, retrieving design might not work properly. Tip: If you must revise this
   * method, please backup this GUI file for JFrameBuilder to retrieve your design properly in
   * future, before revising this method.
   */
  private void initializeComponent() {
    jTextPane1 = new JTextPane();
    jButton1 = new JButton();
    jButton2 = new JButton();
    contentPane = (JPanel) this.getContentPane();

    //
    // jTextPane1
    //
    jTextPane1.setBackground(new Color(140, 152, 236));
    jTextPane1.setForeground(new Color(255, 0, 0));
    jTextPane1.setText(
        "                               \n                                                 NO DONUT FOR YOU\n                           SORRY FOR INCONVINIENCE FACED BY YOU\n                                    SEVER IS DOWN FOR A TIME BEING\n                                         PLEASE TRY AGAIN LATER");
    jTextPane1.setEditable(false);
    //
    // jButton1
    //
    jButton1.setText("Home");
    jButton1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButton1_actionPerformed(e);
          }
        });
    //
    // jButton2
    //
    jButton2.setText("Friends");
    jButton2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButton2_actionPerformed(e);
          }
        });
    //
    // contentPane
    //
    contentPane.setLayout(null);
    contentPane.setBackground(new Color(140, 152, 236));
    addComponent(contentPane, jTextPane1, 76, 165, 451, 150);
    addComponent(contentPane, jButton1, 94, 36, 83, 39);
    addComponent(contentPane, jButton2, 184, 36, 83, 39);
    //
    // serverdown
    //
    this.setTitle("serverdown - extends JFrame");
    this.setLocation(new Point(0, 0));
    this.setSize(new Dimension(1024, 768));
  }
示例#10
0
  private MainPanel() {
    super(new BorderLayout());

    JTextPane textPane = new JTextPane();
    textPane.setEditable(false);
    textPane.setMargin(new Insets(0, 10, 0, 0));
    insertQuestion(textPane, "111 / 37 = ");
    insertQuestion(textPane, "222 / 37 = ");
    insertQuestion(textPane, "333 / 37 = ");
    insertQuestion(textPane, "444 / 37 = ");
    insertQuestion(textPane, "555 / 37 = ");
    insertQuestion(textPane, "666 / 37 = ");
    insertQuestion(textPane, "777 / 37 = ");
    insertQuestion(textPane, "888 / 37 = ");
    insertQuestion(textPane, "999 / 37 = ");

    add(new JScrollPane(textPane));
    setPreferredSize(new Dimension(320, 240));
  }
  public SharedActions(final JFrame frame) {
    this.frame = frame;

    buildActionTable();
    buildPopupMenu();

    JTextPane textPane = new JTextPane();
    textPane.setEditable(false);
    textPane.setText(
        "\n\tUse the MenuBar, ToolBar or right-click for a popup menu.\n\n"
            + "\tAction1 disables itself and enables Action2.\n"
            + "\tAction2 disables itself and enables Action1.\n"
            + "\tAction3 and Action4 support toggle buttons and checkboxes.\n"
            + "\tThe About action enables Actions 1 and 2 and selects Actions 3 and 4.\n\n"
            + "\tAll components use a common set of actions.\n"
            + "\tThe actions and corresponding components\n"
            + "\tare enabled and disabled in concert.\n\n"
            + "\tFor larger swing applications, I place all actions\n"
            + "\tin a separate package which maps to a directory structure\n"
            + "\tsomething like this...\n\n"
            + "\tmypackage \n"
            + "\t\tSharedActions.java\n"
            + "\tmypackage/action\n"
            + "\t\tExitAction.java\n"
            + "\t\tAction1.java\n"
            + "\t\tAction2.java\n"
            + "\t\tAboutAction.java\n");
    frame.getContentPane().add(new MyToolBar(actionTable), BorderLayout.NORTH);
    frame.getContentPane().add(new JScrollPane(textPane), BorderLayout.CENTER);
    textPane.addMouseListener(new MousePopupListener());
    frame.setJMenuBar(new MyMenuBar(actionTable));
    frame.setSize(640, 480);

    //	send window closing events to our "Exit" action handler.
    frame.addWindowListener(
        new WindowAdapter() {

          public void windowClosing(WindowEvent e) {
            getAction(SharedActions.EXIT_KEY).actionPerformed(null);
          }
        });
  }
  @Inject
  public ProblemSelectionPanel(qcevolutionbackend be) {
    this.setLayout(new BorderLayout());
    backend = be;
    Set<String> probs = backend.getProbmanager().getAvailableProblems();
    String[] options = new String[probs.size() + 1];
    options[0] = "Please Select Problem";
    int index = 1;
    Iterator<String> iter = probs.iterator();
    while (iter.hasNext()) {
      options[index++] = iter.next();
    }
    selection_model = new DefaultComboBoxModel(options);

    description = new JTextPane();
    description.setEditable(false);
    description_scroller = new JScrollPane(description);
    description_scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    description_scroller.setPreferredSize(new Dimension(250, 155));
    description_scroller.setMinimumSize(new Dimension(10, 10));

    if (backend.getCurrentse() != null) {
      String key = backend.getQproblem().getName();
      selection_model.setSelectedItem(key);
      description.setText(backend.getProbmanager().getSearchEngineDesc(key));
    }

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    selection = new JComboBox(selection_model);
    selection.addActionListener(this);
    selection.setPreferredSize(new Dimension((int) (screenSize.width * MainPanel.right_perc), 30));
    selection.setMaximumSize(new Dimension((int) (screenSize.width * MainPanel.right_perc), 30));

    be.addObserver(this);
    be.getProbmanager().addObserver(this);
    if (null != backend.getCurrentse()) {
      backend.getCurrentse().addObserver(this);
    }

    this.add(selection, BorderLayout.NORTH);
    this.add(description_scroller, BorderLayout.CENTER);
  }
示例#13
0
  /**
   * Sets the reason of a call failure if one occurs. The renderer should display this reason to the
   * user.
   *
   * @param reason the reason to display
   */
  public void setErrorReason(final String reason) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              setErrorReason(reason);
            }
          });
      return;
    }

    if (errorMessageComponent == null) {
      errorMessageComponent = new JTextPane();

      JTextPane textPane = (JTextPane) errorMessageComponent;
      textPane.setEditable(false);
      textPane.setOpaque(false);

      StyledDocument doc = textPane.getStyledDocument();

      MutableAttributeSet standard = new SimpleAttributeSet();
      StyleConstants.setAlignment(standard, StyleConstants.ALIGN_CENTER);
      StyleConstants.setFontFamily(standard, textPane.getFont().getFamily());
      StyleConstants.setFontSize(standard, 12);
      doc.setParagraphAttributes(0, 0, standard, true);

      GridBagConstraints constraints = new GridBagConstraints();
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.gridx = 0;
      constraints.gridy = 4;
      constraints.weightx = 1;
      constraints.weighty = 0;
      constraints.insets = new Insets(5, 0, 0, 0);

      add(errorMessageComponent, constraints);
      this.revalidate();
    }

    errorMessageComponent.setText(reason);

    if (isVisible()) errorMessageComponent.repaint();
  }
示例#14
0
  public ThaiDigits() {
    super(new GridBagLayout());

    textPane = new JTextPane();
    textPane.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(textPane);

    // Add Components to this panel.
    GridBagConstraints c = new GridBagConstraints();
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0;
    c.weighty = 1.0;
    add(scrollPane, c);

    String outputString = new String();
    Locale[] thaiLocale = {new Locale("th"), new Locale("th", "TH"), new Locale("th", "TH", "TH")};
    for (Locale locale : thaiLocale) {
      NumberFormat nf = NumberFormat.getNumberInstance(locale);
      outputString = outputString + locale.toString() + ": ";
      outputString = outputString + nf.format(573.34) + "\n";
    }

    StyledDocument styledDoc = textPane.getStyledDocument();
    if (styledDoc instanceof AbstractDocument) {
      doc = (AbstractDocument) styledDoc;
    } else {
      System.err.println("Text pane's document isn't an AbstractDocument!");
      System.exit(-1);
    }

    SimpleAttributeSet attrs = new SimpleAttributeSet();
    StyleConstants.setFontFamily(attrs, "SansSerif");
    StyleConstants.setFontSize(attrs, 24);

    try {
      doc.insertString(doc.getLength(), outputString, attrs);
    } catch (BadLocationException ble) {
      System.err.println("Couldn't insert initial text.");
    }
  }
示例#15
0
  private void initComponent() {
    JTextPane helpContentTextPane = new JTextPane();
    helpContentTextPane.setEditable(false);
    helpContentTextPane.setContentType("text/html;charset=utf-8");
    try {
      helpContentTextPane.setText(FileUtil.readFileToString(Config.HELP_FILE_PATH));
    } catch (IOException e) {
      e.printStackTrace();
    }

    JScrollPane scrollPane = new JScrollPane(helpContentTextPane);
    scrollPane.setAutoscrolls(true);

    Container c = this.getContentPane();
    c.add(scrollPane, BorderLayout.CENTER);

    this.setTitle("Help");
    this.setIconImage(new ImageIcon(Config.LOGO_IMG).getImage());
    this.setSize(Config.HELP_DIALOG_WIDTH, Config.HELP_DIALOG_HEIGHT);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  }
  public EventLogPanel() {
    sc = new StyleContext();
    doc = new DefaultStyledDocument(sc);
    logsPanel = new JTextPane(doc);
    logsPanel.setEditable(false);

    cal = Calendar.getInstance();
    sdf = new SimpleDateFormat("HH:mm:ss");

    this.setLayout(new GridLayout(0, 1));

    JScrollPane scrollPanel = new JScrollPane(logsPanel);
    scrollPanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPanel.setPreferredSize(new Dimension(840, 90));
    scrollPanel.setMinimumSize(new Dimension(10, 10));

    this.add(scrollPanel);
    this.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(1, 1, 1, 1),
            BorderFactory.createTitledBorder("Event Log")));
  }
示例#17
0
  private void decompile(Map params) {
    try {
      ClazzSourceView csv = ClazzSourceViewFactory.getClazzSourceView(clazz);
      csv.setDecompileParameters(params);
      source = csv.getSource();

      String sourceText = source;

      sourceText = sourceText.replaceAll(" ", "&nbsp;");
      sourceText = sourceText.replaceAll("<", "&lt;");
      sourceText = sourceText.replaceAll(">", "&gt;");
      sourceText = sourceText.replaceAll("\n", "<BR>");
      sourcePane.setText(sourceText);
      sourcePane.setCaretPosition(0);
    } catch (Throwable ex) {
      if (Utils.hasDebug()) {
        ex.printStackTrace();
      }
      sourcePane.setText("Exception occured while decompiling");

      String link = "http://sourceforge.net/tracker/?group_id=226227&atid=1066690";
      String exception = unpackException(ex);

      JTextPane text = new JTextPane();
      text.setContentType("text/html");
      text.setText(
          "<html>Error occured while decompiling!<BR>Please submit bug at <b>"
              + link
              + "</b><BR>"
              + exception
              + "</html>");
      text.setEditable(false);
      text.setBackground(this.getBackground());

      JOptionPane.showMessageDialog(this, text, "Error", JOptionPane.ERROR_MESSAGE);

      throw new IllegalArgumentException("Error decompiling");
    }
  }
示例#18
0
  /**
   * Inizialize frame components
   *
   * @throws CMSException
   * @throws FileNotFoundException
   * @throws IOException
   * @throws GeneralSecurityException
   */
  private void initComponents()
      throws CMSException, FileNotFoundException, IOException, GeneralSecurityException {

    // *********************************

    panel4 = new JPanel();
    label2 = new JLabel();
    textPane1 = new JTextPane();
    panel5 = new JPanel();
    textArea1 = new JTextArea();
    textArea2 = new JTextArea();

    progressBar = new JProgressBar();

    textPane2 = new JTextPane();
    textField1 = new JTextField();
    button1 = new JButton();
    panel6 = new JPanel();
    button2 = new JButton();
    button3 = new JButton();
    button4 = new JButton();
    GridBagConstraints gbc;
    // ======== this ========
    Container contentPane = getContentPane();
    contentPane.setLayout(new GridBagLayout());
    ((GridBagLayout) contentPane.getLayout()).columnWidths = new int[] {165, 0, 0};
    ((GridBagLayout) contentPane.getLayout()).rowHeights = new int[] {105, 50, 0};
    ((GridBagLayout) contentPane.getLayout()).columnWeights = new double[] {0.0, 1.0, 1.0E-4};
    ((GridBagLayout) contentPane.getLayout()).rowWeights = new double[] {1.0, 0.0, 1.0E-4};

    // ======== panel4 ========
    {
      panel4.setBackground(Color.white);
      panel4.setLayout(new GridBagLayout());
      ((GridBagLayout) panel4.getLayout()).columnWidths = new int[] {160, 0};
      ((GridBagLayout) panel4.getLayout()).rowHeights = new int[] {0, 0, 0};
      ((GridBagLayout) panel4.getLayout()).columnWeights = new double[] {0.0, 1.0E-4};
      ((GridBagLayout) panel4.getLayout()).rowWeights = new double[] {1.0, 1.0, 1.0E-4};

      // ---- label2 ----
      label2.setIcon(
          new ImageIcon(
              "images" + System.getProperty("file.separator") + "logo-freesigner-piccolo.png"));
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.insets.bottom = 5;
      panel4.add(label2, gbc);

      // ---- textPane1 ----
      textPane1.setFont(new Font("Verdana", Font.BOLD, 12));
      textPane1.setText("Lettura\ncertificati\nda token");
      textPane1.setEditable(false);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 1;
      gbc.anchor = GridBagConstraints.NORTHWEST;
      panel4.add(textPane1, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets.bottom = 5;
    gbc.insets.right = 5;
    contentPane.add(panel4, gbc);

    // ======== panel5 ========
    {
      panel5.setBackground(Color.white);
      panel5.setLayout(new GridBagLayout());
      ((GridBagLayout) panel5.getLayout()).columnWidths = new int[] {0, 205, 0, 0};
      ((GridBagLayout) panel5.getLayout()).rowHeights = new int[] {100, 0, 30, 30, 0};
      ((GridBagLayout) panel5.getLayout()).columnWeights = new double[] {1.0, 0.0, 1.0, 1.0E-4};
      ((GridBagLayout) panel5.getLayout()).rowWeights = new double[] {0.0, 0.0, 1.0, 1.0, 1.0E-4};

      // ---- textArea1 ----
      textArea1.setFont(new Font("Verdana", Font.BOLD, 14));
      textArea1.setText("Lettura certificati da token");
      textArea1.setEditable(false);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.gridwidth = 3;
      gbc.fill = GridBagConstraints.VERTICAL;
      gbc.insets.bottom = 5;
      panel5.add(textArea1, gbc);

      // ---- textArea2 ----
      textArea2.setFont(new Font("Verdana", Font.PLAIN, 12));
      textArea2.setText("Ricerca certificati...\n");
      textArea2.setEditable(false);
      textArea2.setColumns(30);
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 1;
      gbc.gridwidth = 3;
      gbc.fill = GridBagConstraints.BOTH;
      panel5.add(textArea2, gbc);
      progressBar.setValue(0);
      progressBar.setMaximum(1);
      progressBar.setStringPainted(true);
      progressBar.setBounds(0, 0, 300, 150);

      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 2;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.insets.bottom = 5;
      gbc.insets.right = 5;
      gbc.gridwidth = 3;
      panel5.add(progressBar, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets.bottom = 5;
    contentPane.add(panel5, gbc);

    // ======== panel6 ========
    {
      panel6.setBackground(Color.white);
      panel6.setLayout(new GridBagLayout());
      ((GridBagLayout) panel6.getLayout()).columnWidths = new int[] {0, 0, 0, 0};
      ((GridBagLayout) panel6.getLayout()).rowHeights = new int[] {0, 0};
      ((GridBagLayout) panel6.getLayout()).columnWeights = new double[] {1.0, 1.0, 1.0, 1.0E-4};
      ((GridBagLayout) panel6.getLayout()).rowWeights = new double[] {1.0, 1.0E-4};

      // ---- button2 ----
      button2.setText("Indietro");
      gbc = new GridBagConstraints();
      gbc.gridx = 0;
      gbc.gridy = 0;
      gbc.insets.right = 5;
      button2.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {

              frame.hide();

              FreeSignerSignApplet nuovo = new FreeSignerSignApplet();
            }
          });

      // panel6.add(button2, gbc);

      // ---- button4 ----
      button4.setText("Annulla");
      gbc = new GridBagConstraints();
      gbc.gridx = 2;
      gbc.gridy = 0;
      // panel6.add(button4, gbc);
    }
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.BOTH;
    contentPane.add(panel6, gbc);
    contentPane.setBackground(Color.white);
    frame = new JFrame();
    frame.setContentPane(contentPane);
    frame.setTitle("Freesigner");
    frame.setSize(300, 150);
    frame.setResizable(false);
    frame.pack();
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getWidth()) / 2, (d.height - frame.getHeight()) / 2);

    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
    timer =
        new Timer(
            10,
            new ActionListener() {

              public void actionPerformed(ActionEvent evt) {
                frame.show();
                if (task.getMessage() != null) {
                  String s = new String();
                  s = task.getMessage();
                  s = s.substring(0, Math.min(60, s.length()));

                  textArea2.setText(s + " ");
                  progressBar.setValue(task.getStatus());
                }
                if (task.isDone()) {
                  timer.stop();

                  // Finalizzo la cryptoki, onde evitare
                  // successivi errori PKCS11 "cryptoki alreadi initialized"

                  if ((task != null)) task.libFinalize();

                  ArrayList slotInfos = task.getSlotInfos();
                  if ((slotInfos == null) || slotInfos.isEmpty()) {

                    frame.show();

                    JOptionPane.showMessageDialog(
                        frame,
                        "Controllare la presenza sul sistema\n"
                            + "della libreria PKCS11 impostata.",
                        "Nessun lettore rilevato",
                        JOptionPane.WARNING_MESSAGE);

                    frame.hide();

                  } else {
                    String st = task.getCRLerror();

                    if (st.length() > 0) {
                      timer.stop();

                      JOptionPane.showMessageDialog(
                          frame,
                          "C'è stato un errore nella verifica CRL.\n" + st,
                          "Errore verifica CRL",
                          JOptionPane.ERROR_MESSAGE);
                      frame.hide();
                      FreeSignerSignApplet nuovo = new FreeSignerSignApplet();
                    }
                    if (task.getDifferentCerts() == 0) {
                      if (task.getCIr() != null) {
                        JOptionPane.showMessageDialog(
                            frame,
                            "La carta "
                                + task.getCardDescription()
                                + " nel lettore "
                                + conf.getReader()
                                + " non contiene certificati",
                            "Attenzione",
                            JOptionPane.WARNING_MESSAGE);

                      } else
                        JOptionPane.showMessageDialog(
                            frame, task.getMessage(), "Errore:", JOptionPane.ERROR_MESSAGE);
                    }

                    frame.hide();

                    // confFrame.createTreeAndTokenNodes(task.getSlotInfos());

                  }
                }
              }
            });
  }
  public static void main() {
    // Main
    frame = new JFrame("Java Playground");
    frame.setSize(640, 480);
    // Make sure the divider is properly resized
    frame.addComponentListener(
        new ComponentAdapter() {
          public void componentResized(ComponentEvent c) {
            splitter.setDividerLocation(.8);
          }
        });
    // Make sure the JVM is reset on close
    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosed(WindowEvent w) {
            new FrameAction().kill();
          }
        });

    // Setting up the keybinding
    // Ctrl+k or Cmd+k -> compile
    bind(KeyEvent.VK_K);

    // Ctrl+e or Cmd+e -> console
    bind(KeyEvent.VK_E);

    // Save, New file, Open file, Print.
    // Currently UNUSED until I figure out how normal java files and playground files will
    // interface.
    bind(KeyEvent.VK_S);
    bind(KeyEvent.VK_N);
    bind(KeyEvent.VK_O);
    bind(KeyEvent.VK_P);

    // Binds the keys to the action defined in the FrameAction class.
    frame.getRootPane().getActionMap().put("console", new FrameAction());

    // The main panel for typing code in.
    text = new JTextPane();
    textScroll = new JScrollPane(text);
    textScroll.setBorder(null);
    textScroll.setPreferredSize(new Dimension(640, 480));

    // Document with syntax highlighting. Currently unfinished.
    doc = text.getStyledDocument();
    doc.addDocumentListener(
        new DocumentListener() {
          public void changedUpdate(DocumentEvent d) {}

          public void insertUpdate(DocumentEvent d) {}

          public void removeUpdate(DocumentEvent d) {}
        });

    ((AbstractDocument) doc).setDocumentFilter(new NewLineFilter());

    // The output log; a combination compiler warning/error/runtime error/output log.
    outputText = new JTextPane();
    outputScroll = new JScrollPane(outputText);
    outputScroll.setBorder(null);

    // "Constant" for the error font
    error = new SimpleAttributeSet();
    error.addAttribute(StyleConstants.CharacterConstants.Italic, Boolean.TRUE);
    error.addAttribute(StyleConstants.Foreground, Color.RED);

    // "Constant" for the warning message font
    warning = new SimpleAttributeSet();
    warning.addAttribute(StyleConstants.CharacterConstants.Italic, Boolean.TRUE);
    warning.addAttribute(StyleConstants.Foreground, Color.PINK);

    // "Constant" for the debugger error font
    progErr = new SimpleAttributeSet();
    progErr.addAttribute(StyleConstants.Foreground, Color.BLUE);

    // Print streams to redirect System.out and System.err.
    out = new TextOutputStream(outputText, null);
    err = new TextOutputStream(outputText, error);
    System.setOut(new PrintStream(out));
    System.setErr(new PrintStream(err));

    // Sets up the output log
    outputText.setEditable(false);
    outputScroll.setVisible(true);

    // File input/output setup
    chooser = new JFileChooser();

    // Setting up miscellaneous stuff
    compiler = ToolProvider.getSystemJavaCompiler();
    JVMrunning = false;
    redirectErr = null;
    redirectOut = null;
    redirectIn = null;

    // Sets up the splitter pane and opens the program up
    splitter = new JSplitPane(JSplitPane.VERTICAL_SPLIT, textScroll, outputScroll);
    consoleDisplayed = false;
    splitter.remove(outputScroll); // Initially hides terminal until it is needed
    splitter.setOneTouchExpandable(true);
    frame.add(splitter);
    frame.setVisible(true);

    // Sets the divider to the proper one, for debugging
    // splitter.setDividerLocation(.8);
  }
示例#20
0
文件: APropos.java 项目: sipi/memento
    @Override
    public void actionPerformed(ActionEvent e) {

      licence_text =
          new String(
              "This program is free software: you can redistribute it and/or modify\n"
                  + "it under the terms of the GNU General Public License as published by\n"
                  + "the Free Software Foundation, either version 3 of the License, or\n"
                  + "(at your option) any later version.\n"
                  + "\n"
                  + "This program is distributed in the hope that it will be useful,\n"
                  + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
                  + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
                  + "GNU General Public License for more details.\n"
                  + "\n"
                  + "You should have received a copy of the GNU General Public License\n"
                  + "along with this program.  If not, see <http://www.gnu.org/licenses/>.\n"
                  + "\n\n\n");

      try {
        InputStream ips = new FileInputStream(getClass().getResource("COPYING").getPath());
        InputStreamReader ipsr = new InputStreamReader(ips);
        BufferedReader br = new BufferedReader(ipsr);

        String line;
        while ((line = br.readLine()) != null) {
          licence_text += line + '\n';
        }
        br.close();
      } catch (Exception e1) {
      }

      Dimension dimension = new Dimension(600, 400);

      JDialog licence = new JDialog(memento, "Licence");

      JTextPane text_pane = new JTextPane();
      text_pane.setEditable(false);
      text_pane.setPreferredSize(dimension);
      text_pane.setSize(dimension);

      StyledDocument doc = text_pane.getStyledDocument();

      Style justified =
          doc.addStyle(
              "justified",
              StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE));
      StyleConstants.setAlignment(justified, StyleConstants.ALIGN_JUSTIFIED);

      try {
        doc.insertString(0, licence_text, justified);
      } catch (BadLocationException ble) {
        System.err.println("Couldn't insert initial text into text pane.");
      }
      Style logicalStyle = doc.getLogicalStyle(0);
      doc.setParagraphAttributes(0, licence_text.length(), justified, false);
      doc.setLogicalStyle(0, logicalStyle);

      JScrollPane paneScrollPane = new JScrollPane(text_pane);
      paneScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
      paneScrollPane.setPreferredSize(dimension);
      paneScrollPane.setMinimumSize(dimension);

      JPanel pan = new JPanel();
      LayoutManager layout = new BorderLayout();
      pan.setLayout(layout);

      pan.add(new JScrollPane(paneScrollPane), BorderLayout.CENTER);
      JButton close = new JButton("Fermer");
      close.addActionListener(new ButtonCloseActionListener(licence));
      JPanel button_panel = new JPanel();
      FlowLayout button_panel_layout = new FlowLayout(FlowLayout.RIGHT, 20, 20);
      button_panel.setLayout(button_panel_layout);

      button_panel.add(close);
      pan.add(button_panel, BorderLayout.SOUTH);

      licence.add(pan);

      licence.pack();
      licence.setLocationRelativeTo(memento);
      licence.setVisible(true);
    }
示例#21
0
  public IRCBOT(boolean uList, String channel, int chatNum) {

    // chatter = new ChatDisplay("<html><body bgcolor='black'><table border=0pt width=100%>");
    winNum = chatNum;
    URL iconURL = getClass().getResource("P_300x300.png");
    ImageIcon icon = new ImageIcon(iconURL);
    setIconImage(icon.getImage());

    Action doNothing =
        new AbstractAction() {

          @Override
          public void actionPerformed(ActionEvent e) {}
        };

    channelName = channel;
    standardWindow = uList;

    chatInput = new JTextArea(4, 55);
    chatInput.setWrapStyleWord(true);
    chatInput.setLineWrap(true);
    chatInput.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "doNothing");
    chatScreen = new JTextPane();
    chatScreen.setContentType("text/html");
    chatScreen.setEditorKit(kit);
    chatScreen.setDocument(doc);
    userList = new JTextPane();
    registeredUserList = new JTextPane();
    sendButton = new JButton("SEND");
    g_start = new JButton("START");
    g_end = new JButton("END");
    g_reroll = new JButton("secret");

    JLabel l_giveaway = new JLabel("Giveaway", JLabel.CENTER);
    JLabel l_chat = new JLabel("Chat", JLabel.CENTER);
    JLabel l_uList = new JLabel("User List", JLabel.CENTER);

    sendButton.addActionListener(this);
    g_start.addActionListener(this);
    g_end.addActionListener(this);
    g_reroll.addActionListener(this);

    g_start.setEnabled(false); // disabled for basic irc client
    g_end.setEnabled(false);
    g_reroll.setEnabled(false);

    // String start = "<html><body>";

    Dimension min = new Dimension(100, 1);
    Dimension pref = new Dimension(150, 1);
    Dimension max = new Dimension(600, 600);
    // chatScreen.setMinimumSize(min);
    // userList.setMinimumSize(min);
    // chatInput.addKeyListener(KeyBoardListener);

    JPanel mainPanel = new JPanel(new BorderLayout(5, 5));
    JPanel left = new JPanel(new BorderLayout(5, 5));
    JPanel mid = new JPanel(new BorderLayout(5, 5));
    JPanel right = new JPanel(new BorderLayout(5, 5));
    JPanel giveaway_buttons = new JPanel(new BorderLayout(5, 5));

    JPanel sendBar = new JPanel();
    scrollChat = new JScrollPane(chatScreen);
    JScrollPane scrollChatInput = new JScrollPane(chatInput);
    userListScroll = new JScrollPane(userList);
    JScrollPane regUserListScroll = new JScrollPane(registeredUserList);

    userListScroll.setMinimumSize(min);
    // userListScroll.setPreferredSize(pref);
    // userListScroll.setMaximumSize(new Dimension(800,600));
    // userListScroll.setPreferredSize(new Dimension(100,100));
    // scrollChat.setPreferredSize(pref);
    scrollChat.setMinimumSize(min);
    // scrollChat.setMaximumSize(new Dimension(500,500));
    regUserListScroll.setPreferredSize(pref);

    mid.add(l_chat, BorderLayout.NORTH);
    mid.add(scrollChat, BorderLayout.CENTER);

    right.add(l_uList, BorderLayout.NORTH);
    right.add(userListScroll, BorderLayout.CENTER);

    giveaway_buttons.add(g_start, BorderLayout.WEST);
    giveaway_buttons.add(g_end, BorderLayout.CENTER);
    giveaway_buttons.add(g_reroll, BorderLayout.PAGE_END);

    left.add(giveaway_buttons, BorderLayout.PAGE_END);

    JSplitPane chat_userList = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, mid, right);
    chat_userList.setOneTouchExpandable(true);
    chat_userList.setDividerLocation(500);
    chat_userList.setResizeWeight(0.5);
    chat_userList.setContinuousLayout(true);
    // chat_userList.setPreferredSize(new Dimension(100,100));
    chat_userList.setMinimumSize(min);
    // chat_userList.setMaximumSize(max);

    userListScroll.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_NEVER);
    // scroll.add(chatScreen);

    sendBar.add(scrollChatInput);
    sendBar.add(sendButton);

    if (standardWindow) {

      mainPanel.add(chat_userList, BorderLayout.CENTER);
      mainPanel.add(sendBar, BorderLayout.PAGE_END);

      JMenuBar menuBar = new JMenuBar();
      JMenu fileMenu = new JMenu("File");
      settings = new JMenuItem("Settings");

      settings.addActionListener(this);

      fileMenu.add(settings);
      menuBar.add(fileMenu);

      left.add(l_giveaway, BorderLayout.NORTH);
      left.add(regUserListScroll, BorderLayout.CENTER);
      // left.setBorder(new EmptyBorder(0,5,0,0));
      // chat_userList.setBorder(new EtchedBorder(0,0,0,5));
      mainPanel.add(left, BorderLayout.WEST);
      mainPanel.add(menuBar, BorderLayout.PAGE_START);
      // mainPanel.setBorder(new EmptyBorder(0,10,10,10));
    } else {
      mainPanel.add(scrollChat, BorderLayout.CENTER);
    }
    registeredUserList.setEditable(false);
    userList.setEditable(false);
    chatScreen.setEditable(false);

    registeredUserList.setFont(new Font("Courier New", Font.PLAIN, 12));
    chatScreen.setFont(new Font("Courier New", Font.PLAIN, 12));
    chatInput.setFont(new Font("Courier New", Font.PLAIN, 12));

    getContentPane().add(mainPanel);
    setSize(800, 500);
    setVisible(true);
    setResizable(true);
    setLocationRelativeTo(null);
    setTitle("IRC Chatter");
    setMinimumSize(new Dimension(500, 200));

    addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            // System.out.println("\n\n\n\n\n\\n\nCLOSEDWINDOW\n\n\n\n\n\n\n\n");
            if (sock.isSafe() == true) sock.outputText("PART " + channelName + "\r\n");
            // System.out.println("\n\n\n\n\n\\n\nCLOSEDWINDOW\n\n\n\n\n\n\n\n");
          }
        });
    chatInput.addKeyListener(this);
    chatInput.requestFocus();
  }
示例#22
0
  /**
   * Creates an instance of <tt>ShowPreviewDialog</tt>
   *
   * @param chatPanel The <tt>ChatConversationPanel</tt> that is associated with this dialog.
   */
  ShowPreviewDialog(final ChatConversationPanel chatPanel) {
    this.chatPanel = chatPanel;

    this.setTitle(
        GuiActivator.getResources().getI18NString("service.gui.SHOW_PREVIEW_DIALOG_TITLE"));
    okButton = new JButton(GuiActivator.getResources().getI18NString("service.gui.OK"));
    cancelButton = new JButton(GuiActivator.getResources().getI18NString("service.gui.CANCEL"));

    JPanel mainPanel = new TransparentPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    // mainPanel.setPreferredSize(new Dimension(200, 150));
    this.getContentPane().add(mainPanel);

    JTextPane descriptionMsg = new JTextPane();
    descriptionMsg.setEditable(false);
    descriptionMsg.setOpaque(false);
    descriptionMsg.setText(
        GuiActivator.getResources().getI18NString("service.gui.SHOW_PREVIEW_WARNING_DESCRIPTION"));

    Icon warningIcon = null;
    try {
      warningIcon =
          new ImageIcon(
              ImageIO.read(
                  GuiActivator.getResources().getImageURL("service.gui.icons.WARNING_ICON")));
    } catch (IOException e) {
      logger.debug("failed to load the warning icon");
    }
    JLabel warningSign = new JLabel(warningIcon);

    JPanel warningPanel = new TransparentPanel();
    warningPanel.setLayout(new BoxLayout(warningPanel, BoxLayout.X_AXIS));
    warningPanel.add(warningSign);
    warningPanel.add(Box.createHorizontalStrut(10));
    warningPanel.add(descriptionMsg);

    enableReplacement =
        new JCheckBox(
            GuiActivator.getResources()
                .getI18NString("plugin.chatconfig.replacement.ENABLE_REPLACEMENT_STATUS"));
    enableReplacement.setOpaque(false);
    enableReplacement.setSelected(cfg.getBoolean(ReplacementProperty.REPLACEMENT_ENABLE, true));
    enableReplacementProposal =
        new JCheckBox(
            GuiActivator.getResources()
                .getI18NString("plugin.chatconfig.replacement.ENABLE_REPLACEMENT_PROPOSAL"));
    enableReplacementProposal.setOpaque(false);

    JPanel checkBoxPanel = new TransparentPanel();
    checkBoxPanel.setLayout(new BoxLayout(checkBoxPanel, BoxLayout.Y_AXIS));
    checkBoxPanel.add(enableReplacement);
    checkBoxPanel.add(enableReplacementProposal);

    JPanel buttonsPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
    buttonsPanel.add(okButton);
    buttonsPanel.add(cancelButton);

    mainPanel.add(warningPanel);
    mainPanel.add(Box.createVerticalStrut(10));
    mainPanel.add(checkBoxPanel);
    mainPanel.add(buttonsPanel);

    okButton.addActionListener(this);
    cancelButton.addActionListener(this);

    this.setPreferredSize(new Dimension(390, 230));
  }
示例#23
0
  public MoleGamePlay() {
    for (int i = 0; i < 2; i++) {
      pan[i] = new JPanel();
      pan[i].setBackground(Color.black);
      idtf[i] = new JTextField();
      idtf[i].setEditable(false);
      idtf[i].setHorizontalAlignment(JLabel.CENTER);
    }
    // 게임내 채팅창
    ta = new JTextArea();
    ta.setEditable(false);
    JScrollPane js = new JScrollPane(ta);
    bar = js.getVerticalScrollBar();
    tf = new JTextField();

    pan[0].setBounds(455, 15, 150, 150);
    add(pan[0]);
    idtf[0].setBounds(455, 170, 150, 30);
    add(idtf[0]);

    pan[1].setBounds(610, 15, 150, 150);
    add(pan[1]);
    idtf[1].setBounds(610, 170, 150, 30);
    add(idtf[1]);

    // 게임내 채팅창 위치
    js.setBounds(455, 220, 305, 160);
    tf.setBounds(455, 390, 305, 30);

    // 채팅창
    add(js);
    add(tf);

    scoreJLabel = new JLabel(new ImageIcon("image/score.png")); // 스코어 이미지 위치
    scoreJLabel.setBounds(10, 10, 144, 44);

    jTextPane = new JTextPane(); // 스코어  위치
    jTextPane.setEditable(false);
    jTextPane.setBounds(154, 10, 180, 43);
    jTextPane.setText("0");
    jTextPane.setFont(new Font("Pompadour", 50, 35));

    jButtonStn = new JButton(new ImageIcon("image/start.png"));
    jButtonStn.setBounds(10, 20, 144, 44);
    jButtonStn.setBorderPainted(false);
    jButtonStn.setContentAreaFilled(false);

    jButtonRdy = new JButton(new ImageIcon("image/ready.png"));
    jButtonRdy.setBounds(184, 20, 144, 44);
    jButtonRdy.setBorderPainted(false);
    jButtonRdy.setContentAreaFilled(false);

    jButtonPause = new JButton(new ImageIcon("image/pause.png"));
    jButtonPause.setBounds(10, 74, 144, 44);
    jButtonPause.setBorderPainted(false);
    jButtonPause.setContentAreaFilled(false);

    jButtonCancel = new JButton(new ImageIcon("image/cancel.png"));
    jButtonCancel.setBounds(184, 74, 144, 44);
    jButtonCancel.setBorderPainted(false);
    jButtonCancel.setContentAreaFilled(false);

    jButtonExit = new JButton(new ImageIcon("image/exit.png"));
    jButtonExit.setBounds(10, 128, 144, 44);
    jButtonExit.setBorderPainted(false);
    jButtonExit.setContentAreaFilled(false);

    JLabel gamemenuJLabel = new JLabel();
    gamemenuJLabel.setLayout(null);
    gamemenuJLabel.setBounds(440, 400, 338, 192);
    gamemenuJLabel.add(jButtonStn);
    gamemenuJLabel.add(jButtonRdy);
    gamemenuJLabel.add(jButtonPause);
    gamemenuJLabel.add(jButtonCancel);
    gamemenuJLabel.add(jButtonExit);

    image = Toolkit.getDefaultToolkit().getImage("image/back.png");
    cursorImage = Toolkit.getDefaultToolkit().getImage("image/01.png");
    cursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImage, new Point(0, 0), "null");
    this.setCursor(cursor);
    this.setLayout(null);
    moleGameMyView.setBounds(26, 70, 400, 450);
    notiMyBar.setBounds(15, 530, 420, 30); // 타이머 노티 영역

    this.add(notiMyBar);
    this.add(scoreJLabel);
    this.add(jTextPane);
    this.add(moleGameMyView);
    this.add(gamemenuJLabel);
  }
  /**
   * Instantiates a new movie information panel.
   *
   * @param movieSelectionModel the movie selection model
   */
  public MovieInformationPanel(MovieSelectionModel movieSelectionModel) {
    this.movieSelectionModel = movieSelectionModel;

    setLayout(
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("450px:grow"),
            },
            new RowSpec[] {
              RowSpec.decode("fill:default:grow"),
            }));

    splitPaneVertical = new JSplitPane();
    splitPaneVertical.setBorder(null);
    splitPaneVertical.setResizeWeight(0.9);
    splitPaneVertical.setContinuousLayout(true);
    splitPaneVertical.setOneTouchExpandable(true);
    splitPaneVertical.setOrientation(JSplitPane.VERTICAL_SPLIT);
    add(splitPaneVertical, "1, 1, fill, fill");

    panelTop = new JPanel();
    panelTop.setBorder(null);
    splitPaneVertical.setTopComponent(panelTop);
    panelTop.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.RELATED_GAP_COLSPEC,
              ColumnSpec.decode("200px:grow"),
              FormFactory.RELATED_GAP_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
            },
            new RowSpec[] {
              RowSpec.decode("fill:default"), RowSpec.decode("top:pref:grow"),
            }));

    JPanel panelMovieHeader = new JPanel();
    panelTop.add(panelMovieHeader, "2, 1, 3, 1, fill, top");
    panelMovieHeader.setBorder(null);
    panelMovieHeader.setLayout(new BorderLayout(0, 0));

    JPanel panelMovieTitle = new JPanel();
    panelMovieHeader.add(panelMovieTitle, BorderLayout.NORTH);
    panelMovieTitle.setLayout(new BorderLayout(0, 0));
    lblMovieName = new JLabel("");
    TmmFontHelper.changeFont(lblMovieName, 1.33, Font.BOLD);
    panelMovieTitle.add(lblMovieName);

    JPanel panelRatingTagline = new JPanel();
    panelMovieHeader.add(panelRatingTagline, BorderLayout.CENTER);
    panelRatingTagline.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.DEFAULT_COLSPEC,
              FormFactory.UNRELATED_GAP_COLSPEC,
              ColumnSpec.decode("25px:grow"),
            },
            new RowSpec[] {
              FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("24px"), FormFactory.DEFAULT_ROWSPEC,
            }));

    lblRating = new JLabel("");
    panelRatingTagline.add(lblRating, "2, 2, left, center");

    lblVoteCount = new JLabel("");
    panelRatingTagline.add(lblVoteCount, "3, 2, left, center");

    panelRatingStars = new StarRater(10, 1);
    panelRatingTagline.add(panelRatingStars, "1, 2, left, top");
    panelRatingStars.setEnabled(false);

    lblTop250 = new JLabel("");
    panelRatingTagline.add(lblTop250, "5, 2, left, default");

    lblTagline = new JLabel();
    panelRatingTagline.add(lblTagline, "1, 3, 5, 1, default, center");

    panelMovieLogos = new JPanel();
    panelMovieHeader.add(panelMovieLogos, BorderLayout.EAST);

    lblCertificationImage = new JLabel();
    panelMovieLogos.add(lblCertificationImage);

    JLayeredPane layeredPaneImages = new JLayeredPane();
    panelTop.add(layeredPaneImages, "1, 2, 4, 1, fill, fill");
    layeredPaneImages.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("max(10px;default)"),
              ColumnSpec.decode("left:120px:grow"),
              ColumnSpec.decode("default:grow(10)"),
            },
            new RowSpec[] {
              RowSpec.decode("max(10px;default)"),
              RowSpec.decode("top:180px:grow"),
              RowSpec.decode("fill:80px:grow(3)"),
            }));

    lblMovieBackground = new ImageLabel(false, true);
    lblMovieBackground.setAlternativeText(BUNDLE.getString("image.notfound.fanart")); // $NON-NLS-1$
    lblMovieBackground.enableLightbox();
    layeredPaneImages.add(lblMovieBackground, "1, 1, 3, 3, fill, fill");

    lblMoviePoster = new ImageLabel();
    lblMoviePoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); // $NON-NLS-1$
    lblMoviePoster.enableLightbox();
    layeredPaneImages.setLayer(lblMoviePoster, 1);
    layeredPaneImages.add(lblMoviePoster, "2, 2, fill, fill");

    lblWatchedImage = new JLabel();
    lblWatchedImage.setOpaque(false);
    layeredPaneImages.setLayer(lblWatchedImage, 2);
    layeredPaneImages.add(lblWatchedImage, "2, 2, left, top");

    JPanel panelGenres = new MovieGenresPanel(movieSelectionModel);
    layeredPaneImages.setLayer(panelGenres, 2);
    layeredPaneImages.add(panelGenres, "2, 2, 2, 2, right, bottom");

    JPanel panelLogos = new JPanel();
    panelLogos.setOpaque(false);
    layeredPaneImages.setLayer(panelLogos, 2);
    layeredPaneImages.add(panelLogos, "2, 2, 2, 2, right, top");
    panelLogos.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    lblMediaLogoResolution = new JLabel("");
    panelLogos.add(lblMediaLogoResolution);

    lblMediaLogoVideoCodec = new JLabel("");
    panelLogos.add(lblMediaLogoVideoCodec);

    lblMediaLogoAudio = new JLabel("");
    panelLogos.add(lblMediaLogoAudio);

    JPanel panelBottom = new JPanel();
    panelBottom.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("300px:grow"),
            },
            new RowSpec[] {
              FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:min:grow"),
            }));

    tabbedPaneMovieDetails = new JTabbedPane(JTabbedPane.TOP);
    panelBottom.add(tabbedPaneMovieDetails, "1, 2, fill, fill");
    splitPaneVertical.setBottomComponent(panelBottom);

    panelDetails = new MovieDetailsPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.details"), null, panelDetails, null); // $NON-NLS-1$

    panelOverview = new JPanel();
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.plot"), null, panelOverview, null); // $NON-NLS-1$
    panelOverview.setLayout(
        new FormLayout(
            new ColumnSpec[] {
              ColumnSpec.decode("200px:grow"),
            },
            new RowSpec[] {
              FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:default:grow"),
            }));
    // panelMovieDetails.add(tabbedPaneMovieDetails, "2, 3, fill, fill");

    JScrollPane scrollPaneOverview = new JScrollPane();
    scrollPaneOverview.setBorder(null);
    panelOverview.add(scrollPaneOverview, "1, 2, fill, fill");

    tpOverview = new JTextPane();
    tpOverview.setOpaque(false);
    tpOverview.setEditable(false);
    scrollPaneOverview.setViewportView(tpOverview);

    panelMovieCrew = new MovieCrewPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.crew"), null, panelMovieCrew, null); // $NON-NLS-1$

    MovieActorPanel panelMovieActors = new MovieActorPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.cast"), null, panelMovieActors, null); // $NON-NLS-1$

    panelMediaInformation = new MovieMediaInformationPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.mediainformation"),
        null,
        panelMediaInformation,
        null); //$NON-NLS-1$

    panelMediaFiles = new MovieMediaFilesPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.mediafiles"), null, panelMediaFiles, null); // $NON-NLS-1$

    final List<MediaFile> mediaFiles = new ArrayList<MediaFile>();
    final ImagePanel panelArtwork = new ImagePanel(mediaFiles);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.artwork"), null, panelArtwork, null); // $NON-NLS-1$

    panelMovieTrailer = new MovieTrailerPanel(movieSelectionModel);
    tabbedPaneMovieDetails.addTab(
        BUNDLE.getString("metatag.trailer"), null, panelMovieTrailer, null); // $NON-NLS-1$

    // beansbinding init
    initDataBindings();

    // manual coded binding
    PropertyChangeListener propertyChangeListener =
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            String property = propertyChangeEvent.getPropertyName();
            Object source = propertyChangeEvent.getSource();
            // react on selection of a movie and change of a movie
            if (source instanceof MovieSelectionModel
                || (source instanceof Movie && MEDIA_FILES.equals(property))) {
              Movie movie = null;
              if (source instanceof MovieSelectionModel) {
                movie = ((MovieSelectionModel) source).getSelectedMovie();
              }
              if (source instanceof Movie) {
                movie = (Movie) source;
              }

              if (movie != null) {
                if (movie.getTop250() > 0) {
                  lblTop250.setText("Top 250: #" + movie.getTop250());
                } else {
                  lblTop250.setText("");
                }
                lblMovieBackground.setImagePath(movie.getArtworkFilename(MediaFileType.FANART));
                lblMoviePoster.setImagePath(movie.getArtworkFilename(MediaFileType.POSTER));

                synchronized (mediaFiles) {
                  mediaFiles.clear();
                  for (MediaFile mediafile : movie.getMediaFiles()) {
                    if (mediafile.isGraphic()) {
                      mediaFiles.add(mediafile);
                    }
                  }
                  panelArtwork.rebuildPanel();
                }
              }
            }
            if ((source.getClass() == Movie.class && FANART.equals(property))) {
              Movie movie = (Movie) source;
              lblMovieBackground.clearImage();
              lblMovieBackground.setImagePath(movie.getArtworkFilename(MediaFileType.FANART));
            }
            if ((source.getClass() == Movie.class && POSTER.equals(property))) {
              Movie movie = (Movie) source;
              lblMoviePoster.clearImage();
              lblMoviePoster.setImagePath(movie.getArtworkFilename(MediaFileType.POSTER));
            }
            if ((source.getClass() == Movie.class && TOP250.equals(property))) {
              Movie movie = (Movie) source;
              if (movie.getTop250() > 0) {
                lblTop250.setText(
                    BUNDLE.getString("metatag.top250") + ": #" + movie.getTop250()); // $NON-NLS-1$
              } else {
                lblTop250.setText("");
              }
            }
          }
        };

    movieSelectionModel.addPropertyChangeListener(propertyChangeListener);
  }
示例#25
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    decompilePanel = new JPanel();
    jScrollPane2 = new JScrollPane();
    sourcePane = new JTextPane();
    jMenuBar1 = new JMenuBar();
    jMenu2 = new JMenu();
    savaAsMenuItem = new JMenuItem();
    CtrlCMenuItem = new JMenuItem();

    setName("decompileFrame"); // NOI18N
    getContentPane().setLayout(new java.awt.GridBagLayout());

    decompilePanel.setLayout(new java.awt.GridBagLayout());

    sourcePane.setContentType("text/html");
    sourcePane.setEditable(false);
    sourcePane.setDisabledTextColor(new java.awt.Color(0, 0, 0));
    sourcePane.setEnabled(false);
    jScrollPane2.setViewportView(sourcePane);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    decompilePanel.add(jScrollPane2, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    getContentPane().add(decompilePanel, gridBagConstraints);

    jMenu2.setText("Edit");

    savaAsMenuItem.setText("Save as...");
    savaAsMenuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveAsMenuItemActionPerformed(evt);
          }
        });
    jMenu2.add(savaAsMenuItem);

    CtrlCMenuItem.setText("Copy All to Clipboard");
    CtrlCMenuItem.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            CtrlCMenuItemActionPerformed(evt);
          }
        });
    jMenu2.add(CtrlCMenuItem);

    jMenuBar1.add(jMenu2);

    setJMenuBar(jMenuBar1);

    pack();
  }
示例#26
0
  /**
   * Returns a JPanel that represents the mancala board using strategy pattern to insert style.
   *
   * @param strat concrete strategy
   * @return JPanel containing both users' pits as controllers
   */
  public JPanel boardContextDoWork(Strategy strat) {
    this.s = strat;
    Color boardColor = s.getBoardColor();
    Color fontColor = s.getFontColor();
    Font font = s.getFont();
    JPanel panCenter = new JPanel();
    JPanel panLeft = new JPanel();
    JPanel panRight = new JPanel();

    panCenter.setLayout(new GridLayout(2, 6, 10, 10));
    // B6 to B1 Controllers
    for (int i = 12; i > 6; i--) {
      final Pits temp = new Pits(i);
      final int pit = i;
      final JLabel tempLabel = new JLabel(temp);
      tempLabel.addMouseListener(
          new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
              if (Model.player == 1) {
                JFrame frame = new JFrame();
                JOptionPane.showMessageDialog(frame, "Player A's turn!");
              } else if (model.data[pit] == 0) {
                JFrame frame = new JFrame();
                JOptionPane.showMessageDialog(frame, "Pit is Empty try another one.");
              } else {
                if (temp.pitShape.contains(e.getPoint())) {
                  model.move(pit); // mutator
                  undoBtn.setText("Undo : " + model.getUndoCounter());
                  model.display();
                }
              }
            }
          });
      JPanel tempPanel = new JPanel(new BorderLayout());

      JTextPane textPane = new JTextPane();
      textPane.setEditable(false);
      textPane.setBackground(boardColor);
      textPane.setForeground(fontColor);
      textPane.setFont(font);
      textPane.setText("B" + (i - 6));
      StyledDocument doc = textPane.getStyledDocument();
      SimpleAttributeSet center = new SimpleAttributeSet();
      StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
      doc.setParagraphAttributes(0, doc.getLength(), center, false);
      tempPanel.add(textPane, BorderLayout.NORTH);
      tempPanel.add(tempLabel, BorderLayout.SOUTH);
      panCenter.add(tempPanel, BorderLayout.SOUTH);

      tempPanel.setBackground(boardColor);
    }
    // A1 to A6 Controllers
    for (int i = 0; i < 6; i++) {
      final Pits newPits = new Pits(i);
      JLabel label = new JLabel(newPits);
      final int pit = i;
      label.addMouseListener(
          new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
              if (Model.player == 2) {
                JFrame frame = new JFrame();
                JOptionPane.showMessageDialog(frame, "Player B's turn!");
              } else if (model.data[pit] == 0) {
                JFrame frame = new JFrame();
                JOptionPane.showMessageDialog(frame, "Pit is Empty try another one.");
              } else {
                if (newPits.pitShape.contains(e.getPoint())) {
                  model.move(pit); // mutator
                  undoBtn.setText("Undo : " + model.getUndoCounter());
                  model.display();
                }
              }
            }
          });
      JPanel tempPanel = new JPanel(new BorderLayout());

      tempPanel.add(label, BorderLayout.NORTH);
      JTextPane textPane = new JTextPane();
      textPane.setBackground(boardColor);
      textPane.setForeground(fontColor);
      textPane.setFont(font);
      textPane.setEditable(false);
      textPane.setText("A" + (i + 1));
      StyledDocument doc = textPane.getStyledDocument();
      SimpleAttributeSet center = new SimpleAttributeSet();
      StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
      doc.setParagraphAttributes(0, doc.getLength(), center, false);
      tempPanel.add(textPane, BorderLayout.SOUTH);
      tempPanel.setBackground(boardColor);
      panCenter.add(tempPanel, BorderLayout.SOUTH);
    }

    // left text pane
    JTextPane paneLeft = new JTextPane();
    paneLeft.setBackground(boardColor);
    paneLeft.setForeground(fontColor);
    paneLeft.setFont(font);
    paneLeft.setEditable(false);
    paneLeft.setText("M\nA\nN\nC\nA\nL\nA\n \nB");

    // right text pane
    JTextPane paneRight = new JTextPane();
    paneRight.setBackground(boardColor);
    paneRight.setForeground(fontColor);
    paneRight.setFont(font);
    paneRight.setEditable(false);
    paneRight.setText("M\nA\nN\nC\nA\nL\nA\n \nA");

    // Add text panes to left and right panels
    panLeft.setLayout(new BorderLayout());
    panRight.setLayout(new BorderLayout());
    panLeft.add(paneLeft, BorderLayout.WEST);
    panRight.add(paneRight, BorderLayout.EAST);
    panLeft.add(new JLabel(new Pits(13)), BorderLayout.EAST);
    panRight.add(new JLabel(new Pits(6)), BorderLayout.WEST);

    // add the 2 mancala panels and pit panel to larger displayPanel
    JPanel displayPanel = new JPanel();
    displayPanel.add(panLeft, BorderLayout.WEST);
    displayPanel.add(panCenter, BorderLayout.CENTER);
    displayPanel.add(panRight, BorderLayout.EAST);

    // set color
    panCenter.setBackground(boardColor);
    panLeft.setBackground(boardColor);
    panRight.setBackground(boardColor);
    displayPanel.setBackground(boardColor);

    // return display panel which contains the containers and elements created
    return displayPanel;
  }
示例#27
0
 private JTextPane makeTextPane(boolean editable) {
   document = new DefaultStyledDocument();
   JTextPane ta = new JTextPane(document);
   ta.setEditable(editable);
   return ta;
 }
示例#28
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame("SkAppA");
    frame.setBounds(100, 100, 750, 400);
    frame.setResizable(false);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    /*  */
    ImageIcon imIcon = new ImageIcon(this.getClass().getClassLoader().getResource("res/logo.png"));
    // ImageIcon imIcon = new ImageIcon("C:\\Users\\davem\\workspace\\Skappa\\res\\logo.png");
    Image image = imIcon.getImage();
    Image newImage = image.getScaledInstance(120, 120, Image.SCALE_SMOOTH);
    imIcon = new ImageIcon(newImage);
    frame.getContentPane().setLayout(new CardLayout(0, 0));

    panelIniziale = new JPanel();
    frame.getContentPane().add(panelIniziale, "name_10245570710976");
    panelIniziale.setLayout(new BorderLayout(0, 0));

    JPanel panel = new JPanel();
    panelIniziale.add(panel, BorderLayout.SOUTH);
    panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    JPanel panelInviaMail = new JPanel();
    frame.getContentPane().add(panelInviaMail, "name_74765522122111");
    frame.setBounds(100, 100, 750, 400);
    panelInviaMail.setLayout(new BorderLayout(0, 0));

    JPanel panel_6 = new JPanel();
    panelInviaMail.add(panel_6, BorderLayout.CENTER);
    GridBagLayout gbl_panel_6 = new GridBagLayout();
    gbl_panel_6.columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    gbl_panel_6.rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    gbl_panel_6.columnWeights =
        new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    gbl_panel_6.rowWeights =
        new double[] {
          0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE
        };
    panel_6.setLayout(gbl_panel_6);

    JLabel lblIndirizzoEmail = new JLabel("Indirizzo email");
    GridBagConstraints gbc_lblIndirizzoEmail = new GridBagConstraints();
    gbc_lblIndirizzoEmail.insets = new Insets(0, 0, 5, 5);
    gbc_lblIndirizzoEmail.gridx = 3;
    gbc_lblIndirizzoEmail.gridy = 1;
    panel_6.add(lblIndirizzoEmail, gbc_lblIndirizzoEmail);

    textFieldEmail = new JTextField();
    GridBagConstraints gbc_textFieldEmail = new GridBagConstraints();
    gbc_textFieldEmail.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldEmail.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldEmail.gridx = 5;
    gbc_textFieldEmail.gridy = 1;
    panel_6.add(textFieldEmail, gbc_textFieldEmail);
    textFieldEmail.setColumns(10);

    JLabel lblUsername = new JLabel("Username");
    GridBagConstraints gbc_lblUsername = new GridBagConstraints();
    gbc_lblUsername.insets = new Insets(0, 0, 5, 5);
    gbc_lblUsername.gridx = 3;
    gbc_lblUsername.gridy = 3;
    panel_6.add(lblUsername, gbc_lblUsername);

    textFieldUsername = new JTextField();
    GridBagConstraints gbc_textFieldUsername = new GridBagConstraints();
    gbc_textFieldUsername.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldUsername.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldUsername.gridx = 5;
    gbc_textFieldUsername.gridy = 3;
    panel_6.add(textFieldUsername, gbc_textFieldUsername);
    textFieldUsername.setColumns(10);

    JLabel lblPassword = new JLabel("Password");
    GridBagConstraints gbc_lblPassword = new GridBagConstraints();
    gbc_lblPassword.insets = new Insets(0, 0, 5, 5);
    gbc_lblPassword.gridx = 3;
    gbc_lblPassword.gridy = 5;
    panel_6.add(lblPassword, gbc_lblPassword);

    passwordField = new JPasswordField();
    GridBagConstraints gbc_passwordField = new GridBagConstraints();
    gbc_passwordField.insets = new Insets(0, 0, 5, 5);
    gbc_passwordField.fill = GridBagConstraints.HORIZONTAL;
    gbc_passwordField.gridx = 5;
    gbc_passwordField.gridy = 5;
    panel_6.add(passwordField, gbc_passwordField);

    JLabel lblIndirizzoServerSmtp = new JLabel("Indirizzo server smtp");
    GridBagConstraints gbc_lblIndirizzoServerSmtp = new GridBagConstraints();
    gbc_lblIndirizzoServerSmtp.insets = new Insets(0, 0, 5, 5);
    gbc_lblIndirizzoServerSmtp.gridx = 3;
    gbc_lblIndirizzoServerSmtp.gridy = 7;
    panel_6.add(lblIndirizzoServerSmtp, gbc_lblIndirizzoServerSmtp);

    textFieldSMTP = new JTextField();
    GridBagConstraints gbc_textFieldSMTP = new GridBagConstraints();
    gbc_textFieldSMTP.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldSMTP.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldSMTP.gridx = 5;
    gbc_textFieldSMTP.gridy = 7;
    panel_6.add(textFieldSMTP, gbc_textFieldSMTP);
    textFieldSMTP.setColumns(10);

    JLabel lblPortaServerSmtp = new JLabel("Porta server smtp");
    GridBagConstraints gbc_lblPortaServerSmtp = new GridBagConstraints();
    gbc_lblPortaServerSmtp.insets = new Insets(0, 0, 5, 5);
    gbc_lblPortaServerSmtp.gridx = 3;
    gbc_lblPortaServerSmtp.gridy = 9;
    panel_6.add(lblPortaServerSmtp, gbc_lblPortaServerSmtp);

    textFieldSMTPPort = new JTextField();
    GridBagConstraints gbc_textFieldSMTPPort = new GridBagConstraints();
    gbc_textFieldSMTPPort.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldSMTPPort.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldSMTPPort.gridx = 5;
    gbc_textFieldSMTPPort.gridy = 9;
    panel_6.add(textFieldSMTPPort, gbc_textFieldSMTPPort);
    textFieldSMTPPort.setColumns(10);

    progressBar = new JProgressBar();
    GridBagConstraints gbc_progressBar = new GridBagConstraints();
    gbc_progressBar.fill = GridBagConstraints.HORIZONTAL;
    gbc_progressBar.insets = new Insets(0, 0, 5, 5);
    gbc_progressBar.gridx = 5;
    gbc_progressBar.gridy = 11;
    panel_6.add(progressBar, gbc_progressBar);
    progressBar.setVisible(false);

    JPanel panel_7 = new JPanel();
    panelInviaMail.add(panel_7, BorderLayout.NORTH);

    JLabel lblInserisciCredenziali = new JLabel("Inserisci credenziali");
    lblInserisciCredenziali.setFont(new Font("Tahoma", Font.PLAIN, 18));
    panel_7.add(lblInserisciCredenziali);

    JPanel panel_8 = new JPanel();
    panelInviaMail.add(panel_8, BorderLayout.SOUTH);

    btnNewButton_5 = new JButton("Invia");
    btnNewButton_5.setPreferredSize(new Dimension(70, 25));
    btnNewButton_5.addActionListener(this);

    panel_8.add(btnNewButton_5);

    JButton btnNewButton_6 = new JButton("Annulla");
    btnNewButton_6.setPreferredSize(new Dimension(70, 25));
    btnNewButton_6.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            panelInviaMail.setVisible(false);
            panelCreaEvento.setVisible(true);
            frame.setBounds(100, 100, 750, 400);
          }
        });
    panel_8.add(btnNewButton_6);

    JButton btnNewButton = new JButton("Crea evento");
    btnNewButton.setPreferredSize(new Dimension(150, 30));
    btnNewButton.setMinimumSize(new Dimension(150, 30));
    btnNewButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            panelCreaEvento.setVisible(true);
            panelIniziale.setVisible(false);
            // frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
            frame.setBounds(100, 100, 750, 400);
          }
        });
    panel.add(btnNewButton);

    JButton btnNewButton_1 = new JButton("Carica partecipanti");
    btnNewButton_1.setPreferredSize(new Dimension(150, 30));
    btnNewButton_1.setMinimumSize(new Dimension(150, 30));
    btnNewButton_1.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            panelCaricaPartecipanti.setVisible(true);
            panelIniziale.setVisible(false);
          }
        });
    panel.add(btnNewButton_1);

    JPanel panel_1 = new JPanel();
    panelIniziale.add(panel_1, BorderLayout.CENTER);
    SimpleAttributeSet attribs = new SimpleAttributeSet();
    StyleConstants.setAlignment(attribs, StyleConstants.ALIGN_CENTER);
    JTextPane txtpnSelezionaLaModalit = new JTextPane();
    txtpnSelezionaLaModalit.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    txtpnSelezionaLaModalit.setEnabled(false);
    txtpnSelezionaLaModalit.setEditable(false);
    txtpnSelezionaLaModalit.setFont(new Font("Tahoma", Font.PLAIN, 16));
    txtpnSelezionaLaModalit.setText("Seleziona la modalit\u00E0");
    txtpnSelezionaLaModalit.setParagraphAttributes(attribs, true);
    panel_1.setLayout(new BoxLayout(panel_1, BoxLayout.X_AXIS));
    panel_1.add(txtpnSelezionaLaModalit);

    JPanel panel_2 = new JPanel();
    panelIniziale.add(panel_2, BorderLayout.NORTH);

    JLabel lblLogo = new JLabel("");
    lblLogo.setIcon(imIcon);
    panel_2.add(lblLogo);

    panelCreaEvento = new JPanel();
    frame.getContentPane().add(panelCreaEvento, "name_10426205657299");

    JPanel panel_5 = new JPanel();

    JPanel panel_3 = new JPanel();
    panelCreaEvento.setLayout(new BorderLayout(0, 0));
    panelCreaEvento.add(panel_5);
    GridBagLayout gbl_panel_5 = new GridBagLayout();
    gbl_panel_5.columnWidths =
        new int[] {64, 66, 67, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 81, 48, 43, 55, 0};
    gbl_panel_5.rowHeights = new int[] {0, 0, 30, 20, 35, 20, 35, 20, 0, 0};
    gbl_panel_5.columnWeights =
        new double[] {
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          1.0,
          0.0,
          1.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
          Double.MIN_VALUE
        };
    gbl_panel_5.rowWeights =
        new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    panel_5.setLayout(gbl_panel_5);

    Component verticalStrut_1 = Box.createVerticalStrut(20);
    GridBagConstraints gbc_verticalStrut_1 = new GridBagConstraints();
    gbc_verticalStrut_1.insets = new Insets(0, 0, 5, 5);
    gbc_verticalStrut_1.gridx = 13;
    gbc_verticalStrut_1.gridy = 0;
    panel_5.add(verticalStrut_1, gbc_verticalStrut_1);

    Component verticalStrut_2 = Box.createVerticalStrut(20);
    GridBagConstraints gbc_verticalStrut_2 = new GridBagConstraints();
    gbc_verticalStrut_2.insets = new Insets(0, 0, 5, 5);
    gbc_verticalStrut_2.gridx = 13;
    gbc_verticalStrut_2.gridy = 1;
    panel_5.add(verticalStrut_2, gbc_verticalStrut_2);

    JLabel lblInserisciDatiEvento = new JLabel("Inserisci dati evento");
    lblInserisciDatiEvento.setFont(new Font("Tahoma", Font.PLAIN, 18));
    GridBagConstraints gbc_lblInserisciDatiEvento = new GridBagConstraints();
    gbc_lblInserisciDatiEvento.gridwidth = 2;
    gbc_lblInserisciDatiEvento.insets = new Insets(0, 0, 5, 5);
    gbc_lblInserisciDatiEvento.gridx = 1;
    gbc_lblInserisciDatiEvento.gridy = 2;
    panel_5.add(lblInserisciDatiEvento, gbc_lblInserisciDatiEvento);

    JLabel lblNomeEvento = new JLabel("Nome evento");
    lblNomeEvento.setFont(new Font("Tahoma", Font.PLAIN, 13));
    GridBagConstraints gbc_lblNomeEvento = new GridBagConstraints();
    gbc_lblNomeEvento.gridwidth = 2;
    gbc_lblNomeEvento.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblNomeEvento.insets = new Insets(0, 0, 5, 5);
    gbc_lblNomeEvento.gridx = 1;
    gbc_lblNomeEvento.gridy = 3;
    panel_5.add(lblNomeEvento, gbc_lblNomeEvento);

    textFieldNome = new JTextField();
    textFieldNome.setColumns(10);
    GridBagConstraints gbc_textFieldNome = new GridBagConstraints();
    gbc_textFieldNome.anchor = GridBagConstraints.NORTH;
    gbc_textFieldNome.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldNome.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldNome.gridwidth = 5;
    gbc_textFieldNome.gridx = 3;
    gbc_textFieldNome.gridy = 3;
    panel_5.add(textFieldNome, gbc_textFieldNome);

    JLabel lblLuogoEvento = new JLabel("Luogo evento");
    lblLuogoEvento.setFont(new Font("Tahoma", Font.PLAIN, 13));
    GridBagConstraints gbc_lblLuogoEvento = new GridBagConstraints();
    gbc_lblLuogoEvento.gridwidth = 2;
    gbc_lblLuogoEvento.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblLuogoEvento.insets = new Insets(0, 0, 5, 5);
    gbc_lblLuogoEvento.gridx = 1;
    gbc_lblLuogoEvento.gridy = 5;
    panel_5.add(lblLuogoEvento, gbc_lblLuogoEvento);

    textFieldLuogo = new JTextField();
    textFieldLuogo.setColumns(10);
    GridBagConstraints gbc_textFieldLuogo = new GridBagConstraints();
    gbc_textFieldLuogo.anchor = GridBagConstraints.NORTH;
    gbc_textFieldLuogo.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldLuogo.insets = new Insets(0, 0, 5, 5);
    gbc_textFieldLuogo.gridwidth = 5;
    gbc_textFieldLuogo.gridx = 3;
    gbc_textFieldLuogo.gridy = 5;
    panel_5.add(textFieldLuogo, gbc_textFieldLuogo);

    JLabel lblProvincia = new JLabel("Provincia");
    GridBagConstraints gbc_lblProvincia = new GridBagConstraints();
    gbc_lblProvincia.anchor = GridBagConstraints.WEST;
    gbc_lblProvincia.insets = new Insets(0, 0, 5, 5);
    gbc_lblProvincia.gridx = 9;
    gbc_lblProvincia.gridy = 5;
    panel_5.add(lblProvincia, gbc_lblProvincia);

    JComboBox comboBoxProvincia = new JComboBox(provinceArray);
    GridBagConstraints gbc_comboBoxProvincia = new GridBagConstraints();
    gbc_comboBoxProvincia.anchor = GridBagConstraints.NORTHWEST;
    gbc_comboBoxProvincia.insets = new Insets(0, 0, 5, 5);
    gbc_comboBoxProvincia.gridx = 10;
    gbc_comboBoxProvincia.gridy = 5;
    panel_5.add(comboBoxProvincia, gbc_comboBoxProvincia);

    JLabel lblDataEvento = new JLabel("Data evento");
    lblDataEvento.setFont(new Font("Tahoma", Font.PLAIN, 13));
    GridBagConstraints gbc_lblDataEvento = new GridBagConstraints();
    gbc_lblDataEvento.gridwidth = 2;
    gbc_lblDataEvento.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblDataEvento.insets = new Insets(0, 0, 0, 5);
    gbc_lblDataEvento.gridx = 1;
    gbc_lblDataEvento.gridy = 7;
    panel_5.add(lblDataEvento, gbc_lblDataEvento);

    JComboBox comboBoxGiorno = new JComboBox(giorniArray);
    GridBagConstraints gbc_comboBoxGiorno = new GridBagConstraints();
    gbc_comboBoxGiorno.anchor = GridBagConstraints.NORTHWEST;
    gbc_comboBoxGiorno.insets = new Insets(0, 0, 0, 5);
    gbc_comboBoxGiorno.gridx = 3;
    gbc_comboBoxGiorno.gridy = 7;
    panel_5.add(comboBoxGiorno, gbc_comboBoxGiorno);

    JComboBox comboBoxMese = new JComboBox(mesiArray);
    GridBagConstraints gbc_comboBoxMese = new GridBagConstraints();
    gbc_comboBoxMese.anchor = GridBagConstraints.NORTHWEST;
    gbc_comboBoxMese.insets = new Insets(0, 0, 0, 5);
    gbc_comboBoxMese.gridx = 4;
    gbc_comboBoxMese.gridy = 7;
    panel_5.add(comboBoxMese, gbc_comboBoxMese);

    JComboBox comboBoxAnno = new JComboBox(anniArray);
    GridBagConstraints gbc_comboBoxAnno = new GridBagConstraints();
    gbc_comboBoxAnno.insets = new Insets(0, 0, 0, 5);
    gbc_comboBoxAnno.anchor = GridBagConstraints.NORTHEAST;
    gbc_comboBoxAnno.gridx = 5;
    gbc_comboBoxAnno.gridy = 7;
    panel_5.add(comboBoxAnno, gbc_comboBoxAnno);

    JLabel lblOra = new JLabel("Ora");
    GridBagConstraints gbc_lblOra = new GridBagConstraints();
    gbc_lblOra.anchor = GridBagConstraints.EAST;
    gbc_lblOra.insets = new Insets(0, 0, 0, 5);
    gbc_lblOra.gridx = 8;
    gbc_lblOra.gridy = 7;
    panel_5.add(lblOra, gbc_lblOra);

    JComboBox comboBoxOre = new JComboBox(oreArray);
    GridBagConstraints gbc_comboBox_1 = new GridBagConstraints();
    gbc_comboBox_1.insets = new Insets(0, 0, 0, 5);
    gbc_comboBox_1.fill = GridBagConstraints.HORIZONTAL;
    gbc_comboBox_1.gridx = 10;
    gbc_comboBox_1.gridy = 7;
    panel_5.add(comboBoxOre, gbc_comboBox_1);

    JComboBox comboBoxMinuti = new JComboBox(minutiArray);
    GridBagConstraints gbc_comboBox_2 = new GridBagConstraints();
    gbc_comboBox_2.insets = new Insets(0, 0, 0, 5);
    gbc_comboBox_2.fill = GridBagConstraints.HORIZONTAL;
    gbc_comboBox_2.gridx = 12;
    gbc_comboBox_2.gridy = 7;
    panel_5.add(comboBoxMinuti, gbc_comboBox_2);
    panelCreaEvento.add(panel_3, BorderLayout.NORTH);
    GridBagLayout gbl_panel_3 = new GridBagLayout();
    gbl_panel_3.columnWidths = new int[] {0, 0, 0, 200, 0, 227, 77, 0, 0, 0};
    gbl_panel_3.rowHeights = new int[] {0, 0, 23, 0};
    gbl_panel_3.columnWeights =
        new double[] {0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, Double.MIN_VALUE};
    gbl_panel_3.rowWeights = new double[] {0.0, 0.0, 0.0, Double.MIN_VALUE};
    panel_3.setLayout(gbl_panel_3);

    Component verticalStrut = Box.createVerticalStrut(20);
    GridBagConstraints gbc_verticalStrut = new GridBagConstraints();
    gbc_verticalStrut.insets = new Insets(0, 0, 5, 5);
    gbc_verticalStrut.gridx = 6;
    gbc_verticalStrut.gridy = 0;
    panel_3.add(verticalStrut, gbc_verticalStrut);

    JLabel lblInserisciPercorsoFile = new JLabel("Inserisci percorso file nominativi");
    GridBagConstraints gbc_lblInserisciPercorsoFile = new GridBagConstraints();
    gbc_lblInserisciPercorsoFile.insets = new Insets(0, 0, 5, 5);
    gbc_lblInserisciPercorsoFile.gridx = 3;
    gbc_lblInserisciPercorsoFile.gridy = 1;
    panel_3.add(lblInserisciPercorsoFile, gbc_lblInserisciPercorsoFile);

    textField = new JTextField();
    textField.setPreferredSize(new Dimension(6, 25));
    textField.setColumns(10);
    GridBagConstraints gbc_textField = new GridBagConstraints();
    gbc_textField.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField.insets = new Insets(0, 0, 5, 5);
    gbc_textField.gridx = 5;
    gbc_textField.gridy = 1;
    panel_3.add(textField, gbc_textField);

    JButton btnNewButton_2 = new JButton("Apri...");
    btnNewButton_2.setPreferredSize(new Dimension(135, 25));
    btnNewButton_2.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent arg0) {
            JFileChooser chooser = new JFileChooser();
            chooser.setCurrentDirectory(new java.io.File("."));
            chooser.setDialogTitle("Choose the folder");
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
              System.out.println("getCurrentDirectory(): " + chooser.getSelectedFile());
              file = chooser.getSelectedFile();
              inputFilePath = file.getAbsolutePath();
              textField.setText(inputFilePath);
            }
          }
        });
    GridBagConstraints gbc_btnNewButton_2 = new GridBagConstraints();
    gbc_btnNewButton_2.insets = new Insets(0, 0, 5, 5);
    gbc_btnNewButton_2.fill = GridBagConstraints.HORIZONTAL;
    gbc_btnNewButton_2.gridx = 6;
    gbc_btnNewButton_2.gridy = 1;
    panel_3.add(btnNewButton_2, gbc_btnNewButton_2);

    Component horizontalStrut = Box.createHorizontalStrut(20);
    GridBagConstraints gbc_horizontalStrut = new GridBagConstraints();
    gbc_horizontalStrut.insets = new Insets(0, 0, 0, 5);
    gbc_horizontalStrut.gridx = 2;
    gbc_horizontalStrut.gridy = 2;
    panel_3.add(horizontalStrut, gbc_horizontalStrut);

    Component horizontalStrut_1 = Box.createHorizontalStrut(20);
    GridBagConstraints gbc_horizontalStrut_1 = new GridBagConstraints();
    gbc_horizontalStrut_1.insets = new Insets(0, 0, 0, 5);
    gbc_horizontalStrut_1.gridx = 7;
    gbc_horizontalStrut_1.gridy = 2;
    panel_3.add(horizontalStrut_1, gbc_horizontalStrut_1);

    JPanel panel_4 = new JPanel();
    panelCreaEvento.add(panel_4, BorderLayout.SOUTH);

    JButton btnNewButton_3 = new JButton("Crea evento");
    btnNewButton_3.setPreferredSize(new Dimension(95, 25));
    btnNewButton_3.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {

            int giorno = Integer.parseInt((String) comboBoxGiorno.getSelectedItem());
            int mese = comboBoxMese.getSelectedIndex();
            int anno = Integer.parseInt((String) comboBoxAnno.getSelectedItem());
            int ore = Integer.parseInt((String) comboBoxOre.getSelectedItem());
            int minuti = Integer.parseInt((String) comboBoxMinuti.getSelectedItem());
            inputFilePath = textField.getText();
            file = new File(inputFilePath);

            if (!isValidDate(giorno, mese, anno)) {
              JOptionPane.showMessageDialog(
                  frame, "Data non corretta.", "Errore", JOptionPane.ERROR_MESSAGE);
            } else if (!extensionIs("xlsx", file)) {
              JOptionPane.showMessageDialog(
                  frame, "Formato file non corretto.", "Errore", JOptionPane.ERROR_MESSAGE);
            } else {
              inputFilePath = textField.getText();
              /*try {
                  l = Loader.generateList(inputFilePath);
              } catch (Exception e) {
                  JOptionPane.showMessageDialog(frame, "Errore nel file di input.", "Errore", JOptionPane.ERROR_MESSAGE);
              }*/

              evento =
                  new Event(
                      textFieldNome.getText(),
                      textFieldLuogo.getText(),
                      (String) comboBoxProvincia.getSelectedItem(),
                      new GregorianCalendar(anno, mese, giorno, ore, minuti),
                      l);
              frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
              try {
                evento.generateList(inputFilePath);
              } catch (Exception e) {
                e.printStackTrace();
                JOptionPane.showMessageDialog(
                    frame, "Errore nel file di output.", "Errore", JOptionPane.ERROR_MESSAGE);
              }

              evento.toString();
              File dir = new File(inputFilePath);
              evento.assignQR(dir.getParent());

              frame.setCursor(null);

              frame.setBounds(100, 100, 750, 400);
              panelCreaEvento.setVisible(false);
              panelInviaMail.setVisible(true);
            }
          }
        });
    panel_4.add(btnNewButton_3);

    JButton btnNewButton_4 = new JButton("Indietro");
    btnNewButton_4.setPreferredSize(new Dimension(95, 25));
    btnNewButton_4.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            panelCreaEvento.setVisible(false);
            panelIniziale.setVisible(true);
          }
        });
    panel_4.add(btnNewButton_4);

    panelCaricaPartecipanti = new JPanel();
    frame.getContentPane().add(panelCaricaPartecipanti, "name_80084471932092");
    panelCaricaPartecipanti.setLayout(new BorderLayout(0, 0));

    JPanel panel_9 = new JPanel();
    panelCaricaPartecipanti.add(panel_9);
    GridBagLayout gbl_panel_9 = new GridBagLayout();
    gbl_panel_9.columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0, 0};
    gbl_panel_9.rowHeights = new int[] {0, 0, 0, 0, 0, 0};
    gbl_panel_9.columnWeights = new double[] {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    gbl_panel_9.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    panel_9.setLayout(gbl_panel_9);

    JLabel lblInserisciFileExcel = new JLabel("Inserisci file Excel di output");
    GridBagConstraints gbc_lblInserisciFileExcel = new GridBagConstraints();
    gbc_lblInserisciFileExcel.insets = new Insets(0, 0, 5, 5);
    gbc_lblInserisciFileExcel.gridx = 2;
    gbc_lblInserisciFileExcel.gridy = 2;
    panel_9.add(lblInserisciFileExcel, gbc_lblInserisciFileExcel);

    textField_1 = new JTextField();
    GridBagConstraints gbc_textField_1 = new GridBagConstraints();
    gbc_textField_1.insets = new Insets(0, 0, 5, 5);
    gbc_textField_1.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField_1.gridx = 3;
    gbc_textField_1.gridy = 2;
    panel_9.add(textField_1, gbc_textField_1);
    textField_1.setColumns(10);

    JButton btnNewButton_7 = new JButton("Scegli file...");
    btnNewButton_7.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            chooser.setCurrentDirectory(new java.io.File("."));
            chooser.setDialogTitle("Choose the folder");
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
              System.out.println("getCurrentDirectory(): " + chooser.getSelectedFile());
              file = chooser.getSelectedFile();
              excelOutputFilePath = file.getAbsolutePath();
              textField_1.setText(excelOutputFilePath);
            }
          }
        });
    GridBagConstraints gbc_btnNewButton_7 = new GridBagConstraints();
    gbc_btnNewButton_7.insets = new Insets(0, 0, 5, 5);
    gbc_btnNewButton_7.gridx = 5;
    gbc_btnNewButton_7.gridy = 2;
    panel_9.add(btnNewButton_7, gbc_btnNewButton_7);

    JLabel lblInserisciFileDelle = new JLabel("Inserisci file delle scansioni");
    GridBagConstraints gbc_lblInserisciFileDelle = new GridBagConstraints();
    gbc_lblInserisciFileDelle.insets = new Insets(0, 0, 0, 5);
    gbc_lblInserisciFileDelle.gridx = 2;
    gbc_lblInserisciFileDelle.gridy = 4;
    panel_9.add(lblInserisciFileDelle, gbc_lblInserisciFileDelle);

    textField_2 = new JTextField();
    GridBagConstraints gbc_textField_2 = new GridBagConstraints();
    gbc_textField_2.insets = new Insets(0, 0, 0, 5);
    gbc_textField_2.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField_2.gridx = 3;
    gbc_textField_2.gridy = 4;
    panel_9.add(textField_2, gbc_textField_2);
    textField_2.setColumns(10);

    JButton btnNewButton_8 = new JButton("Scegli file...");
    btnNewButton_8.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            chooser.setCurrentDirectory(new java.io.File("."));
            chooser.setDialogTitle("Choose the folder");
            chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
              System.out.println("getCurrentDirectory(): " + chooser.getSelectedFile());
              file = chooser.getSelectedFile();
              txtOutputFilePath = file.getAbsolutePath();
              textField_2.setText(txtOutputFilePath);
            }
          }
        });
    GridBagConstraints gbc_btnNewButton_8 = new GridBagConstraints();
    gbc_btnNewButton_8.insets = new Insets(0, 0, 0, 5);
    gbc_btnNewButton_8.gridx = 5;
    gbc_btnNewButton_8.gridy = 4;
    panel_9.add(btnNewButton_8, gbc_btnNewButton_8);

    JPanel panel_10 = new JPanel();
    panelCaricaPartecipanti.add(panel_10, BorderLayout.NORTH);

    JPanel panel_11 = new JPanel();
    panelCaricaPartecipanti.add(panel_11, BorderLayout.SOUTH);

    JButton btnNewButton_9 = new JButton("Associa");
    btnNewButton_9.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            txtOutputFilePath = textField_2.getText();
            File f = new File(txtOutputFilePath);
            excelOutputFilePath = textField_1.getText();
            Loader.writeInOut(excelOutputFilePath, Loader.loadParticipants(f));
            JOptionPane.showMessageDialog(
                frame, "Associazione degli orari eseguita!", "", JOptionPane.PLAIN_MESSAGE);
          }
        });
    panel_11.add(btnNewButton_9);

    JButton btnNewButton_10 = new JButton("Annulla");
    panel_11.add(btnNewButton_10);
  }
示例#29
0
  private JPanel createCentrePanel(YDataStateException exception) {
    XMLOutputter xmlOut = new XMLOutputter(Format.getPrettyFormat());
    JPanel centrePanel = new JPanel(new GridLayout(1, 2));

    JPanel schemaPanel = new JPanel(new BorderLayout());
    schemaPanel.setBackground(YAdminGUI._apiColour);
    schemaPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(), "Schema for completing task"),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    JTextPane schemaTextPane = new JTextPane();
    schemaTextPane.setContentType("text/xml");
    schemaTextPane.setFont(new Font("courier", Font.PLAIN, 12));
    String schemaXML = xmlOut.outputString(exception.getSchema());

    /** AJH: Trap various XML format errors gracefully. */
    try {
      String xml =
          schemaXML.substring(schemaXML.indexOf('<'), schemaXML.lastIndexOf("</xsd:schema>") + 13);
      schemaTextPane.setText(xml);
    } catch (Exception e) {
      schemaTextPane.setText(schemaXML);
    }

    schemaTextPane.setEditable(false);
    schemaTextPane.setBackground(Color.LIGHT_GRAY);
    JPanel noWrapPanel = new JPanel();
    noWrapPanel.setLayout(new BorderLayout());
    noWrapPanel.add(schemaTextPane);
    schemaPanel.add(new JScrollPane(noWrapPanel));

    JPanel rightPanel = new JPanel(new GridLayout(2, 1));

    JPanel dataPanel = new JPanel(new BorderLayout());
    dataPanel.setBackground(YAdminGUI._apiColour);
    dataPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(), "The data that failed to validate"),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    JTextPane dataTextPane = new JTextPane();
    dataTextPane.setContentType("text/xml");
    dataTextPane.setFont(new Font("courier", Font.PLAIN, 12));
    String data = xmlOut.outputString(exception.get_dataInput());

    /** AJH: Trap various XML format errors gracefully. */
    try {
      String temp = data.substring(data.lastIndexOf("<?xml"), data.lastIndexOf('>'));
      dataTextPane.setText(temp);
    } catch (Exception e) {
      dataTextPane.setText(data);
    }

    dataTextPane.setEditable(false);
    dataTextPane.setBackground(Color.LIGHT_GRAY);
    JPanel noWrapPanel2 = new JPanel();
    noWrapPanel2.setLayout(new BorderLayout());
    noWrapPanel2.add(dataTextPane);
    dataPanel.add(new JScrollPane(noWrapPanel2));

    JPanel errorPanel = new JPanel(new BorderLayout());
    errorPanel.setBackground(YAdminGUI._apiColour);
    errorPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(), "The error message from validation engine"),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    JTextPane errorTextPane = new JTextPane();
    errorTextPane.setContentType("text/plain");
    errorTextPane.setFont(new Font("courier", Font.PLAIN, 12));

    /** AJH: Trap various XML format errors gracefully. */
    try {
      String error = schemaXML.substring(schemaXML.lastIndexOf("ERRORS ="), schemaXML.length());
      errorTextPane.setText(error);
    } catch (Exception e) {
      // null action !
    }

    errorTextPane.setText(exception.getErrors());

    errorTextPane.setEditable(false);
    errorTextPane.setBackground(Color.LIGHT_GRAY);
    JPanel noWrapPanel3 = new JPanel();
    noWrapPanel3.setLayout(new BorderLayout());
    noWrapPanel3.add(errorTextPane);
    errorPanel.add(new JScrollPane(noWrapPanel3));

    rightPanel.add(dataPanel);
    rightPanel.add(errorPanel);
    centrePanel.add(schemaPanel, BorderLayout.NORTH);
    centrePanel.add(rightPanel, BorderLayout.CENTER);
    return centrePanel;
  }
  About() {
    window = new JWindow();
    this.setPreferredSize(new Dimension(650, 550));
    this.setVisible(true);
    this.setLayout(null);

    JTextPane text = new JTextPane();
    text.setBounds(5, 150, 625, 525);
    text.setVisible(true);
    text.setEditable(false);
    text.setOpaque(false);
    HTMLEditorKit htmlKit =
        new HTMLEditorKit() {
          public Parser getParser() {
            return super.getParser();
          }
        };
    HTMLDocument htmlDoc = new HTMLDocument();
    text.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              if (Desktop.isDesktopSupported()) {
                try {
                  Desktop.getDesktop().browse(e.getURL().toURI());
                  return;
                } catch (IOException e1) {
                } catch (URISyntaxException e1) {
                }
              }
              try {
                Runtime.getRuntime().exec("xdg-open ".concat(e.getURL().toString()));
              } catch (IOException ioex) {
                ControlRoom.log(
                    Level.WARNING,
                    "Failed to show file: '"
                        + e.getURL().toString()
                        + "'. Possible unsupported File Manager...",
                    null);
              }
            }
          }
        });
    text.setEditorKit(htmlKit);
    text.setDocument(htmlDoc);
    try {
      BufferedReader reader =
          new BufferedReader(
              new InputStreamReader(
                  this.getClass().getResourceAsStream("/resources/about.html"), "UTF-8"));
      htmlKit.read(reader, htmlDoc, htmlDoc.getLength());
    } catch (IOException ioex) {
      ControlRoom.log(Level.SEVERE, "Failed to read about.html", ioex);
    } catch (BadLocationException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }

    text.addMouseListener(this);
    window.getContentPane().add(text);
    window.getContentPane().add(this);
    window.addMouseListener(this);
    window.pack();
    ControlRoom.setWindowRelativeToCentral(window);
    window.setVisible(true);
    window.setAlwaysOnTop(true);
  }