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

📄 vijxtadialogview.java

📁 myjxta是用jxta开发的一个p2p通讯软件 有聊天 文件共享 视频3大功能 界面采用swing
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/* * Copyright (c) [2005] [Jeffrey Moore] * * Redistributions in source code form must reproduce the above copyright and * this condition. * * The contents of this file are subject to the Sun Project JXTA License * Version 1.1 (the "License"); you may not use this file except in compliance * with the License. A copy of the License is available at * http://www.jxta.org/jxta_license.html. * *//** ViJxtaDialogView.java** Created on April 11, 2005, 9:26 AM*/package net.jxta.myjxta.plugins.vijxta;import info.clearthought.layout.TableLayout;import net.jxta.logging.Logging;import net.jxta.myjxta.View;import net.jxta.myjxta.dialog.Dialog;import net.jxta.myjxta.plugin.PluginView;import net.jxta.myjxta.util.Resources;import net.jxta.myjxta.util.exec.ExecFactory;import javax.swing.*;import javax.swing.border.TitledBorder;import javax.swing.event.ChangeEvent;import javax.swing.event.ChangeListener;import java.awt.*;import java.awt.event.*;import java.net.MalformedURLException;import java.net.URL;import java.util.Collections;import java.util.Hashtable;import java.util.Iterator;import java.util.ResourceBundle;import java.util.logging.Level;import java.util.logging.Logger;/** * @author Jeff Moore */public final class ViJxtaDialogView extends JPanel implements PluginView {    static final Logger LOG = Logger.getLogger(ViJxtaDialogView.class.getName());    private static final ResourceBundle STRINGS = Resources.getStrings();    //hACK!    public static final String CONFIG_VIDEO_SOURCE_PANEL = "configVideoSource";    public static final String CONFIG_LOCAL_DEVICES_PANEL = "configLocalDevices";    public static final String CONFIG_NETWORKED_DEVICES_PANEL = "configNetworkedDevices";    public static final String INITIATED_LOCALLY = "ViJxtaDialogInitiatedLocally";    private static final String CONFIG_FORMATS_PANEL = "configFormats";    private static final String CONFIG_TEST_PANEL = "configTest";    private static final String CONFIG_PANEL = "configPanel";    private static final String NO_RESPONSE_PANEL = "noResponsePanel";    private static final String CONFIG_LOCAL_OPTIONS_PANEL = "configLocalOptionsPanel";    private static final String CALL_CONTROL_PANEL = "callControlPanel";    private static final String STATS_PANEL = "statsPanel";    private static final String ERROR_PANEL = "errorPanel";    private static final String IDLE_PANEL = "idlePanel";    private static final String URL_JMF_DOWNLOAD = "http://java.sun.com/products/java-media/jmf/2.1.1/download.html";    private static final String JMF_ERROR_MESSAGE = "<html><font color=blue><u>Download Java Media Framework</u></font></html>";    /**     * sleep time for the UI update thread     */    private static final int UI_UPDATE_INTERVAL = 1000;    /**     * sleep time while waiting for dialog pipe to connect     */    private static final int CONNECT_SLEEP_TIME = 200;    private final JButton startCallButton = null;    private JButton endCallButton = null;    private JSlider imageQualitySlider = null;    private JLabel messageLabel = null;    private JLabel incomingBufferSizeLabel = null;    private JLabel outgoingBufferSizeLabel = null;    private final JLabel sessionLogFileNameLabel = null;    private JLabel incomingImageCompressionLabel = null;    private JLabel outgoingImageCompressionLabel = null;    private JLabel productLabel = null;    private final JCheckBox speakerMuteCheckBox = null;    private final JCheckBox saveConvoCheckBox = null;    private JLabel bytesReceivedLabel = null;    private JLabel messagesReceivedLabel = null;    private JLabel roundTripTimeLabel = null;    private JLabel bytesSentLabel = null;    JCheckBox transmitCheckBox = null;    JCheckBox receiveCheckBox = null;    private JLabel messagesSentLabel = null;    private CardLayout cardLayout = null;    private JPanel deckPanel = null;    private CardLayout configCardLayout = null;    private JPanel configDeckPanel = null;    private final JLabel speakerLabel = null;    private JButton statsButton = null;    private JLabel jmfErrorLabel = null;    private final JLabel encodedBufferSizeLabel = null;    private JLabel errorMessageLabel = null;    private final JLabel encodedBlockSizeLabel = null;    private JLabel callElapsedTimeLabel = null;    private JLabel callStartTimeLabel = null;    private JLabel callEndTimeLabel = null;    private JLabel outgoingMessagesPerSecondLabel = null;    private JLabel incomingMessagesPerSecondLabel = null;    private JLabel outgoingBytesPerSecondLabel = null;    private JLabel incomingBytesPerSecondLabel = null;    private final JLabel compressionRatioLabel = null;    private final JLabel qualityLabel = null;    private JLabel averageDecodeTimeLabel = null;    private JLabel averageEncodeTimeLabel = null;    private JLabel decodeTimeLabel = null;    private JLabel encodeTimeLabel = null;    private JLabel protocolStateLabel = null;    private JLabel refreshRateLabel = null;    private final JLabel encodedMessageSizeLabel = null;    private JList captureDevicesList = null;    private JList formatsList = null;    private JPanel monitorTestPanel = null;    private boolean inSession = false;    final Insets panelInsets = null;    private ViJxtaDialog viJxtaDialog = null;    final Insets subComponentInsets = null;    private boolean initiatedLocally = false;    private View myJxtaView = null;    private ViJxtaCallControl viJxtaCallControl = null;    private Thread updateThread = null;    private boolean updateThreadRun = true;    long previousOutgoingMessagesValue = 0;    long previousIncomingMessagesValue = 0;    long previousOutgoingBytesValue = 0;    long previousIncomingBytesValue = 0;    private boolean noLocalCaptureDevicesFound = false;    private Hashtable imageQualityLabelTable = null;    private Component monitorTestComponent = null;    private final Component localMonitorComponent = null;    private final Component remoteMonitorComponent = null;    private JPanel localMonitorPanel = null;    private JPanel remoteMonitorPanel = null;    private JButton placeAcceptCallButton = null;    private final JPanel messagePanel = null;    private JButton holdResumeCallButton = null;    private JSlider refreshRateSlider = null;    private boolean isJMFPresent = false;    private boolean localDevice = false;    private boolean networkedDevice = false;    private boolean noDevice = false;    private JTextField networkedSourceURLTextField = null;    private JTextField authenticationUserNameTextField = null;    private JPasswordField authenticationPasswordTextField = null;    private JCheckBox authenticationCheckBox = null;    /**     * Creates a new instance of ViJxtaDialogView     */    public ViJxtaDialogView(View p_view, Dialog dialog, boolean p_locallyInitiated) {        super();        initiatedLocally = p_locallyInitiated;        LOG.setLevel(Level.INFO);        imageQualityLabelTable = new Hashtable();        imageQualityLabelTable.put(new Integer(0), new JLabel("0%"));        imageQualityLabelTable.put(new Integer(20), new JLabel("20%"));        imageQualityLabelTable.put(new Integer(40), new JLabel("40%"));        imageQualityLabelTable.put(new Integer(60), new JLabel("60%"));        imageQualityLabelTable.put(new Integer(80), new JLabel("80%"));        imageQualityLabelTable.put(new Integer(100), new JLabel("100%"));        this.myJxtaView = p_view;        this.viJxtaDialog = (ViJxtaDialog) dialog;        if (!this.viJxtaDialog.isConnected()) {            if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) {                LOG.info("Constructor : ViJxtaDialog not connected");            }            dismiss();        } else {            UI();            /** test for jmf.jar. if jmf is not present then move to errorpane and ditch plugin             *  protocol will never be sent.             */            //tests for jmf.jar            try {                this.isJMFPresent = LocalDeviceMonitorControl.isJMFPresent();            } catch (Exception x) {                x.printStackTrace();                isJMFPresent = false;            } catch (Error e) {                e.printStackTrace();                isJMFPresent = false;            }            this.viJxtaCallControl = new ViJxtaCallControl(this, this.myJxtaView, viJxtaDialog, initiatedLocally);            if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) {                LOG.info("viJxtaCall Control is " + this.viJxtaCallControl);            }            if (Logging.SHOW_INFO && LOG.isLoggable(Level.INFO)) {                LOG.info("viJxtaCall Control is " + this.getCallControl());            }            /** UI update thread for stats, call times etc*/            updateThread = new Thread(new Runnable() {                public void run() {                    while (updateThreadRun) {                        EventQueue.invokeLater(new Runnable() {                            public void run() {                                long tmp = 0;                                if (getCallControl().getLocalMonitorControl().isTransmit()) {                                    refreshRateLabel.setText(String.valueOf(getCallControl().getLocalMonitorControl().getRefreshRate()) + " fps");                                    bytesSentLabel.setText(String.valueOf(getCallControl().getLocalMonitorControl().getBytesSent()));                                    messagesSentLabel.setText(String.valueOf(getCallControl().getLocalMonitorControl().getMessagesSent()));                                    outgoingImageCompressionLabel.setText(String.valueOf(getCallControl().getLocalMonitorControl().getImageCompression()));                                    tmp = getCallControl().getLocalMonitorControl().getMessagesSent();                                    outgoingMessagesPerSecondLabel.setText(String.valueOf(                                            tmp - previousOutgoingMessagesValue));                                    previousOutgoingMessagesValue = tmp;                                    tmp = getCallControl().getLocalMonitorControl().getBytesSent();                                    outgoingBytesPerSecondLabel.setText(String.valueOf(                                            tmp - previousOutgoingBytesValue));                                    previousOutgoingBytesValue = tmp;                                    encodeTimeLabel.setText(String.valueOf(getCallControl().getLocalMonitorControl().getImageEncodeTime()));                                    averageEncodeTimeLabel.setText(String.valueOf(getCallControl().getLocalMonitorControl().getAverageImageEncodeTime()));                                    outgoingBufferSizeLabel.setText(String.valueOf(getCallControl().getLocalMonitorControl().getBufferSize()));                                }                                bytesReceivedLabel.setText(String.valueOf(getCallControl().getRemoteMonitorControl().getBytesReceived()));                                messagesReceivedLabel.setText(String.valueOf(getCallControl().getRemoteMonitorControl().getMessagesReceived()));                                incomingImageCompressionLabel.setText(String.valueOf(getCallControl().getRemoteMonitorControl().getImageCompression()));                                roundTripTimeLabel.setText(String.valueOf(getCallControl().getRoundTripTime()));                                callEndTimeLabel.setText(getCallControl().getCallEndTimeString());                                callStartTimeLabel.setText(getCallControl().getCallStartTimeString());                                callElapsedTimeLabel.setText(getCallControl().getCallElapseTimeString());                                tmp = getCallControl().getRemoteMonitorControl().getMessagesReceived();                                incomingMessagesPerSecondLabel.setText(String.valueOf(                                        tmp - previousIncomingMessagesValue));                                previousIncomingMessagesValue = tmp;                                tmp = getCallControl().getRemoteMonitorControl().getBytesReceived();                                incomingBytesPerSecondLabel.setText(String.valueOf(                                        tmp - previousIncomingBytesValue));                                previousIncomingBytesValue = tmp;                                decodeTimeLabel.setText(String.valueOf(getCallControl().getRemoteMonitorControl().getImageDecodeTime()));                                averageDecodeTimeLabel.setText(String.valueOf(getCallControl().getRemoteMonitorControl().getAverageImageDecodeTime()));                                incomingBufferSizeLabel.setText(String.valueOf(getCallControl().getRemoteMonitorControl().getBufferSize()));                            }

⌨️ 快捷键说明

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