📄 publishargsdialog.java
字号:
/* * PublishArgsDialog.java * * Created on 2005年3月12日, 下午4:38 */package com.sinpool.rivercrescent.GUI;import com.sinpool.rivercrescent.interfaces.*;/** * * @author sinpool */public class PublishArgsDialog extends javax.swing.JDialog { /** A return status code - returned if Cancel button has been pressed */ public static final int RET_CANCEL = 0; /** A return status code - returned if OK button has been pressed */ public static final int RET_OK = 1; private com.sinpool.rivercrescent.myutil.RSConfigure rsc = null; /** Creates new form PublishArgsDialog */ public PublishArgsDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); buttonGroup1.add(this.singleRadioButton); buttonGroup1.add(this.multipleRadioButton); rsc = com.sinpool.rivercrescent.myutil.RSConfigure.readFromDisk(); this.thisNiceName = rsc.getDefaultPeerName(); this.nicenameTextField.setText(this.thisNiceName); } /** @return the return status of this dialog - one of RET_OK or RET_CANCEL */ public int getReturnStatus() { return returnStatus; } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; buttonGroup1 = new javax.swing.ButtonGroup(); jPanel3 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); groupNameTextField = new javax.swing.JTextField(); nicenameTextField = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); miaoshuTextArea = new javax.swing.JTextArea(); jSeparator1 = new javax.swing.JSeparator(); jLabel6 = new javax.swing.JLabel(); lengthComboBox = new javax.swing.JComboBox(); jSeparator2 = new javax.swing.JSeparator(); jPanel1 = new javax.swing.JPanel(); singleRadioButton = new javax.swing.JRadioButton(); multipleRadioButton = new javax.swing.JRadioButton(); jSeparator3 = new javax.swing.JSeparator(); jPanel2 = new javax.swing.JPanel(); okButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); getContentPane().setLayout(new java.awt.GridBagLayout()); setTitle("\u5171\u4eab\u6587\u4ef6\u5411\u5bfc"); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); jPanel3.setLayout(null); jLabel4.setFont(new java.awt.Font("宋体", 0, 14)); jLabel4.setText("(\u5fc5\u586b\u9879)"); jPanel3.add(jLabel4); jLabel4.setBounds(160, 140, 100, 20); jLabel3.setFont(new java.awt.Font("宋体", 0, 14)); jLabel3.setText("(\u9ed8\u8ba4\u9879)"); jPanel3.add(jLabel3); jLabel3.setBounds(160, 110, 100, 20); groupNameTextField.setFont(new java.awt.Font("宋体", 0, 12)); jPanel3.add(groupNameTextField); groupNameTextField.setBounds(50, 140, 100, 21); nicenameTextField.setFont(new java.awt.Font("宋体", 0, 12)); nicenameTextField.setEnabled(false); jPanel3.add(nicenameTextField); nicenameTextField.setBounds(50, 110, 100, 21); jLabel2.setFont(new java.awt.Font("宋体", 0, 14)); jLabel2.setText("\u7ec4\u540d"); jPanel3.add(jLabel2); jLabel2.setBounds(20, 140, 40, 20); jLabel1.setFont(new java.awt.Font("宋体", 0, 14)); jLabel1.setText("\u6635\u79f0"); jPanel3.add(jLabel1); jLabel1.setBounds(20, 110, 30, 20); jLabel5.setFont(new java.awt.Font("宋体", 0, 14)); jLabel5.setText("\u63cf\u8ff0"); jPanel3.add(jLabel5); jLabel5.setBounds(20, 170, 28, 16); miaoshuTextArea.setFont(new java.awt.Font("宋体", 0, 12)); jScrollPane1.setViewportView(miaoshuTextArea); jPanel3.add(jScrollPane1); jScrollPane1.setBounds(50, 170, 190, 120); jSeparator1.setPreferredSize(new java.awt.Dimension(50, 10)); jPanel3.add(jSeparator1); jSeparator1.setBounds(0, 340, 250, 10); jLabel6.setFont(new java.awt.Font("宋体", 0, 14)); jLabel6.setText("\u6587\u4ef6\u5757\u5927\u5c0f"); jPanel3.add(jLabel6); jLabel6.setBounds(20, 300, 80, 30); lengthComboBox.setFont(new java.awt.Font("宋体", 0, 12)); lengthComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "自动设置", "32K", "64K", "128K", "256K", "512K", "1024K" })); jPanel3.add(lengthComboBox); lengthComboBox.setBounds(110, 300, 130, 21); jPanel3.add(jSeparator2); jSeparator2.setBounds(0, 100, 250, 10); jPanel1.setBorder(new javax.swing.border.TitledBorder(null, "\u5171\u4eab\u7c7b\u578b", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("宋体", 0, 14), java.awt.Color.blue)); singleRadioButton.setFont(new java.awt.Font("宋体", 0, 14)); singleRadioButton.setSelected(true); singleRadioButton.setText("\u5171\u4eab\u5355\u6587\u4ef6"); jPanel1.add(singleRadioButton); multipleRadioButton.setFont(new java.awt.Font("宋体", 0, 14)); multipleRadioButton.setText("\u5171\u4eab\u591a\u6587\u4ef6"); jPanel1.add(multipleRadioButton); jPanel3.add(jPanel1); jPanel1.setBounds(40, 10, 170, 90); jSeparator3.setPreferredSize(new java.awt.Dimension(50, 10)); jPanel3.add(jSeparator3); jSeparator3.setBounds(0, 0, 250, 10); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 3; gridBagConstraints.ipadx = 249; gridBagConstraints.ipady = 349; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(jPanel3, gridBagConstraints); jPanel2.setLayout(null); okButton.setText("OK"); okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); jPanel2.add(okButton); okButton.setBounds(30, 0, 49, 25); cancelButton.setText("Cancel"); cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); jPanel2.add(cancelButton); cancelButton.setBounds(120, 0, 67, 25); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.ipadx = 229; gridBagConstraints.ipady = 29; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(jPanel2, gridBagConstraints); pack(); }//GEN-END:initComponents private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed thisGroupName = groupNameTextField.getText(); thisGroupMiaoShu = miaoshuTextArea.getText(); thisNiceName = nicenameTextField.getText(); if ( !this.singleRadioButton.isSelected() ) this.single = false; doClose(RET_OK); }//GEN-LAST:event_okButtonActionPerformed private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed doClose(RET_CANCEL); }//GEN-LAST:event_cancelButtonActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog doClose(RET_CANCEL); }//GEN-LAST:event_closeDialog private void doClose(int retStatus) { returnStatus = retStatus; setVisible(false); dispose(); } public String getGroupName(){ return thisGroupName; } public String getGroupMiaoShu(){ return thisGroupMiaoShu; } public String getNiceName(){ return thisNiceName; } public boolean getFileType(){ return single; } public int getPieceLength(){ switch ( this.lengthComboBox.getSelectedIndex() ){ case 1 : return Bencoding.PIECE_LENGTH32; case 2 : return Bencoding.PIECE_LENGTH64; case 3 : return Bencoding.PIECE_LENGTH128; case 4 : return Bencoding.PIECE_LENGTH256; case 5 : return Bencoding.PIECE_LENGTH512; case 6 : return Bencoding.PIECE_LENGTH1024; } return Bencoding.PIECE_LENGTH128; } private String thisGroupName; private String thisGroupMiaoShu; private String thisNiceName; private boolean single = true; private int pieceLength = 128 * 1024; // 变量声明 - 不进行修改//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JButton cancelButton; private javax.swing.JTextField groupNameTextField; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator3; private javax.swing.JComboBox lengthComboBox; private javax.swing.JTextArea miaoshuTextArea; private javax.swing.JRadioButton multipleRadioButton; private javax.swing.JTextField nicenameTextField; private javax.swing.JButton okButton; private javax.swing.JRadioButton singleRadioButton; // 变量声明结束//GEN-END:variables private int returnStatus = RET_CANCEL;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -