📄 findnetdialog.java
字号:
gridBagConstraints.gridy = 7; gridBagConstraints.gridheight = 2; gridBagConstraints.ipadx = 37; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(exitButton, gridBagConstraints); joinButton.setFont(new java.awt.Font("宋体", 0, 14)); joinButton.setText("\u52a0\u5165"); joinButton.setEnabled(false); joinButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { joinButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.gridheight = 2; gridBagConstraints.ipadx = 37; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(joinButton, gridBagConstraints); searchButton.setFont(new java.awt.Font("宋体", 0, 14)); searchButton.setText("\u641c\u7d22"); searchButton.setPreferredSize(new java.awt.Dimension(30, 25)); searchButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { searchButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.ipadx = 118; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(searchButton, gridBagConstraints); niceNamePanel.setLayout(new java.awt.GridBagLayout()); niceNameLabel.setFont(new java.awt.Font("宋体", 0, 14)); niceNameLabel.setText("\u6635\u79f0"); niceNameLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.1; niceNamePanel.add(niceNameLabel, gridBagConstraints); niceNameTextField.setFont(new java.awt.Font("宋体", 0, 12)); niceNameTextField.setEnabled(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.9; niceNamePanel.add(niceNameTextField, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 7; gridBagConstraints.gridheight = 2; gridBagConstraints.ipadx = 136; gridBagConstraints.ipady = -1; gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); getContentPane().add(niceNamePanel, gridBagConstraints); java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); setBounds((screenSize.width-400)/2, (screenSize.height-300)/2, 400, 300); }//GEN-END:initComponents private void groupIDRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_groupIDRadioButtonActionPerformed // TODO 将在此处增加您的处理代码: searchTextField.setEditable(true); }//GEN-LAST:event_groupIDRadioButtonActionPerformed private void groupNameRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_groupNameRadioButtonActionPerformed // TODO 将在此处增加您的处理代码: searchTextField.setEditable(true); }//GEN-LAST:event_groupNameRadioButtonActionPerformed private void searchAllRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchAllRadioButtonActionPerformed // TODO 将在此处增加您的处理代码: searchTextField.setEditable(false); }//GEN-LAST:event_searchAllRadioButtonActionPerformed private void searchListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_searchListValueChanged // TODO 将在此处增加您的处理代码: this.joinButton.setEnabled(true); this.niceNamePanel.setVisible(true); }//GEN-LAST:event_searchListValueChanged private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed // TODO 将在此处增加您的处理代码: if ( searchAllRadioButton.isSelected() ){ nw.findTable("Name", "*" , 10, searchList); return; } String sv = searchTextField.getText(); if ( sv.equals("搜索内容") || (sv.length() == 0) ){ JOptionPane.showMessageDialog(this,"请填写搜索内容","警告",JOptionPane.WARNING_MESSAGE); return; } else{ String attrib = null; String value = null ; com.sinpool.rivercrescent.myutil.RSConfigure rsc = com.sinpool.rivercrescent.myutil.RSConfigure.readFromDisk(); int threshold = rsc.getDefaultSearchThreshold(); this.niceName = rsc.getDefaultPeerName(); this.niceNameTextField.setText(niceName); if ( this.groupIDRadioButton.isSelected() ){ attrib = "GID"; value = "urn:jxta:uuid-" + sv; } else { if ( this.groupNameRadioButton.isSelected() ) { attrib = "Name"; value = sv; } } nw.findTable(attrib, value , threshold, searchList); } }//GEN-LAST:event_searchButtonActionPerformed private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing // TODO 将在此处增加您的处理代码: doClose(RET_CANCEL); }//GEN-LAST:event_formWindowClosing private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed // TODO 将在此处增加您的处理代码: //千万不能在这里写东西.!!!!!!!!!!!!! }//GEN-LAST:event_formWindowClosed private void joinButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_joinButtonActionPerformed // TODO 将在此处增加您的处理代码: this.joinedGroupIndex = searchList.getSelectedIndex(); this.niceName = this.niceNameTextField.getText(); doClose(RET_OK); }//GEN-LAST:event_joinButtonActionPerformed private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitButtonActionPerformed doClose(RET_CANCEL); }//GEN-LAST:event_exitButtonActionPerformed private void doClose(int retStatus) { returnStatus = retStatus; this.setVisible(false); dispose(); } private NetWork nw; private static int returnStatus; private int joinedGroupIndex ; private String niceName; // 变量声明 - 不进行修改//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JButton exitButton; private javax.swing.JRadioButton groupIDRadioButton; private javax.swing.JRadioButton groupNameRadioButton; private javax.swing.JPanel jPanel4; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JButton joinButton; private javax.swing.JLabel niceNameLabel; private javax.swing.JPanel niceNamePanel; private javax.swing.JTextField niceNameTextField; private javax.swing.JRadioButton searchAllRadioButton; private javax.swing.JButton searchButton; private javax.swing.JList searchList; private javax.swing.JTextField searchTextField; // 变量声明结束//GEN-END:variables }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -