Пример #1
0
  /* Sjekker om scannet kort finnes og om det er gyldig,
  og skriver ut om scanningen var gyldig/ugyldig */
  private void sjekk() {
    vindu.getSelgerMetoder().setAktivTilKontroll();
    try {
      int nr = Integer.parseInt(kortid.getText());
      Boolean ok = aktivkortreg.sjekkGyldig(nr);
      if (ok) {
        info.setText("\n\n                       Gyldig");
        info.setBackground(Color.GREEN);
        if (scan(ok)) aktivkortreg.fjernKlipp(nr);

        kortid.setText("");
        kortid.selectAll();
        resetFocus();
      } else {
        info.setText("\n\n                    Ikke gyldig");
        info.setBackground(Color.RED);
        scan(ok);
        kortid.setText("");
        kortid.selectAll();
        resetFocus();
      }

      aktivkortreg.oppdater();
      vindu.oppdaterInfoPanel();
    } catch (NumberFormatException e) {
      info.setText("\n\n                    Kun tall...");
      kortid.setText("");
      timer.schedule(new Tick(), timersec * 500);
      return;
    }
  }
Пример #2
0
  // Mode modification
  public void modeModification() {
    resetCollection();
    loadCollection();
    resetCategorie();
    loadCategorie();
    comboCollection.setEnabled(true);

    textTitre.setVisible(true);
    textTitre.setEnabled(true);
    textTitre.setEditable(true);

    textAnnee.setVisible(true);
    textAnnee.setEnabled(true);
    textAnnee.setEditable(true);

    comboType.setVisible(true);
    comboType.setEnabled(true);

    comboEval.setVisible(true);
    comboEval.setEnabled(true);

    scrollCom.setEnabled(true);
    scrollCat.setEnabled(true);

    textCommentaires.setEnabled(true);
    textCommentaires.setEditable(true);
    textCommentaires.setBackground(Color.WHITE);
    textCommentaires.setText("");

    textCategories.setEnabled(true);
    textCategories.setEditable(false);
    textCategories.setBackground(GRIS);
    textCategories.setText("");

    for (int i = 0; i < infos_film.length; i++) {
      infos_film[i].setVisible(false);
    }

    for (int k = 0; k < modeButton.length; k++) {
      modeButton[k].setEnabled(false);
      modeButton[k].setVisible(false);
    }

    modeButton[3].setVisible(true); // Boutton Modifier
    modeButton[4].setVisible(true); // Boutton Supprimer
    boolean enabled = true;
    if (listeEstVide()) {
      enabled = false;
    }
    modeButton[3].setEnabled(enabled);
    modeButton[4].setEnabled(enabled);

    optionCategories[0].setEnabled(true); // Boutton ajouter categorie
    optionCategories[1].setEnabled(true);

    // Place the first element of combobox in the grid
    comboCollection.setSelectedIndex(0);
    Video video = this.obtenirVideo(comboCollection.getSelectedItem().toString());
    afficherFilmChoisis(video.getTitre());
  }
Пример #3
0
  // Mode consultation
  public void modeConsultation() {
    resetCollection();
    loadCollection();
    comboCollection.setEnabled(true);

    textTitre.setVisible(false);
    textTitre.setEditable(false);
    textAnnee.setVisible(false);
    textAnnee.setEditable(false);
    comboType.setVisible(false);
    comboType.setEnabled(false);
    comboEval.setVisible(false);
    comboEval.setEnabled(false);

    // Juste au cas que ca foire
    scrollCom.setEnabled(true);
    scrollCat.setEnabled(true);

    textCommentaires.setEnabled(true);
    textCommentaires.setEditable(false);
    textCategories.setEnabled(true);
    textCategories.setEditable(false);

    textCommentaires.setBackground(GRIS);
    textCategories.setBackground(GRIS);

    for (int k = 0; k < infos_film.length; k++) {
      infos_film[k].setVisible(true);
    }

    // Place the first element of combobox in the grid DEPRECATED by Enoncé
    comboCollection.setSelectedIndex(comboCollection.getSelectedIndex());

    for (int l = 0; l < modeButton.length; l++) {
      if (l < 2) {
        modeButton[0].setEnabled(false);
        modeButton[0].setVisible(true);
        if (comboCollection.getItemCount() > 1) {
          modeButton[l].setEnabled(true);
          modeButton[l].setVisible(true);
        } else {
          modeButton[l].setEnabled(false);
          modeButton[l].setVisible(true);
        }
        // modeButton[l].setEnabled(true);
        // modeButton[l].setVisible(true);
      } else {
        modeButton[l].setEnabled(false);
        modeButton[l].setVisible(false);
      }
    }
    optionCategories[0].setEnabled(false);
    optionCategories[1].setEnabled(false);

    // Get the collection and place in combobox

    Video video = this.obtenirVideo(comboCollection.getSelectedItem().toString());
    afficherFilmChoisis(video.getTitre());
  }
Пример #4
0
  @Override
  protected JComponent createCenterPanel() {
    final JPanel panel = new JPanel(new BorderLayout());
    JTextArea area =
        new JTextArea(
            "The imported language extends other languages.\n"
                + "It might be useful to import all or some of them.");
    area.setEditable(false);
    area.setBackground(this.getContentPane().getBackground());
    area.setBorder(BorderFactory.createEmptyBorder(5, 5, 3, 5));
    panel.add(area, BorderLayout.NORTH);

    JPanel center = new JPanel(new GridBagLayout());
    JTextArea label = new JTextArea("Select additional languages to import:");
    label.setEditable(false);
    label.setBackground(getContentPane().getBackground());
    label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    center.add(
        label,
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));

    myList = new JBList(myCandidates.toArray());

    myList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    myList.setSelectionInterval(0, myList.getModel().getSize() - 1);
    myList.setCellRenderer(new MyDefaultListCellRenderer());
    myList.setBorder(BorderFactory.createEtchedBorder());
    center.add(
        ScrollPaneFactory.createScrollPane(myList),
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    panel.add(center, BorderLayout.CENTER);
    panel.setPreferredSize(new Dimension(400, 250));

    return panel;
  }
Пример #5
0
  // Mode ajout
  public void modeAjout() {
    resetCollection();
    loadCollection();
    resetCategorie();
    loadCategorie();
    comboCollection.setEnabled(false);

    textTitre.setVisible(true);
    textTitre.setEnabled(true);
    textTitre.setEditable(true);
    textTitre.setText("");
    textTitre.requestFocusInWindow();

    textAnnee.setVisible(true);
    textAnnee.setEnabled(true);
    textAnnee.setEditable(true);
    textAnnee.setText("");

    comboType.setVisible(true);
    comboType.setEnabled(true);
    comboType.setSelectedIndex(1);

    comboEval.setVisible(true);
    comboEval.setEnabled(true);
    comboEval.setSelectedIndex(0);

    // Juste au cas que ca foire
    scrollCom.setEnabled(true);
    scrollCat.setEnabled(true);

    textCommentaires.setEnabled(true);
    textCommentaires.setEditable(true);
    textCommentaires.setBackground(Color.WHITE);
    textCommentaires.setText("");

    textCategories.setEnabled(true);
    textCategories.setEditable(false);
    textCategories.setBackground(GRIS);
    textCategories.setText("");

    optionCategories[0].setEnabled(true);
    optionCategories[1].setEnabled(false);

    for (int i = 0; i < infos_film.length; i++) {
      infos_film[i].setVisible(false);
    }

    for (int k = 0; k < modeButton.length; k++) {
      if (k == 2) {
        modeButton[k].setEnabled(true);
        modeButton[k].setVisible(true);
      } else {
        modeButton[k].setEnabled(false);
        modeButton[k].setVisible(false);
      }
    }
  }
Пример #6
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();
    }
Пример #7
0
  // Mode recherche
  public void modeRecherche() {
    resetCollection();

    comboCollection.setEnabled(false);

    textTitre.setVisible(true);
    textTitre.setEnabled(true);
    textTitre.setEditable(true);
    textTitre.setText("");
    textTitre.requestFocusInWindow();

    textAnnee.setVisible(true);
    textAnnee.setEnabled(true);
    textAnnee.setEditable(true);
    textAnnee.setText("");

    comboType.setVisible(true);
    comboType.setEnabled(true);
    comboType.setSelectedIndex(0);

    comboEval.setVisible(true);
    comboEval.setEnabled(false);
    // comboEval.setFont();
    comboEval.setSelectedIndex(0);

    textCommentaires.setEnabled(true);
    textCommentaires.setEditable(false);
    textCommentaires.setBackground(GRIS);
    textCommentaires.setText("");

    textCategories.setEnabled(true);
    textCategories.setEditable(false);
    textCategories.setBackground(GRIS);
    textCategories.setText("");

    for (int i = 0; i < infos_film.length; i++) {
      infos_film[i].setVisible(false);
    }

    for (int k = 0; k < modeButton.length; k++) {
      modeButton[k].setEnabled(false);
      modeButton[k].setVisible(false);
    }
    modeButton[5].setVisible(true);
    // modeButton[6].setVisible(true);

    boolean enabled = true;

    if (listeEstVide()) {
      enabled = false;
    }
    optionCategories[0].setEnabled(enabled);
    optionCategories[1].setEnabled(enabled);
    modeButton[5].setEnabled(enabled);
    modeButton[6].setEnabled(true);
  }
Пример #8
0
 public void flashBackground() {
   if (flashState == 0) {
     textArea.setBackground(FLASH_COLOR);
     flashState = 1;
   } else {
     textArea.setBackground(Color.WHITE);
     flashState = 0;
   }
   repaint();
 }
Пример #9
0
 @Override
 public void setEnabled(final boolean b) {
   txtErfassungsdatum.setEditable(b);
   txtBemerkung.setEditable(b);
   chkSperre.setEnabled(b);
   txtSearch.setEnabled(!b);
   btnSearch.setEnabled(!b);
   if (b) {
     txtBemerkung.setBackground(java.awt.Color.white);
   } else {
     txtBemerkung.setBackground(this.getBackground());
   }
 }
Пример #10
0
 private void setBackgroundColors() {
   shellPreview.setBackground(themeData.getColor(ThemeData.SHELL_BACKGROUND_COLOR));
   shellPreview.setSelectionColor(themeData.getColor(ThemeData.SHELL_SELECTED_BACKGROUND_COLOR));
   historyPreview.setBackground(themeData.getColor(ThemeData.SHELL_HISTORY_BACKGROUND_COLOR));
   historyPreview.setSelectionBackground(
       themeData.getColor(ThemeData.SHELL_HISTORY_SELECTED_BACKGROUND_COLOR));
 }
Пример #11
0
  /**
   * Erzeuge das Zusammenfassung-Panel, in dem die ausgewählten Verleihkarten im Detail angezeigt
   * werden.
   */
  private void erzeugeVerleihkartenAnzeiger() {
    JPanel verleihkartenAnzeigerPanel = new JPanel();
    BorderLayout detailsPanelLayout = new BorderLayout();
    _ruecknahmePanel.add(verleihkartenAnzeigerPanel, BorderLayout.CENTER);
    verleihkartenAnzeigerPanel.setLayout(detailsPanelLayout);
    verleihkartenAnzeigerPanel.setPreferredSize(new java.awt.Dimension(-1, -1));
    verleihkartenAnzeigerPanel.setSize(-1, -1);
    verleihkartenAnzeigerPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    JScrollPane verleihkartenAnzeigerScrollPane = new JScrollPane();
    verleihkartenAnzeigerPanel.add(verleihkartenAnzeigerScrollPane, BorderLayout.CENTER);
    verleihkartenAnzeigerScrollPane.setPreferredSize(new java.awt.Dimension(-1, -1));
    verleihkartenAnzeigerScrollPane.setBorder(
        BorderFactory.createTitledBorder(
            null,
            "Ausgewählte Verleihkarten",
            TitledBorder.LEADING,
            TitledBorder.DEFAULT_POSITION,
            UIConstants.HEADER_FONT));
    verleihkartenAnzeigerScrollPane.setSize(-1, -1);
    verleihkartenAnzeigerScrollPane.setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAnzeigerScrollPane
        .getVerticalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAnzeigerScrollPane
        .getHorizontalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);

    _verleihkartenAnzeigerTextArea = new JTextArea();
    _verleihkartenAnzeigerTextArea.setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAnzeigerScrollPane.setViewportView(_verleihkartenAnzeigerTextArea);
    _verleihkartenAnzeigerTextArea.setEditable(false);
    _verleihkartenAnzeigerTextArea.setFont(UIConstants.TEXT_FONT);
  }
Пример #12
0
  /**
   * Create a new JumpSourcePanel.
   *
   * @param tab parent JumpTab
   */
  public JumpSourcePanel(final JumpTab tab) {
    this.tab = tab;
    this.editorPane = new JTextArea();
    this.highlighter = new DefaultHighlighter();
    highlighter.setDrawsLayeredHighlights(false);

    setLayout(new BorderLayout());
    setBorder(new TitledBorder("Source"));
    editorPane.setFont(JumpGui.FONT_MONOSPACED);
    editorPane.setHighlighter(highlighter);
    final StringBuilder sb = new StringBuilder();
    for (int i = 1; i < MAXIMUM_LINE_NUMBER; ++i) {
      sb.append(String.format("%3d %n", i));
    }

    final JTextArea lineNumbers = new JTextArea(sb.toString());
    lineNumbers.setFont(editorPane.getFont());
    lineNumbers.setBackground(getBackground());
    lineNumbers.setEditable(false);
    lineNumbers.setFocusable(false);

    final JScrollPane scrollPane =
        new JScrollPane(
            editorPane,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setRowHeaderView(lineNumbers);
    add(scrollPane);
    SwingUtilities.invokeLater(this);
  }
Пример #13
0
  private void themeing() {

    aboutDialogLogger.entry();
    Color color = new Color(0, 0, 0, 0);

    mainPanel.setOpaque(false);
    mainPanel.setBackground(new Color(51, 181, 229));

    programLabel.setFont(new Font(programLabel.getFont().getName(), Font.BOLD, 24));

    displayPanel.setOpaque(false);

    licenseScrollPane.setOpaque(false);
    licenseScrollPane.getViewport().setOpaque(false);
    licenseScrollPane.setBorder(null);
    licenseScrollPane.setViewportBorder(null);
    licenseTextArea.setOpaque(false);
    licenseTextArea.setBackground(color);
    licenseTextArea.setEditable(false);

    developerScrollPane.setOpaque(false);
    developerScrollPane.getViewport().setOpaque(false);
    developerScrollPane.setBorder(null);
    developerScrollPane.setViewportBorder(null);
    developerPane.setOpaque(false);
    developerPane.setBackground(color);
    developerPane.setEditable(false);
    emptyPanel.setOpaque(false);
    aboutDialogLogger.exit(LoggerValues.SUCCESSFUL_EXIT);
  }
Пример #14
0
 /** @see javax.swing.JComponent#setBackground(java.awt.Color) */
 @Override
 public void setBackground(Color bg) {
   if (outField != null) {
     outField.setBackground(bg);
   }
   super.setBackground(bg);
 }
Пример #15
0
  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();
  }
Пример #16
0
  /**
   * Get the {@link JComponent} that displays the given message.
   *
   * @param msg Message to display.
   * @param breakLines Whether or not {@literal "long"} lines should be broken up.
   * @return {@code JComponent} that displays {@code msg}.
   */
  private static JComponent getMessageComponent(String msg, boolean breakLines) {
    if (msg.startsWith("<html>")) {
      Component[] comps = GuiUtils.getHtmlComponent(msg, null, 500, 400);
      return (JScrollPane) comps[1];
    }

    int msgLength = msg.length();
    if (msgLength < 50) {
      return new JLabel(msg);
    }

    StringBuilder sb = new StringBuilder(msgLength * 2);
    if (breakLines) {
      for (String line : StringUtil.split(msg, "\n")) {
        line = StringUtil.breakText(line, "\n", 50);
        sb.append(line).append('\n');
      }
    } else {
      sb.append(msg).append('\n');
    }

    JTextArea textArea = new JTextArea(sb.toString());
    textArea.setFont(textArea.getFont().deriveFont(Font.BOLD));
    textArea.setBackground(new JPanel().getBackground());
    textArea.setEditable(false);
    JScrollPane textSp = GuiUtils.makeScrollPane(textArea, 400, 200);
    textSp.setPreferredSize(new Dimension(400, 200));
    return textSp;
  }
 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);
 }
  public ConexionServidorCMD() {
    super("Cliente"); // Establece titulo al Frame

    campoTexto = new JTextField(); // crea el campo para texto
    campoTexto.setEditable(false); // No permite que sea editable el campo de texto
    add(campoTexto, BorderLayout.NORTH); // Coloca el campo de texto en la parte superior

    areaTexto = new JTextArea(); // Crear displayArea
    areaTexto.setEditable(false);
    add(new JScrollPane(areaTexto), BorderLayout.CENTER);
    areaTexto.setBackground(Color.orange); // Pone de color cyan al displayArea
    areaTexto.setForeground(Color.BLACK); // pinta azul la letra en el displayArea
    campoTexto.setForeground(Color.BLACK); // pinta toja la letra del mensaje a enviar

    // Crea menu Archivo y submenu Salir, ademas agrega el submenu al menu
    JMenu menuArchivo = new JMenu("Archivo");
    JMenuItem salir = new JMenuItem("Salir");
    menuArchivo.add(salir); // Agrega el submenu Salir al menu menuArchivo

    JMenuBar barra = new JMenuBar(); // Crea la barra de menus
    setJMenuBar(barra); // Agrega barra de menus a la aplicacion
    barra.add(menuArchivo); // agrega menuArchivo a la barra de menus

    // Accion que se realiza cuando se presiona el submenu Salir
    salir.addActionListener(
        new ActionListener() { // clase interna anonima
          public void actionPerformed(ActionEvent e) {
            System.exit(0); // Sale de la aplicacion
          }
        });

    setSize(300, 320); // Establecer tamano a ventana
    setVisible(true); // Pone visible la ventana
  }
Пример #19
0
 public Affichage() {
   this.jta = new JTextArea(texte);
   this.setBackground(new Color(0, 0, 0));
   jta.setBackground(new Color(0, 0, 0));
   jta.setForeground(Color.GREEN);
   this.add(jta);
 }
  public void addGui(final DownloadDialog gui) {
    buildDownloadAreaInputFields();
    final JPanel dlg = new JPanel(new GridBagLayout());

    tfOsmUrl.getDocument().addDocumentListener(new OsmUrlRefresher());

    // select content on receiving focus. this seems to be the default in the
    // windows look+feel but not for others. needs invokeLater to avoid strange
    // side effects that will cancel out the newly made selection otherwise.
    tfOsmUrl.addFocusListener(new SelectAllOnFocusHandler(tfOsmUrl));
    tfOsmUrl.setLineWrap(true);
    tfOsmUrl.setBorder(latlon[0].getBorder());

    dlg.add(new JLabel(tr("min lat")), GBC.std().insets(10, 20, 5, 0));
    dlg.add(latlon[0], GBC.std().insets(0, 20, 0, 0));
    dlg.add(new JLabel(tr("min lon")), GBC.std().insets(10, 20, 5, 0));
    dlg.add(latlon[1], GBC.eol().insets(0, 20, 0, 0));
    dlg.add(new JLabel(tr("max lat")), GBC.std().insets(10, 0, 5, 0));
    dlg.add(latlon[2], GBC.std());
    dlg.add(new JLabel(tr("max lon")), GBC.std().insets(10, 0, 5, 0));
    dlg.add(latlon[3], GBC.eol());

    dlg.add(
        new JLabel(
            tr("URL from www.openstreetmap.org (you can paste an URL here to download the area)")),
        GBC.eol().insets(10, 20, 5, 0));
    dlg.add(tfOsmUrl, GBC.eop().insets(10, 0, 5, 0).fill());
    tfOsmUrl.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            checkPopup(e);
          }

          @Override
          public void mouseClicked(MouseEvent e) {
            checkPopup(e);
          }

          @Override
          public void mouseReleased(MouseEvent e) {
            checkPopup(e);
          }

          private void checkPopup(MouseEvent e) {
            if (e.isPopupTrigger()) {
              OsmUrlPopup popup = new OsmUrlPopup();
              popup.show(tfOsmUrl, e.getX(), e.getY());
            }
          }
        });
    dlg.add(showUrl, GBC.eop().insets(10, 0, 5, 5));
    showUrl.setEditable(false);
    showUrl.setBackground(dlg.getBackground());
    showUrl.addFocusListener(new SelectAllOnFocusHandler(showUrl));

    gui.addDownloadAreaSelector(dlg, tr("Bounding Box"));
    this.parent = gui;
  }
Пример #21
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);
 }
Пример #22
0
 /**
  * Set the value of taskbar
  *
  * @param newVar the new value of taskbar
  */
 private void setTaskbar() {
   /** *****************Task Bar**************** */
   taskbar = new JTextArea();
   taskbar.setVisible(true);
   taskbar.setBackground(Color.lightGray);
   taskbar.setEditable(false);
   /** *****************End of Task Bar**************** */
 }
Пример #23
0
  public static JTextArea getTextArea() {
    JTextArea component = new JTextArea();
    component.setBackground(BACKGROUND_COLOR_TXTA);
    component.setForeground(TEXT_COLOR_TXTA);
    component.setFont(FONT_TYPE_TXTA);

    return component;
  }
  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);
  }
Пример #25
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);
  }
Пример #26
0
 public void setOutputPanel() {
   BoxLayout box = new BoxLayout(output, BoxLayout.Y_AXIS);
   output.setLayout(box);
   Color c1 = new Color(166, 209, 241);
   Color c2 = new Color(204, 210, 211);
   JLabel label3 = new JLabel("Messaggi interni:");
   output.add(label3);
   outp.setBackground(c1);
   outp.setAutoscrolls(true);
   outp.setEditable(false);
   intmsg.setBackground(c2);
   intmsg.setAutoscrolls(true);
   intmsg.setEditable(false);
   output.add(scrollPaneM);
   JLabel label4 = new JLabel("Output:");
   output.add(label4);
   output.add(scrollPaneO);
   output.setBorder(BorderFactory.createEtchedBorder());
 }
Пример #27
0
    private Component buildContent() {
      contentArea = new JTextArea();
      contentArea.setEditable(false);
      contentArea.setBackground(Color.WHITE);
      JScrollPane scrollPane = new JScrollPane(contentArea);
      scrollPane.setPreferredSize(new Dimension(500, 300));

      return UISupport.wrapInEmptyPanel(
          scrollPane, BorderFactory.createEmptyBorder(10, 10, 10, 10));
    }
Пример #28
0
  /**
   * Creates the terminal for interaction with client from server
   *
   * @param s
   */
  public Terminal(Server s) {
    mServer = s;

    TextFieldListener tfListener = new TextFieldListener();
    input.addActionListener(tfListener);

    Display = new javax.swing.JLayeredPane();

    input.setColumns(50);
    output.setColumns(50);
    output.setRows(30);
    output.setEditable(false);

    output.setBackground(Color.BLACK);
    output.setForeground(Color.WHITE);

    input.requestFocus(); // start with focus on this field

    output.setBounds(0, 0, 550, 310);
    Display.add(output, javax.swing.JLayeredPane.DEFAULT_LAYER);

    input.setBounds(0, 320, 550, 25);
    Display.add(input, javax.swing.JLayeredPane.DEFAULT_LAYER);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(
                        Display,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        550,
                        javax.swing.GroupLayout.PREFERRED_SIZE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(
                                Display,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                350,
                                javax.swing.GroupLayout.PREFERRED_SIZE))));

    pack();
  }
Пример #29
0
  public ImportClientsGUI(File file, Controller controller) {
    super();
    setOpaque(false);

    this.controller = controller;
    this.towns = new HashMap<String, TownDTO>();
    this.subcategories = new HashMap<String, SubcategoryDTO>();

    for (TownDTO town : controller.getAllTowns()) {
      this.towns.put(town.getName().toUpperCase(), town);
    }

    for (SubcategoryDTO subcategory : controller.getAllSubcategories()) {
      this.subcategories.put(subcategory.getDescription().toUpperCase(), subcategory);
    }

    this.file = file;
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] {0, 0};
    gridBagLayout.rowHeights = new int[] {0, 50, 0};
    gridBagLayout.columnWeights = new double[] {1.0, Double.MIN_VALUE};
    gridBagLayout.rowWeights = new double[] {1.0, 0.0, Double.MIN_VALUE};
    setLayout(gridBagLayout);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setOpaque(false);
    GridBagConstraints gbc_scrollPane = new GridBagConstraints();
    gbc_scrollPane.insets = new Insets(15, 15, 10, 15);
    gbc_scrollPane.fill = GridBagConstraints.BOTH;
    gbc_scrollPane.gridx = 0;
    gbc_scrollPane.gridy = 0;
    add(scrollPane, gbc_scrollPane);

    textArea = new JTextArea();
    textArea.setEditable(false);
    textArea.setMargin(new Insets(10, 10, 10, 10));
    textArea.setWrapStyleWord(true);
    textArea.setLineWrap(true);
    textArea.setForeground(Color.GREEN);
    textArea.setFont(new Font("Lucida Grande", Font.PLAIN, 15));
    textArea.setBackground(new Color(0, 0, 0, 140));
    scrollPane.setViewportView(textArea);

    progressBar = new JProgressBar();
    progressBar.setStringPainted(true);
    progressBar.setForeground(Color.BLACK);
    progressBar.setFont(new Font("Lucida Grande", Font.PLAIN, 20));
    GridBagConstraints gbc_progressBar = new GridBagConstraints();
    gbc_progressBar.fill = GridBagConstraints.BOTH;
    gbc_progressBar.insets = new Insets(0, 15, 15, 15);
    gbc_progressBar.gridx = 0;
    gbc_progressBar.gridy = 1;
    add(progressBar, gbc_progressBar);
  }
Пример #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 "";
    }
  }