public ChatPane createChatPane(String userName) {
    JTextPane chatPane = new JTextPane();
    chatPane.setEditable(false);
    Font font = chatPane.getFont();
    float size = Main.pref.getInteger("geochat.fontsize", -1);
    if (size < 6) size += font.getSize2D();
    chatPane.setFont(font.deriveFont(size));
    //        DefaultCaret caret = (DefaultCaret)chatPane.getCaret(); // does not work
    //        caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    JScrollPane scrollPane =
        new JScrollPane(
            chatPane,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    chatPane.addMouseListener(new GeoChatPopupAdapter(panel));

    ChatPane entry = new ChatPane();
    entry.pane = chatPane;
    entry.component = scrollPane;
    entry.notify = 0;
    entry.userName = userName;
    entry.isPublic = userName == null;
    chatPanes.put(userName == null ? PUBLIC_PANE : userName, entry);

    tabs.addTab(null, scrollPane);
    tabs.setTabComponentAt(tabs.getTabCount() - 1, new ChatTabTitleComponent(entry));
    tabs.setSelectedComponent(scrollPane);
    return entry;
  }
Пример #2
0
  /** Create a colorized diff view. */
  public DiffView() {
    super(VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
    setPreferredSize(new Dimension(800, 600));
    panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    getViewport().setView(panel);

    normal = getStyle(Color.black, false, false, font, fontSize);
    bigBold = getStyle(Color.blue, false, true, font, bigFontSize);
    bold = getStyle(Color.black, false, true, font, fontSize);
    italic = getStyle(Color.black, true, false, font, fontSize);
    red = getStyle(Color.red, false, false, font, fontSize);
    green = getStyle(new Color(0, 128, 32), false, false, font, fontSize);

    textPane = new JTextPane();
    normalCursor = textPane.getCursor();
    handCursor = new Cursor(Cursor.HAND_CURSOR);
    textPane.setEditable(false);
    document = textPane.getStyledDocument();
    panel.add(textPane);

    getVerticalScrollBar().setUnitIncrement(10);

    textPane.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent event) {
            ActionListener action = getAction(event);
            if (action != null) action.actionPerformed(new ActionEvent(DiffView.this, 0, "action"));
          }
        });
  }
  public DisplayArea(final ClassySharkPanel tabPanel) {
    jTextPane = new JTextPane();
    jTextPane.setEditable(false);
    jTextPane.setBackground(ColorScheme.BACKGROUND);

    jTextPane.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (displayDataState == DisplayDataState.SHARKEY
                || displayDataState == DisplayDataState.INFO) {
              return;
            }

            if (e.getButton() != MouseEvent.BUTTON1) {
              return;
            }

            if (e.getClickCount() != 2) {
              return;
            }

            int offset = jTextPane.viewToModel(e.getPoint());

            try {
              int rowStart = Utilities.getRowStart(jTextPane, offset);
              int rowEnd = Utilities.getRowEnd(jTextPane, offset);
              String selectedLine = jTextPane.getText().substring(rowStart, rowEnd);
              System.out.println(selectedLine);

              if (displayDataState == DisplayDataState.CLASSES_LIST) {
                tabPanel.onSelectedClassName(selectedLine);
              } else if (displayDataState == DisplayDataState.INSIDE_CLASS) {
                if (selectedLine.contains("import")) {
                  tabPanel.onSelectedImportFromMouseClick(
                      getClassNameFromImportStatement(selectedLine));
                } else {

                  rowStart = Utilities.getWordStart(jTextPane, offset);
                  rowEnd = Utilities.getWordEnd(jTextPane, offset);
                  String word = jTextPane.getText().substring(rowStart, rowEnd);

                  tabPanel.onSelectedTypeClassFromMouseClick(word);
                }
              }
            } catch (BadLocationException e1) {
              e1.printStackTrace();
            }
          }

          public String getClassNameFromImportStatement(String selectedLine) {
            final String IMPORT = "import ";
            int start = selectedLine.indexOf(IMPORT) + IMPORT.length();
            String result = selectedLine.trim().substring(start, selectedLine.indexOf(";"));
            return result;
          }
        });

    displaySharkey();
  }
Пример #4
0
  public static void addPopupMenu(
      final JTextPane textPane, final DebuggerParserListener debugDelegator) {
    final JPopupMenu menu = new JPopupMenu();
    JMenuItem menuItem = new JMenuItem("Run to this expression");
    menuItem.addActionListener(
        new ThreadSafeActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                final int start = textPane.getDocument().getLength() - textPane.getSelectionStart();
                final int end = textPane.getDocument().getLength() - textPane.getSelectionEnd();

                debugDelegator.runToExpression(start, end);
              }
            }));

    menu.add(menuItem);

    textPane.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent evt) {
            if (evt.isPopupTrigger()) {
              menu.show(evt.getComponent(), evt.getX(), evt.getY());
            }
          }

          public void mouseReleased(MouseEvent evt) {
            if (evt.isPopupTrigger()) {
              menu.show(evt.getComponent(), evt.getX(), evt.getY());
            }
          }
        });
  }
Пример #5
0
  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);
  }
  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);
          }
        });
  }
Пример #7
0
  private void jbInit() throws Exception {
    borderForProjectView = BorderFactory.createLineBorder(Color.black, 2);
    titleBoderForProjectView = new TitledBorder(borderForProjectView, "Project view");
    borderForEntitiesView = BorderFactory.createLineBorder(Color.black, 2);
    titledBorderForEntitiesView = new TitledBorder(borderForEntitiesView, "Entities view");
    titledBorderForMessagesPane =
        new TitledBorder(
            BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)), "Messages");
    this.getContentPane().setLayout(borderLayout2);
    file.setText("File");
    save.setEnabled(false);
    save.setText("Save");
    save.setName("Savefilemenu");
    save.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            save_actionPerformed(e);
          }
        });
    load.setText("Load");
    load.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            load_actionPerformed(e);
          }
        });
    this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    this.setJMenuBar(mainMenuBar);
    this.setTitle("INGENIAS Development Kit");
    this.setSize(625, 470);
    this.addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosed(WindowEvent e) {
            this_windowClosed(e);
          }

          public void windowClosing(WindowEvent e) {
            this_windowClosing(e);
          }
        });
    splitPaneSeparatingProjectsAndEntitiesView.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPaneSeparatingProjectsAndEntitiesView.setBottomComponent(scrollPaneForEntitiesView);
    splitPaneSeparatingProjectsAndEntitiesView.setTopComponent(scrollPaneForProyectView);
    jPanel1.setLayout(gridLayout1);
    arbolObjetos.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            arbolObjetos_mouseClicked(e);
          }
        });
    scrollPaneForProyectView.setAutoscrolls(true);
    scrollPaneForProyectView.setBorder(titleBoderForProjectView);
    scrollPaneForEntitiesView.setBorder(titledBorderForEntitiesView);
    edit.setText("Edit");
    copyImage.setText("Copy diagram as a file");
    copyImage.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            capture_actionPerformed(e);
          }
        });
    saveas.setText("Save as");
    saveas.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            saveas_actionPerformed(e);
          }
        });
    help.setText("Help");
    manual.setText("Tool manual");
    manual.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            manual_actionPerformed(e);
          }
        });
    about.setText("About");
    about.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            about_actionPerformed(e);
          }
        });
    project.setText("Project");
    copy.setText("Copy");
    copy.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            copy_actionPerformed(e);
          }
        });
    paste.setText("Paste");
    paste.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            paste_actionPerformed(e);
          }
        });
    exit.setText("Exit");
    exit.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            exit_actionPerformed(e);
          }
        });
    splitPanelDiagramMessagesPaneSeparator.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPanelDiagramMessagesPaneSeparator.setLastDividerLocation(150);
    pprin.setLayout(new BorderLayout());
    pprin.setName("DiagramPane");
    pprin.setPreferredSize(new Dimension(400, 300));
    pprin.add(BorderLayout.SOUTH, pbar);
    pbar.setVisible(false);
    jSplitPane1.setOrientation(JSplitPane.HORIZONTAL_SPLIT);

    scrollLogs.setBorder(titledBorderForMessagesPane);
    scrollLogs.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            jScrollPane3_keyPressed(e);
          }
        });
    this.clearMessages.setText("Clear");
    clearMessages.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            clearMessages_actionPerformed(e, (JTextPane) messagesMenu.getInvoker());
          }
        });
    forcegc.setText("Force GC");
    forcegc.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            forcegc_actionPerformed(e);
          }
        });

    menuTools.setText("Tools");
    menuCodeGenerator.setText("Code Generator");
    profiles.setText("Profiles");

    menuModules.setText("Modules");
    this.properties.setText("Properties");
    properties.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            properties_actionPerformed(e);
          }
        });
    moutput.setEditable(false);
    moutput.setSelectionStart(0);
    moutput.setText("");
    moduleOutput.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            moduleOutput_mouseClicked(e);
          }
        });
    moduleOutput.setFont(new java.awt.Font("Monospaced", 0, 11));
    logs.setContentType("text/html");
    logs.setEditable(false);
    logs.setText("");
    logs.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            logs_mouseClicked(e);
          }
        });
    logs.addComponentListener(
        new java.awt.event.ComponentAdapter() {
          public void componentResized(ComponentEvent e) {
            logs_componentResized(e);
          }
        });
    newProject.setText("New");
    newProject.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            newProject_actionPerformed(e);
          }
        });
    undo.setText("Undo");
    undo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            undo_actionPerformed(e);
          }
        });
    redo.setText("Redo");
    redo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            redo_actionPerformed(e);
          }
        });
    delete.setText("Delete");
    delete.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            delete_actionPerformed(e);
          }
        });
    selectall.setText("Select all");
    selectall.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            selectall_actionPerformed(e);
          }
        });
    cpClipboard.setText("Copy diagram to clipboard");
    cpClipboard.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cpClipboard_actionPerformed(e);
          }
        });
    preferences.setText("Preferences");

    enableUMLView.setToolTipText("UML view" + "instead of its type");
    enableUMLView.setText("Enable UML view from now on");
    enableUMLView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            enableUMLView_actionPerformed(e);
          }
        });
    enableINGENIASView.setToolTipText("INGENIAS view");
    enableINGENIASView.setText("Enable INGENIAS view from now on");
    enableINGENIASView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            enableINGENIASView_actionPerformed(e);
          }
        });

    switchINGENIASView.setToolTipText("Switch to INGENIAS view");
    switchINGENIASView.setText("Switch to INGENIAS view");
    switchINGENIASView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            switchINGENIASView_actionPerformed(e);
          }
        });

    switchUMLView.setToolTipText("Switch to UML view");
    switchUMLView.setText("Switch to UML view");
    switchUMLView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            switchUMLView_actionPerformed(e);
          }
        });

    resizeAll.setToolTipText("Resize all");
    resizeAll.setText("Resize all entities within current diagram");
    resizeAll.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            resizeAll_actionPerformed(e);
          }
        });

    resizeAllDiagrams.setToolTipText("Resize all diagrams");
    resizeAllDiagrams.setText("Resize all entities within all defined diagram");
    resizeAllDiagrams.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            resizeAllDiagrams_actionPerformed(e);
          }
        });

    JMenuItem workspaceEntry = new JMenuItem("Switch workspace");
    workspaceEntry.setToolTipText("Change current workspace");
    workspaceEntry.setText("Switch workspace");
    workspaceEntry.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            changeWorkspace(e);
          }
        });
    preferences.add(workspaceEntry);
    preferences.add(resizeAll);
    preferences.add(resizeAllDiagrams);
    {
      elimOverlap = new JMenuItem();
      preferences.add(elimOverlap);
      elimOverlap.setText("Eliminate overlap");
      elimOverlap.setAccelerator(KeyStroke.getKeyStroke("F3"));
      elimOverlap.addMenuKeyListener(
          new MenuKeyListener() {
            public void menuKeyPressed(MenuKeyEvent evt) {
              System.out.println("elimOverlap.menuKeyPressed, event=" + evt);
              // TODO add your code for elimOverlap.menuKeyPressed
            }

            public void menuKeyReleased(MenuKeyEvent evt) {
              System.out.println("elimOverlap.menuKeyReleased, event=" + evt);
              // TODO add your code for elimOverlap.menuKeyReleased
            }

            public void menuKeyTyped(MenuKeyEvent evt) {
              elimOverlapMenuKeyTyped(evt);
            }
          });
      elimOverlap.addKeyListener(
          new KeyAdapter() {
            public void keyPressed(KeyEvent evt) {
              elimOverlapKeyPressed(evt);
            }
          });
      elimOverlap.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              elimOverlapActionPerformed(evt);
            }
          });
    }
    {
      modelingLanguageNotationSwitchMenu = new JMenu();
      preferences.add(modelingLanguageNotationSwitchMenu);
      modelingLanguageNotationSwitchMenu.setText("Modelling language");
      modelingLanguageNotationSwitchMenu.add(enableINGENIASView);

      viewSelection.add(enableINGENIASView);
      modelingLanguageNotationSwitchMenu.add(enableUMLView);
      viewSelection.add(enableUMLView);

      enableINGENIASView.setSelected(true);
      modelingLanguageNotationSwitchMenu.add(switchUMLView);
      modelingLanguageNotationSwitchMenu.add(switchINGENIASView);
    }
    {
      propertiesModeMenu = new JMenu();
      preferences.add(propertiesModeMenu);
      propertiesModeMenu.setText("Edit Properties Mode");
      {
        editPopUpProperties = new JCheckBoxMenuItem();
        propertiesModeMenu.add(editPopUpProperties);
        editPopUpProperties.setText("Edit Properties in a PopUp Window");
        editPopUpProperties.setSelected(true);
        editPopUpProperties.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                editPopUpProperties_selected();
              }
            });
        propertiesEditModeSelection.add(editPopUpProperties);
      }
      {
        editOnMessages = new JCheckBoxMenuItem();
        propertiesModeMenu.add(editOnMessages);
        editOnMessages.setText("Edit Properties in Messages Panel");
        propertiesEditModeSelection.add(editOnMessages);
        editOnMessages.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                editOnMessages_selected();
              }
            });
      }
    }

    mainMenuBar.add(file);
    mainMenuBar.add(edit);
    mainMenuBar.add(project);
    mainMenuBar.add(menuModules);
    mainMenuBar.add(profiles);
    mainMenuBar.add(preferences);
    mainMenuBar.add(help);
    file.add(newProject);
    file.add(load);
    {
      importFile = new JMenuItem();
      file.add(importFile);
      importFile.setText("Import file");
      importFile.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              importFileActionPerformed(evt);
            }
          });
    }
    file.add(save);
    file.add(saveas);
    file.addSeparator();
    file.add(exit);
    file.addSeparator();
    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(buttonModelPanel, BorderLayout.WEST);
    this.getContentPane().add(jSplitPane1, BorderLayout.CENTER);
    rightPanel.add(splitPanelDiagramMessagesPaneSeparator, BorderLayout.CENTER);
    jSplitPane1.add(splitPaneSeparatingProjectsAndEntitiesView, JSplitPane.LEFT);
    splitPaneSeparatingProjectsAndEntitiesView.add(scrollPaneForProyectView, JSplitPane.TOP);
    {
      jPanel2 = new JPanel();
      BorderLayout jPanel2Layout = new BorderLayout();
      jPanel2.setLayout(jPanel2Layout);
      splitPaneSeparatingProjectsAndEntitiesView.add(jPanel2, JSplitPane.BOTTOM);
      jPanel2.add(jPanel1, BorderLayout.SOUTH);
      jPanel2.add(scrollPaneForEntitiesView, BorderLayout.CENTER);
    }
    jSplitPane1.add(rightPanel, JSplitPane.RIGHT);
    splitPanelDiagramMessagesPaneSeparator.add(pprin, JSplitPane.TOP);
    splitPanelDiagramMessagesPaneSeparator.add(messagespane, JSplitPane.BOTTOM);
    JScrollPane scrollSearchDiagram = new JScrollPane();
    scrollSearchDiagram.getViewport().add(searchDiagramPanel, null);
    searchDiagramPanel.setContentType("text/html");
    searchDiagramPanel.setEditable(false);

    messagespane.addConventionalTab(scrollLogs, "Logs");
    scrollLogs.getViewport().add(logs, null);
    scrolloutput.getViewport().add(this.moduleOutput, null);
    messagespane.addConventionalTab(scrolloutput, "Module Output");
    messagespane.addConventionalTab(scrollSearchDiagram, "Search");
    scrolloutput.getViewport().add(moduleOutput, null);
    {
      searchPanel = new JPanel();
      FlowLayout searchPanelLayout = new FlowLayout();
      searchPanelLayout.setVgap(1);
      searchPanel.setLayout(searchPanelLayout);
      jPanel1.add(searchPanel, BorderLayout.SOUTH);
      searchPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
      {
        searchField = new JTextField();
        searchPanel.add(searchField);
        searchField.setColumns(15);

        searchField.addKeyListener(
            new KeyAdapter() {
              public void keyTyped(KeyEvent evt) {
                searchFieldKeyTyped(evt);
              }
            });
      }
      {
        Search = new JButton();
        scrollPaneForProyectView.setViewportView(arbolProyectos);
        scrollPaneForEntitiesView.setViewportView(arbolObjetos);
        searchPanel.add(Search);

        Search.setIcon(new ImageIcon(ImageLoader.getImage(("images/lense.png"))));
        //	Search.setPreferredSize(new java.awt.Dimension(20, 20));
        Search.setIconTextGap(0);
        Search.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent evt) {
                SearchActionPerformed(evt);
              }
            });
      }
    }
    edit.add(undo);
    edit.add(redo);
    edit.addSeparator();
    edit.add(copy);
    edit.add(paste);
    edit.add(delete);
    edit.add(selectall);
    edit.addSeparator();
    edit.add(copyImage);
    edit.add(cpClipboard);
    help.add(manual);
    help.add(about);
    help.add(forcegc);

    menuModules.add(menuTools);
    menuModules.add(menuCodeGenerator);
    messagesMenu.add(this.clearMessages);
    project.add(this.properties);

    project.addSeparator();
    jSplitPane1.setDividerLocation(250);
    splitPaneSeparatingProjectsAndEntitiesView.setDividerLocation(250);
    arbolProyectos.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            arbolProyectos_mouseClicked(e);
          }
        });
    splitPanelDiagramMessagesPaneSeparator.setDividerLocation(400);
  }
Пример #8
0
 /**
  * constructor
  *
  * @param controller is the parent object
  * @throws Exception
  */
 public PseudoHYDC3View(PseudoHYDC3 controller) throws Exception {
   this.controller = controller;
   {
     String sFontName = "DFKai-SB2" /*"PMingLiU"*/;
     if (System.getProperty("hydc3.fontName") != null) {
       sFontName = System.getProperty("hydc3.fontName");
     }
     UIManager.put(
         "TextPane.font",
         new Font(
             sFontName,
             UIManager.getFont("TextPane.font").getStyle(),
             UIManager.getFont("TextPane.font").getSize()));
     UIManager.put(
         "List.font",
         new Font(
             sFontName,
             UIManager.getFont("List.font").getStyle(),
             UIManager.getFont("List.font").getSize()));
     UIManager.put(
         "TextField.font",
         new Font(
             sFontName,
             UIManager.getFont("TextField.font").getStyle(),
             UIManager.getFont("TextField.font").getSize()));
   }
   frame = new JFrame("漢語大詞典もどき");
   frame.setPreferredSize(new Dimension(800, 600));
   {
     JMenuBar menuBar = new JMenuBar();
     {
       JMenu menu = new JMenu("File");
       {
         JMenuItem menuItem = new JMenuItem("Exit");
         menuItem.addActionListener(
             new ActionListener() {
               @Override
               public void actionPerformed(ActionEvent event) {
                 System.exit(0);
               }
             });
         menu.add(menuItem);
       }
       menuBar.add(menu);
     }
     {
       JMenu menu = new JMenu("Help");
       {
         JMenuItem menuItem = new JMenuItem("About...");
         menuItem.addActionListener(
             new ActionListener() {
               @Override
               public void actionPerformed(ActionEvent event) {
                 JOptionPane.showMessageDialog(
                     frame,
                     "漢語大詞典もどき  version 0.1  by Beu",
                     "about",
                     JOptionPane.INFORMATION_MESSAGE);
               }
             });
         menu.add(menuItem);
       }
       menuBar.add(menu);
     }
     frame.setJMenuBar(menuBar);
     JPanel rootPanel = new JPanel(new BorderLayout());
     {
       JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
       {
         JSplitPane splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
         {
           JTabbedPane tabbedPane = new JTabbedPane();
           {
             JPanel panel = new JPanel();
             BoxLayout layout = new BoxLayout(panel, BoxLayout.Y_AXIS);
             panel.setLayout(layout);
             {
               JPanel panel2 = new JPanel();
               {
                 inputTextField = new JTextField(8);
                 Font font = inputTextField.getFont();
                 font = font.deriveFont(font.getSize2D() * 3);
                 inputTextField.setFont(font);
                 panel2.add(inputTextField);
               }
               panel.add(panel2);
             }
             {
               JPanel panel2 = new JPanel();
               {
                 JButton button = new JButton("字");
                 button.setActionCommand("searchWithCharacter");
                 button.addActionListener(controller);
                 panel2.add(button);
               }
               {
                 JButton button = new JButton("詞");
                 button.setActionCommand("searchWithWord");
                 button.addActionListener(controller);
                 panel2.add(button);
               }
               {
                 JButton button = new JButton("音");
                 button.setActionCommand("searchWithReading");
                 button.addActionListener(controller);
                 panel2.add(button);
               }
               {
                 JButton button = new JButton("碼");
                 button.setActionCommand("searchWithCode");
                 button.addActionListener(controller);
                 panel2.add(button);
               }
               panel.add(panel2);
             }
             tabbedPane.addTab("輸入", panel);
           }
           {
             DefaultMutableTreeNode root = controller.getRadicalTree();
             JTree tree = new JTree(root);
             Font font = tree.getFont();
             font = font.deriveFont(font.getSize2D() * 1.5F);
             tree.setFont(font);
             tree.addTreeSelectionListener(controller);
             JScrollPane scrollPane =
                 new JScrollPane(
                     tree,
                     JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
             tabbedPane.addTab("部首", scrollPane);
           }
           {
             JPanel panel = new JPanel();
             BoxLayout layout = new BoxLayout(panel, BoxLayout.Y_AXIS);
             panel.setLayout(layout);
             {
               JPanel panel2 = new JPanel();
               panel2.add(new JLabel("從"));
               {
                 fromStrokesTextField = new JTextField("1", 2);
                 Font font = fromStrokesTextField.getFont();
                 font = font.deriveFont(font.getSize2D() * 2);
                 fromStrokesTextField.setFont(font);
                 fromStrokesTextField.setHorizontalAlignment(JTextField.RIGHT);
                 panel2.add(fromStrokesTextField);
               }
               panel2.add(new JLabel("到"));
               {
                 toStrokesTextField = new JTextField("10", 2);
                 Font font = toStrokesTextField.getFont();
                 font = font.deriveFont(font.getSize2D() * 2);
                 toStrokesTextField.setFont(font);
                 toStrokesTextField.setHorizontalAlignment(JTextField.RIGHT);
                 panel2.add(toStrokesTextField);
               }
               panel.add(panel2);
             }
             {
               JPanel panel2 = new JPanel();
               {
                 JButton button = new JButton("査");
                 button.setActionCommand("searchWithStrokes");
                 button.addActionListener(controller);
                 panel2.add(button);
               }
               panel.add(panel2);
             }
             tabbedPane.addTab("畫數", panel);
           }
           splitPane2.add(tabbedPane, JSplitPane.TOP);
         }
         {
           selectingList = new JList();
           Font font = selectingList.getFont();
           font = font.deriveFont(font.getSize2D() * 2);
           selectingList.setFont(font);
           selectingList.addMouseListener(controller);
           JScrollPane scrollPane =
               new JScrollPane(
                   selectingList,
                   JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                   JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
           scrollPane.setBorder(new TitledBorder("候補"));
           splitPane2.add(scrollPane, JSplitPane.BOTTOM);
         }
         splitPane.add(splitPane2, JSplitPane.LEFT);
       }
       {
         descriptionTextPane = new JTextPane();
         Font font = descriptionTextPane.getFont();
         font = font.deriveFont(font.getSize2D() * 1.5F);
         descriptionTextPane.setFont(font);
         descriptionTextPane.addMouseListener(controller);
         descriptionTextPane.addMouseMotionListener(controller);
         JScrollPane scrollPane =
             new JScrollPane(
                 descriptionTextPane,
                 JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                 JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
         splitPane.add(scrollPane, JSplitPane.RIGHT);
       }
       rootPanel.add(splitPane, BorderLayout.CENTER);
     }
     {
       JPanel panel = new JPanel(new BorderLayout());
       {
         JLabel label = new JLabel("status");
         panel.add(label, BorderLayout.WEST);
       }
       rootPanel.add(panel, BorderLayout.SOUTH);
     }
     frame.setContentPane(rootPanel);
   }
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.pack();
   frame.setVisible(true);
 }
  public FilmDetailsView(JFrame mainFrame, HelperResultsSection parentView, HelperItem helperItem) {
    super(mainFrame, parentView, helperItem);
    setFilm((FichaPelicula) helperItem);

    System.out.println("creado super");
    setBackground(SystemColor.menu);

    // setBorder(new SoftBevelBorder(BevelBorder.LOWERED, new Color(64, 64, 64), null, null, null));
    setBorder(PanelProperties.BORDER);

    infoPanel = new JPanel();
    // infoPanel.setBorder(UIManager.getBorder("InternalFrame.border"));

    titleLabel = new JLabel("T\u00EDtulo");
    titleLabel.setFont(new Font("Tahoma", Font.BOLD, 16));
    titleLabel.setHorizontalAlignment(SwingConstants.CENTER);

    JLabel lblNewLabel_2 = new JLabel("T\u00EDtulo original");
    lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 12));

    JLabel lblNewLabel_3 = new JLabel("Director");
    lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 12));

    JLabel lblNewLabel_4 = new JLabel("Pa\u00EDs");
    lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 12));

    originalTitleLabel = new JLabel("Value");
    originalTitleLabel.setFont(new Font("Tahoma", Font.PLAIN, 12));

    countryLabel = new JLabel("Value");
    countryLabel.setFont(new Font("Tahoma", Font.PLAIN, 12));

    imageLabel = new JLabel("");
    imageLabel.setBorder(new LineBorder(new Color(0, 0, 0)));
    imageLabel.setHorizontalAlignment(SwingConstants.CENTER);
    imageLabel.setIcon(
        new ImageIcon(
            FilmDetailsView.class.getResource("/javax/swing/plaf/basic/icons/image-delayed.png")));

    JLabel lblNewLabel_5 = new JLabel("A\u00F1o");
    lblNewLabel_5.setFont(new Font("Tahoma", Font.BOLD, 12));

    yearLabel = new JLabel("Value");
    yearLabel.setFont(new Font("Tahoma", Font.PLAIN, 12));

    JLabel lblNewLabel_6 = new JLabel("Reparto");
    lblNewLabel_6.setFont(new Font("Tahoma", Font.BOLD, 12));

    System.out.println("Creados primeros componentes");

    JLabel lblNewLabel_7 = new JLabel("Premios");
    lblNewLabel_7.setFont(new Font("Tahoma", Font.BOLD, 12));

    System.out.println("Creadas listas");
    JPanel panel = new JPanel();
    panel.setBorder(new LineBorder(new Color(0, 0, 0)));

    markLabel = new JLabel("Nota");
    markLabel.setFont(new Font("Tahoma", Font.PLAIN, 23));
    markLabel.setHorizontalAlignment(SwingConstants.CENTER);
    GroupLayout gl_panel = new GroupLayout(panel);
    gl_panel.setHorizontalGroup(
        gl_panel
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(markLabel, GroupLayout.PREFERRED_SIZE, 57, Short.MAX_VALUE)
                    .addContainerGap()));
    gl_panel.setVerticalGroup(
        gl_panel
            .createParallelGroup(Alignment.TRAILING)
            .addGroup(
                gl_panel
                    .createSequentialGroup()
                    .addContainerGap(14, Short.MAX_VALUE)
                    .addComponent(
                        markLabel, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    panel.setLayout(gl_panel);

    rateButton = new JButton("");
    rateButton.setIcon(
        new ImageIcon(
            FilmDetailsView.class.getResource("/images/HelperResults/rate-film-icon.png")));
    rateButton.setToolTipText("Votar");
    rateButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            rateItem();
          }
        });
    rateButton.setFont(new Font("Tahoma", Font.PLAIN, 11));

    System.out.println("Creando tabla");

    usersMarkFrame = new JPanel();
    usersMarkFrame.setBorder(new LineBorder(new Color(0, 0, 0)));

    usersMarkLabel = new JLabel("Nota U");
    usersMarkLabel.setHorizontalAlignment(SwingConstants.CENTER);
    usersMarkLabel.setFont(new Font("Tahoma", Font.PLAIN, 23));
    GroupLayout gl_usersMarkFrame = new GroupLayout(usersMarkFrame);
    gl_usersMarkFrame.setHorizontalGroup(
        gl_usersMarkFrame
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_usersMarkFrame
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(usersMarkLabel, GroupLayout.PREFERRED_SIZE, 55, Short.MAX_VALUE)
                    .addContainerGap()));
    gl_usersMarkFrame.setVerticalGroup(
        gl_usersMarkFrame
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_usersMarkFrame
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        usersMarkLabel, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(14, Short.MAX_VALUE)));
    usersMarkFrame.setLayout(gl_usersMarkFrame);

    yourMarkLabel = new JLabel("Tu Nota");
    yourMarkLabel.setFont(new Font("Tahoma", Font.BOLD, 12));

    JLabel lblNewLabel_9 = new JLabel("Nota Almas Gemelas");
    lblNewLabel_9.setFont(new Font("Tahoma", Font.BOLD, 12));

    twinSoulsMarkFrame = new JPanel();
    twinSoulsMarkFrame.setBorder(new LineBorder(new Color(0, 0, 0)));

    twinSoulsMarkLabel = new JLabel("Nota U");
    twinSoulsMarkLabel.setHorizontalAlignment(SwingConstants.CENTER);
    twinSoulsMarkLabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
    GroupLayout gl_twinSoulsMarkFrame = new GroupLayout(twinSoulsMarkFrame);
    gl_twinSoulsMarkFrame.setHorizontalGroup(
        gl_twinSoulsMarkFrame
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_twinSoulsMarkFrame
                    .createSequentialGroup()
                    .addGap(11)
                    .addComponent(
                        twinSoulsMarkLabel,
                        GroupLayout.PREFERRED_SIZE,
                        34,
                        GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(11, Short.MAX_VALUE)));
    gl_twinSoulsMarkFrame.setVerticalGroup(
        gl_twinSoulsMarkFrame
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_twinSoulsMarkFrame
                    .createSequentialGroup()
                    .addGap(10)
                    .addComponent(
                        twinSoulsMarkLabel,
                        GroupLayout.PREFERRED_SIZE,
                        35,
                        GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    twinSoulsMarkFrame.setLayout(gl_twinSoulsMarkFrame);

    JLabel lblCrticas = new JLabel("Cr\u00EDticas");
    lblCrticas.setFont(new Font("Tahoma", Font.BOLD, 12));

    sinopsisScrollPane = new JScrollPane();
    sinopsisScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    JLabel lblSinopsis = new JLabel("Sinopsis");
    lblSinopsis.setFont(new Font("Tahoma", Font.BOLD, 12));

    reviewsScrollPane = new JScrollPane();

    reviewsTable =
        new JTable() {
          @Override
          public String getToolTipText(MouseEvent e) {
            String tip = null;
            Point p = e.getPoint();
            int rowIndex = rowAtPoint(p);
            int colIndex = columnAtPoint(p);
            int realColumnIndex = convertColumnIndexToModel(colIndex);

            if (realColumnIndex == 0) { // Sport column
              tip = getValueAt(rowIndex, colIndex).toString();
            } // else { //another column
            //			            //You can omit this part if you know you don't
            //			            //have any renderers that supply their own tool
            //			            //tips.
            //			            tip = super.getToolTipText(e);
            //			        }
            return tip;
          }
        };
    reviewsScrollPane.setViewportView(reviewsTable);
    reviewsTable.setBorder(new BevelBorder(BevelBorder.RAISED, Color.DARK_GRAY, null, null, null));

    sinopsisTextPane = new JTextPane();
    sinopsisTextPane.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            if (arg0.getClickCount() == 2) {
              if (!sinopsisTextPane.getText().isEmpty()) {
                showSinopsisOnDialog();
              }
            }
          }
        });
    sinopsisTextPane.setFont(new Font("Tahoma", Font.PLAIN, 12));
    sinopsisTextPane.setText("lorem ipsum escatigae no taliratae guanto male son sonambilare");
    sinopsisTextPane.setEditable(false);
    sinopsisTextPane.setToolTipText("Doble click para agrandar");
    sinopsisScrollPane.setViewportView(sinopsisTextPane);

    castingScrollPane = new JScrollPane();
    castingScrollPane.getVerticalScrollBar().setUnitIncrement(16);

    castingList = new JList<String>();
    castingList.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2 && castingList.getSelectedIndex() != -1) {
              searchActor();
            }
          }
        });
    castingScrollPane.setViewportView(castingList);

    prizesScrollPane = new JScrollPane();

    prizesList = new JList<String>();
    prizesScrollPane.setViewportView(prizesList);

    directorsPane = new JPanel();
    GroupLayout gl_infoPanel = new GroupLayout(infoPanel);
    gl_infoPanel.setHorizontalGroup(
        gl_infoPanel
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_infoPanel
                    .createSequentialGroup()
                    .addGap(4)
                    .addComponent(
                        titleLabel, GroupLayout.PREFERRED_SIZE, 398, GroupLayout.PREFERRED_SIZE))
            .addGroup(
                gl_infoPanel
                    .createSequentialGroup()
                    .addGroup(
                        gl_infoPanel
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addGap(8)
                                    .addGroup(
                                        gl_infoPanel
                                            .createParallelGroup(Alignment.LEADING)
                                            .addComponent(
                                                lblNewLabel_2,
                                                GroupLayout.PREFERRED_SIZE,
                                                90,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                lblNewLabel_3,
                                                GroupLayout.PREFERRED_SIZE,
                                                63,
                                                GroupLayout.PREFERRED_SIZE))
                                    .addGap(11)
                                    .addComponent(
                                        originalTitleLabel,
                                        GroupLayout.PREFERRED_SIZE,
                                        176,
                                        GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addContainerGap()
                                    .addGroup(
                                        gl_infoPanel
                                            .createParallelGroup(Alignment.LEADING)
                                            .addComponent(
                                                lblNewLabel_5,
                                                GroupLayout.PREFERRED_SIZE,
                                                46,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                lblNewLabel_4,
                                                GroupLayout.PREFERRED_SIZE,
                                                46,
                                                GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(
                                        ComponentPlacement.RELATED, 71, Short.MAX_VALUE)
                                    .addGroup(
                                        gl_infoPanel
                                            .createParallelGroup(Alignment.LEADING)
                                            .addComponent(
                                                yearLabel,
                                                GroupLayout.PREFERRED_SIZE,
                                                148,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                countryLabel,
                                                GroupLayout.PREFERRED_SIZE,
                                                150,
                                                GroupLayout.PREFERRED_SIZE))
                                    .addGap(24)))
                    .addGap(11)
                    .addComponent(
                        imageLabel, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE))
            .addGroup(
                gl_infoPanel
                    .createSequentialGroup()
                    .addGap(13)
                    .addComponent(
                        lblNewLabel_7, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
                    .addGap(35)
                    .addComponent(
                        prizesScrollPane,
                        GroupLayout.PREFERRED_SIZE,
                        285,
                        GroupLayout.PREFERRED_SIZE))
            .addGroup(
                gl_infoPanel
                    .createSequentialGroup()
                    .addGap(11)
                    .addComponent(
                        lblCrticas, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
                    .addGap(28)
                    .addComponent(
                        reviewsScrollPane,
                        GroupLayout.PREFERRED_SIZE,
                        287,
                        GroupLayout.PREFERRED_SIZE))
            .addGroup(
                gl_infoPanel
                    .createSequentialGroup()
                    .addGroup(
                        gl_infoPanel
                            .createParallelGroup(Alignment.LEADING, false)
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addGap(11)
                                    .addComponent(
                                        lblNewLabel_6,
                                        GroupLayout.PREFERRED_SIZE,
                                        63,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(29)
                                    .addComponent(
                                        castingScrollPane,
                                        GroupLayout.PREFERRED_SIZE,
                                        212,
                                        GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addGap(10)
                                    .addComponent(
                                        lblSinopsis,
                                        GroupLayout.PREFERRED_SIZE,
                                        63,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(30)
                                    .addGroup(
                                        gl_infoPanel
                                            .createParallelGroup(Alignment.LEADING)
                                            .addComponent(
                                                directorsPane,
                                                GroupLayout.PREFERRED_SIZE,
                                                184,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                sinopsisScrollPane,
                                                GroupLayout.PREFERRED_SIZE,
                                                212,
                                                GroupLayout.PREFERRED_SIZE))))
                    .addGap(27)
                    .addGroup(
                        gl_infoPanel
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(
                                rateButton,
                                GroupLayout.PREFERRED_SIZE,
                                77,
                                GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                panel, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addGap(13)
                                    .addComponent(yourMarkLabel))
                            .addComponent(
                                usersMarkFrame,
                                GroupLayout.PREFERRED_SIZE,
                                GroupLayout.DEFAULT_SIZE,
                                GroupLayout.PREFERRED_SIZE)))
            .addGroup(
                gl_infoPanel
                    .createSequentialGroup()
                    .addGap(9)
                    .addComponent(
                        lblNewLabel_9, GroupLayout.PREFERRED_SIZE, 131, GroupLayout.PREFERRED_SIZE)
                    .addGap(34)
                    .addComponent(
                        twinSoulsMarkFrame,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)));
    gl_infoPanel.setVerticalGroup(
        gl_infoPanel
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_infoPanel
                    .createSequentialGroup()
                    .addComponent(titleLabel)
                    .addGroup(
                        gl_infoPanel
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addGap(27)
                                    .addGroup(
                                        gl_infoPanel
                                            .createParallelGroup(Alignment.LEADING)
                                            .addComponent(
                                                lblNewLabel_2,
                                                GroupLayout.PREFERRED_SIZE,
                                                14,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(originalTitleLabel))
                                    .addGroup(
                                        gl_infoPanel
                                            .createParallelGroup(Alignment.LEADING)
                                            .addGroup(
                                                gl_infoPanel
                                                    .createSequentialGroup()
                                                    .addGap(16)
                                                    .addComponent(lblNewLabel_3)
                                                    .addGap(1))
                                            .addGroup(
                                                gl_infoPanel
                                                    .createSequentialGroup()
                                                    .addPreferredGap(ComponentPlacement.RELATED)
                                                    .addComponent(
                                                        directorsPane,
                                                        GroupLayout.DEFAULT_SIZE,
                                                        65,
                                                        Short.MAX_VALUE)
                                                    .addPreferredGap(ComponentPlacement.RELATED)))
                                    .addGroup(
                                        gl_infoPanel
                                            .createParallelGroup(Alignment.BASELINE)
                                            .addComponent(countryLabel)
                                            .addComponent(lblNewLabel_4))
                                    .addGap(20)
                                    .addGroup(
                                        gl_infoPanel
                                            .createParallelGroup(Alignment.BASELINE)
                                            .addComponent(lblNewLabel_5)
                                            .addComponent(yearLabel))
                                    .addGap(15))
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addGap(11)
                                    .addComponent(
                                        imageLabel,
                                        GroupLayout.PREFERRED_SIZE,
                                        166,
                                        GroupLayout.PREFERRED_SIZE)))
                    .addGap(11)
                    .addGroup(
                        gl_infoPanel
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addGroup(
                                        gl_infoPanel
                                            .createParallelGroup(Alignment.LEADING)
                                            .addComponent(lblSinopsis)
                                            .addComponent(
                                                sinopsisScrollPane,
                                                GroupLayout.PREFERRED_SIZE,
                                                90,
                                                GroupLayout.PREFERRED_SIZE))
                                    .addGap(19)
                                    .addGroup(
                                        gl_infoPanel
                                            .createParallelGroup(Alignment.LEADING)
                                            .addGroup(
                                                gl_infoPanel
                                                    .createSequentialGroup()
                                                    .addGap(1)
                                                    .addComponent(lblNewLabel_6))
                                            .addComponent(
                                                castingScrollPane,
                                                GroupLayout.PREFERRED_SIZE,
                                                107,
                                                GroupLayout.PREFERRED_SIZE)))
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addComponent(
                                        panel,
                                        GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(19)
                                    .addComponent(yourMarkLabel)
                                    .addGap(6)
                                    .addComponent(
                                        usersMarkFrame,
                                        GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(
                                        rateButton,
                                        GroupLayout.PREFERRED_SIZE,
                                        37,
                                        GroupLayout.PREFERRED_SIZE)))
                    .addGap(18)
                    .addGroup(
                        gl_infoPanel
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(lblNewLabel_7)
                            .addComponent(
                                prizesScrollPane,
                                GroupLayout.PREFERRED_SIZE,
                                109,
                                GroupLayout.PREFERRED_SIZE))
                    .addGroup(
                        gl_infoPanel
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addGap(49)
                                    .addComponent(lblCrticas))
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addGap(46)
                                    .addComponent(
                                        reviewsScrollPane,
                                        GroupLayout.PREFERRED_SIZE,
                                        115,
                                        GroupLayout.PREFERRED_SIZE)))
                    .addGap(17)
                    .addGroup(
                        gl_infoPanel
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_infoPanel
                                    .createSequentialGroup()
                                    .addGap(25)
                                    .addComponent(lblNewLabel_9))
                            .addComponent(
                                twinSoulsMarkFrame,
                                GroupLayout.PREFERRED_SIZE,
                                55,
                                GroupLayout.PREFERRED_SIZE))
                    .addGap(45)));
    directorsPane.setLayout(new GridLayout(0, 2, 0, 0));
    infoPanel.setLayout(gl_infoPanel);
    GroupLayout groupLayout = new GroupLayout(this);
    groupLayout.setHorizontalGroup(
        groupLayout
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                groupLayout
                    .createSequentialGroup()
                    .addGap(2)
                    .addComponent(infoPanel, GroupLayout.DEFAULT_SIZE, 455, Short.MAX_VALUE)));
    groupLayout.setVerticalGroup(
        groupLayout
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                groupLayout
                    .createSequentialGroup()
                    .addGap(3)
                    .addComponent(
                        infoPanel,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    setLayout(groupLayout);
    initLabels();
  }
Пример #10
0
  HtmlPanel(final Map<String, Action> actions, HtmlPage page) throws IOException {
    super(new BorderLayout());

    this.actions = actions;
    textPane = new JTextPane();
    find = new JTextField();
    matches = new JLabel();
    this.page = null;

    final Dimension d = matches.getPreferredSize();
    matches.setPreferredSize(new Dimension(100, d.height));

    textPane.setEditable(false);
    textPane.setFocusable(false);
    textPane.addHyperlinkListener(
        new HyperlinkListener() {

          public final void hyperlinkUpdate(HyperlinkEvent ev) {
            if (ev.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              final JEditorPane pane = (JEditorPane) ev.getSource();
              if (ev instanceof HTMLFrameHyperlinkEvent) {
                final HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) ev;
                final HTMLDocument doc = (HTMLDocument) pane.getDocument();
                doc.processHTMLFrameHyperlinkEvent(evt);
              } else if (Desktop.isDesktopSupported())
                try {
                  Desktop.getDesktop().browse(ev.getURL().toURI());
                } catch (final Exception e) {
                  e.printStackTrace();
                }
            }
          }
        });

    final HTMLEditorKit kit =
        new HTMLEditorKit() {
          private static final long serialVersionUID = 1L;

          @Override
          public final Document createDefaultDocument() {
            final HTMLDocument doc = (HTMLDocument) super.createDefaultDocument();
            // Load synchronously.
            doc.setAsynchronousLoadPriority(-1);
            return doc;
          }
        };

    final StyleSheet styleSheet = kit.getStyleSheet();
    final InputStream is = getClass().getResourceAsStream("/doogal.css");
    try {
      styleSheet.loadRules(newBufferedReader(is), null);
    } finally {
      is.close();
    }

    textPane.setEditorKit(kit);

    final Document doc = kit.createDefaultDocument();
    textPane.setDocument(doc);
    textPane.addMouseListener(
        new MouseAdapter() {

          private final void showPopup(MouseEvent e) {
            if (e.isPopupTrigger()) {
              final JPopupMenu menu = newPopupMenu(TableType.DOCUMENT, actions);
              if (null != menu) menu.show(e.getComponent(), e.getX(), e.getY());
            }
          }

          @Override
          public final void mousePressed(MouseEvent e) {
            showPopup(e);
          }

          @Override
          public final void mouseReleased(MouseEvent e) {
            showPopup(e);
          }
        });
    find.setColumns(16);
    find.setFont(new Font("Dialog", Font.PLAIN, TINY_FONT));
    find.setMargin(new Insets(2, 2, 2, 2));
    find.addActionListener(
        new ActionListener() {
          public final void actionPerformed(ActionEvent ev) {
            find(find.getText());
          }
        });

    final JLabel label = new JLabel("Quick Find: ");
    label.setLabelFor(find);

    final JButton clear = new JButton("Clear");
    clear.setMargin(new Insets(1, 5, 0, 5));
    clear.setFont(new Font("Dialog", Font.PLAIN, TINY_FONT));
    clear.addActionListener(
        new ActionListener() {
          public final void actionPerformed(ActionEvent e) {
            find.setText("");
            find("");
          }
        });

    final JPanel findPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    findPanel.add(label);
    findPanel.add(find);
    findPanel.add(clear);
    findPanel.add(matches);

    scrollPane =
        new JScrollPane(
            textPane,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setFocusable(false);
    final JScrollBar scrollBar = scrollPane.getVerticalScrollBar();
    scrollBar.setBlockIncrement(scrollBar.getBlockIncrement() * 20);
    scrollBar.setUnitIncrement(scrollBar.getUnitIncrement() * 20);

    add(scrollPane, BorderLayout.CENTER);
    add(findPanel, BorderLayout.SOUTH);

    setPage(page);
  }
  /** Create the frame. */
  public LoginWindow() {
    setAutoRequestFocus(false);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 454, 488);
    contentPane = new JPanel();
    contentPane.setForeground(UIManager.getColor("ScrollBar.trackHighlightForeground"));
    contentPane.setBackground(UIManager.getColor("ScrollBar.track"));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);

    JTextPane WelcomeMessage = new JTextPane();
    WelcomeMessage.setEditable(false);
    WelcomeMessage.setBackground(UIManager.getColor("Separator.highlight"));
    WelcomeMessage.setForeground(Color.DARK_GRAY);
    WelcomeMessage.setFont(new Font("Verdana", Font.BOLD, 11));
    WelcomeMessage.setText("\tWelcome to Neighborhood Information Center");

    JPanel panel = new JPanel();
    panel.setForeground(UIManager.getColor("TextPane.caretForeground"));
    panel.setBorder(new LineBorder(UIManager.getColor("TextField.background")));
    panel.setBackground(UIManager.getColor("TextField.disabledBackground"));

    JTextPane LoginMessage = new JTextPane();
    LoginMessage.setEditable(false);
    LoginMessage.setText("Please Login to Continue");
    LoginMessage.setForeground(SystemColor.controlText);
    LoginMessage.setFont(new Font("Verdana", Font.BOLD, 11));
    LoginMessage.setBackground(UIManager.getColor("TextField.disabledBackground"));

    LoginField = new JTextField();
    LoginField.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Login = LoginField.getText();
            System.out.println("\n Login-ID is : " + Login);
          }
        });
    LoginField.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            LoginField.setText("");
            LoginField.setForeground(Color.BLACK);
          }
        });
    LoginField.setBackground(UIManager.getColor("TextField.background"));
    LoginField.setForeground(SystemColor.scrollbar);
    LoginField.setText("Login ID");
    LoginField.setColumns(10);

    JButton LoginButton = new JButton("Login");
    LoginButton.addActionListener(
        new ActionListener() {
          @SuppressWarnings({})
          public void actionPerformed(ActionEvent arg0) {

            Login = LoginField.getText();
            System.out.println("\n Login-ID is : " + Login);

            Password = passwordField.getText();
            System.out.println("\n LOGIN BUTTON - Password is : " + Password);

            // ******************************************************************************
            // Set LoginField Back to Normal
            LoginField.setText("");
            LoginField.setBackground(UIManager.getColor("TextField.background"));
            LoginField.setForeground(SystemColor.scrollbar);
            LoginField.setText("Login ID");

            // Set PasswordField Back to Normal
            passwordField.setText("");
            passwordField.setBackground(UIManager.getColor("TextField.background"));
            passwordField.setForeground(SystemColor.scrollbar);
            char c = 0;
            passwordField.setEchoChar(c);
            passwordField.setText("Password");
            // *******************************************************************************

            int Valid = -99;

            try {
              int info = 1;
              Valid = database.getInfo(connection, Login, Password, info);
            } catch (SQLException e) {
              // TODO Auto-generated catch block
              System.out.printf("\n Failed to retrieve \n");
            }

            if (Valid > 0) {
              System.out.printf(" Successful in Login App. \n");
              frame.setVisible(false);
              userGUI program = new userGUI();
              // System.exit(0);
            } else {
              UnsuccessfulLogin fail = new UnsuccessfulLogin(Login);
              fail.NoSuccess(Login);
            }
          }
        });
    LoginButton.setBackground(new Color(102, 153, 255));

    JTextPane txtpnCreateAnAccount = new JTextPane();
    txtpnCreateAnAccount.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            CreateAccount newAcct = new CreateAccount();
            newAcct.account();
          }
        });
    txtpnCreateAnAccount.setEditable(false);
    txtpnCreateAnAccount.setText("Create an account");
    txtpnCreateAnAccount.setForeground(new Color(25, 25, 112));
    txtpnCreateAnAccount.setFont(new Font("Verdana", Font.BOLD, 11));
    txtpnCreateAnAccount.setBackground(SystemColor.menu);

    passwordField = new JPasswordField();

    // Setting Password as text
    passwordField.setBackground(UIManager.getColor("TextField.background"));
    passwordField.setForeground(SystemColor.scrollbar);
    passwordField.setText("Password");
    char c = 0;
    passwordField.setEchoChar(c);
    passwordField.setText("Password");

    // Done setting text

    passwordField.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            char c = 183;
            passwordField.setForeground(Color.black);
            passwordField.setEchoChar(c);
            passwordField.setText("");
          }
        });
    passwordField.setBackground(UIManager.getColor("TextField.background"));
    passwordField.setForeground(SystemColor.scrollbar);
    passwordField.setText("Password");
    passwordField.addActionListener(
        new ActionListener() {
          @SuppressWarnings("deprecation")
          public void actionPerformed(ActionEvent e) {

            Password = passwordField.getText();

            System.out.println("\n Password is : " + Password);
          }
        });
    GroupLayout gl_panel = new GroupLayout(panel);
    gl_panel.setHorizontalGroup(
        gl_panel
            .createParallelGroup(Alignment.TRAILING)
            .addGroup(
                gl_panel
                    .createSequentialGroup()
                    .addContainerGap(60, Short.MAX_VALUE)
                    .addGroup(
                        gl_panel
                            .createParallelGroup(Alignment.TRAILING)
                            .addGroup(
                                gl_panel
                                    .createSequentialGroup()
                                    .addComponent(
                                        txtpnCreateAnAccount,
                                        GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(63))
                            .addGroup(
                                gl_panel
                                    .createSequentialGroup()
                                    .addGroup(
                                        gl_panel
                                            .createParallelGroup(Alignment.TRAILING, false)
                                            .addComponent(
                                                LoginMessage,
                                                Alignment.LEADING,
                                                GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.PREFERRED_SIZE)
                                            .addComponent(
                                                LoginButton,
                                                Alignment.LEADING,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                Short.MAX_VALUE)
                                            .addComponent(
                                                LoginField,
                                                Alignment.LEADING,
                                                GroupLayout.DEFAULT_SIZE,
                                                166,
                                                Short.MAX_VALUE)
                                            .addComponent(passwordField))
                                    .addGap(42)))));
    gl_panel.setVerticalGroup(
        gl_panel
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_panel
                    .createSequentialGroup()
                    .addGap(30)
                    .addComponent(
                        LoginMessage,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addGap(56)
                    .addComponent(
                        LoginField,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addGap(18)
                    .addComponent(
                        passwordField,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addGap(18)
                    .addComponent(LoginButton)
                    .addPreferredGap(ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
                    .addComponent(
                        txtpnCreateAnAccount,
                        GroupLayout.PREFERRED_SIZE,
                        21,
                        GroupLayout.PREFERRED_SIZE)
                    .addGap(47)));
    panel.setLayout(gl_panel);
    GroupLayout gl_contentPane = new GroupLayout(contentPane);
    gl_contentPane.setHorizontalGroup(
        gl_contentPane
            .createParallelGroup(Alignment.TRAILING)
            .addGroup(
                gl_contentPane
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        gl_contentPane
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                gl_contentPane
                                    .createSequentialGroup()
                                    .addComponent(
                                        WelcomeMessage,
                                        GroupLayout.DEFAULT_SIZE,
                                        418,
                                        Short.MAX_VALUE)
                                    .addGap(0))
                            .addGroup(
                                Alignment.TRAILING,
                                gl_contentPane
                                    .createSequentialGroup()
                                    .addComponent(
                                        panel,
                                        GroupLayout.PREFERRED_SIZE,
                                        270,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(66)))));
    gl_contentPane.setVerticalGroup(
        gl_contentPane
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                gl_contentPane
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        WelcomeMessage,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)
                    .addGap(18)
                    .addComponent(
                        panel, GroupLayout.PREFERRED_SIZE, 342, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(48, Short.MAX_VALUE)));
    contentPane.setLayout(gl_contentPane);
  }
  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);
  }
Пример #13
0
  private void jbInit() throws Exception {
    border1 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151));
    border2 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151));
    border3 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178));
    titledBorder1 = new TitledBorder(border3, "Subject");
    border4 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178));
    titledBorder2 = new TitledBorder(border4, "Message");
    border5 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178));
    titledBorder3 = new TitledBorder(border5, "Subject");
    border6 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151));
    titledBorder4 = new TitledBorder(border6, "Message");
    border7 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151));
    titledBorder5 = new TitledBorder(border7, "Messages");
    border8 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151));
    titledBorder6 = new TitledBorder(border8, "Online Users");
    border9 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178));
    titledBorder7 = new TitledBorder(border9, "Send Message");
    this.getContentPane().setLayout(borderLayout1);
    jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT);
    jSplitPane1.setBorder(border1);
    jSplitPane1.setLastDividerLocation(250);
    jSplitPane1.setResizeWeight(1.0);
    jLabelServer.setRequestFocusEnabled(true);
    jLabelServer.setText("Server");
    jLabelUserId.setText("User Id");
    jTextFieldServer.setPreferredSize(new Dimension(75, 20));
    jTextFieldServer.setText("");
    jTextFieldUser.setPreferredSize(new Dimension(75, 20));
    jTextFieldUser.setText("");
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.setJMenuBar(jMenuBarMain);
    this.setTitle("Message Client");
    jLabeltargetUser.setText("Target");
    jTextFieldTargetUser.setPreferredSize(new Dimension(75, 20));
    jTextFieldTargetUser.setText("");
    jPanelSendMessages.setBorder(border2);
    jPanelSendMessages.setMaximumSize(new Dimension(32767, 32767));
    jPanelSendMessages.setOpaque(false);
    jPanelSendMessages.setPreferredSize(new Dimension(96, 107));
    jPanelSendMessages.setRequestFocusEnabled(true);
    jPanelSendMessages.setToolTipText("");
    jPanelSendMessages.setLayout(verticalFlowLayout1);
    jTextFieldSendSubject.setBorder(titledBorder3);
    jTextFieldSendSubject.setText("");
    jTextFieldSendSubject.addKeyListener(new Client_jTextFieldSendSubject_keyAdapter(this));
    jSplitPane2.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    jScrollPane1.setBorder(titledBorder5);
    jScrollPane2.setBorder(titledBorder6);
    jToggleButtonRegister.setText("Register");
    jToggleButtonRegister.addActionListener(new Client_jToggleButtonRegister_actionAdapter(this));
    jButtonMultiConnect.setText("Multi-Connect");
    jButtonMultiConnect.addActionListener(new Client_jButtonMultiConnect_actionAdapter(this));
    jListOnlineUsers.addMouseListener(new Client_jListOnlineUsers_mouseAdapter(this));
    jToggleButtonConnect.setText("Connect");
    jToggleButtonConnect.addActionListener(new Client_jToggleButtonConnect_actionAdapter(this));
    jTextPaneDisplayMessages.setEditable(false);
    jTextPaneDisplayMessages.addMouseListener(
        new Client_jTextPaneDisplayMessages_mouseAdapter(this));
    jTextFieldSendMessages.setBorder(titledBorder7);
    jTextFieldSendMessages.setToolTipText("");
    jTextFieldSendMessages.addKeyListener(new Client_jTextFieldSendMessages_keyAdapter(this));
    jButtonMessageStresser.setText("Msg Stresser");
    jButtonMessageStresser.addActionListener(
        new Client_jToggleButtonMessageStresser_actionAdapter(this));
    jMenuItemClearMessages.setText("Clear Messages");
    jMenuItemClearMessages.addActionListener(new Client_jMenuItemClearMessages_actionAdapter(this));
    jMenuServer.setText("Server");
    jMenuItemServerConnect.setText("Connect");
    jMenuItemServerConnect.addActionListener(new Client_jMenuItemServerConnect_actionAdapter(this));
    jMenuItemServerDisconnect.setText("Disconnect");
    jMenuItemServerDisconnect.addActionListener(
        new Client_jMenuItemServerDisconnect_actionAdapter(this));
    jMenuOptions.setText("Options");
    jMenuTest.setText("Test");
    jMenuItemOptionsRegister.setText("Register");
    jMenuItemOptionsRegister.addActionListener(
        new Client_jMenuItemOptionsRegister_actionAdapter(this));
    jMenuItemOptionsDeregister.setText("Deregister");
    jMenuItemOptionsDeregister.addActionListener(
        new Client_jMenuItemOptionsDeregister_actionAdapter(this));
    jMenuItemOptionsEavesdrop.setText("Eavesdrop");
    jMenuItemOptionsEavesdrop.addActionListener(
        new Client_jMenuItemOptionsEavesdrop_actionAdapter(this));
    jMenuItemOptionsUneavesdrop.setText("Uneavesdrop");
    jMenuItemOptionsUneavesdrop.addActionListener(
        new Client_jMenuItemOptionsUneavesdrop_actionAdapter(this));
    jMenuItemTestMulticonnect.setText("Multiconnect");
    jMenuItemTestMulticonnect.addActionListener(
        new Client_jMenuItemTestMulticonnect_actionAdapter(this));
    jMenuItemTestMessageStresser.setText("Message Stresser");
    jMenuItemTestMessageStresser.addActionListener(
        new Client_jMenuItemTestMessageStresser_actionAdapter(this));
    jMenuItemTestMultidisconnect.setText("Multidisconnect");
    jMenuItemTestMultidisconnect.addActionListener(
        new Client_jMenuItemTestMultidisconnect_actionAdapter(this));
    jMenuItemOptionsGlobalEavesdrop.setText("Global Eavesdrop");
    jMenuItemOptionsGlobalEavesdrop.addActionListener(
        new Client_jMenuItemOptionsGlobalEavesdrop_actionAdapter(this));
    jMenuItemOptionsGlobalUneavesdrop.setEnabled(false);
    jMenuItemOptionsGlobalUneavesdrop.setText("Global Uneavesdrop");
    jMenuItemOptionsGlobalUneavesdrop.addActionListener(
        new Client_jMenuItemOptionsGlobalUneavesdrop_actionAdapter(this));
    jLabelPwd.setText("Pwd");
    jPasswordFieldPwd.setMinimumSize(new Dimension(11, 20));
    jPasswordFieldPwd.setPreferredSize(new Dimension(75, 20));
    jPasswordFieldPwd.setText("");
    jMenuItemScheduleCommand.setText("Schedule Command");
    jMenuItemScheduleCommand.addActionListener(
        new Client_jMenuItemScheduleCommand_actionAdapter(this));
    jMenuItemEditScheduledCommands.setText("Edit Scheduled Commands");
    jMenuItemEditScheduledCommands.addActionListener(
        new Client_jMenuItemEditScheduledCommands_actionAdapter(this));
    jPanelSendMessages.add(jTextFieldSendSubject, null);
    jPanelSendMessages.add(jTextFieldSendMessages, null);
    jSplitPane1.add(jSplitPane2, JSplitPane.TOP);
    jSplitPane2.add(jScrollPane1, JSplitPane.TOP);
    jScrollPane1.getViewport().add(jTextPaneDisplayMessages, null);
    jSplitPane2.add(jScrollPane2, JSplitPane.BOTTOM);
    jScrollPane2.getViewport().add(jListOnlineUsers, null);
    this.getContentPane().add(jSplitPane1, BorderLayout.CENTER);
    jSplitPane1.add(jPanelSendMessages, JSplitPane.BOTTOM);
    this.getContentPane().add(jPanel1, BorderLayout.NORTH);
    jPanel1.add(jLabelServer, null);
    jPanel1.add(jTextFieldServer, null);
    jPanel1.add(jLabelUserId, null);
    jPanel1.add(jTextFieldUser, null);
    jPanel1.add(jLabelPwd, null);
    jPanel1.add(jPasswordFieldPwd, null);
    jPanel1.add(jLabeltargetUser, null);
    jPanel1.add(jTextFieldTargetUser, null);
    jPanel1.add(jToggleButtonConnect, null);
    jPanel1.add(jToggleButtonRegister, null);
    jPanel1.add(jButtonMultiConnect, null);
    jPanel1.add(jButtonMessageStresser, null);
    jPopupMenuMessageArea.add(jMenuItemClearMessages);
    jMenuBarMain.add(jMenuServer);
    jMenuBarMain.add(jMenuOptions);
    jMenuBarMain.add(jMenuTest);
    jMenuServer.add(jMenuItemServerConnect);
    jMenuServer.add(jMenuItemServerDisconnect);
    jMenuOptions.add(jMenuItemOptionsRegister);
    jMenuOptions.add(jMenuItemOptionsDeregister);
    jMenuOptions.add(jMenuItemOptionsEavesdrop);
    jMenuOptions.add(jMenuItemOptionsUneavesdrop);
    jMenuOptions.add(jMenuItemOptionsGlobalEavesdrop);
    jMenuOptions.add(jMenuItemOptionsGlobalUneavesdrop);
    jMenuTest.add(jMenuItemTestMulticonnect);
    jMenuTest.add(jMenuItemTestMultidisconnect);
    jMenuTest.add(jMenuItemTestMessageStresser);
    jMenuTest.add(jMenuItemScheduleCommand);
    jMenuTest.add(jMenuItemEditScheduledCommands);
    jSplitPane1.setDividerLocation(200);
    jSplitPane2.setDividerLocation(600);
    jListOnlineUsers.setCellRenderer(new OnlineListCellRenderer());
    jListOnlineUsers.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    jMenuItemTestMulticonnect.setEnabled(true);
    jMenuItemTestMultidisconnect.setEnabled(false);
    jMenuItemServerConnect.setEnabled(true);
    jMenuItemServerDisconnect.setEnabled(false);
    jMenuItemOptionsRegister.setEnabled(true);
    jMenuItemOptionsDeregister.setEnabled(false);
  }
Пример #14
0
  public Notes(String sessionID, ChatRoom room) {
    setLayout(new BorderLayout());

    this.chatRoom = room;

    this.sessionID = sessionID;

    textPane = new JTextPane();
    textPane.setText(FpRes.getString("message.click.to.add.notes"));
    textPane.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (!hasClickedInPane) {
              textPane.setText("");
              hasClickedInPane = true;
            }
          }
        });

    scrollPane = new JScrollPane(textPane);

    this.add(scrollPane, BorderLayout.CENTER);

    toolBar = new JToolBar();
    toolBar.setFloatable(false);

    saveButton = new RolloverButton(FastpathRes.getImageIcon(FastpathRes.SAVE_AS_16x16));

    toolBar.add(saveButton);

    ResourceUtils.resButton(saveButton, FpRes.getString("button.save.note"));

    final BackgroundPane titlePanel = new BackgroundPane();
    titlePanel.setLayout(new GridBagLayout());

    JLabel notesLabel = new JLabel();
    notesLabel.setFont(new Font("Dialog", Font.BOLD, 12));

    ResourceUtils.resLabel(notesLabel, textPane, FpRes.getString("label.notes"));

    JLabel descriptionLabel = new JLabel();
    descriptionLabel.setText(FpRes.getString("message.chat.notes"));

    titlePanel.add(
        notesLabel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 5, 5, 5),
            0,
            0));
    titlePanel.add(
        descriptionLabel,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 10, 5, 5),
            0,
            0));
    titlePanel.add(
        saveButton,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(5, 10, 5, 5),
            0,
            0));

    // add(titlePanel, BorderLayout.NORTH);

    textPane
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              public void changedUpdate(DocumentEvent e) {
                saveButton.setEnabled(true);
                updated = true;
              }

              public void insertUpdate(DocumentEvent e) {
                saveButton.setEnabled(true);
                updated = true;
              }

              public void removeUpdate(DocumentEvent e) {
                saveButton.setEnabled(true);
                updated = true;
              }
            });

    saveButton.setEnabled(false);

    // Add status label
    statusLabel = new JLabel();
    this.add(statusLabel, BorderLayout.SOUTH);

    chatRoom.addClosingListener(
        new ChatRoomClosingListener() {
          public void closing() {
            if (updated) {
              saveNotes();
            }
          }
        });
  }