示例#1
13
  private void setScrollBarVisibility(final int visibility) {
    final ScrollableJTextArea pane = getDelegate();
    final JTextArea view = pane.getView();
    view.setLineWrap(false);

    switch (visibility) {
      case TextArea.SCROLLBARS_NONE:
        pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        view.setLineWrap(true);
        break;
      case TextArea.SCROLLBARS_VERTICAL_ONLY:
        pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        view.setLineWrap(true);
        break;
      case TextArea.SCROLLBARS_HORIZONTAL_ONLY:
        pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        break;
      default:
        pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        break;
    }
  }
示例#2
1
  /**
   * Returns a JTextArea in a scroll pane
   *
   * @return JTextArea in a scroll pane
   */
  protected JComponent getCenterComponent() {
    // visually placed in the south !
    lineCounter = new LineCounterField();
    lineCounter.setBorder(BorderFactory.createEmptyBorder(0, SwingConfig.PADDING, 0, 0));
    // end of visually placed in the south

    saveAction = new SaveAction(getLocalizer().localize("button.save"));

    // text area
    textArea = new JTextArea();
    textArea.setLineWrap(false);
    textArea.setEditable(true);
    textArea.addCaretListener(lineCounter);
    textArea
        .getKeymap()
        .addActionForKeyStroke(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK), saveAction);
    loadFile();
    JScrollPane contentScrollPane = new JScrollPane(textArea);
    contentScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
    Rectangle screen = getGraphicsConfiguration().getBounds();
    contentScrollPane.setPreferredSize(
        new Dimension(Math.min(screen.width / 3, 420), Math.min(2 * screen.height / 3, 560)));
    return contentScrollPane;
  }
示例#3
0
  /**
   * Create the XPath task pane
   *
   * @return XPath task pane
   */
  private JPanel createXpathExtractorTasksPanel() {
    Box xpathActionPanel = Box.createVerticalBox();

    Box selectorAndButton = Box.createHorizontalBox();

    Border margin = new EmptyBorder(5, 5, 0, 5);
    xpathActionPanel.setBorder(margin);
    xpathExpressionField =
        new JLabeledTextField(JMeterUtils.getResString("xpath_tester_field")); // $NON-NLS-1$

    JButton xpathTester =
        new JButton(JMeterUtils.getResString("xpath_tester_button_test")); // $NON-NLS-1$
    xpathTester.setActionCommand(XPATH_TESTER_COMMAND);
    xpathTester.addActionListener(this);

    selectorAndButton.add(xpathExpressionField);
    selectorAndButton.add(xpathTester);

    xpathActionPanel.add(selectorAndButton);
    xpathActionPanel.add(xmlConfPanel);
    xpathActionPanel.add(getFragment);

    xpathResultField = new JTextArea();
    xpathResultField.setEditable(false);
    xpathResultField.setLineWrap(true);
    xpathResultField.setWrapStyleWord(true);

    JPanel xpathTasksPanel = new JPanel(new BorderLayout(0, 5));
    xpathTasksPanel.add(xpathActionPanel, BorderLayout.NORTH);
    xpathTasksPanel.add(GuiUtils.makeScrollPane(xpathResultField), BorderLayout.CENTER);

    return xpathTasksPanel;
  }
示例#4
0
  /**
   * this is the gui initialization method
   *
   * @param width - the main window width
   * @param height - the main window height
   */
  private void showClientGui(int width, int height) {
    int rows = 2;
    int cols = 2;

    JPanel panel = new JPanel();
    JButton send = new JButton("send");
    JButton disconnect = new JButton("disconnect");

    _textField = new JTextField();
    _textField.setMaximumSize(new Dimension(400, 40));
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    _frame = new JFrame("Chat client");
    _frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    _frame.setSize(width, height);
    _textArea = new JTextArea("", rows, cols);
    _textArea.setLineWrap(true);
    panel.add(_textArea);
    panel.add(_textField);
    panel.add(send);
    panel.add(disconnect);

    _frame.add(panel);
    _frame.setVisible(true);
    SendMessageListener smlisten = new SendMessageListener();
    send.addActionListener(smlisten);
    _textField.addActionListener(smlisten);
    disconnect.addActionListener(new disconnectButtonListener());
  }
 public MyPanel() {
   JButton button = new JButton("Talk to Mortens Server");
   final JTextArea textArea = new JTextArea();
   JScrollPane scrollPane = new JScrollPane(textArea);
   textArea.setWrapStyleWord(true);
   textArea.setLineWrap(true);
   button.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           try {
             URLConnection urlConnection =
                 new URL(
                         "http://213.173.255.177:8081/funnystuff/Servlet267944?name="
                             + System.getProperty("user.name").replaceAll(" ", "%20"))
                     .openConnection();
             InputStream inputStream = urlConnection.getInputStream();
             textArea.append(
                 new BufferedReader(new InputStreamReader(inputStream)).readLine() + "\n");
           } catch (IOException e1) {
             e1.printStackTrace();
           }
         }
       });
   setLayout(new BorderLayout());
   JPanel panel2 = new JPanel();
   panel2.add(button);
   add(panel2, BorderLayout.WEST);
   add(scrollPane, BorderLayout.CENTER);
 }
  public PrinterStatusPanel(Executor exe) {
    this.exe = exe;
    myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.PAGE_AXIS));
    myPanel.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.black), "Printer Status"));

    // Temperature plot
    tempPanel = new TemperaturePanel(exe);

    // Text Area for Log Messages
    statusText.setEditable(false);
    statusText.setFont(new Font(Font.MONOSPACED, Font.PLAIN, FONT_SIZE));
    statusText.setLineWrap(false);
    statusText.setText(OFFLINE_MESSAGE);
    final DefaultCaret caret = (DefaultCaret) statusText.getCaret();
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    scrollPane = new JScrollPane(statusText);
    scrollPane.setViewportView(statusText);

    final JSplitPane splitPane =
        new JSplitPane(JSplitPane.VERTICAL_SPLIT, tempPanel.getPanel(), scrollPane);
    splitPane.setDividerLocation(300);
    myPanel.add(splitPane);
    GuiAppender.setTextArea(statusText);
  }
  private void initializeUI() {
    this.setLayout(new BorderLayout());
    this.setPreferredSize(new Dimension(400, 200));

    JLabel label = new JLabel("Tab size: ");
    Object[] items = {2, 4, 8, 10, 20};
    final JComboBox comboBox = new JComboBox(items);

    JPanel tabPanel = new JPanel(new FlowLayout());
    tabPanel.add(label);
    tabPanel.add(comboBox);

    this.add(tabPanel, BorderLayout.NORTH);

    final JTextArea textArea = new JTextArea();
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);

    //
    // Sets the number of characters to expand tabs to.
    //
    textArea.setTabSize((Integer) comboBox.getSelectedItem());
    comboBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            textArea.setTabSize((Integer) comboBox.getSelectedItem());
          }
        });

    JScrollPane pane = new JScrollPane(textArea);
    pane.setPreferredSize(new Dimension(400, 200));
    pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    this.add(pane, BorderLayout.CENTER);
  }
示例#8
0
  private void buildGui() {
    myListener = new MainFrameListener(this);

    JPanel pan = new JPanel();

    frame.setSize(500, 650);

    JScrollPane scroll =
        new JScrollPane(
            txtChatList,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    txtChatList.setEditable(false);
    txtChatList.setVisible(true);
    txtChatList.setLineWrap(true);
    ((DefaultCaret) txtChatList.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    frame.getContentPane().add(scroll);

    pan.add(txtInptChat);
    pan.add(btnSubmit, BorderLayout.SOUTH);

    frame.getContentPane().add(pan, BorderLayout.SOUTH);

    frame.setVisible(true);

    btnSubmit.addActionListener(myListener);
    btnSubmit.setActionCommand("submit");

    txtInptChat.setActionCommand("submit");
    txtInptChat.addActionListener(myListener);
  }
示例#9
0
  public void initializeGUIComponents() {

    // Setup Data Panel
    editButton = new JButton("Edit");
    editButton.addActionListener(buttonController);
    JPanel buttonPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) buttonPanel.getLayout();
    flowLayout.setAlignment(FlowLayout.RIGHT);
    buttonPanel.add(editButton);
    buttonPanel.add(Box.createHorizontalStrut(10));

    // Setup the Main Panel.
    setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Skills"));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    // Setup TextField
    scrollPane = new JScrollPane();
    taSkills = new JTextArea();
    taSkills.setLineWrap(true);
    taSkills.setWrapStyleWord(true);
    taSkills.setEditable(false);
    scrollPane.setViewportView(taSkills);

    add(scrollPane);
    add(buttonPanel);
  }
示例#10
0
  public Console() {
    super("Javacalculus Test GUI");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);
    System.setOut(new PrintStream(new consoleOutputStream()));
    // System.setErr(new PrintStream(new consoleOutputStream(true)));
    inputLabel.setLabelFor(input);
    input.setPreferredSize(new Dimension(300, 20));
    input.setBorder(BorderFactory.createLoweredBevelBorder());
    input.addKeyListener(this);
    commandHistory.add("");
    execute.addActionListener(this);
    execute.setBackground(Color.GREEN);
    execute.setForeground(Color.WHITE);
    console.setLineWrap(true);
    console.setWrapStyleWord(true);
    console.setEditable(false);
    console.setFont(new Font("Dialog", Font.BOLD, 14));
    JScrollPane consolePane =
        new JScrollPane(
            console,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    consolePane.setPreferredSize(new Dimension(600, 300));
    consolePane.setBorder(BorderFactory.createLoweredBevelBorder());
    //		error.setLineWrap(true);
    //		error.setWrapStyleWord(true);
    //		error.setEditable(false);
    //    	error.setFont(new Font("Dialog", Font.ITALIC, 12));
    //		JScrollPane errorPane = new JScrollPane(error, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    //				JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    //		errorPane.setBorder(BorderFactory.createLoweredBevelBorder());
    //		errorPane.setPreferredSize(new Dimension(600,300));
    // content.setPreferredSize(new Dimension(400,400));
    content.setLayout(new GridBagLayout());
    content.setBorder(BorderFactory.createLoweredBevelBorder());
    GridBagConstraints c = new GridBagConstraints();

    c.gridx = 0;
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    content.add(inputLabel, c);
    c.gridx = 1;
    c.gridy = 0;
    content.add(input, c);
    c.gridx = 2;
    c.gridy = 0;
    content.add(execute, c);
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 3;
    content.add(consolePane, c);
    //		c.gridx = 0; c.gridy = 2;
    //		content.add(errorPane, c);
    add(content);

    pack();
    setVisible(true);
    input.requestFocus();
  }
示例#11
0
  public TargetSequencePanel(TargetListModel list_model) {
    this.list_model = list_model;
    list_model.addListDataListener(this);
    this.setLayout(new BorderLayout());
    // set up the gui
    JPanel northPane = new JPanel();
    northPane.setLayout(new FlowLayout(FlowLayout.LEADING));
    JLabel label = new JLabel("Primary target transcript id:");
    northPane.add(label);
    northPane.add(jtf_id);
    this.add(northPane, BorderLayout.NORTH);

    JPanel centerPane = new JPanel();
    centerPane.setLayout(new BorderLayout());
    label = new JLabel("Primary transcript sequence:");
    centerPane.add(label, BorderLayout.NORTH);
    JScrollPane scrollPane = new JScrollPane(jta_seq);
    centerPane.add(scrollPane, BorderLayout.CENTER);
    jta_seq.setLineWrap(true);
    this.add(centerPane, BorderLayout.CENTER);

    JPanel bttn_pane = new JPanel();
    JButton bttn_OK = new JButton("Save Change");
    bttn_OK.addActionListener(this);
    bttn_OK.setName("Save");
    bttn_pane.add(bttn_OK);
    JButton bttn_Cancel = new JButton("Cancel");
    bttn_pane.setVisible(false);
    bttn_Cancel.addActionListener(this);
    bttn_Cancel.setName("Cancel");
    bttn_pane.add(bttn_Cancel);
    this.add(bttn_pane, BorderLayout.SOUTH);
  }
示例#12
0
  public ReplyView(MikroEventModel e, EventViewManager m) {
    super();
    evm = m;
    textArea = new JTextArea("@" + evm.event.getAuthor() + " ", 4, 45);
    Font f = new Font("Nimbus Sans L Bold", Font.PLAIN, 15);
    textArea.setFont(f);
    textArea.setLineWrap(true);
    ((AbstractDocument) textArea.getDocument()).setDocumentFilter(new DocumentSizeFilter(140));
    buttonPanel = new JPanel();
    submitButton = new JButton("Post");
    cancelButton = new JButton("Cancel");

    submitButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            evm.reply(textArea.getText());
          }
        });
    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            evm.setEventView();
          }
        });

    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
    buttonPanel.add(Box.createHorizontalGlue());
    buttonPanel.add(submitButton);
    buttonPanel.add(Box.createHorizontalStrut(5));
    buttonPanel.add(cancelButton);

    this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    this.add(textArea);
    this.add(buttonPanel);
  }
    private void addComponents() {
      this.setLayout(new BorderLayout());
      this.setSize(new Dimension(350, 200));
      // set display location
      Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
      this.setLocation((d.width - getWidth()) / 2, (d.height - getHeight()) / 2);

      textArea = new JTextArea();
      textArea.setLineWrap(true);
      textArea.setEditable(false);
      textArea.setBorder(BorderFactory.createLineBorder(Color.gray));
      JScrollPane scrollPane =
          new JScrollPane(
              textArea,
              JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
              JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      scrollPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
      this.add(scrollPane, BorderLayout.CENTER);

      JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
      JButton closeButton = new JButton("Close");
      closeButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              PopupDialog.this.setVisible(false);
            }
          });
      buttonPanel.add(closeButton);
      this.add(buttonPanel, BorderLayout.SOUTH);
    }
 private void addInfoPanel(
     Icon icon, String titleString, String textString, JButton... buttons) {
   JLabel regenerateIcon = new JLabel(icon);
   JLabel title = new JLabel(titleString, SwingConstants.LEFT);
   title.setFont(FlexoCst.BOLD_FONT);
   JTextArea text = new JTextArea(textString);
   text.setBackground(null);
   text.setEditable(false);
   text.setFont(FlexoCst.NORMAL_FONT);
   text.setLineWrap(true);
   text.setWrapStyleWord(true);
   text.setBorder(BorderFactory.createEmptyBorder(0, 30, 10, 30));
   JPanel infoPanel = new JPanel(new VerticalLayout());
   JPanel titlePanel = new JPanel(new FlowLayout());
   titlePanel.add(regenerateIcon);
   titlePanel.add(title);
   infoPanel.add(titlePanel);
   infoPanel.add(text);
   if (buttons != null && buttons.length > 0) {
     JPanel buttonPanel = new JPanel(new FlowLayout());
     for (JButton b : buttons) {
       buttonPanel.add(b);
     }
     infoPanel.add(buttonPanel);
   }
   add(infoPanel, BorderLayout.SOUTH);
 }
示例#15
-1
  /**
   * Invoked when an item has been selected or deselected by the user.
   *
   * <p>Invoked when an item has been selected or deselected by the user. The code written for this
   * method performs the operations that need to occur when an item is selected (or deselected).
   */
  public void itemStateChanged(ItemEvent e) {
    /* format menu */
    if (e.getSource() == wordWrap) {
      editor.setLineWrap(!editor.getLineWrap());
      side.setLineWrap(editor.getLineWrap());
      // wordWrap.setText(editor.getLineWrap() ? "Disable Word Wrap" : "Enable Word Wrap");
      wordWrap.setDisplayedMnemonicIndex(wordWrap.getText().indexOf('W'));
    }

    /* view menu */
    if (e.getSource() == toggleSide) {
      // hide the sidePane, sideButton, and update the text in the toggleSide JMenuItem (need to
      // update mnemonicindex as well)
      sidePane.setVisible(!sidePane.isVisible());
      sideButton.setVisible(sidePane.isVisible());
      // toggleSide.setText(sidePane.isVisible() ? "Hide Side Pane" : "Show Side Pane");
      toggleSide.setDisplayedMnemonicIndex(5);

      // easier to remove everything and then add them back
      centerPanel.removeAll();
      centerPanel.add(editorPane);
      if (sideButton.isVisible()) {
        centerPanel.add(sidePane);
      }
      centerPanel.validate();
    }
  }
  public void go() {
    // build gui

    frame = new JFrame("Quiz Card Buider");
    JPanel mainPanel = new JPanel();
    Font bigFont = new Font("sanserif", Font.BOLD, 24);
    question = new JTextArea(6, 20);
    question.setLineWrap(true);
    question.setWrapStyleWord(true);
    question.setFont(bigFont);

    JScrollPane qScroller = new JScrollPane(question);
    qScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    qScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    answer = new JTextArea(6, 20);
    answer.setLineWrap(true);
    answer.setWrapStyleWord(true);
    answer.setFont(bigFont);

    JScrollPane aScroller = new JScrollPane(question);
    aScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    aScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    JButton nextButton = new JButton("Next Card");

    cardList = new ArrayList<QuizCard>();

    JLabel qLabel = new JLabel("Question");
    JLabel aLabel = new JLabel("Answer");

    mainPanel.add(qLabel);
    mainPanel.add(qScroller);
    mainPanel.add(aLabel);
    mainPanel.add(aScroller);
    mainPanel.add(nextButton);

    nextButton.addActionListener(new NextCardListener());

    JMenuBar menuBar = new JMenuBar();

    JMenu fileMenu = new JMenu("File");

    JMenuItem newMenuItem = new JMenuItem("New");
    JMenuItem saveMenuItem = new JMenuItem("Save");
    newMenuItem.addActionListener(new NewMenuListener());
    saveMenuItem.addActionListener(new SaveMenuListener());

    fileMenu.add(newMenuItem);
    fileMenu.add(saveMenuItem);
    menuBar.add(fileMenu);
    frame.setJMenuBar(menuBar);
    frame.getContentPane().add(BorderLayout.CENTER, mainPanel);
    frame.setSize(500, 600);
    frame.setVisible(true);
    // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

  }
示例#17
-1
  public KrustyView() {
    content = new JFrame();
    content.setLayout(new RiverLayout());
    JLabel searchTerm = new JLabel("Search: ");
    content.add(searchTerm);
    this.inputText = new JTextField("", 20);
    content.add("left", inputText);
    JLabel fromDateLabel = new JLabel("From date: ");
    content.add(fromDateLabel);
    this.fromDate = new JTextField("", 6);
    content.add(fromDate);

    JLabel toDateLabel = new JLabel("To date: ");
    content.add(toDateLabel);
    this.toDate = new JTextField("", 6);
    content.add(toDate);

    for (String s : searchDescription) {
      searchCombo.addItem(s);
    }
    content.add("tab", searchCombo);
    this.searchButton = new JButton("Search");
    content.add("tab", searchButton);

    GridLayout outputLayout = new GridLayout(0, 2);
    outputLayout.setHgap(10);
    JPanel outputPanel = new JPanel(outputLayout);
    content.add("p hfill vfill", outputPanel);

    searchOutput = new JTextArea();
    searchOutput.setEditable(false);
    TitledBorder searchTitle;
    searchTitle = BorderFactory.createTitledBorder("Search results");
    searchTitle.setTitleJustification(TitledBorder.RIGHT);
    searchOutput.setBorder(searchTitle);
    searchOutput.setLineWrap(true);
    outputPanel.add(new JScrollPane(searchOutput));
    productionOutput = new JTextArea();
    productionOutput.setEditable(false);
    TitledBorder productionTitle;
    productionTitle = BorderFactory.createTitledBorder("Production status");
    productionTitle.setTitleJustification(TitledBorder.RIGHT);
    productionOutput.setBorder(productionTitle);
    productionOutput.setLineWrap(true);
    outputPanel.add(new JScrollPane(productionOutput));

    this.blockedTrue = new JButton("Blocked");
    content.add("p", blockedTrue);
    this.blockedFalse = new JButton("Not blocked");
    content.add("", blockedFalse);

    content.setSize(1024, 768);
    content.setTitle("Krusty Kookies");
    content.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    content.setVisible(true);
    content.setResizable(false);
  }
示例#18
-1
  /** Show the bootstrap node data Display the contacts data Display the content data */
  private void populateData() {
    contacts.removeAll();
    contacts.setText(bootstrapInstance.getRoutingTable().toString());
    contacts.setWrapStyleWord(true);
    contacts.setLineWrap(true);

    content.removeAll();
    content.setText(bootstrapInstance.getDHT().toString());
    content.setWrapStyleWord(true);
    content.setLineWrap(true);
  }
示例#19
-1
    public SimilarityRenderer() {
      evalue.setHorizontalAlignment(SwingConstants.RIGHT);
      evalue.setVerticalAlignment(SwingConstants.TOP);
      evalue.setOpaque(true);
      length.setHorizontalAlignment(SwingConstants.RIGHT);
      length.setVerticalAlignment(SwingConstants.TOP);
      length.setOpaque(true);
      ungappedId.setHorizontalAlignment(SwingConstants.RIGHT);
      ungappedId.setVerticalAlignment(SwingConstants.TOP);
      ungappedId.setOpaque(true);
      queryCoord.setHorizontalAlignment(SwingConstants.RIGHT);
      queryCoord.setVerticalAlignment(SwingConstants.TOP);
      queryCoord.setOpaque(true);
      subjCoord.setHorizontalAlignment(SwingConstants.RIGHT);
      subjCoord.setVerticalAlignment(SwingConstants.TOP);
      subjCoord.setOpaque(true);
      score.setHorizontalAlignment(SwingConstants.RIGHT);
      score.setVerticalAlignment(SwingConstants.TOP);
      score.setOpaque(true);
      overlap.setHorizontalAlignment(SwingConstants.RIGHT);
      overlap.setVerticalAlignment(SwingConstants.TOP);
      overlap.setOpaque(true);
      method.setHorizontalAlignment(SwingConstants.RIGHT);
      method.setVerticalAlignment(SwingConstants.TOP);
      method.setOpaque(true);

      organismTextArea.setLineWrap(true);
      organismTextArea.setWrapStyleWord(true);

      hit.setHorizontalAlignment(SwingConstants.CENTER);
      hit.setVerticalAlignment(SwingConstants.TOP);
      hit.setOpaque(true);
      hit_dbxref.setHorizontalAlignment(SwingConstants.CENTER);
      hit_dbxref.setVerticalAlignment(SwingConstants.TOP);
      hit_dbxref.setOpaque(true);

      descriptionTextArea.setLineWrap(true);
      descriptionTextArea.setWrapStyleWord(true);

      buttRemove.setOpaque(true);
      buttRemove.setText("X");

      Font font = getFont().deriveFont(Font.BOLD);
      buttRemove.setFont(font);
      buttRemove.setToolTipText("REMOVE");
      buttRemove.setHorizontalAlignment(SwingConstants.CENTER);
      buttRemove.setVerticalAlignment(SwingConstants.TOP);
    }
示例#20
-1
  /**
   * Shows a dialog request to enter text in a multiline text field <br>
   * Though not all text might be visible, everything entered is delivered with the returned text
   * <br>
   * The main purpose for this feature is to allow pasting text from somewhere preserving line
   * breaks <br>
   *
   * @param msg the message to display.
   * @param title the title for the dialog (default: Sikuli input request)
   * @param lines the maximum number of lines visible in the text field (default 9)
   * @param width the maximum number of characters visible in one line (default 20)
   * @return The user's input including the line breaks.
   */
  public static String inputText(String msg, String title, int lines, int width) {
    width = Math.max(20, width);
    lines = Math.max(9, lines);
    if ("".equals(title)) {
      title = "Sikuli input request";
    }
    JTextArea ta = new JTextArea("");
    int w = width * ta.getFontMetrics(ta.getFont()).charWidth('m');
    int h = (int) (lines * ta.getFontMetrics(ta.getFont()).getHeight());
    ta.setPreferredSize(new Dimension(w, h));
    ta.setMaximumSize(new Dimension(w, 2 * h));

    JScrollPane sp = new JScrollPane(ta);
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);

    JTextArea tm = new JTextArea(msg);
    tm.setColumns(width);
    tm.setLineWrap(true);
    tm.setWrapStyleWord(true);
    tm.setEditable(false);
    tm.setBackground(new JLabel().getBackground());

    JPanel pnl = new JPanel();
    pnl.setLayout(new BoxLayout(pnl, BoxLayout.Y_AXIS));
    pnl.add(sp);
    pnl.add(Box.createVerticalStrut(10));
    pnl.add(tm);
    pnl.add(Box.createVerticalStrut(10));

    if (0 == JOptionPane.showConfirmDialog(null, pnl, title, JOptionPane.OK_CANCEL_OPTION)) {
      return ta.getText();
    } else {
      return "";
    }
  }
示例#21
-1
 public JFrameComandi(Mediator mediator) {
   panelText = new JPanel();
   panelText.setLayout(new BorderLayout());
   panelText.setBackground(Color.white);
   panelButton = new JPanel();
   panelButton.setBackground(Color.white);
   dimensione = Toolkit.getDefaultToolkit().getScreenSize();
   setTitle("Comandi");
   txa = new JTextArea();
   txa.setEditable(false);
   txa.setText(text);
   txa.setFont(new Font("Ariel", Font.PLAIN, dimensione.height / 55));
   txa.setLineWrap(true);
   txa.setWrapStyleWord(true);
   ok = new JButton("ESCI");
   ok.setName("okComandi");
   ok.setFont(new Font("Ariel", Font.PLAIN, dimensione.height / 50));
   panelText.add(txa, BorderLayout.CENTER);
   panelButton.add(ok, BorderLayout.CENTER);
   mediator.manageEvent(new ActionEvent(ok, Counter.generateID(), null));
   pack();
   setResizable(false);
   setSize(new Dimension(dimensione.width / 3, dimensione.height / 3));
   add(panelText, BorderLayout.CENTER);
   add(panelButton, BorderLayout.SOUTH);
   setAlwaysOnTop(true);
   setLocationRelativeTo(null);
   setVisible(false);
   setDefaultCloseOperation(DISPOSE_ON_CLOSE);
 }
示例#22
-1
  private void initComponents() {
    accountNumberField = new JTextFieldEx();
    accountCodeField = new JIntegerField();
    nameField = new JTextFieldEx();
    bankIdField = new JTextFieldEx();
    nameField.setText(rb.getString("Word.Name"));
    descriptionField = new JTextFieldEx();
    descriptionField.setText(rb.getString("Word.Description"));
    currencyCombo = new CurrencyComboBox();
    securityButton = new JButton(rb.getString("Word.None"));

    // for preferred width so button does not force a wide layout
    securityButton.setPreferredSize(new Dimension(20, securityButton.getPreferredSize().height));

    accountTypeModel = new DefaultComboBoxModel<>(AccountType.values());
    accountTypeModel.removeElement(AccountType.ROOT);
    accountTypeCombo = new JComboBox<>(accountTypeModel);

    lockedCheckBox = new JCheckBox(rb.getString("Button.Locked"));
    placeholderCheckBox = new JCheckBox(rb.getString("Button.PlaceHolder"));
    hideCheckBox = new JCheckBox(rb.getString("Button.HideAccount"));
    excludeBudgetCheckBox = new JCheckBox(rb.getString("Button.ExcludeFromBudget"));
    parentButton = new JButton("Root");

    notesArea = new javax.swing.JTextArea();
    notesArea.setLineWrap(true);
    notesArea.setAutoscrolls(false);
    notesArea.setPreferredSize(new java.awt.Dimension(100, 80));

    accountTypeCombo.addActionListener(this);
    securityButton.addActionListener(this);
    parentButton.addActionListener(this);
  }
  private void addrequirementActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addrequirementActionPerformed
    // TODO add your handling code here:
    String[] types = {"Functional", "Non-functional"};
    JComboBox typeList = new JComboBox(types);
    typeList.setSelectedIndex(0);
    JTextArea description = new JTextArea();
    description.setRows(5);
    description.setColumns(10);
    description.setLineWrap(true);
    JScrollPane pane = new JScrollPane(description);
    Object[] message = {
      "Requirement Type:", typeList,
      "Description:", pane,
    };
    int option =
        JOptionPane.showConfirmDialog(
            this, message, "Enter Requirement Information", JOptionPane.OK_CANCEL_OPTION);

    if (option == JOptionPane.OK_OPTION) {
      Requirement req = new Requirement();
      req.setRequirementDescription(description.getText());
      if (typeList.getSelectedItem().toString().equals("Functional")) {
        req.setIsFunctionalRequirement(true);
      } else req.setIsFunctionalRequirement(false);
      currentProject.getRequirements().add(req);
      requirementmodel.addElement(typeList.getSelectedItem() + " " + description.getText());
      requirementlist.setModel(requirementmodel);
    }
  } // GEN-LAST:event_addrequirementActionPerformed
示例#24
-1
  /**
   * Create the panel.
   *
   * @param notifyInterface the object to notify when the user submits entered text; if null, text
   *     entry is disallowed.
   */
  public ChatArea(ChatAreaNotifyInterface notifyInterface) {
    this.mainWindow = notifyInterface;

    setLayout(new BorderLayout(0, 0));
    setBorder(new EmptyBorder(0, 0, 0, 0));

    textField = new JTextField();
    add(textField, BorderLayout.SOUTH);

    if (this.mainWindow == null) {
      textField.setEnabled(false);
    } else {
      textField.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              textAreaAction(e);
            }
          });
    }

    textArea = new JTextArea();
    textArea.setRequestFocusEnabled(false);
    textArea.setFont(new Font("Monospaced", Font.PLAIN, 12));
    textArea.setText("");
    textArea.setBorder(null);
    textArea.setEditable(false);
    textArea.setLineWrap(true);
    caret = (DefaultCaret) textArea.getCaret();
    textAreaScrollPane = new JScrollPane(textArea);
    textAreaScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    textAreaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    textAreaScrollPane.setBorder(null);
    add(textAreaScrollPane, BorderLayout.CENTER);
  }
  private void updateViewerForSelection() {
    if (myAllContents.isEmpty()) return;
    String fullString = getSelectedText();

    if (myViewer != null) {
      EditorFactory.getInstance().releaseEditor(myViewer);
    }

    if (myUseIdeaEditor) {
      myViewer = createIdeaEditor(fullString);
      JComponent component = myViewer.getComponent();
      component.setPreferredSize(JBUI.size(300, 500));
      mySplitter.setSecondComponent(component);
    } else {
      final JTextArea textArea = new JTextArea(fullString);
      textArea.setRows(3);
      textArea.setWrapStyleWord(true);
      textArea.setLineWrap(true);
      textArea.setSelectionStart(0);
      textArea.setSelectionEnd(textArea.getText().length());
      textArea.setEditable(false);
      mySplitter.setSecondComponent(ScrollPaneFactory.createScrollPane(textArea));
    }
    mySplitter.revalidate();
  }
  public void go() {
    frame = new JFrame("Quiz Card Player");
    JPanel mainPanel = new JPanel();
    Font bigFont = new Font("sanserif", Font.BOLD, 24);

    display = new JTextArea(10, 20);
    display.setFont(bigFont);
    display.setLineWrap(true);
    display.setEditable(false);

    JScrollPane qScroller = new JScrollPane(display);
    qScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    qScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    nextButton = new JButton("Show Questions");
    nextButton.addActionListener(new NextCardListener());

    mainPanel.add(qScroller);
    mainPanel.add(nextButton);

    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenuItem loadMenuItem = new JMenuItem("Load Card Set");
    loadMenuItem.addActionListener(new OpenMenuListener());
    fileMenu.add(loadMenuItem);
    menuBar.add(fileMenu);

    frame.setJMenuBar(menuBar);
    frame.getContentPane().add(BorderLayout.CENTER, mainPanel);
    frame.setSize(640, 500);
    frame.setVisible(true);
  }
  private void addriskActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addriskActionPerformed
    // TODO add your handling code here:
    String[] types = {"Minor", "Moderate", "Major", "Catastrophic"};
    JComboBox typeList = new JComboBox(types);
    typeList.setSelectedIndex(0);
    JTextArea description = new JTextArea();
    description.setRows(5);
    description.setColumns(10);
    description.setLineWrap(true);
    JScrollPane pane = new JScrollPane(description);
    Object[] message = {
      "Risk Type:", typeList,
      "Description:", pane,
    };
    int option =
        JOptionPane.showConfirmDialog(
            this, message, "Enter Risk Information", JOptionPane.OK_CANCEL_OPTION);

    if (option == JOptionPane.OK_OPTION) {
      Risk risk = new Risk();
      risk.setRiskName(description.getText());
      risk.setRiskStatus(typeList.getSelectedItem().toString());
      currentProject.getRisks().add(risk);
      riskmodel.addElement(typeList.getSelectedItem().toString() + " " + description.getText());
      risklist.setModel(riskmodel);
    }
  } // GEN-LAST:event_addriskActionPerformed
示例#28
-1
  public OpenDecisionsPanel() {
    odList_ = new Vector<List<String>>();
    snList_ = new Vector<Integer>();
    ledList_ = new Vector<String>();

    currentIdx_ = -1;

    labelTotal_ = new JLabel(makeLabelTotal(), SwingConstants.CENTER);
    labelCurrent_ = new JLabel(makeLabelCurrent(), SwingConstants.CENTER);
    JPanel btnPanel = new JPanel(new FlowLayout());

    btnPrev_ = new JButton("<<");
    btnPrev_.addActionListener(this);
    btnPrev_.setActionCommand("prev");
    btnNext_ = new JButton(">>");
    btnNext_.addActionListener(this);
    btnNext_.setActionCommand("next");
    checkButtons();
    JButton btn;
    btn = new JButton("Go To Step");
    btn.addActionListener(this);
    btn.setActionCommand("goto");

    gotoIdx_ = new JTextField(6);
    btnPanel.add(btnPrev_);
    btnPanel.add(btnNext_);
    btnPanel.add(btn);
    btnPanel.add(gotoIdx_);

    lastExecutedDecision_ = new JTextArea(5, 10);
    lastExecutedDecision_.setLineWrap(true);

    JPanel topPanel = new JPanel(new BorderLayout());
    JPanel p = new JPanel(new GridLayout(3, 1));
    p.add(labelTotal_);
    p.add(btnPanel);
    p.add(new JLabel("Last Executed Decision", SwingConstants.CENTER));

    ledTable_ = new JTable();
    ledTable_.setTableHeader(null);
    ledTable_.setPreferredScrollableViewportSize(new Dimension(500, 70));

    JTabbedPane tp = new JTabbedPane();
    tp.addTab("As Table", new JScrollPane(ledTable_));
    tp.addTab("As Text", new JScrollPane(lastExecutedDecision_));

    topPanel.add(BorderLayout.NORTH, p);
    topPanel.add(BorderLayout.CENTER, tp);
    odTable_ = new JTable(Util.makeTableModel(odList_, new String[] {"toString"}));
    odTable_.setTableHeader(null);
    odTable_.setPreferredScrollableViewportSize(new Dimension(500, 70));

    setLayout(new BorderLayout());
    add(BorderLayout.NORTH, topPanel);

    JPanel odPanel = new JPanel(new BorderLayout());
    odPanel.add(BorderLayout.NORTH, labelCurrent_);
    odPanel.add(BorderLayout.CENTER, new JScrollPane(odTable_));
    add(BorderLayout.CENTER, odPanel);
  }
示例#29
-1
  public EventInfoFrame(TestEvent event) {
    setAlwaysOnTop(true);
    textArea = new JTextArea(stackTraceToString(event.getStackTrace()));
    textArea.setEditable(false);
    textArea.setColumns(80);
    textArea.setWrapStyleWord(true);
    textArea.setLineWrap(true);
    getContentPane().add(new JScrollPane(textArea));
    Container southPanel = new JPanel(new FlowLayout());
    Action disposeAction =
        new AbstractAction("Close") {
          private static final long serialVersionUID = -1L;

          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        };
    closeButton = new JButton(disposeAction);
    southPanel.add(closeButton);
    getContentPane().add(southPanel, BorderLayout.SOUTH);
    String message = event.getMessage();
    if (message == null) {
      message = "";
    }
    setTitle(event.getTestName() + "." + event.getTestMethod() + "()");
    pack();
    closeButton.requestFocusInWindow();
  }
  public BaseGoogleLoginUI(@NotNull String signinText) {
    setLayout(new GridBagLayout());
    setPreferredSize(new Dimension(MIN_WIDTH, PREFERRED_HEIGHT));
    setOpaque(false);

    JLabel googleIcon = new JBLabel();

    setBorder(BorderFactory.createEmptyBorder(10, 15, 15, 15));
    googleIcon.setHorizontalAlignment(SwingConstants.CENTER);
    googleIcon.setVerticalAlignment(SwingConstants.CENTER);
    googleIcon.setOpaque(false);
    googleIcon.setIcon(GoogleLoginIcons.GOOGLE_LOGO);
    googleIcon.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weighty = 0;
    add(googleIcon, c);

    JTextArea signinTextArea = new JTextArea();
    signinTextArea.setFont(UIUtil.getLabelFont());
    signinTextArea.setLineWrap(true);
    signinTextArea.setWrapStyleWord(true);
    signinTextArea.setOpaque(false);
    signinTextArea.setText(signinText);
    c.gridx = 0;
    c.gridy = 1;
    c.weighty = 1;
    c.gridwidth = 2;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.CENTER;
    add(signinTextArea, c);
  }