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

📄 connctioninfop.java

📁 基于jxta的局域网P2P文件共享,可以实现局域网中的文件p2p共享,实现文件快速传输及交流
💻 JAVA
字号:
package connex.app.loginUI;

import java.awt.*;

import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;

public class ConnctionInfoP extends JLabel implements ActionListener , ItemListener {
    private ImageIcon img1 = new ImageIcon("images/back2.png");
    private ButtonGroup group = new ButtonGroup();

    private String selected = null;
     private String mode = null;
    JPanel jPanel1 = new JPanel();
    JPanel jPanel2 = new JPanel();
    JRadioButton jRadioButton1 = new JRadioButton();
    JRadioButton jRadioButton2 = new JRadioButton();
    JRadioButton jRadioButton3 = new JRadioButton();
    JRadioButton jRadioButton4 = new JRadioButton();
    JRadioButton jRadioButton5 = new JRadioButton();
    Border border1 = BorderFactory.createEtchedBorder(Color.white,
            new Color(165, 163, 151));
    Border border2 = new TitledBorder(border1, "Connection Mode");
    Border border3 = BorderFactory.createEtchedBorder(Color.white,
            new Color(165, 163, 151));
    Border border4 = new TitledBorder(border3, "Speed");
    ButtonGroup buttonGroup1 = new ButtonGroup();
    JRadioButton jRadioButton6 = new JRadioButton();
    JRadioButton jRadioButton7 = new JRadioButton();

    public ConnctionInfoP() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        this.setLayout(null);
        this.setOpaque(false);
        this.setHorizontalAlignment(SwingConstants.TRAILING);
        this.setIcon(img1);
        this.setVerticalAlignment(SwingConstants.BOTTOM);
        jPanel1.setBorder(border2);
        jPanel1.setOpaque(false);
        jPanel1.setBounds(new Rectangle(132, 35, 255, 212));
        jPanel1.setLayout(null);
        jPanel2.setBorder(border4);
        jPanel2.setOpaque(false);
        jPanel2.setBounds(new Rectangle(18, 35, 111, 211));
        jPanel2.setLayout(null);
        jRadioButton1.setOpaque(false);
        jRadioButton1.setText("T1/T3");
        jRadioButton1.setBounds(new Rectangle(6, 171, 163, 40));
        jRadioButton1.addActionListener(this);
        jRadioButton2.setOpaque(false);
        jRadioButton2.setText("DSL/Cable");
        jRadioButton2.setBounds(new Rectangle(6, 91, 163, 40));
        jRadioButton2.addActionListener(this);
        jRadioButton3.setOpaque(false);
        jRadioButton3.setText("LAN");
        jRadioButton3.setBounds(new Rectangle(6, 131, 163, 40));
        jRadioButton3.addActionListener(this);
        jRadioButton4.setOpaque(false);
        jRadioButton4.setText("56 Kbps ");
        jRadioButton4.setBounds(new Rectangle(6, 11, 163, 40));
        jRadioButton4.addActionListener(this);
        jRadioButton5.setOpaque(false);
        jRadioButton5.setText("128 Kbps");
        jRadioButton5.setBounds(new Rectangle(6, 51, 163, 40));
        jRadioButton5.addActionListener(this);
        jRadioButton6.setOpaque(false);
        jRadioButton6.setText("Work as Client");
        jRadioButton6.setBounds(new Rectangle(17, 34, 139, 23));
        jRadioButton6.addItemListener(this);
        jRadioButton6.setSelected(true) ;
        jRadioButton7.setOpaque(false);
        jRadioButton7.setToolTipText("");
        jRadioButton7.setText("Work as Server");
        jRadioButton7.setBounds(new Rectangle(18, 69, 141, 26));
        jRadioButton7.addItemListener(this);
        mode= jRadioButton6.getText() ;
        jPanel1.add(jRadioButton6);
        jPanel1.add(jRadioButton7);
        this.add(jPanel2);
        ButtonGroup g = new ButtonGroup();
        g.add(jRadioButton4);
        g.add(jRadioButton5);
        g.add(jRadioButton2);
        g.add(jRadioButton3);
        g.add(jRadioButton1);

        jPanel2.add(jRadioButton4);
        jPanel2.add(jRadioButton5);
        jPanel2.add(jRadioButton2);
        jPanel2.add(jRadioButton3);
        jPanel2.add(jRadioButton1);
        this.add(jPanel1);
        buttonGroup1.add(jRadioButton6);
        buttonGroup1.add(jRadioButton7);
    }

    public String getSpeed() {
        return selected;
    }

    public String getMode() {
        return mode;
    }

    public void actionPerformed(ActionEvent e) {

        selected = e.getActionCommand();
        //System.out.println(selected);

    }

    public void itemStateChanged(ItemEvent e) {
        if(e.getStateChange() ==ItemEvent.SELECTED ){
            mode = ((JRadioButton) e.getItem()).getText();
           // System.out.println(mode);
        }
    }


}

⌨️ 快捷键说明

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