Beispiel #1
0
 public CToolTipUI(Color background) {
   super();
   this.background = background;
   renderer = new CellRendererPane();
   textArea = new JTextArea();
   textArea.setMargin(new Insets(0, 3, 0, 0));
   renderer.removeAll();
   renderer.add(textArea);
   textArea.setFont(new Font("Ariel", Font.PLAIN, 11));
   textArea.setWrapStyleWord(true);
   textArea.setLineWrap(true);
   textArea.setWrapStyleWord(true);
 }
  private void createJointTitleDescPanel() {
    // create titlePanel
    titlePanel = new JPanel(new BorderLayout());
    titleLab = new JLabel("Title");
    titleField = new JTextField(20);
    titlePanel.add(titleLab, BorderLayout.NORTH);
    titlePanel.add(titleField, BorderLayout.SOUTH);

    // create descriptionPanel
    descriptionPanel = new JPanel(new BorderLayout());
    descLab = new JLabel("Description");
    descriptionField = new JTextArea(5, 30);
    descriptionField.setWrapStyleWord(true);
    descriptionField.setLineWrap(true);
    JScrollPane scroll = new JScrollPane(descriptionField);
    descriptionPanel.add(descLab, BorderLayout.NORTH);
    descriptionPanel.add(scroll, BorderLayout.SOUTH);

    // put them together in jointTitleDescPanel
    jointTitleDescPanel = new JPanel(new BorderLayout());

    titlePanel.setBorder(new EmptyBorder(10, 10, 5, 0));
    jointTitleDescPanel.add(titlePanel, BorderLayout.NORTH);

    descriptionPanel.setBorder(new EmptyBorder(5, 10, 5, 0));
    jointTitleDescPanel.add(descriptionPanel, BorderLayout.SOUTH);
  }
  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);
  }
Beispiel #4
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;
  }
 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);
 }
Beispiel #6
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();
  }
  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);
  }
  private void newComps() {
    ta = new JTextArea();
    // ta.setLineWrap(true);
    ta.setWrapStyleWord(true);
    ta.setFocusable(false);
    ta.setEditable(false);
    ta.setFont(new Font("Courier New", Font.BOLD, 20));
    ta.setBackground(Color.black);
    ta.setForeground(Color.GREEN);

    sc = new JScrollPane();
    sc.setViewportView(ta);

    btnExport = new JButton("Export");
    btnExport.setOpaque(false);
    btnExport.setFont(ta.getFont());
    btnExport.setFocusable(false);

    ckWrap = new JCheckBox("Wrap text");
    ckWrap.setOpaque(false);
    ckWrap.setForeground(Color.white);
    ckWrap.setFont(ta.getFont());
    ckWrap.setFocusable(false);

    chooser = new JFileChooser();
  }
 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);
 }
  /** Sets window size and layout */
  public void init() {
    textArea_ = new JTextArea(INSTRUCTIONS_LINES, INSTRUCTIONS_WIDTH);
    textArea_.setLineWrap(true);
    textArea_.setWrapStyleWord(true);
    add(textArea_, NORTH);

    inputLabel_ = new JLabel("Input: ");
    add(inputLabel_, SOUTH);

    userInputTextField_ = new JTextField("", INPUT_WIDTH);
    add(userInputTextField_, SOUTH);

    button1_ = new JButton("Button1");
    button1_.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onButton1Click();
          }
        });
    add(button1_, SOUTH);

    button2_ = new JButton("Button2");
    button2_.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onButton2Click();
          }
        });
    add(button2_, SOUTH);

    setSize(APPLET_WIDTH, APPLET_HEIGHT);
  }
Beispiel #11
0
 static {
   textArea.setEditable(false);
   textArea.setBackground(UIManager.getColor("Panel.background"));
   textArea.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
   textArea.setTabSize(2);
   textArea.setLineWrap(true);
   textArea.setWrapStyleWord(true);
 }
 private TestAppLogger initDebugLogging() {
   String[] levelLabels = bundle.getString("logging.level.labels").split(";");
   debugTextArea.setEditable(false);
   debugTextArea.setLineWrap(true);
   debugTextArea.setWrapStyleWord(true);
   debugTextArea.setText("");
   return new TestAppLogger(debugTextArea, levelLabels, bundle.getString("logging.dateformat"));
 }
Beispiel #13
0
 private void luoKysymysKentta(Container container) {
   kysymysKentta = new JTextArea(5, 20);
   kysymysKentta.setEditable(false);
   kysymysKentta.setLineWrap(true);
   kysymysKentta.setWrapStyleWord(true);
   kysymysKentta.setText(Luokkakirjasto.alkuTervehdys);
   container.add(kysymysKentta);
 }
Beispiel #14
0
  @Override
  public VcsDependentHistoryComponents getUICustomization(
      final VcsHistorySession session, JComponent forShortcutRegistration) {
    final ColumnInfo[] columns;
    final Consumer<VcsFileRevision> listener;
    final JComponent addComp;
    if (((SvnHistorySession) session).isHaveMergeSources()) {
      final MergeSourceColumnInfo mergeSourceColumn =
          new MergeSourceColumnInfo((SvnHistorySession) session);
      columns = new ColumnInfo[] {new CopyFromColumnInfo(), mergeSourceColumn};

      final JPanel panel = new JPanel(new BorderLayout());

      final JTextArea field = new JTextArea();
      field.setEditable(false);
      field.setBackground(UIUtil.getComboBoxDisabledBackground());
      field.setWrapStyleWord(true);
      listener =
          new Consumer<VcsFileRevision>() {
            @Override
            public void consume(VcsFileRevision vcsFileRevision) {
              field.setText(mergeSourceColumn.getText(vcsFileRevision));
            }
          };

      final MergeSourceDetailsAction sourceAction = new MergeSourceDetailsAction();
      sourceAction.registerSelf(forShortcutRegistration);

      JPanel fieldPanel =
          new ToolbarDecorator() {
            @Override
            protected JComponent getComponent() {
              return field;
            }

            @Override
            protected void updateButtons() {}

            @Override
            protected void installDnDSupport() {}

            @Override
            protected boolean isModelEditable() {
              return false;
            }
          }.initPosition().addExtraAction(AnActionButton.fromAction(sourceAction)).createPanel();
      fieldPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT | SideBorder.TOP));

      panel.add(fieldPanel, BorderLayout.CENTER);
      panel.add(new JLabel("Merge Sources:"), BorderLayout.NORTH);
      addComp = panel;
    } else {
      columns = new ColumnInfo[] {new CopyFromColumnInfo()};
      addComp = null;
      listener = null;
    }
    return new VcsDependentHistoryComponents(columns, listener, addComp);
  }
  private void init() {

    listMultipleSelection = getMultipleSelection();
    listModel = new DefaultListModel();

    // create GUI
    if (listMultipleSelection.getPossibleValues().isEmpty()) {
      panel = null;
      itemsContainerList = null;
      return;
    }

    final Border padding = BorderFactory.createEmptyBorder(5, 10, 5, 10);
    panel = new JPanel();
    BorderLayout layout = new BorderLayout();
    panel.setLayout(layout);
    final JTextArea jta = new JTextArea(getDescription());
    jta.setPreferredSize(new Dimension(200, 50));
    jta.setLineWrap(true);
    jta.setWrapStyleWord(true);
    jta.setBorder(padding);
    panel.add(jta, BorderLayout.PAGE_START);
    jta.setBackground(null);
    jta.setEditable(false);

    // put the items in a list
    itemsContainerList =
        new JList(listModel); // new JList(listMultipleSelection.getPossibleValues().toArray());
    for (T value : getMultipleSelection().getPossibleValues()) listModel.addElement(value);

    itemsContainerList.setFont(new Font("sansserif", Font.PLAIN, 11));
    itemsContainerList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    itemsContainerList.addListSelectionListener(this);

    // selected items
    final List<T> selectedVals = listMultipleSelection.getSelectedValues();
    final List<T> allValues = listMultipleSelection.getPossibleValues();

    final int[] selectedIdx = new int[selectedVals.size()];
    int index = 0;
    for (T selected : selectedVals) {
      for (int i = 0; i < allValues.size(); i++) {
        if (itemsContainerList.getModel().getElementAt(i).equals(selected)) {
          selectedIdx[index] = i;
          index++;
        }
      }
    }
    itemsContainerList.setSelectedIndices(selectedIdx);

    // use a JscrollPane to visualize the items

    final JScrollPane scrollpane = new JScrollPane(itemsContainerList);
    scrollpane.setAutoscrolls(true);
    scrollpane.setOpaque(false);
    scrollpane.setBorder(padding);
    panel.add(scrollpane, BorderLayout.CENTER);
  }
Beispiel #16
0
  public LicenseDialog(Component parent) {
    setTitle("Licensing information");

    pnlButtons.add(bttnOk);

    cbLang.addItem("English");
    cbLang.addItem("Eesti");

    FlowLayout fl = new FlowLayout();
    fl.setAlignment(FlowLayout.LEFT);

    pnlHeader.setLayout(fl);

    pnlHeader.add(lblLang);
    pnlHeader.add(cbLang);

    pnlMain.setLayout(new BorderLayout());
    pnlMain.add(pnlHeader, BorderLayout.NORTH);
    pnlMain.add(scrollPane, BorderLayout.CENTER);
    pnlMain.add(pnlButtons, BorderLayout.SOUTH);

    taLicenseText.setText(getLicenseText());
    taLicenseText.setCaretPosition(0);
    taLicenseText.setLineWrap(true);
    taLicenseText.setEditable(false);
    taLicenseText.setWrapStyleWord(true);

    getContentPane().add(pnlMain);
    setPreferredSize(new Dimension(500, 600));
    setLocationRelativeTo(parent);

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    bttnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (evt.getSource() == bttnOk) {
              dispose();
            }
          } // end actionPerformed
        }); // end bttnOk Action Listener

    cbLang.addItemListener(
        new ItemListener() {
          public void itemStateChanged(final ItemEvent event) {
            if (event.getSource() == cbLang
                && event.getStateChange() == ItemEvent.SELECTED
                && cbLang.getItemCount() > 0) {
              taLicenseText.setText(getLicenseText());
              taLicenseText.setCaretPosition(0);
            }
          }
        }); // end cbLang item listener

    pack();
    setVisible(true);
  } // PortPropertiesDialog
Beispiel #17
0
 private void createTextArea() {
   requestTextArea = new JTextArea();
   requestTextArea.setLineWrap(true);
   requestTextArea.setWrapStyleWord(true);
   requestTextArea.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
   JScrollPane jsp = new JScrollPane(requestTextArea);
   jsp.setPreferredSize(new Dimension(390, 475));
   add(jsp);
 }
  /** Construct the panel with wrapped text area to display contexts. */
  public ConcordanceContextDisplayPanel() {
    setBorder(BorderFactory.createTitledBorder("Context"));

    context = new JTextArea();
    context.setLineWrap(true);
    context.setWrapStyleWord(true);
    context.setEditable(false);
    this.add(context);
  }
Beispiel #19
0
 private void setupChatPane() {
   chatArea.setLineWrap(true);
   chatArea.setWrapStyleWord(true);
   chatArea.setEnabled(false);
   chatArea.setEditable(false);
   textPane = new JScrollPane(chatArea);
   textPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
   textPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
 }
Beispiel #20
0
  /**
   * Set the console wrapping style to one of the following:
   *
   * @param style one of the defined style attributes - one of
   *     <ul>
   *       <li>{@link #WRAP_STYLE_NONE} No wrapping
   *       <li>{@link #WRAP_STYLE_LINE} Wrap at end of line
   *       <li>{@link #WRAP_STYLE_WORD} Wrap by word boundaries
   *     </ul>
   */
  public void setWrapStyle(int style) {
    wrapStyle = style;
    console.setLineWrap(style != WRAP_STYLE_NONE);
    console.setWrapStyleWord(style == WRAP_STYLE_WORD);

    if (wrapGroup != null) {
      wrapGroup.setSelected(wrapMenu.getItem(style).getModel(), true);
    }
  }
Beispiel #21
0
  private void createGui() {
    final JPanel topPanel = new JPanel(new BorderLayout());

    final JPanel messagePanel = new JPanel(new BorderLayout());

    final JTextField messageField = new JTextField();
    messageField.setEditable(false);
    messageField.setText(message);
    messageField.setBackground(Color.WHITE);

    messagePanel.add(messageField);

    messagePanel.setBorder(new TitledBorder("Error Message"));

    topPanel.add(messagePanel, BorderLayout.NORTH);

    final JTabbedPane tabbedPane = new JTabbedPane();

    final JTextArea descriptionArea = new JTextArea();

    descriptionArea.setEditable(false);
    descriptionArea.setText(description);
    descriptionArea.setLineWrap(true);
    descriptionArea.setWrapStyleWord(true);

    tabbedPane.addTab("Description", descriptionArea);

    if (exception != null) {
      final JTextArea traceArea = new JTextArea();

      traceArea.setEditable(false);
      traceArea.setText(StackTrace.toString(exception.getStackTrace()));

      tabbedPane.addTab("Stack Trace", new JScrollPane(traceArea));
    }

    add(topPanel, BorderLayout.NORTH);
    add(tabbedPane);

    final JPanel bottomButtonPanel = new JPanel(new BorderLayout());
    final JPanel leftButtonPanelBottom = new JPanel();

    final JButton reportButton = new JButton(new ReportAction());
    reportButton.setMinimumSize(new Dimension(180, reportButton.getHeight()));

    leftButtonPanelBottom.add(reportButton);

    bottomButtonPanel.add(leftButtonPanelBottom, BorderLayout.WEST);

    final JPanel rightButtonPanelBottom = new JPanel();
    final JButton okButton = new JButton(new CloseButtonListener());
    getRootPane().setDefaultButton(okButton);
    rightButtonPanelBottom.add(okButton);
    bottomButtonPanel.add(rightButtonPanelBottom, BorderLayout.EAST);
    add(bottomButtonPanel, BorderLayout.SOUTH);
  }
Beispiel #22
0
    @Override
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

      boldFont = getFont().deriveFont(Font.BOLD);

      AssertionListEntry entry = (AssertionListEntry) value;
      String type = TestAssertionRegistry.getInstance().getAssertionTypeForName(entry.getName());
      boolean canAssert = false;
      boolean disable = true;
      JLabel label;
      JTextArea descText;
      JLabel disabledInfo;
      if (type != null && assertable != null && assertable.getModelItem() != null) {
        canAssert =
            isAssertionApplicable(type, assertable.getModelItem(), getSelectedPropertyName());
        disable = !categoriesListTable.isEnabled() || !canAssert;
      }
      String str = entry.getName();
      label = new JLabel(str);
      label.setFont(boldFont);
      descText = new JTextArea(((AssertionListEntry) value).getDescription());
      descText.setSize(new Dimension(80, 20));
      descText.setLineWrap(true);
      descText.setWrapStyleWord(true);
      disabledInfo = new JLabel("Not applicable with selected Source and Property");
      descText.setFont(disabledInfo.getFont());
      if (disable) {
        label.setForeground(Color.LIGHT_GRAY);
        descText.setForeground(Color.LIGHT_GRAY);
        disabledInfo.setForeground(Color.LIGHT_GRAY);
      }
      SimpleForm form = new SimpleForm();
      form.addComponent(label);
      if (!isHideDescriptionSelected()) {
        form.addComponent(descText);
        //				if( disable )
        //				{
        //					form.addComponent( disabledInfo );
        //				}
        getAssertionsTable().setRowHeight(70);
      } else {
        if (disable) {
          form.addComponent(disabledInfo);
        }
        getAssertionsTable().setRowHeight(40);
      }
      if (isSelected) {
        descText.setBackground(Color.LIGHT_GRAY);
        form.getPanel().setBackground(Color.LIGHT_GRAY);
      } else {
        descText.setBackground(Color.WHITE);
        form.getPanel().setBackground(Color.WHITE);
      }
      return form.getPanel();
    }
  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);

  }
  /** 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);
  }
    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);
    }
Beispiel #26
-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);
 }
  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();
  }
Beispiel #28
-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);
  }
Beispiel #30
-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 "";
    }
  }