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

📄 p42filesharingpane.java

📁 peeranha42是jxta的 p2p程序核心
💻 JAVA
字号:
package de.uni_bremen.informatik.p2p.plugins.filesharing.gui;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;

import de.uni_bremen.informatik.p2p.peeranha42.core.plugin.gui.P42_application_pane;
import de.uni_bremen.informatik.p2p.plugins.filesharing.data.FilesharingState;
import de.uni_bremen.informatik.p2p.plugins.filesharing.gui.event.DownloadEventListener;
import de.uni_bremen.informatik.p2p.plugins.filesharing.gui.event.SearchEventListener;
import de.uni_bremen.informatik.p2p.plugins.filesharing.gui.event.SharedEventListener;


/**
 * An object of this class the pane which gets displayed in the p42 gui.
 *
 * @author Lars Kordes
 */
public class P42FilesharingPane
    extends P42_application_pane {
	
	JLabel label;
	JProgressBar bar;
	JTabbedPane pane;
	JScrollPane scroll;
	
    /**
     * Creates a new P42FilesharingPane object.
     */
    public P42FilesharingPane() {
        super("P42 Filesharing", P42_application_pane.ATTACHED, FilesharingState.pluginid);

        setLayout(new FlowLayout());
        
        label = new JLabel("Joining P42 Filesharing group.");
        add(label);
        
        bar = new JProgressBar();
        bar.setSize(100,200);
		bar.setStringPainted(true);
		bar.setString("Please wait...");
		bar.setIndeterminate(true);
		add(bar);
        
        // create rest of gui, but dont show it
        FilesharingState.searchpanel =
            new SearchPanel(FilesharingState.searchresults,
                            new SearchEventListener());
        FilesharingState.downloadpanel =
            new DownloadPanel(FilesharingState.downloads,
                              new DownloadEventListener());
        FilesharingState.sharedpanel =
            new SharedPanel(new SharedEventListener());

        // create tabbed pane, add panels to pane and add pane
        pane = new JTabbedPane();
        pane.addTab("Search", FilesharingState.searchpanel);
        pane.addTab("Sharing", FilesharingState.sharedpanel);
        pane.addTab("Transfer", FilesharingState.downloadpanel);

        // create filesharing console and scrollpanel and add to panel
        FilesharingState.info = new FilesharingConsole();
        FilesharingState.info.setEditable(false);
        FilesharingState.info.append("Welcome to PoP Filesharing!");
    }
    
    public void showUserInterface() {
    	// destroy wait screen
    	remove(label);
    	remove(bar);
    	
        // set new layout
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        setLayout(gridbag);
        
        // show userinterface
        c.fill = GridBagConstraints.BOTH;
        c.gridx = 0;
        c.gridy = 0;
        c.weightx = 1;
        c.weighty = 1;
        gridbag.setConstraints(pane, c);
        add(pane);
        
        scroll = new JScrollPane(FilesharingState.info);
        scroll.setPreferredSize(new Dimension(100, 200));
        c.gridy++;
        c.weighty = 0;
        gridbag.setConstraints(scroll, c);
        add(scroll);
        
        this.updateUI();
    }
}

⌨️ 快捷键说明

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