public JPasswordField getSenhaField() { if (senhaField == null) { senhaField = new JPasswordField(); int strSize = 50; senhaField.setDocument(new TextDocument(strSize)); senhaField.setToolTipText("Informe a nova senha"); senhaField.setColumns(10); } return senhaField; }
/** * This method initializes jPasswordFieldPassword * * @return javax.swing.JPasswordField */ private JPasswordField getJPasswordFieldPassword() { if (jPasswordFieldPassword == null) { jPasswordFieldPassword = new JPasswordField(); jPasswordFieldPassword.setBounds(new Rectangle(377, 285, 180, 30)); jPasswordFieldPassword.setText(""); jPasswordFieldPassword.setToolTipText("Enter your password here"); jPasswordFieldPassword.setEnabled(true); jPasswordFieldPassword.setEchoChar('*'); } return jPasswordFieldPassword; }
/** builds the UI */ protected void build() { setLayout(new GridBagLayout()); setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); GridBagConstraints gc = new GridBagConstraints(); // -- OSM user name gc.fill = GridBagConstraints.HORIZONTAL; gc.anchor = GridBagConstraints.NORTHWEST; gc.weightx = 0.0; gc.insets = new Insets(0, 0, 3, 3); add(new JLabel(tr("OSM username:"******"OSM password:"******"Please enter your OSM password")); // -- an info panel with a warning message gc.gridx = 0; gc.gridy = 2; gc.gridwidth = 2; gc.weightx = 1.0; gc.weighty = 1.0; gc.insets = new Insets(5, 0, 0, 0); gc.fill = GridBagConstraints.BOTH; decorationPanel = new JPanel(new BorderLayout()); add(decorationPanel, gc); }
/** * Creates and initializes the components * * @param userName The name of the user. * @param hostName The default hostName. */ private void initialize(String userName, String hostName) { components = new ArrayList<JComponent>(); // status update. currentTask = new JLabel(); Font newFont = currentTask.getFont().deriveFont(8); currentTask.setFont(newFont); currentTask.setForeground(ScreenLogin.TEXT_COLOR); progressBar = new JProgressBar(); progressBar.setVisible(false); progressBar.setStringPainted(false); progressBar.setFont(newFont); originalName = userName; user = new JTextField(); user.setName("username field"); user.setText(userName); user.setToolTipText("Enter your username."); user.setColumns(TEXT_COLUMN); pass = new JPasswordField(); pass.setName("password field"); pass.setToolTipText("Enter your password."); pass.setColumns(TEXT_COLUMN); Map<String, String> servers = editor.getServers(); if (CommonsLangUtils.isNotBlank(hostName)) { serverName = hostName; // if user did point to another server if (servers != null && servers.size() > 0) { int n = servers.size() - 1; Iterator<String> i = servers.keySet().iterator(); int k = 0; String value; while (i.hasNext()) { serverName = i.next(); if (k == n) { value = servers.get(serverName); if (value != null) { try { selectedPort = Integer.parseInt(value); } catch (Exception e) { } } } k++; } } else { editor.removeLastRow(); editor.addRow(hostName); } } else { if (servers == null || servers.size() == 0) serverName = hostName; else { int n = servers.size() - 1; Iterator<String> i = servers.keySet().iterator(); int k = 0; String value; while (i.hasNext()) { serverName = i.next(); if (k == n) { value = servers.get(serverName); if (value != null) { try { selectedPort = Integer.parseInt(value); } catch (Exception e) { } } } k++; } } } if (serverName.length() == 0) serverName = DEFAULT_SERVER; if (!DEFAULT_SERVER.equals(serverName)) originalServerName = serverName; connectionSpeedText = new JLabel(getConnectionSpeed()); connectionSpeedText.setForeground(TEXT_COLOR); connectionSpeedText.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); serverText = UIUtilities.buildTextPane(serverName, TEXT_COLOR); serverText.setName("server name text pane"); serverTextPane = UIUtilities.buildComponentPanelRight(serverText, false); serverTextPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); initializeGroups(); ref = new ArrayList<JComponent>(); login = new JButton("Login"); login.setName("login button"); defaultForeground = login.getForeground(); login.setMnemonic('L'); login.setToolTipText("Login"); setButtonDefault(login); login.setEnabled(false); // UIUtilities.enterPressesWhenFocused(login); UIUtilities.opacityCheck(login); cancel = new JButton("Quit"); cancel.setMnemonic('Q'); cancel.setToolTipText("Cancel Login."); setButtonDefault(cancel); UIUtilities.opacityCheck(cancel); configButton = new JButton(); configButton.setName("config server button"); configButton.setMnemonic('X'); configButton.setToolTipText("Enter the server's address."); configButton.setBorderPainted(false); configButton.setBorder(null); // configButton.setMargin(new Insets(1, 1, 1, 1)); configButton.setFocusPainted(false); configButton.setContentAreaFilled(false); IconManager icons = IconManager.getInstance(); configButton.setIcon(icons.getIcon(IconManager.CONFIG_24)); // configButton.setPressedIcon(icons.getIcon( // IconManager.CONFIG_PRESSED_24)); encrypted = !isEncrypted(); encryptedButton = new JButton(); List<String> tips = new ArrayList<String>(); tips.add("The connection to the server is always encrypted."); tips.add( "If selected, the data transfer (e.g. annotations, images) " + "will also be encrypted."); tips.add("But the transfer will be much slower."); encryptedButton.setToolTipText(UIUtilities.formatToolTipText(tips)); encryptedButton.setBorderPainted(false); encryptedButton.setBorder(null); encryptedButton.setFocusPainted(false); encryptedButton.setContentAreaFilled(false); if (encrypted) encryptedButton.setIcon(icons.getIcon(IconManager.ENCRYPTED_24)); else encryptedButton.setIcon(icons.getIcon(IconManager.DECRYPTED_24)); getRootPane().setDefaultButton(login); enableControls(); }
/** * Cria uma instância da janela de cadastro de funcionário do sistema BVB * * @param janelaPai <code>Window</code> com a janela pai da caixa de diálogo <code> * IgCadFuncionario</code> * @param funcionario <code>Funcionario</code> referênte ao objeto onde os dados serão salvos * @see Window * @see Funcionario */ public IgCadFuncionario(Window janelaPai, Funcionario funcionario) { setModal(true); Color nephritis = new Color(39, 174, 96); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setResizable(false); setTitle("BVB - Cadastro de Funcion\u00E1rio"); setBounds(100, 100, 523, (int) (506 * 0.85)); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JSeparator separatorBtn = new JSeparator(); separatorBtn.setBounds(0, 348, 517, 2); contentPane.add(separatorBtn); JSeparator separatorTitulo = new JSeparator(); separatorTitulo.setBounds(0, 69, 517, 2); contentPane.add(separatorTitulo); JTextPane txtpnSubTitulo = new JTextPane(); txtpnSubTitulo.setEditable(false); txtpnSubTitulo.setForeground(Color.WHITE); txtpnSubTitulo.setBackground(nephritis); txtpnSubTitulo.setText("Insira o login e a senha do novo funcion\u00E1rio."); txtpnSubTitulo.setFont(new Font("Tahoma", Font.PLAIN, 12)); txtpnSubTitulo.setBounds(20, 36, 290, 22); contentPane.add(txtpnSubTitulo); JTextPane txtpnTitulo = new JTextPane(); txtpnTitulo.setEditable(false); txtpnTitulo.setForeground(Color.WHITE); txtpnTitulo.setBackground(nephritis); txtpnTitulo.setText("Cadastro de Funcion\u00E1rio"); txtpnTitulo.setFont(new Font("Tahoma", Font.BOLD, 13)); txtpnTitulo.setBounds(10, 11, 210, 22); contentPane.add(txtpnTitulo); JLabel lblImg = new JLabel("Label Img"); lblImg.setBorder(new LineBorder(Color.WHITE, 1, true)); lblImg.setIcon( new ImageIcon( IgCadFuncionario.class.getResource("/tsi/too/bvb/recursos/imagens/User-48.png"))); lblImg.setBounds(459, 11, 48, 48); contentPane.add(lblImg); JEditorPane dtrpnCampoTitulo = new JEditorPane(); dtrpnCampoTitulo.setBackground(nephritis); dtrpnCampoTitulo.setEditable(false); dtrpnCampoTitulo.setBounds(0, 0, 517, 70); contentPane.add(dtrpnCampoTitulo); JPanel Btnpanel = new JPanel(); Btnpanel.setBounds(0, 359, 517, 43); contentPane.add(Btnpanel); Btnpanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); btnFinalizar = new JButton("Finalizar"); btnFinalizar.addActionListener(new TEActionCadastrarFuncionario(this, funcionario)); btnFinalizar.setMnemonic(KeyEvent.VK_F); Btnpanel.add(btnFinalizar); btnLimpar = new JButton("Limpar"); btnLimpar.addActionListener(new TEActionCadastrarFuncionario(this, funcionario)); btnLimpar.setMnemonic(KeyEvent.VK_L); Btnpanel.add(btnLimpar); btnCancelar = new JButton("Cancelar"); btnCancelar.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { IgCadFuncionario.this.dispose(); } }); btnCancelar.setMnemonic(KeyEvent.VK_C); Btnpanel.add(btnCancelar); verificacaoPanel = new JPanel(); verificacaoPanel.setLayout(null); verificacaoPanel.setBorder( new TitledBorder( UIManager.getBorder("TitledBorder.border"), "N\u00E3o Verificado", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 255))); verificacaoPanel.setBounds(100, 95, 407, 58); contentPane.add(verificacaoPanel); loginTextField = new JTextField(); loginTextField.setToolTipText( "este campo \u00E9 de preenchimento obrigat\u00F3rio, deve conter no m\u00EDnimo 6 e no m\u00E1ximo 20 caracteres (letras, d\u00EDgitos e os s\u00EDmbolos underscore (_) ou ponto (.)) e deve ser \u00FAnico"); loginTextField.setColumns(10); loginTextField.setBounds(10, 20, 288, 20); verificacaoPanel.add(loginTextField); passwordField = new JPasswordField(); passwordField.setToolTipText( "este campo \u00E9 de preenchimento obrigat\u00F3rio e deve conter no m\u00EDnimo 6 e no m\u00E1ximo 10 caracteres"); passwordField.setBounds(100, 172, 308, 20); contentPane.add(passwordField); JPanel tipoUsuarioPanel = new JPanel(); tipoUsuarioPanel.setLayout(null); tipoUsuarioPanel.setBorder( new TitledBorder( UIManager.getBorder("TitledBorder.border"), "Tipo do Usu\u00E1rio", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(51, 153, 255))); tipoUsuarioPanel.setBounds(10, 235, 497, 58); contentPane.add(tipoUsuarioPanel); rdbtnAdministrador = new JRadioButton("Administrador"); rdbtnAdministrador.setToolTipText("selecione se o funcion\u00E1rio for um administrador"); buttonGroup.add(rdbtnAdministrador); rdbtnAdministrador.setSelected(true); rdbtnAdministrador.setMnemonic(KeyEvent.VK_A); rdbtnAdministrador.setBounds(10, 20, 108, 23); tipoUsuarioPanel.add(rdbtnAdministrador); rdbtnCaixa = new JRadioButton("Caixa"); rdbtnCaixa.setToolTipText("selecione se o funcion\u00E1rio for um caixa"); buttonGroup.add(rdbtnCaixa); rdbtnCaixa.setMnemonic(KeyEvent.VK_I); rdbtnCaixa.setBounds(120, 20, 58, 23); tipoUsuarioPanel.add(rdbtnCaixa); rdbtnGerente = new JRadioButton("Gerente"); rdbtnGerente.setToolTipText("selecione se o funcion\u00E1rio for um gerente"); buttonGroup.add(rdbtnGerente); rdbtnGerente.setMnemonic(KeyEvent.VK_G); rdbtnGerente.setBounds(220, 20, 72, 23); tipoUsuarioPanel.add(rdbtnGerente); JLabel lblLogin = new JLabel("Login:"******"Verificar"); btnVerificar.addActionListener(new TEActionCadastrarFuncionario(this, funcionario)); btnVerificar.setMnemonic(KeyEvent.VK_V); btnVerificar.setBounds(308, 19, 89, 23); verificacaoPanel.add(btnVerificar); lblLogin.setDisplayedMnemonic(KeyEvent.VK_O); lblLogin.setBounds(10, 115, 60, 14); contentPane.add(lblLogin); JLabel lblSenha = new JLabel("Senha:"); lblSenha.setLabelFor(passwordField); lblSenha.setDisplayedMnemonic(KeyEvent.VK_S); lblSenha.setBounds(10, 175, 60, 14); contentPane.add(lblSenha); lblCamposErrados = new JLabel("* Os campos destacados de vermelho n\u00E3o foram preenchidos corretamente!"); lblCamposErrados.setVisible(false); lblCamposErrados.setForeground(Color.RED); lblCamposErrados.setBounds(10, 323, 497, 14); contentPane.add(lblCamposErrados); JLabel lblRepetirSenha = new JLabel("Repita a Senha:"); lblRepetirSenha.setDisplayedMnemonic(KeyEvent.VK_R); lblRepetirSenha.setBounds(10, 205, 90, 14); contentPane.add(lblRepetirSenha); rPasswordField = new JPasswordField(); lblRepetirSenha.setLabelFor(rPasswordField); rPasswordField.setToolTipText( "este campo \u00E9 de preenchimento obrigat\u00F3rio e as senhas devem conferir"); rPasswordField.setBounds(100, 204, 308, 20); contentPane.add(rPasswordField); setLocationRelativeTo(janelaPai); setVisible(true); }
public RegisterPanel() { setBackground(SystemColor.window); setLayout(null); add(Regtitle); add(RegLogo1); add(UserIcon); add(lblBack); add(Register_username); add(Register_password); add(Tip); add(RegButton); Regtitle.setFont(new Font("Arial", Font.PLAIN, 40)); Regtitle.setBounds(230, 75, 280, 50); RegLogo1.setBounds(140, 60, 80, 80); UserIcon.setBounds(130, 176, 100, 100); // need PS lblBack.setForeground(Color.BLUE); lblBack.setFont(new Font("Lucida Grande", Font.PLAIN, 16)); lblBack.setBounds(470, 180, 80, 35); Register_username.setToolTipText("email address"); Register_username.setBounds(240, 180, 220, 35); Register_username.setColumns(10); Register_password.setToolTipText("password"); Register_password.setEchoChar((char) (0)); Register_password.setBounds(240, 240, 220, 35); Tip.setBounds(245, 252, 160, 20); RegButton.setBounds(240, 300, 120, 40); lblBack.addMouseListener( new MouseListener() { public void mouseClicked(MouseEvent e) { MainFrame.cl.show(MainFrame.panelCont, "Log"); Register_username.setText("email address"); Register_password.setText("password"); Register_password.setEchoChar((char) (0)); } public void mouseExited(MouseEvent e) { lblBack.setForeground(Color.BLUE); } public void mouseEntered(MouseEvent e) { lblBack.setForeground(Color.MAGENTA); } public void mouseReleased(MouseEvent e) {} public void mousePressed(MouseEvent e) {} }); class FocusHandler extends FocusAdapter { public void focusGained(FocusEvent e) { if (e.getSource() == Register_username) { if ("email address".equals(Register_username.getText())) Register_username.setText(""); } if (e.getSource() == Register_password) { if ("password".equals(Register_password.getText())) Register_password.setText(""); Register_password.setEchoChar('*'); } if (("".equals(Register_password.getText())) | ("password".equals(Register_password.getText()))) { } else { Register_password.setEchoChar('*'); } } public void focusLost(FocusEvent e) { if (e.getSource() == Register_username) { if ("".equals(Register_username.getText())) Register_username.setText("email address"); } if (e.getSource() == Register_password) { if ("".equals(Register_password.getText())) Register_password.setText("password"); Register_password.setEchoChar((char) (0)); } if (("".equals(Register_password.getText())) | ("password".equals(Register_password.getText()))) { } else { Register_password.setEchoChar('*'); } } } Register_username.addFocusListener(new FocusHandler()); Register_password.addFocusListener(new FocusHandler()); RegButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { validate = Email(Register_username.getText()); if (validate == true) { LoginPanel.operation = "create-new-account?"; LoginFunction.Test( LoginPanel.operation, Register_username.getText(), Register_password.getText()); } else { JOptionPane.showMessageDialog(null, "Not a valid email address"); } Register_username.setText("email address"); Register_password.setText("password"); Register_password.setEchoChar((char) (0)); } }); }
Usermaster() { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); x = dim.width; y = dim.height; setSize(x, y); setUndecorated(true); Container c = getContentPane(); center = new JPanel() { public void paintComponent(Graphics g) { Toolkit kit = Toolkit.getDefaultToolkit(); Image img = kit.getImage("Image/user.jpg"); MediaTracker t = new MediaTracker(this); t.addImage(img, 0); while (true) { try { t.waitForAll(); break; } catch (Exception ee) { } } g.drawImage(img, 0, 0, x, y, null); } }; c.add(center); center.setLayout(null); titleLb = new JLabel( "<html><body ><font size='5'><b><i> User Name </b></i></font></body></html>"); titleLb.setForeground(new Color(10, 110, 255)); titleLb.setBounds(x / 2 + 50, x / 4, 150, 50); center.add(titleLb); output = new JLabel( "<html><body ><font size='5'><b><i> OUTPUT </b></i></font></body></html>"); output.setForeground(Color.white); output.setBounds(x / 2 - 250, x / 6, 150, 50); center.add(output); login = new JButton(new ImageIcon("Image/logBut.gif")); login.setBorder(BorderFactory.createRaisedBevelBorder()); login.setBounds(x / 2 + 100, x / 2 - 70, 100, 100); login.setBackground(Color.white); pass = new JPasswordField(); pass.setToolTipText("Enter The Password To Payroll System"); login.requestFocus(); pass.setBorder(BorderFactory.createRaisedBevelBorder()); pass.setForeground(new Color(10, 110, 255)); pass.setFont(new Font("Arial", Font.BOLD, 22)); pass.setCaretColor(Color.red); pass.setBounds(x / 2 + 50, x / 3, 200, 35); center.add(pass); center.add(login); pass.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { output.setText( "<html><body ><font size='5'><b><i> OUTPUT </b></i></font></body></html>"); output.setForeground(Color.white); } }); try { clsConnection connect = new clsConnection(); conn = connect.setConnection(conn, "", ""); } catch (Exception e) { } login.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { st = conn.createStatement(); rs = st.executeQuery("select * from img"); while (rs.next()) { if (pass.getText().equals(rs.getString(3))) { setVisible(false); URL url = closeSystem.class.getResource("spacemusic.au"); click = Applet.newAudioClip(url); click.play(); paro.setVisible(true); } else { pass.setText(""); pass.requestFocus(); output.setText("Fell"); output.setFont(new Font("Arial", Font.BOLD, 36)); output.setForeground(Color.red); } } } catch (Exception er) { System.out.println("Sorry\n" + er); } } }); }
public BugZillaAssistant( ProgressThread thread, final Throwable exception, final XmlRpcClient client) throws XmlRpcException { super("send_bugreport", true, new Object[] {}); rpcClient = client; thread.getProgressListener().setCompleted(35); if (thread.isCancelled()) { return; } // gather information to fill out combo boxes Object[] compVals, severityVals, platformVals, osVals; // components Map<String, String> valQueryMap = new HashMap<String, String>(); valQueryMap.put("field", "component"); valQueryMap.put("product_id", "2"); Map resultMap = (Map) rpcClient.execute("Bug.legal_values", new Object[] {valQueryMap}); compVals = (Object[]) resultMap.get("values"); thread.getProgressListener().setCompleted(50); if (thread.isCancelled()) { return; } // severity valQueryMap = new HashMap<String, String>(); valQueryMap.put("field", "severity"); valQueryMap.put("product_id", "2"); resultMap = (Map) rpcClient.execute("Bug.legal_values", new Object[] {valQueryMap}); severityVals = (Object[]) resultMap.get("values"); thread.getProgressListener().setCompleted(65); if (thread.isCancelled()) { return; } // platform valQueryMap = new HashMap<String, String>(); valQueryMap.put("field", "platform"); valQueryMap.put("product_id", "2"); resultMap = (Map) rpcClient.execute("Bug.legal_values", new Object[] {valQueryMap}); platformVals = (Object[]) resultMap.get("values"); thread.getProgressListener().setCompleted(80); if (thread.isCancelled()) { return; } // operating system valQueryMap = new HashMap<String, String>(); valQueryMap.put("field", "op_sys"); valQueryMap.put("product_id", "2"); resultMap = (Map) rpcClient.execute("Bug.legal_values", new Object[] {valQueryMap}); osVals = (Object[]) resultMap.get("values"); thread.getProgressListener().setCompleted(95); if (thread.isCancelled()) { return; } Collection<AbstractButton> buttons = new LinkedList<AbstractButton>(); final JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); final JPanel loginPanel = new JPanel(); loginPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0; gbc.weighty = 0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(GAP, 0, 0, GAP); JLabel loginLabel = new JLabel(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".login_e_mail.label")); loginPanel.add(loginLabel, gbc); final JTextField loginName = new JTextField(15); loginName.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".login_e_mail.tip")); gbc.gridx = 1; gbc.weightx = 1; loginPanel.add(loginName, gbc); JLabel passwordLabel = new JLabel(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".login_password.label")); gbc.gridx = 0; gbc.gridy = 1; gbc.weightx = 0; loginPanel.add(passwordLabel, gbc); final JPasswordField loginPassword = new JPasswordField(15); loginPassword.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), getKey() + ".login_password.tip")); gbc.gridx = 1; gbc.weightx = 1; loginPanel.add(loginPassword, gbc); final JCheckBox useAnonymousLogin = new JCheckBox(); useAnonymousLogin.setText( I18N.getMessage(I18N.getGUIBundle(), getKey() + ".login_as_anonymous.label")); useAnonymousLogin.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), getKey() + ".login_as_anonymous.tip")); useAnonymousLogin.setSelected(false); useAnonymousLogin.setAlignmentX(Component.LEFT_ALIGNMENT); useAnonymousLogin.setMinimumSize(useAnonymousLogin.getPreferredSize()); useAnonymousLogin.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { loginName.setEditable(false); loginPassword.setEditable(false); } else { loginName.setEditable(true); loginPassword.setEditable(true); } } }); gbc.gridx = 0; gbc.gridy = 2; gbc.weightx = 0; loginPanel.add(useAnonymousLogin, gbc); gbc.gridwidth = 2; gbc.weightx = 1; gbc.gridy = 3; gbc.insets = new Insets(GAP * 2, 0, GAP, 0); loginPanel.add(new JSeparator(), gbc); panel.add(loginPanel); final JPanel detailPanel = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(GAP, 0, 0, GAP); c.gridx = 0; c.gridy = 0; c.weightx = 0; c.anchor = GridBagConstraints.WEST; c.weighty = 0; detailPanel.add( new JLabel(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".component.label") + ":"), c); c.gridx = 1; c.gridy = 0; final JComboBox compBox = new JComboBox(compVals); compBox.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".component.tip")); compBox.setSelectedItem("Vega: Processes, data flow and meta data"); detailPanel.add(compBox, c); c.gridx = 2; c.gridy = 0; detailPanel.add( new JLabel(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".severity.label") + ":"), c); c.gridx = 3; c.gridy = 0; final JComboBox severityBox = new JComboBox(severityVals); severityBox.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".severity.tip")); severityBox.setSelectedItem("normal"); detailPanel.add(severityBox, c); c.gridx = 0; c.gridy = 1; detailPanel.add( new JLabel(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".platform.label") + ":"), c); c.gridx = 1; c.gridy = 1; final JComboBox platformBox = new JComboBox(platformVals); platformBox.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".platform.tip")); detailPanel.add(platformBox, c); c.gridx = 2; c.gridy = 1; detailPanel.add( new JLabel(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".os.label") + ":"), c); c.gridx = 3; c.gridy = 1; final JComboBox osBox = new JComboBox(osVals); osBox.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".os.tip")); String os = System.getProperty("os.name"); if (os.toLowerCase(Locale.ENGLISH).contains("windows")) { osBox.setSelectedItem("Windows"); platformBox.setSelectedItem("PC"); } else if (os.toLowerCase(Locale.ENGLISH).contains("linux")) { osBox.setSelectedItem("Linux"); platformBox.setSelectedItem("PC"); } else if (os.toLowerCase(Locale.ENGLISH).contains("mac")) { osBox.setSelectedItem("Mac OS"); platformBox.setSelectedItem("Macintosh"); } else { osBox.setSelectedItem("Other"); platformBox.setSelectedItem("Other"); } detailPanel.add(osBox, c); c.gridx = 4; c.gridy = 0; c.weightx = 1; detailPanel.add(new JLabel(), c); c.gridy = 1; detailPanel.add(new JLabel(), c); c.gridwidth = 5; c.gridx = 0; c.gridy = 2; c.fill = GridBagConstraints.BOTH; c.insets = new Insets(GAP * 2, 0, GAP, 0); detailPanel.add(new JSeparator(), c); panel.add(detailPanel); final JPanel mailPanel = new JPanel(new GridBagLayout()); c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.insets = new Insets(GAP, 0, 0, GAP); c.weighty = 0; c.weightx = 0; c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.HORIZONTAL; final JCheckBox addProcessCheckBox = new JCheckBox(); addProcessCheckBox.setText( I18N.getMessage(I18N.getGUIBundle(), getKey() + ".add_process_xml.label")); addProcessCheckBox.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), getKey() + ".add_process_xml.tip")); addProcessCheckBox.setSelected(true); addProcessCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); addProcessCheckBox.setMinimumSize(addProcessCheckBox.getPreferredSize()); mailPanel.add(addProcessCheckBox, c); c.gridx = 1; final JCheckBox addSysPropsCheckBox = new JCheckBox(); addSysPropsCheckBox.setText( I18N.getMessage(I18N.getGUIBundle(), getKey() + ".add_system_props.label")); addSysPropsCheckBox.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), getKey() + ".add_system_props.tip")); addSysPropsCheckBox.setSelected(true); addSysPropsCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); addSysPropsCheckBox.setMinimumSize(addSysPropsCheckBox.getPreferredSize()); mailPanel.add(addSysPropsCheckBox, c); c.gridx = 2; c.weightx = 0.75; mailPanel.add(new JLabel(), c); c.gridwidth = 3; c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 1; mailPanel.add( new JLabel(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".summary.label") + ":"), c); final JTextField summaryField = new JTextField(15); summaryField.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".summary.tip")); c.gridy = 2; mailPanel.add(summaryField, c); c.gridy = 3; mailPanel.add( new JLabel(I18N.getMessage(I18N.getGUIBundle(), getKey() + ".description.label") + ":"), c); descriptionField.setLineWrap(true); descriptionField.setWrapStyleWord(true); descriptionField.addFocusListener( new FocusAdapter() { @Override public void focusGained(FocusEvent e) { if (descriptionField.getText().equals(descriptionText)) { descriptionField.setText(""); descriptionField.removeFocusListener(this); } } }); descriptionField.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), getKey() + ".description.tip")); JScrollPane descriptionPane = new ExtendedJScrollPane(descriptionField); descriptionPane.setBorder(createBorder()); descriptionPane.setPreferredSize(new Dimension(400, 400)); c.gridy = 4; c.weighty = 1; mailPanel.add(descriptionPane, c); c.insets = new Insets(GAP, 0, 0, 0); c.gridx = 3; c.gridy = 0; c.gridheight = 5; c.weightx = 0.25; c.weighty = 1; attachments.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane attachmentPane = new JScrollPane(attachments); attachmentPane.setBorder(createBorder()); attachmentPane.setPreferredSize(new Dimension(150, 400)); mailPanel.add(attachmentPane, c); panel.add(mailPanel); buttons.add( new JButton( new ResourceAction("send_bugreport.add_file") { private static final long serialVersionUID = 5152169309271935854L; @Override public void actionPerformed(ActionEvent e) { File file = SwingTools.chooseFile(null, null, true, null, null); if (file != null) { ((DefaultListModel) attachments.getModel()).addElement(file); } } })); buttons.add( new JButton( new ResourceAction("send_bugreport.remove_file") { private static final long serialVersionUID = 5353693430346577972L; public void actionPerformed(ActionEvent e) { if (attachments.getSelectedIndex() >= 0) { ((DefaultListModel) attachments.getModel()) .remove(attachments.getSelectedIndex()); } } })); JButton infoButton = new JButton( new ResourceAction("send_bugreport.info") { private static final long serialVersionUID = 2135052418891516027L; @Override public void actionPerformed(ActionEvent e) { BugReportViewerDialog dialog = new BugReportViewerDialog(); dialog.setInfoText( BugReport.createCompleteBugDescription( descriptionField.getText().trim(), exception, addProcessCheckBox.isSelected(), addSysPropsCheckBox.isSelected())); dialog.setVisible(true); } }); buttons.add(infoButton); submitButton = new JButton( new ResourceAction("send_bugreport.submit") { private static final long serialVersionUID = -4559762951458936715L; @Override public void actionPerformed(ActionEvent e) { // check fields email = loginName.getText().trim(); pawo = loginPassword.getPassword(); String summary = summaryField.getText().trim(); String description = descriptionField.getText().trim(); final String version = RapidMiner.getShortVersion(); if (!useAnonymousLogin.isSelected()) { if (email.length() <= 0) { SwingTools.showVerySimpleErrorMessage("enter_email"); return; } if (!email.matches("(.+?)@(.+?)[.](.+?)")) { SwingTools.showVerySimpleErrorMessage("enter_correct_email"); return; } boolean noPW = true; for (char c : pawo) { if (c != ' ') { noPW = false; break; } } if (noPW) { SwingTools.showVerySimpleErrorMessage("enter_password"); return; } } else { email = "*****@*****.**"; pawo = new char[] { '!', 'z', '4', '8', '#', 'H', 'c', '2', '$', '%', 'm', ')', '9', '+', '*', '*' }; } if (summary.length() <= 0) { SwingTools.showVerySimpleErrorMessage("enter_summary"); return; } // more than a single word for a descriptive summary required! String[] splitResult = summary.trim().split("\\s"); if (splitResult.length < 2) { SwingTools.showVerySimpleErrorMessage("enter_descriptive_summary"); return; } if (description.length() <= 0 || description.equals(descriptionText)) { SwingTools.showVerySimpleErrorMessage("enter_description"); return; } // all checks passed, bug report would be created right now, however we want the // user // to check his browser for similar/duplicate bugs by opening the bugzilla search // page with // given parameters try { if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.BROWSE)) { String bugzillaSearchString = "http://bugs.rapid-i.com/buglist.cgi?field0-0-0=attach_data.thedata&type0-0-1=allwordssubstr&field0-0-1=longdesc&query_format=advanced&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&value0-0-1=" + exception.getMessage() + "&type0-0-0=allwordssubstr&value0-0-0=" + exception.getMessage(); URL bugzillaURL = new URL(bugzillaSearchString); URI bugzillaURI = new URI( bugzillaURL.getProtocol(), bugzillaURL.getHost(), bugzillaURL.getPath(), bugzillaURL.getQuery(), null); desktop.browse(bugzillaURI); int returnVal = SwingTools.showConfirmDialog( "send_bugreport.check_browser_for_duplicates", ConfirmDialog.YES_NO_OPTION); // user clicked no, don't submit if (returnVal == ConfirmDialog.NO_OPTION) { return; } } } } catch (URISyntaxException e1) { // should not occur (famous last comment) } catch (IOException e1) { // we can't change it, so ignore it } // create bugreport in own progess thread (cancel not allowed) submitButton.setEnabled(false); new ProgressThread("send_report_to_bugzilla", false) { @Override public void run() { try { getProgressListener().setTotal(100); ListModel model = attachments.getModel(); File[] attachments = new File[model.getSize()]; for (int i = 0; i < attachments.length; i++) { attachments[i] = (File) model.getElementAt(i); } getProgressListener().setCompleted(20); XmlRpcClient client = XmlRpcHandler.login(XmlRpcHandler.BUGZILLA_URL, email, pawo); getProgressListener().setCompleted(40); BugReport.createBugZillaReport( client, exception, summaryField.getText().trim(), descriptionField.getText().trim(), String.valueOf(compBox.getSelectedItem()), version, String.valueOf(severityBox.getSelectedItem()), String.valueOf(platformBox.getSelectedItem()), String.valueOf(osBox.getSelectedItem()), RapidMinerGUI.getMainFrame().getProcess(), RapidMinerGUI.getMainFrame().getMessageViewer().getLogMessage(), attachments, addProcessCheckBox.isSelected(), addSysPropsCheckBox.isSelected()); getProgressListener().setCompleted(100); SwingTools.showMessageDialog("bugreport_successful"); dispose(); } catch (XmlRpcException e1) { SwingTools.showVerySimpleErrorMessage( "bugreport_xmlrpc_error", e1.getLocalizedMessage()); } catch (Exception e2) { LogService.getRoot().warning(e2.getLocalizedMessage()); SwingTools.showVerySimpleErrorMessage("bugreport_creation_failed"); } finally { getProgressListener().complete(); for (int i = 0; i < pawo.length; i++) { pawo[i] = 0; } submitButton.setEnabled(true); } } }.start(); } }); buttons.add(submitButton); buttons.add(makeCancelButton()); layoutDefault(panel, LARGE, buttons); }
public PaymentDialog(int amount) { super(Main.frame, true); setTitle(tr("Payment")); JPanel center = new JPanel(); center.setLayout(new MigLayout()); JLabel amountLabel = new JLabel(tr("Amount") + ": " + amount + " \u20ac"); amountLabel.setFont(new Font("default", Font.BOLD, 14)); center.add(amountLabel, "spanx, alignx center, wrap"); JLabel numLabel = new JLabel(tr("Card number") + ":"); num = new JTextField(20); numLabel.setDisplayedMnemonic('n'); numLabel.setLabelFor(num); center.add(numLabel); center.add(num, "spanx, wrap"); JLabel dateLabel = new JLabel(tr("Expiry date") + ":"); date = new JTextField(8); numLabel.setDisplayedMnemonic('d'); date.setToolTipText(tr("Use mm/yy format")); numLabel.setLabelFor(date); center.add(dateLabel); center.add(date); JLabel codeLabel = new JLabel(tr("CVC") + ":"); code = new JPasswordField(3); code.setToolTipText(tr("3 digit code in the back of the card")); numLabel.setDisplayedMnemonic('c'); numLabel.setLabelFor(code); center.add(codeLabel); center.add(code, "wrap"); JLabel nameLabel = new JLabel(tr("Full name") + ":"); name = new JTextField(20); numLabel.setDisplayedMnemonic('n'); numLabel.setLabelFor(name); center.add(nameLabel); center.add(name, "spanx, wrap"); JPanel btnPanel = new JPanel(); btnPanel.setLayout(new MigLayout()); btnPanel.add(new JPanel(), "pushx"); JButton pay = new JButton(tr("Pay")); pay.setMnemonic('p'); pay.setToolTipText(tr("Authorize the payment")); pay.addActionListener(new PayAction()); btnPanel.add(pay); JButton cancel = new JButton(tr("Cancel")); cancel.setToolTipText(tr("Cancel the payment")); cancel.setMnemonic('c'); cancel.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); btnPanel.add(cancel); add(center, BorderLayout.CENTER); add(btnPanel, BorderLayout.SOUTH); setResizable(false); pack(); setLocationRelativeTo(Main.frame); getRootPane().setDefaultButton(null); }
public LoginPanel(final Controller controller) { super(controller); setLayout(null); Font font = new Font("Tahoma", Font.PLAIN, 28); Font font2 = new Font("Tahoma", Font.PLAIN, 16); // Welcome Label JLabel welcomeLabel = new JLabel("Herzlich Willkommen bei ShareBoxUltimate"); welcomeLabel.setFont(font); welcomeLabel.setBounds(42, 11, 620, 91); add(welcomeLabel); // label statement - what the user have to do JLabel loginLabel = new JLabel("Bitte loggen Sie sich ein:"); loginLabel.setBounds(212, 108, 298, 67); loginLabel.setFont(font2); add(loginLabel); // label statement for registration JLabel lblNochKeinLogin = new JLabel("Noch kein Login? Dann melden Sie sich jetzt an:"); lblNochKeinLogin.setBounds(134, 446, 376, 34); lblNochKeinLogin.setFont(font2); add(lblNochKeinLogin); // text field userName final JTextField loginNameField = new JTextField("username"); loginNameField.addFocusListener( new FocusAdapter() { @Override // is clearing the field for Users Input public void focusGained(FocusEvent arg0) { loginNameField.setText(""); } }); // create the statement to put in user name loginNameField.setToolTipText("Bitte geben Sie hier ihren Benutzernamen ein"); loginNameField.setBounds(190, 204, 110, 50); add(loginNameField); loginNameField.setFont(font2); // label text is only shown if login data is invalid final JLabel loginFailedLabel = new JLabel(""); loginFailedLabel.setBounds(239, 157, 300, 50); loginFailedLabel.setFont(font2); loginFailedLabel.setForeground(Color.red); add(loginFailedLabel); // text field password final JPasswordField loginPasswordField = new JPasswordField("password"); loginPasswordField.addFocusListener( new FocusAdapter() { @Override // is clearing the field for Users Input public void focusGained(FocusEvent arg0) { loginPasswordField.setText(""); } }); // button login and actionHandling JButton loginButton = new JButton("Login"); loginButton.setToolTipText("Hier klicken zum Einloggen"); loginButton.setBounds(236, 282, 130, 72); add(loginButton); loginButton.setFont(font2); // button is shown after bad login final JButton forgottenLogin = new JButton(""); forgottenLogin.setForeground(Color.RED); forgottenLogin.setFont(font2); forgottenLogin.setContentAreaFilled(false); forgottenLogin.setBounds(190, 375, 220, 51); forgottenLogin.setToolTipText( "Bitte klicken Sie hier, um ihren Benutzernamen und Passwort zu erfahren"); // create the statement to put in password loginPasswordField.setToolTipText("Bitte geben Sie hier ihr Passwort ein"); loginPasswordField.addKeyListener( new KeyAdapter() { @Override // login with pressing enter key after password public void keyReleased(KeyEvent evnt) { if (evnt.getKeyCode() == KeyEvent.VK_ENTER) { String name = loginNameField.getText(); // string constructor - creates string from charArray String password = new String(loginPasswordField.getPassword()); User user = controller.login(name, password); if (user != null) { login(user); } else { // show error message loginFailedLabel.setText("Falsche Login-Daten"); add(forgottenLogin); forgottenLogin.setVisible(true); forgottenLogin.setText("Benutzerdaten vergessen?"); /** When login failed view change to forgottenLoginPanel */ final ActionListener forgottenLoginClickedActionListener = new ActionListener() { @Override public void actionPerformed(final ActionEvent evntg) { changePanel(new ForgottenLoginPanel(controller)); } }; forgottenLogin.addActionListener(forgottenLoginClickedActionListener); add(forgottenLogin); } } } }); // create password field loginPasswordField.setPreferredSize(new Dimension(53, 20)); loginPasswordField.setBounds(316, 206, 128, 50); add(loginPasswordField); loginPasswordField.setFont(font2); // button register JButton registerButton = new JButton("Registrieren"); registerButton.setToolTipText("Hier klicken, um sich zu registrieren"); registerButton.setBounds(156, 508, 322, 50); // action-handling register button ActionListener registerButtonClickedActionListener = new ActionListener() { @Override // change the view when user push the register button public void actionPerformed(ActionEvent fevent) { changePanel(new RegisterPanel(controller)); } }; /** Error display is shown, when login button is clicked and user could not found. */ registerButton.addActionListener(registerButtonClickedActionListener); add(registerButton); ActionListener loginButtonClickedActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent eevent) { String name = loginNameField.getText(); // string constructor - creates a string out of an a charArray String password = new String(loginPasswordField.getPassword()); User user = controller.login(name, password); if (user != null) { login(user); } else { // show error message loginFailedLabel.setText("Falsche Login-Daten"); add(forgottenLogin); forgottenLogin.setVisible(true); forgottenLogin.setText("Benutzerdaten vergessen?"); final ActionListener forgottenLoginClickedActionListener = new ActionListener() { @Override // change the view when user push the register button public void actionPerformed(final ActionEvent evntg) { changePanel(new ForgottenLoginPanel(controller)); } }; forgottenLogin.addActionListener(forgottenLoginClickedActionListener); add(forgottenLogin); } } }; loginButton.addActionListener(loginButtonClickedActionListener); }