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

📄 screen.java

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

import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.*;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import connex.app.wsUI.WorkSpaceGUI;

public class Screen extends JFrame implements MouseMotionListener,
        MouseListener, LoadStatusListener {
    private ImageIcon img = new ImageIcon("splash.png");


    public Screen() {
        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        this.getContentPane().setLayout(borderLayout1);
        addMouseMotionListener(this);
        addMouseListener(this);
        setSize(400, 244);
        this.setUndecorated(true);
        jPanel1.setLayout(null);
        centerFrame();

        this.setAlwaysOnTop(true);
        jLabel1.setBackground(Color.white);
        jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
        jLabel1.setIcon(img);
        jLabel1.setVerticalAlignment(SwingConstants.TOP);
        jLabel1.setBounds(new Rectangle(0, 0, 399, 299));
        status.setForeground(Color.BLUE);
        status.setText("starting ......");
        status.setBounds(new Rectangle(86, 195, 242, 18));
        jPanel1.setBackground(Color.white);
        this.getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        jPanel1.add(status);
        jPanel1.add(jLabel1);
    }

    private void centerFrame() {

        // Center the window
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = this.getSize();
        if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
        }
        if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
        }
        this.setLocation((screenSize.width - frameSize.width) / 2,
                         (screenSize.height - frameSize.height) / 2);

        this.setVisible(true);
    }


    BorderLayout borderLayout1 = new BorderLayout(); //JPanel jLabel1 = new JPanel();
    JPanel jPanel1 = new JPanel();
    private Point mp;
    private JLabel jLabel1 = new JLabel();
    private JLabel status = new JLabel();
    public void mouseDragged(MouseEvent e) {
        if (mp == null) {
            return;
        }
        Point p = e.getPoint();
        int x = getX() + p.x - mp.x;
        int y = getY() + p.y - mp.y;
        setLocation(x, y);

    }

    public void mouseMoved(MouseEvent e) {
    }

    public void mouseClicked(MouseEvent e) {
    }

    public void mouseReleased(MouseEvent m) {
        mp = null;
    }

    public void mousePressed(MouseEvent m) {
        mp = m.getPoint();
    }


    public void mouseEntered(MouseEvent e) {
    }

    public void mouseExited(MouseEvent e) {
    }

    public void setStatus(String s) {
        if (s.equals("connecting to ConneX")) {





        }
        this.status.setText(s + " ...............");
    }


}

⌨️ 快捷键说明

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