⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 projectmanagementtab.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.weighty = 1.0;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        repositoryPanel.add(repositoryTextArea, gridBagConstraints);        midWarning.setText("When changing the repository location, restart the dialog to see users.");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 5;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        repositoryPanel.add(midWarning, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 0;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.weighty = 0.25;        projectManagement.add(repositoryPanel, gridBagConstraints);        usersPanelMidSecurity.setLayout(new java.awt.GridBagLayout());        currentUserLabel.setText("Logged-in user:");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 0;        gridBagConstraints.gridwidth = 2;        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        usersPanelMidSecurity.add(currentUserLabel, gridBagConstraints);        userListPane.setPreferredSize(new java.awt.Dimension(100, 150));        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 2;        gridBagConstraints.gridheight = 4;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.weighty = 1.0;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        usersPanelMidSecurity.add(userListPane, gridBagConstraints);        jLabel5.setText("Users:");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 1;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        usersPanelMidSecurity.add(jLabel5, gridBagConstraints);        jPanel1.setLayout(new java.awt.GridBagLayout());        jPanel1.setBorder(new javax.swing.border.TitledBorder("Administration"));        deleteButton.setText("Delete User");        deleteButton.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                deleteButtonActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        jPanel1.add(deleteButton, gridBagConstraints);        addButton.setText("Add User...");        addButton.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                addButtonActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 1;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        jPanel1.add(addButton, gridBagConstraints);        authorizeButton.setText("Authorize...");        authorizeButton.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                authorizeButtonActionPerformed(evt);            }        });        jPanel1.add(authorizeButton, new java.awt.GridBagConstraints());        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 1;        gridBagConstraints.gridy = 5;        usersPanelMidSecurity.add(jPanel1, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 1;        gridBagConstraints.gridy = 4;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        usersPanelMidSecurity.add(jSeparator1, gridBagConstraints);        loginButton.setText("Login");        loginButton.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                loginButtonActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 1;        gridBagConstraints.gridy = 2;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        usersPanelMidSecurity.add(loginButton, gridBagConstraints);        passwordButton.setText("Change Password");        passwordButton.addActionListener(new java.awt.event.ActionListener()        {            public void actionPerformed(java.awt.event.ActionEvent evt)            {                passwordButtonActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 1;        gridBagConstraints.gridy = 3;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        usersPanelMidSecurity.add(passwordButton, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 1;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.weighty = 0.75;        projectManagement.add(usersPanelMidSecurity, gridBagConstraints);        usersPanelLowSecurity.setLayout(new java.awt.GridBagLayout());        jLabel3.setText("User Name:");        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 0;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        usersPanelLowSecurity.add(jLabel3, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 1;        gridBagConstraints.gridy = 0;        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        usersPanelLowSecurity.add(userName, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 2;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        projectManagement.add(usersPanelLowSecurity, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 2;        getContentPane().add(projectManagement, gridBagConstraints);        pack();    }    // </editor-fold>//GEN-END:initComponents	private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_deleteButtonActionPerformed	{//GEN-HEADEREND:event_deleteButtonActionPerformed		if (!authorized)		{			JOptionPane.showMessageDialog(this, "You must be authorized to delete users.  Click the 'Authorize' button.", "Not Authorized", JOptionPane.ERROR_MESSAGE);			return;		}		int index = userList.getSelectedIndex();		if (index < 0)		{			JOptionPane.showMessageDialog(this, "Select a user before clicking 'delete'", "Nothing Selected", JOptionPane.ERROR_MESSAGE);			return;		}		String user = (String)userModel.getElementAt(index);		// get password		PasswordDialog pwd = new PasswordDialog(PasswordDialog.DELETEUSER, user);		if (pwd.cancelled()) return;		// delete the user and redisplay		Users.deleteUser(user);		reloadUsers();	}//GEN-LAST:event_deleteButtonActionPerformed	private void authorizeButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_authorizeButtonActionPerformed	{//GEN-HEADEREND:event_authorizeButtonActionPerformed		if (authorized)		{			// already authorized, change auth password			PasswordDialog pwd = new PasswordDialog(PasswordDialog.RENAMEAUTHPASS, null);			if (pwd.cancelled()) return;			// make the change			String pass = pwd.getPassword();			Project.setAuthorizationPassword(pass);		} else		{			// not authorized: do it			PasswordDialog pwd = new PasswordDialog(PasswordDialog.AUTHORIZE, null);			if (pwd.cancelled()) return;			// allow authorized actions			authorized = true;			// change button names			deleteButton.setEnabled(true);			addButton.setEnabled(true);			authorizeButton.setText("Change Authorization...");		}	}//GEN-LAST:event_authorizeButtonActionPerformed	private void browseButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_browseButtonActionPerformed	{//GEN-HEADEREND:event_browseButtonActionPerformed		String fileName = OpenFile.chooseDirectory(null);		if (fileName == null) return;		repositoryTextArea.setText(fileName);	}//GEN-LAST:event_browseButtonActionPerformed	private void addButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_addButtonActionPerformed	{//GEN-HEADEREND:event_addButtonActionPerformed		if (!authorized)		{			JOptionPane.showMessageDialog(this, "You must be authorized to add users.  Click the 'Authorize' button.", "Not Authorized", JOptionPane.ERROR_MESSAGE);			return;		}		// prompt for name and password		PasswordDialog pwd = new PasswordDialog(PasswordDialog.NEWUSER, null);		if (pwd.cancelled()) return;		// create the user and redisplay		String userName = pwd.getUserName();		String encryptedPassword = Users.encryptPassword(pwd.getPassword());		Users.addUser(userName, encryptedPassword);		reloadUsers();	}//GEN-LAST:event_addButtonActionPerformed	private void passwordButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_passwordButtonActionPerformed	{//GEN-HEADEREND:event_passwordButtonActionPerformed		// find out the user to delete		int index = userList.getSelectedIndex();		if (index < 0)		{			JOptionPane.showMessageDialog(this, "Select a user before changing their password", "Nothing Selected", JOptionPane.ERROR_MESSAGE);			return;		}		String userName = (String)userModel.getElementAt(index);			// prompt to change password (includes validation)		PasswordDialog pwd = new PasswordDialog(PasswordDialog.CHANGEPASSWORD, userName);		if (pwd.cancelled()) return;		// make the change		String encryptedPassword = Users.encryptPassword(pwd.getPassword());		Users.changeEncryptedPassword(userName, encryptedPassword);	}//GEN-LAST:event_passwordButtonActionPerformed	private void loginButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_loginButtonActionPerformed	{//GEN-HEADEREND:event_loginButtonActionPerformed		// find out the user to login		int index = userList.getSelectedIndex();		if (index < 0)		{			JOptionPane.showMessageDialog(this, "Select a user before clicking 'login'", "Nothing Selected", JOptionPane.ERROR_MESSAGE);			return;		}		String userName = (String)userModel.getElementAt(index);		// get the password and validate it		PasswordDialog pwd = new PasswordDialog(PasswordDialog.LOGINUSER, userName);		if (pwd.cancelled()) return;		// save this user as the one logged-in		Project.setCurrentUserName(userName);		currentUserLabel.setText("Logged-in user: " + userName);	}//GEN-LAST:event_loginButtonActionPerformed	/** Closes the dialog */	private void closeDialog(java.awt.event.WindowEvent evt)//GEN-FIRST:event_closeDialog	{		setVisible(false);		dispose();	}//GEN-LAST:event_closeDialog    // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JButton addButton;    private javax.swing.JButton authorizeButton;    private javax.swing.JButton browseButton;    private javax.swing.JLabel currentUserLabel;    private javax.swing.JButton deleteButton;    private javax.swing.JLabel jLabel1;    private javax.swing.JLabel jLabel3;    private javax.swing.JLabel jLabel4;    private javax.swing.JLabel jLabel5;    private javax.swing.JLabel jLabel6;    private javax.swing.JLabel jLabel7;    private javax.swing.JPanel jPanel1;    private javax.swing.JSeparator jSeparator1;    private javax.swing.JButton loginButton;    private javax.swing.JLabel midWarning;    private javax.swing.JButton passwordButton;    private javax.swing.JPanel projectManagement;    private javax.swing.JPanel repositoryPanel;    private javax.swing.JTextArea repositoryTextArea;    private javax.swing.JScrollPane userListPane;    private javax.swing.JTextField userName;    private javax.swing.JPanel usersPanelLowSecurity;    private javax.swing.JPanel usersPanelMidSecurity;    // End of variables declaration//GEN-END:variables}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -