Example #1
0
 private Object[] buttons() {
   ResourceBundle bundle = NbBundle.getBundle(PropertyAction.class);
   JButton okButton = new JButton();
   Mnemonics.setLocalizedText(okButton, bundle.getString("CTL_OK")); // NOI18N
   okButton
       .getAccessibleContext()
       .setAccessibleDescription(bundle.getString("ACSD_CTL_OK")); // NOI18N
   okButton.setActionCommand(OK_COMMAND);
   JButton cancelButton = new JButton();
   Mnemonics.setLocalizedText(cancelButton, bundle.getString("CTL_Cancel")); // NOI18N
   cancelButton
       .getAccessibleContext()
       .setAccessibleDescription(bundle.getString("ACSD_CTL_Cancel")); // NOI18N
   cancelButton.setActionCommand(CANCEL_COMMAND);
   if (property.isDefaultValue()) {
     if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
       return new Object[] {cancelButton, okButton};
     } else {
       return new Object[] {okButton, cancelButton};
     }
   } else {
     JButton restoreButton = new JButton();
     Mnemonics.setLocalizedText(restoreButton, bundle.getString("CTL_RestoreDefault")); // NOI18N
     restoreButton
         .getAccessibleContext()
         .setAccessibleDescription(bundle.getString("ACSD_CTL_RestoreDefault")); // NOI18N
     restoreButton.setActionCommand(RESTORE_COMMAND);
     if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
       return new Object[] {restoreButton, cancelButton, okButton};
     } else {
       return new Object[] {okButton, restoreButton, cancelButton};
     }
   }
 }
Example #2
0
 public Update(File repository, String defaultRevision) {
   this.repository = repository;
   panel = new UpdatePanel(repository);
   okButton = new JButton();
   org.openide.awt.Mnemonics.setLocalizedText(
       okButton,
       org.openide.util.NbBundle.getMessage(
           RevertModifications.class, "CTL_UpdateForm_Action_Update")); // NOI18N
   okButton
       .getAccessibleContext()
       .setAccessibleDescription(
           org.openide.util.NbBundle.getMessage(
               RevertModifications.class, "ACSD_UpdateForm_Action_Update")); // NOI18N
   okButton
       .getAccessibleContext()
       .setAccessibleName(
           org.openide.util.NbBundle.getMessage(
               RevertModifications.class, "ACSN_UpdateForm_Action_Update")); // NOI18N
   cancelButton = new JButton();
   org.openide.awt.Mnemonics.setLocalizedText(
       cancelButton,
       org.openide.util.NbBundle.getMessage(
           RevertModifications.class, "CTL_UpdateForm_Action_Cancel")); // NOI18N
   cancelButton
       .getAccessibleContext()
       .setAccessibleDescription(
           org.openide.util.NbBundle.getMessage(
               RevertModifications.class, "ACSD_UpdateForm_Action_Cancel")); // NOI18N
   cancelButton
       .getAccessibleContext()
       .setAccessibleName(
           org.openide.util.NbBundle.getMessage(
               RevertModifications.class, "ACSN_UpdateForm_Action_Cancel")); // NOI18N
 }
  /** If Certificate was not accepted during installation user must accept it here. */
  public static boolean acceptCertificatePanel(String certificate) throws Exception {
    CertificatePanel CertificatePanel = new CertificatePanel(certificate);
    ResourceBundle bundle = NbBundle.getBundle(AcceptCertificate.class);
    String yesLabel = bundle.getString("MSG_CertificateYesButton");
    String noLabel = bundle.getString("MSG_CertificateNoButton");
    JButton yesButton = new JButton(yesLabel);
    JButton noButton = new JButton(noLabel);

    ActionListener listener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            command = e.getActionCommand();
            d.setVisible(false);
          }
        };
    yesButton.addActionListener(listener);
    noButton.addActionListener(listener);

    yesButton.setActionCommand("yes"); // NOI18N
    noButton.setActionCommand("no"); // NOI18N

    yesButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_AcceptButton"));
    yesButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSD_AcceptButton"));

    noButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_RejectButton"));
    noButton.getAccessibleContext().setAccessibleName(bundle.getString("ACSD_RejectButton"));

    int maxWidth = Math.max(yesButton.getPreferredSize().width, noButton.getPreferredSize().width);
    int maxHeight =
        Math.max(yesButton.getPreferredSize().height, noButton.getPreferredSize().height);
    yesButton.setPreferredSize(new Dimension(maxWidth, maxHeight));
    noButton.setPreferredSize(new Dimension(maxWidth, maxHeight));

    d = new JDialog((Frame) null, bundle.getString("MSG_CertificateDlgTitle"), true);

    d.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_CertificateDlg"));
    d.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_CertificateDlg"));

    d.getContentPane().add(CertificatePanel, BorderLayout.CENTER);
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(17, 12, 11, 11));
    buttonPanel.add(yesButton);
    buttonPanel.add(noButton);
    d.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    d.setSize(new Dimension(600, 600));
    d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    d.setModal(true);
    d.setResizable(true);
    // Center on screen
    d.setLocationRelativeTo(null);
    d.setVisible(true);

    if ("yes".equals(command)) { // NOI18N
      return true;
    } else {
      return false;
    }
  }
 private boolean shouldChangePlatform(
     SpecificationVersion selectedSourceLevel, SpecificationVersion platformSourceLevel) {
   JButton changeOption =
       new JButton(NbBundle.getMessage(PlatformUiSupport.class, "CTL_ChangePlatform")); // NOI18N
   changeOption
       .getAccessibleContext()
       .setAccessibleDescription(
           NbBundle.getMessage(PlatformUiSupport.class, "AD_ChangePlatform")); // NOI18N
   String message =
       MessageFormat.format(
           NbBundle.getMessage(PlatformUiSupport.class, "TXT_ChangePlatform"), // NOI18N
           selectedSourceLevel.toString(),
           platformSourceLevel.toString());
   return DialogDisplayer.getDefault()
           .notify(
               new NotifyDescriptor(
                   message,
                   NbBundle.getMessage(
                       PlatformUiSupport.class, "TXT_ChangePlatformTitle"), // NOI18N
                   NotifyDescriptor.DEFAULT_OPTION,
                   NotifyDescriptor.WARNING_MESSAGE,
                   new Object[] {changeOption, NotifyDescriptor.CANCEL_OPTION},
                   changeOption))
       == changeOption;
 }
Example #5
0
 /** Simple convenience routine for adding a button/icon to a Toolbar */
 public static JButton addTool(JToolBar toolBar, String name) {
   JButton b;
   b = new JButton(new ImageIcon("images/" + name + ".gif", name));
   toolBar.add(b);
   b.setToolTipText(name);
   b.setMargin(new Insets(0, 0, 0, 0));
   b.getAccessibleContext().setAccessibleName(name);
   return b;
 }
 private JButton createButton(String labelId, String labelMnemonicId, String mnemonicId) {
   JButton button =
       new JButton(NbBundle.getMessage(ProjectImportLocationWizardPanel.class, labelId));
   button
       .getAccessibleContext()
       .setAccessibleDescription(
           NbBundle.getMessage(ProjectImportLocationWizardPanel.class, labelMnemonicId));
   button.setMnemonic(
       NbBundle.getMessage(ProjectImportLocationWizardPanel.class, mnemonicId).charAt(0));
   return button;
 }
  public GotoDialogSupport() {
    ResourceBundle bundle = NbBundle.getBundle(org.netbeans.editor.BaseKit.class);
    JButton gotoButton = new JButton(bundle.getString("goto-button-goto")); // NOI18N
    JButton cancelButton = new JButton(bundle.getString("goto-button-cancel")); // NOI18N
    gotoButton
        .getAccessibleContext()
        .setAccessibleDescription(bundle.getString("ACSD_goto-button-goto")); // NOI18N
    cancelButton
        .getAccessibleContext()
        .setAccessibleDescription(bundle.getString("ACSD_goto-button-cancel")); // NOI18N
    //        gotoButton.setMnemonic( bundle.getString("goto-button-goto-mnemonic").charAt(0));
    // //NOI18N

    gotoButtons = new JButton[] {gotoButton, cancelButton};
    gotoPanel = new GotoDialogPanel();

    gotoPanel
        .getGotoCombo()
        .getEditor()
        .getEditorComponent()
        .addKeyListener(
            new KeyListener() {
              public void keyPressed(KeyEvent evt) {}

              public void keyReleased(KeyEvent evt) {}

              public void keyTyped(KeyEvent evt) {
                if (evt.getKeyChar() == '\n') {
                  actionPerformed(new ActionEvent(gotoButtons[0], 0, null));
                }
                //                if (!Character.isDigit(evt.getKeyChar()) &&
                // !Character.isISOControl(evt.getKeyChar())) {
                //                    evt.consume();
                //                    Component c = evt.getComponent();
                //                    if (c != null) {
                //                        c.getToolkit().beep();
                //                    }
                //                }
              }
            });
  }
Example #8
0
  public PIDSelectPanel(JButton okButton) {
    this.okButton = okButton;

    combo = new JComboBox<>();
    button = new JButton(REFRESH_BUTTON_NAME);

    JPanel infoPanel = new JPanel();
    infoPanel.setLayout(new GridBagLayout());

    GridBagConstraints labelGbc = new GridBagConstraints();
    labelGbc.insets = new Insets(3, 5, 0, 0);
    labelGbc.anchor = WEST;

    GridBagConstraints valueGbc = new GridBagConstraints();
    valueGbc.weightx = 1.0;
    valueGbc.fill = HORIZONTAL;
    valueGbc.insets = new Insets(3, 5, 0, 5);
    valueGbc.gridwidth = REMAINDER;
    valueGbc.anchor = WEST;

    JLabel l;

    l = new JLabel(PID_LABEL_TEXT);
    l.setFont(l.getFont().deriveFont(BOLD));
    infoPanel.add(l, labelGbc);
    infoPanel.add(pidLabel = new JLabel(), valueGbc);
    l = new JLabel(MAIN_CLASS_LABEL_TEXT);
    l.setFont(l.getFont().deriveFont(BOLD));
    infoPanel.add(l, labelGbc);
    infoPanel.add(mainClassLabel = new JLabel(), valueGbc);
    l = new JLabel(ARGUMENTS_LABEL_TEXT);
    l.setFont(l.getFont().deriveFont(BOLD));
    infoPanel.add(l, labelGbc);
    infoPanel.add(argumentsLabel = new JLabel(), valueGbc);
    l = new JLabel(VM_ARGUMENTS_LABEL_TEXT);
    l.setFont(l.getFont().deriveFont(BOLD));
    infoPanel.add(l, labelGbc);
    infoPanel.add(vmArgumentsLabel = new JLabel(), valueGbc);
    l = new JLabel(VM_FLAGS_LABEL_TEXT);
    l.setFont(l.getFont().deriveFont(BOLD));
    infoPanel.add(l, labelGbc);
    infoPanel.add(vmFlagsLabel = new JLabel(), valueGbc);

    combo.setRenderer(new PIDComboRenderer());
    combo.getAccessibleContext().setAccessibleName(COMBO_ACCESS_NAME);
    combo.getAccessibleContext().setAccessibleDescription(COMBO_ACCESS_DESCR);

    button.getAccessibleContext().setAccessibleDescription(BUTTON_ACCESS_DESCR);

    setBorder(createEmptyBorder(12, 12, 12, 12));
    setLayout(new BorderLayout(0, 10));

    JPanel northPanel = new JPanel();
    northPanel.setLayout(new BorderLayout(5, 0));

    northPanel.add(combo, CENTER);
    northPanel.add(button, EAST);

    add(northPanel, NORTH);
    add(infoPanel, CENTER);

    okButton.setEnabled(false);

    refreshCombo();

    button.addActionListener(this);
    combo.addActionListener(this);
  }
  private void criaInterfaceVisualEscalavel() {
    miBtnSalvar = new JMenuItem(XHTML_Panel.BTN_SALVAR);
    painel = new JPanel();
    textAreaSourceCode = new G_TextAreaSourceCode();
    // frameSilvinha.setJMenuBar(this.criaMenuBar());
    textAreaSourceCode.setTipoHTML();
    textAreaSourceCode.setBorder(criaBorda(XHTML_Panel.COD_FONTE));
    // frameSilvinha.setTitle(XHTMLPanel.TIT_LINK_RED);

    painel.setLayout(new GridLayout(2, 1));
    setBackground(frameSilvinha.corDefault);

    Container contentPane = this;
    contentPane.setLayout(new GridLayout(1, 1));
    painel.add(textAreaSourceCode);

    JPanel panelBtnTabela = new JPanel();

    panelBtnTabela.setLayout(new BorderLayout());

    /*
     * Barra de botões
     */
    btnPanel = new JPanel();
    btnPanel.setLayout(null);
    btn_salvar = new JButton(XHTML_Panel.BTN_SALVAR);
    btn_salvar.setToolTipText(XHTML_Panel.DICA_SALVAR);
    btn_salvar.setBounds(10, 0, 150, 25);
    btnPanel.add(btn_salvar);

    btn_abrir = new JButton(XHTML_Panel.BTN_ABRIR);
    btn_abrir.setToolTipText(XHTML_Panel.DICA_ABRIR);
    btn_abrir.setBounds(165, 0, 150, 25);
    btnPanel.add(btn_abrir);

    btn_salvarComo = new JButton(XHTML_Panel.BTN_SALVAR_COMO);
    btn_salvarComo.setToolTipText(XHTML_Panel.DICA_SALVAR_COMO);
    btn_salvarComo.setBounds(320, 0, 150, 25);
    btnPanel.add(btn_salvarComo);

    btn_cancelar = new JButton(XHTML_Panel.TELA_ANTERIOR);
    btn_cancelar.setToolTipText(XHTML_Panel.DICA_TELA_ANTERIOR);
    btn_cancelar.setBounds(480, 0, 150, 25);
    btnPanel.add(btn_cancelar);

    btnPanel.setPreferredSize(new Dimension(430, 30));

    /*
     * Barra de correcao
     */
    btnAplicar = new JButton(XHTML_Panel.BTN_APLICAR);
    btnAplicar.setToolTipText(XHTML_Panel.DICA_BTN_APLICAR);
    btnAplicar.setEnabled(false);

    texto = new JTextField();

    texto.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    JPanel borda = new JPanel(new BorderLayout());
    JLabel lbl_texto = new JLabel(XHTML_Panel.ROTULO_TEXTO);
    lbl_texto.setToolTipText(XHTML_Panel.DICA_ROTULO_TEXTO);
    borda.add(lbl_texto, BorderLayout.WEST);
    borda.add(texto, BorderLayout.CENTER);
    borda.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    borda.setOpaque(false);
    panelCorretor = new JPanel(new BorderLayout());
    panelCorretor.add(borda, BorderLayout.CENTER);
    panelCorretor.add(btnAplicar, BorderLayout.EAST);
    // panelCorretor.add(btnPanel,BorderLayout.WEST);
    panelCorretor.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
    panelCorretor.setOpaque(false);

    /*
     * Tabela de erros
     */
    tabelaDeErros = new TabelaErros();
    scrollPaneTabela = new JScrollPane();
    scrollPaneTabela.setViewportView(tabelaDeErros);
    panelBtnTabela.add(panelCorretor, BorderLayout.NORTH);
    panelBtnTabela.add(scrollPaneTabela, BorderLayout.CENTER);
    panelBtnTabela.add(btnPanel, BorderLayout.SOUTH);
    scrollPaneTabela.setBorder(criaBorda(XHTML_Panel.LISTA_ERROS));
    painel.add(panelBtnTabela);

    btnPanel.setBackground(frameSilvinha.corDefault);
    if (!original) {
      reverter = new JButton("Reverter");
      reverter.setText(TradPainelRelatorio.REVERTER);
      reverter.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              // TODO Auto-generated method stub
              setVisible(false);
              TxtBuffer.setContent(TxtBuffer.getContentOriginal());
              frameSilvinha.showPainelFerramentaLinksRedundantes();
              setVisible(true);
            }
          });
      // reverter.setActionCommand("Reverter");
      reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER);
      reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER);
      reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER);
      reverter.setBounds(640, 0, 150, 25);
      btnPanel.add(reverter);
    }

    panelBtnTabela.setBackground(frameSilvinha.corDefault);
    painel.setBackground(frameSilvinha.corDefault);
    contentPane.setBackground(frameSilvinha.corDefault);
    scrollPaneTabela.setBackground(frameSilvinha.corDefault);
    textAreaSourceCode.setBackground(frameSilvinha.corDefault);
    miBtnSalvar.setEnabled(false);
    btn_salvar.setEnabled(false);
    salvaAlteracoes =
        TxtBuffer.getInstanciaSalvaAlteracoes(
            textAreaSourceCode.getTextPane(), btn_salvar, miBtnSalvar, frameSilvinha);
    String fil[] = {".html", ".htm"};
    salvaAlteracoes.setFiltro(fil);
    contentPane.add(painel);
    // pack();
    this.setVisible(true);
  }
Example #10
0
  public DatabaseSearchUI() {

    setLayout(new BorderLayout());

    JPanel displayNamePanel = new JPanel(new BorderLayout());
    JLabel displayNameLabel = new JLabel("Base Displayed Name:");
    baseDisplayedNameField = new JTextField();
    baseDisplayedNameField.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            if (goButton.isEnabled()) goButton.doClick();
          }
        });
    displayNameLabel.setLabelFor(baseDisplayedNameField);
    displayNamePanel.add(baseDisplayedNameField, BorderLayout.CENTER);
    displayNamePanel.add(displayNameLabel, BorderLayout.WEST);

    goButton = new JButton();
    String searchButtonText = "Search"; // bundle.getString("SEARCH_BUTTON");
    goButton.getAccessibleContext().setAccessibleName(searchButtonText);
    goButton.setAction(
        new AbstractAction(searchButtonText) {

          @Override
          public void actionPerformed(ActionEvent e) {
            goButton.setEnabled(false);
            SearchTask task = new SearchTask();
            listModel.removeAllElements();
            resultStatus.setText(null);
            task.execute();
          }
        });
    JPanel displayNameAndGoPanel = new JPanel(new BorderLayout());
    displayNameAndGoPanel.add(displayNamePanel, BorderLayout.CENTER);
    displayNameAndGoPanel.add(goButton, BorderLayout.EAST);

    listModel = new DefaultListModel();
    list = new JList(listModel);
    list.getAccessibleContext().setAccessibleName("Search Result List");
    list.setCellRenderer(
        new DefaultListCellRenderer() {
          @Override
          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            ComponentInfo ci = (ComponentInfo) value;
            JLabel label =
                (JLabel)
                    super.getListCellRendererComponent(
                        list, ci.name, index, isSelected, cellHasFocus);
            label.setIcon(AbstractComponent.getIconForComponentType(ci.type));
            return label;
          }
        });

    list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    list.addListSelectionListener(
        new ListSelectionListener() {

          @Override
          public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
              Collection<View> selectedManifestations = getSelectedManifestations();
              if (!selectedManifestations.isEmpty()) {
                firePropertyChange(
                    SelectionProvider.SELECTION_CHANGED_PROP, null, selectedManifestations);
              } // end if
            } // end if
          }
        });

    list.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            Collection<View> selectedManifestations = getSelectedManifestations();
            if (selectedManifestations.isEmpty()) return;

            View manifestation = selectedManifestations.iterator().next();
            if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
              manifestation.getManifestedComponent().open();
              return;
            }
          }
        });
    list.setDragEnabled(true);
    list.setTransferHandler(
        new TransferHandler() {
          @Override
          protected Transferable createTransferable(JComponent c) {
            List<View> viewRoles = new ArrayList<View>();
            Collection<View> selectedManifestations = getSelectedManifestations();
            if (!selectedManifestations.isEmpty()) {
              for (View manifestation : getSelectedManifestations()) viewRoles.add(manifestation);
              return new ViewRoleSelection(viewRoles.toArray(new View[viewRoles.size()]));
            } else {
              return null;
            } // end if
          }

          @Override
          public int getSourceActions(JComponent c) {
            return TransferHandler.COPY;
          }
        });

    JPanel controlPanel = new JPanel(new GridLayout(2, 1, 5, 5));
    controlPanel.add(displayNameAndGoPanel);
    findObjectsCreatedByMe = new JCheckBox("Created By Me");
    controlPanel.add(findObjectsCreatedByMe);

    JPanel descriptionPanel = new JPanel(new GridLayout(2, 1));
    JLabel searchEverywhereLabel = new JLabel("Search everywhere");
    searchEverywhereLabel.setFont(searchEverywhereLabel.getFont().deriveFont(Font.BOLD));

    resultStatus = new JLabel();
    resultStatus.setForeground(Color.BLUE);

    descriptionPanel.add(searchEverywhereLabel);
    descriptionPanel.add(resultStatus);

    JPanel upperPanel = new JPanel(new BorderLayout(PADDING, PADDING));
    upperPanel.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING));
    upperPanel.add(descriptionPanel, BorderLayout.NORTH);
    upperPanel.add(controlPanel, BorderLayout.CENTER);

    add(upperPanel, BorderLayout.NORTH);
    add(new JScrollPane(list), BorderLayout.CENTER);
  }