Example #1
0
 private void jbInit() throws Exception {
   box1 = Box.createVerticalBox();
   this.getContentPane().setLayout(borderLayout1);
   close.setText("Close");
   close.addActionListener(new CellHelpWindow_close_actionAdapter(this));
   jLabel1.setText("Recommendation");
   jLabel2.setText("Description");
   jPanel1.setLayout(borderLayout2);
   jPanel2.setLayout(borderLayout3);
   description.setText("jTextPane1");
   description.setContentType("text/html");
   scp1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   scp1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
   scp1.setToolTipText("");
   recom.setText("");
   recom.setContentType("text/html");
   this.getContentPane().add(box1, BorderLayout.CENTER);
   box1.add(jPanel1, null);
   box1.add(jPanel2, null);
   this.getContentPane().add(jPanel3, BorderLayout.SOUTH);
   jPanel3.add(close, null);
   jPanel2.add(jLabel1, BorderLayout.NORTH);
   jPanel2.add(scp2, BorderLayout.CENTER);
   scp2.getViewport().add(recom, null);
   jPanel2.add(scp2, BorderLayout.CENTER);
   jPanel1.add(jLabel2, BorderLayout.NORTH);
   jPanel1.add(scp1, BorderLayout.CENTER);
   scp1.getViewport().add(description, null);
 }
Example #2
0
 private void initFields(Student student) {
   if (student != null) {
     txtFaculty.setText(student.getGroup().getFaculty());
     txtNOG.setText(String.valueOf(student.getGroup().getNumberOfGroup()));
     txtName.setText(student.getNameOfStudent());
     txtDOE.setText(student.getDateOfEnrollment());
   }
 }
  public SurrenderUI() {
    setType(Type.UTILITY);

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

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

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

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

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

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

    setSize(800, 553);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
Example #4
0
  private void updateEditorView() {
    editorPane.setText("");
    numParameters = 0;
    try {
      java.util.List elements = editableTemplate.getPrintfElements();
      for (Iterator it = elements.iterator(); it.hasNext(); ) {
        PrintfUtil.PrintfElement el = (PrintfUtil.PrintfElement) it.next();
        if (el.getFormat().equals(PrintfUtil.PrintfElement.FORMAT_NONE)) {
          appendText(el.getElement(), PLAIN_ATTR);
        } else {
          insertParameter(
              (ConfigParamDescr) paramKeys.get(el.getElement()),
              el.getFormat(),
              editorPane.getDocument().getLength());
        }
      }
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(
          this,
          "Invalid Format: " + ex.getMessage(),
          "Invalid Printf Format",
          JOptionPane.ERROR_MESSAGE);

      selectedPane = 1;
      printfTabPane.setSelectedIndex(selectedPane);
      updatePane(selectedPane);
    }
  }
 /*
  * (non-Javadoc)
  *
  * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
  */
 @Override
 public void update(Observable o, Object arg) {
   if (o instanceof qcevolutionbackend) {
     if (null != backend.getCurrentse()) {
       backend.getCurrentse().addObserver(this);
     }
   } else if (o instanceof ProblemManager) {
     Set<String> probs = backend.getProbmanager().getAvailableProblems();
     String[] options = new String[probs.size() + 1];
     options[0] = "Please Select Problem";
     int index = 1;
     Iterator<String> iter = probs.iterator();
     while (iter.hasNext()) {
       options[index++] = iter.next();
     }
     selection_model = new DefaultComboBoxModel(options);
     if (backend.getQproblem() != null) {
       String key = backend.getQproblem().getName();
       selection_model.setSelectedItem(key);
       description.setText(backend.getProbmanager().getSearchEngineDesc(key));
     }
     selection.setModel(selection_model);
   } else {
     if (backend.getCurrentse() != null) {
       if (backend.getCurrentse().getState() == SearchEngineState.Searching) {
         selection.setEnabled(false);
       } else {
         selection.setEnabled(true);
       }
       validate();
     }
   }
 }
  private void setupPanels(@Nullable ProjectTemplate template) {

    restorePanel(myNamePathComponent, 4);
    restorePanel(myModulePanel, myWizardContext.isCreatingNewProject() ? 8 : 6);
    restorePanel(myExpertPanel, myWizardContext.isCreatingNewProject() ? 1 : 0);
    mySettingsStep = myModuleBuilder == null ? null : myModuleBuilder.modifySettingsStep(this);

    String description = null;
    if (template != null) {
      description = template.getDescription();
      if (StringUtil.isNotEmpty(description)) {
        StringBuilder sb = new StringBuilder("<html><body><font ");
        sb.append(SystemInfo.isMac ? "" : "face=\"Verdana\" size=\"-1\"").append('>');
        sb.append(description).append("</font></body></html>");
        description = sb.toString();
        myDescriptionPane.setText(description);
      }
    }

    myExpertPlaceholder.setVisible(
        !(myModuleBuilder instanceof TemplateModuleBuilder)
            && myExpertPanel.getComponentCount() > 0);
    for (int i = 0; i < 6; i++) {
      myModulePanel.getComponent(i).setVisible(!(myModuleBuilder instanceof EmptyModuleBuilder));
    }
    myDescriptionPanel.setVisible(StringUtil.isNotEmpty(description));

    mySettingsPanel.revalidate();
    mySettingsPanel.repaint();
  }
Example #7
0
  private JPanel createCentrePanel(YDataStateException exception) {
    JPanel centrePanel = new JPanel(new GridLayout(1, 2));

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

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

    centrePanel.add(msgPanel, BorderLayout.NORTH);
    return centrePanel;
  }
  public void substarterEnd(String prefix, String userName, String input) {
    System.out.println("ending give");
    if (substarter.end(winNum)) {

      g_start.setEnabled(true);
      g_end.setEnabled(false);

      String winner = substarter.returnWinner(winNum);

      input = "Congrats to the new sub winner: " + winner + "!";
      prefix = "<b><font color=blue>[" + userName + "]:</font></b> ";

      registeredUserList.setText(winner + "\n");

    } else {
      g_start.setEnabled(true);
      g_end.setEnabled(false);

      prefix = "<b><font color=blue>[" + userName + "]:</font></b> ";
      input = "No one entered giveaway, ending giveaway.";
    }
    sock.outputToChannel(input, channelName);
    try {
      toChatScreen(prefix + input, false);
    } catch (IOException | BadLocationException ex) {
      Logger.getLogger(IRCBOT.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  /**
   * Shows the given error message.
   *
   * @param text the text of the error
   */
  private void showErrorMessage(String text) {
    errorPane.setText(text);

    if (errorPane.getParent() == null) add(errorPane, BorderLayout.NORTH);

    SwingUtilities.getWindowAncestor(CreateSip2SipAccountForm.this).pack();
  }
Example #10
0
  private void show(int _current) {
    OpenDefinitionsDocument doc = _docs.get(_current);

    String text = getTextFor(doc);

    _label.setText(_displayManager.getName(doc));
    _label.setIcon(_displayManager.getIcon(doc));

    if (text.length() > 0) {
      // as wide as the text area wants, but only 200px high
      _textpane.setText(text);
      _scroller.setPreferredSize(_textpane.getPreferredScrollableViewportSize());
      if (_scroller.getPreferredSize().getHeight() > 200)
        _scroller.setPreferredSize(
            new Dimension((int) _scroller.getPreferredSize().getWidth(), 200));

      _scroller.setVisible(_showSource);
    } else _scroller.setVisible(false);

    Dimension d = _label.getMinimumSize();
    d.setSize(d.getWidth() + _padding * 2, d.getHeight() + _padding * 2);
    _label.setPreferredSize(d);
    _label.setHorizontalAlignment(SwingConstants.CENTER);
    _label.setVerticalAlignment(SwingConstants.CENTER);
    pack();
    centerH();
  }
Example #11
0
 /**
  * Displays the string representation of the maze.
  *
  * @param mz String representing the maze.
  */
 public void displayMaze(String mz) {
   SimpleAttributeSet attr = new SimpleAttributeSet();
   StyleConstants.setLineSpacing(attr, -0.3f);
   mazeOutLabel.setParagraphAttributes(attr, false);
   mazeOutLabel.setText(mz);
   imagePanel.add(mazeOutLabel);
   pack();
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
  */
 @Override
 public void actionPerformed(ActionEvent e) {
   JComboBox cb = (JComboBox) e.getSource();
   if (cb.getSelectedIndex() != 0) {
     String prob_key = (String) cb.getSelectedItem();
     description.setText(backend.getProbmanager().getSearchEngineDesc(prob_key));
     backend.setQproblem(backend.getProbmanager().getProblem(prob_key));
   }
 }
  /** Clears all the data previously entered in the form. */
  public void clear() {
    usernameField.setText("");
    displayNameField.setText("");
    passField.setText("");
    retypePassField.setText("");
    emailField.setText("");
    errorPane.setText("");

    remove(errorPane);
  }
Example #14
0
 public void newFile() {
   if (!dirty || checkForSave()) {
     textView.setText("");
     consoleView.setText("");
     problemsView.setText("");
     statusView.setText(" Created new file.");
     file = null;
     // reset dirty bit
     dirty = false;
   }
 }
Example #15
0
  /**
   * Updates the text area to take into account the new search text.
   *
   * @param searchText the search text to update
   */
  private void updateTextArea(String searchText) {
    if (callButton.getParent() != null) {
      textArea.setText(
          GuiActivator.getResources()
              .getI18NString(
                  "service.gui.NO_CONTACTS_FOUND", new String[] {'"' + searchText + '"'}));

      this.revalidate();
      this.repaint();
    }
  }
Example #16
0
  public LoginView() {

    // set head label Maybe it can be updated with a logo style image later.
    loginViewHeadLabel.setFont(new Font("arial", Font.BOLD, 18));
    loginViewHeadLabel.setForeground(new Color(143, 51, 32));
    loginViewHeadLabel.setText("E-COMMERCE for SME v0.01");
    // setting header jtextpane for information.
    loginViewTextPane.setFont(new Font("arial", Font.BOLD, 14));
    loginViewTextPane.setForeground(Color.RED);
    loginViewTextPane.setText("Kullanıcı adı ve parolanızı giriniz.");
  }
Example #17
0
  public RecentDocFrame(MainFrame f) {
    super();
    _frame = f;
    _current = 0;
    _label =
        new JLabel("...") {
          // Enable anti-aliased text by overriding paintComponent.
          protected void paintComponent(Graphics g) {
            if (_antiAliasText && g instanceof Graphics2D) {
              Graphics2D g2d = (Graphics2D) g;
              g2d.setRenderingHint(
                  RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
            }
            super.paintComponent(g);
          }
        };
    _panel = new JPanel();
    _scroller = new JScrollPane();
    _textpane =
        new JTextPane() {
          // Enable anti-aliased text by overriding paintComponent.
          protected void paintComponent(Graphics g) {
            if (_antiAliasText && g instanceof Graphics2D) {
              Graphics2D g2d = (Graphics2D) g;
              g2d.setRenderingHint(
                  RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
            }
            super.paintComponent(g);
          }
        };

    _textpane.setText("...");
    _scroller.getViewport().add(_textpane);
    _scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    _scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    _scroller.setMaximumSize(new Dimension(300, 200));

    _panel.setLayout(new BorderLayout());
    _panel.add(_label, BorderLayout.NORTH);
    _panel.add(_scroller, BorderLayout.SOUTH);

    getContentPane().add(_panel);
    pack();
    updateFontColor();
    _showSource = DrJava.getConfig().getSetting(OptionConstants.SHOW_SOURCE_WHEN_SWITCHING);
    DrJava.getConfig()
        .addOptionListener(OptionConstants.DEFINITIONS_BACKGROUND_COLOR, _colorListener);
    DrJava.getConfig().addOptionListener(OptionConstants.DEFINITIONS_NORMAL_COLOR, _colorListener);
    DrJava.getConfig().addOptionListener(OptionConstants.FONT_MAIN, _fontListener);
    DrJava.getConfig().addOptionListener(OptionConstants.TEXT_ANTIALIAS, _antialiasListener);
    DrJava.getConfig()
        .addOptionListener(OptionConstants.SHOW_SOURCE_WHEN_SWITCHING, _showSourceListener);
  }
Example #18
0
  /**
   * Creates the <tt>UnknownContactPanel</tt> by specifying the parent window.
   *
   * @param window the parent window
   */
  public UnknownContactPanel(MainFrame window) {
    super(new BorderLayout());

    this.parentWindow = window;

    TransparentPanel mainPanel = new TransparentPanel(new BorderLayout());

    this.add(mainPanel, BorderLayout.NORTH);

    if (!ConfigurationUtils.isAddContactDisabled()) {
      initAddContactButton();
    }

    initCallButton();

    initSMSButton();

    initTextArea();
    mainPanel.add(textArea, BorderLayout.CENTER);

    if (callButton.getParent() != null) {
      textArea.setText(
          GuiActivator.getResources()
              .getI18NString(
                  "service.gui.NO_CONTACTS_FOUND",
                  new String[] {'"' + parentWindow.getCurrentSearchText() + '"'}));
    } else {
      textArea.setText(
          GuiActivator.getResources().getI18NString("service.gui.NO_CONTACTS_FOUND_SHORT"));
    }

    if (buttonPanel.getComponentCount() > 0) {
      TransparentPanel southPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
      southPanel.add(buttonPanel);

      mainPanel.add(southPanel, BorderLayout.SOUTH);
    }

    loadSkin();
  }
Example #19
0
  private void decompile(Map params) {
    try {
      ClazzSourceView csv = ClazzSourceViewFactory.getClazzSourceView(clazz);
      csv.setDecompileParameters(params);
      source = csv.getSource();

      String sourceText = source;

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

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

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

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

      throw new IllegalArgumentException("Error decompiling");
    }
  }
Example #20
0
 void jList1_mouseClicked(MouseEvent e) {
   int indx = jList1.getLeadSelectionIndex();
   jTextPane2.setText(((applicant) appList.elementAt(indx)).getDescription());
   try {
     currPicture =
         new ImageIcon(
             "../Blackwood Client/src/edu/nodak/ndsu/cs/lions/blackwood/Resources/Image/people/"
                 + ((applicant) jList1.getSelectedValue()).Picture
                 + ".gif");
     repaint();
   } catch (Exception ex) {
     ex.printStackTrace();
   }
 }
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Windows Form
   * Designer. Otherwise, retrieving design might not work properly. Tip: If you must revise this
   * method, please backup this GUI file for JFrameBuilder to retrieve your design properly in
   * future, before revising this method.
   */
  private void initializeComponent() {
    jTextPane1 = new JTextPane();
    jButton1 = new JButton();
    jButton2 = new JButton();
    contentPane = (JPanel) this.getContentPane();

    //
    // jTextPane1
    //
    jTextPane1.setBackground(new Color(140, 152, 236));
    jTextPane1.setForeground(new Color(255, 0, 0));
    jTextPane1.setText(
        "                               \n                                                 NO DONUT FOR YOU\n                           SORRY FOR INCONVINIENCE FACED BY YOU\n                                    SEVER IS DOWN FOR A TIME BEING\n                                         PLEASE TRY AGAIN LATER");
    jTextPane1.setEditable(false);
    //
    // jButton1
    //
    jButton1.setText("Home");
    jButton1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButton1_actionPerformed(e);
          }
        });
    //
    // jButton2
    //
    jButton2.setText("Friends");
    jButton2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jButton2_actionPerformed(e);
          }
        });
    //
    // contentPane
    //
    contentPane.setLayout(null);
    contentPane.setBackground(new Color(140, 152, 236));
    addComponent(contentPane, jTextPane1, 76, 165, 451, 150);
    addComponent(contentPane, jButton1, 94, 36, 83, 39);
    addComponent(contentPane, jButton2, 184, 36, 83, 39);
    //
    // serverdown
    //
    this.setTitle("serverdown - extends JFrame");
    this.setLocation(new Point(0, 0));
    this.setSize(new Dimension(1024, 768));
  }
Example #22
0
 public void prettyPrint() {
   try {
     // clear old problem messages
     problemsView.setText("");
     // update status view
     statusView.setText(" Parsing ...");
     LispExpr root = Parser.parse(textView.getText());
     statusView.setText(" Pretty Printing ...");
     String newText = PrettyPrinter.prettyPrint(root);
     textView.setText(newText);
     statusView.setText(" Done.");
   } catch (Error e) {
     System.err.println(e.getMessage());
     statusView.setText(" Errors.");
   }
 }
Example #23
0
 public void openFile() {
   if (!dirty || checkForSave()) {
     if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
       file = fileChooser.getSelectedFile();
     } else {
       // user cancelled open after all
       return;
     }
     // load file into text view
     textView.setText(physReadTextFile(file));
     // update status
     statusView.setText(" Loaded file \"" + file.getName() + "\".");
     // reset dirty bit
     dirty = false;
   }
 }
 /**
  * Initializes event editing panel.
  *
  * @param ne Network Element.
  * @param em Event Manager.
  * @param evt Event.
  */
 protected void initialize(AbstractNetworkElement ne, EventManager em) {
   myNE = ne;
   myEventManager = em;
   setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
   JPanel pH = new JPanel(new FlowLayout());
   JLabel lD =
       new JLabel(
           "<html><font color=\"blue\">"
               + TypesHWC.typeString(myNE.getType())
               + " "
               + myNE.toString()
               + "</font></html>");
   pH.add(lD);
   add(pH);
   // Box dp = Box.createVerticalBox();
   JPanel pD = new JPanel(new BorderLayout());
   pD.setBorder(BorderFactory.createTitledBorder("Description"));
   desc.setText(myEvent.getDescription());
   pD.add(new JScrollPane(desc), BorderLayout.CENTER);
   // dp.add(pD);
   add(pD);
   fillPanel();
   // Box fp = Box.createVerticalBox();
   JPanel pT = new JPanel(new FlowLayout());
   pT.setBorder(BorderFactory.createTitledBorder("Activation Time"));
   hh = new JSpinner(new SpinnerNumberModel(Util.getHours(myEvent.getTime()), 0, 99, 1));
   hh.setEditor(new JSpinner.NumberEditor(hh, "00"));
   pT.add(hh);
   pT.add(new JLabel("h "));
   mm = new JSpinner(new SpinnerNumberModel(Util.getMinutes(myEvent.getTime()), 0, 59, 1));
   mm.setEditor(new JSpinner.NumberEditor(mm, "00"));
   pT.add(mm);
   pT.add(new JLabel("m "));
   ss = new JSpinner(new SpinnerNumberModel(Util.getSeconds(myEvent.getTime()), 0, 59.99, 1));
   ss.setEditor(new JSpinner.NumberEditor(ss, "00.##"));
   pT.add(ss);
   pT.add(new JLabel("s"));
   // fp.add(pT);
   add(pT);
   winEE = new WindowEventEditor(this, null);
   winEE.setVisible(true);
   return;
 }
  @Inject
  public ProblemSelectionPanel(qcevolutionbackend be) {
    this.setLayout(new BorderLayout());
    backend = be;
    Set<String> probs = backend.getProbmanager().getAvailableProblems();
    String[] options = new String[probs.size() + 1];
    options[0] = "Please Select Problem";
    int index = 1;
    Iterator<String> iter = probs.iterator();
    while (iter.hasNext()) {
      options[index++] = iter.next();
    }
    selection_model = new DefaultComboBoxModel(options);

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

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

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

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

    this.add(selection, BorderLayout.NORTH);
    this.add(description_scroller, BorderLayout.CENTER);
  }
 private void handleConnect() {
   if (jToggleButtonConnect.isSelected() || jMenuItemServerConnect.isEnabled())
     try {
       jTextPaneDisplayMessages.setText("");
       session = new Session();
       try {
         String userid = jTextFieldUser.getText();
         if (jPasswordFieldPwd.getPassword() != null) {
           String pwd = String.valueOf(jPasswordFieldPwd.getPassword()).trim();
           if (!pwd.equals("")) {
             userid += ":" + pwd;
           }
         }
         if (session.connect(jTextFieldServer.getText(), userid)) {
           displayMessage("Connected\n", incomingMsgAttrSet);
           session.addListener(this);
           jToggleButtonConnect.setText("Disconnect");
           jMenuItemServerConnect.setEnabled(false);
           jMenuItemServerDisconnect.setEnabled(true);
         } else {
           jToggleButtonConnect.setSelected(false);
           jMenuItemServerConnect.setEnabled(true);
           jMenuItemServerDisconnect.setEnabled(false);
           displayMessage("Connection attempt failed\n", offlineClientAttrSet);
         }
       } catch (ConnectionException ex1) {
         jToggleButtonConnect.setSelected(false);
         jMenuItemServerConnect.setEnabled(true);
         jMenuItemServerDisconnect.setEnabled(false);
         displayMessage(
             "Connection attempt failed: " + ex1.getMessage() + "\n", offlineClientAttrSet);
       }
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   else {
     disconnect();
     jMenuItemServerConnect.setEnabled(true);
     jMenuItemServerDisconnect.setEnabled(false);
     displayMessage("Disconnected\n", offlineClientAttrSet);
   }
 }
  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);
          }
        });
  }
Example #28
0
  private void initComponent() {
    JTextPane helpContentTextPane = new JTextPane();
    helpContentTextPane.setEditable(false);
    helpContentTextPane.setContentType("text/html;charset=utf-8");
    try {
      helpContentTextPane.setText(FileUtil.readFileToString(Config.HELP_FILE_PATH));
    } catch (IOException e) {
      e.printStackTrace();
    }

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

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

    this.setTitle("Help");
    this.setIconImage(new ImageIcon(Config.LOGO_IMG).getImage());
    this.setSize(Config.HELP_DIALOG_WIDTH, Config.HELP_DIALOG_HEIGHT);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  }
Example #29
0
    public MonitorGUI(final PhoneCallMonitor pcm, String title) {
      this.pcm = pcm;

      text.setFont(new Font("Courier", Font.PLAIN, 12));
      text.setText(title);

      JPanel buttons = new JPanel();
      buttons.setLayout(new GridLayout(1, 0));

      button =
          new JButton(
              new AbstractAction("Pick Up" /*,new JarImageIcon(getClass(),"32x32/play.png")*/) {
                public void actionPerformed(ActionEvent ev) {
                  button.setEnabled(false);
                  pcm.pickup();
                }
              });
      buttons.add(button);

      setLayout(new BorderLayout());
      add(new JScrollPane(text), BorderLayout.CENTER);
      add(buttons, BorderLayout.SOUTH);
    }
Example #30
0
  public void substarterBegin(String prefix, String userName, String input) {
    if (substarter.start(winNum)) {
      System.out.println("Starting give");
      g_start.setEnabled(false);
      g_end.setEnabled(true);

      registeredUserList.setText("");

      prefix = "<b><font color=blue>[" + userName + "]:</font></b> ";
      input =
          "Substarter giveaway is starting, make sure to register at http://substarter.com/my-account to participate.  Type !substarter for a chance to win a free sub!";
      sock.outputToChannel(input, channelName);
    } else {
      input =
          "<font color='red'>[WARNING]: Giveaway already started, perhaps in another chat window.</font>";
    }

    try {
      toChatScreen(prefix + input, false);
    } catch (IOException | BadLocationException ex) {
      Logger.getLogger(IRCBOT.class.getName()).log(Level.SEVERE, null, ex);
    }
  }