/usr/share/doc/libmina-java-doc/examples/src/main/java/org/apache/mina/example/chat/client/ConnectDialog.java is in libmina-java-doc 1.1.7.dfsg-11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | /*
* @(#) $Id: ConnectDialog.java 555855 2007-07-13 03:19:00Z trustin $
*
* Copyright 2006 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.mina.example.chat.client;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
/**
*
* @author The Apache Directory Project (mina-dev@directory.apache.org)
* @version $Rev$, $Date$
*
*/
public class ConnectDialog extends JDialog {
private static final long serialVersionUID = 2009384520250666216L;
private String serverAddress;
private String username;
private boolean useSsl;
private boolean cancelled = false;
public ConnectDialog(Frame owner) throws HeadlessException {
super(owner, "Connect", true);
serverAddress = "localhost:1234";
username = "user" + Math.round(Math.random() * 10);
final JTextField serverAddressField = new JTextField(serverAddress);
final JTextField usernameField = new JTextField(username);
final JCheckBox useSslCheckBox = new JCheckBox("Use SSL", false);
JPanel content = new JPanel();
content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS));
content.add(new JLabel("Server address"));
content.add(serverAddressField);
content.add(new JLabel("Username"));
content.add(usernameField);
content.add(useSslCheckBox);
JButton okButton = new JButton();
okButton.setAction(new AbstractAction("OK") {
private static final long serialVersionUID = -2292183622613960604L;
public void actionPerformed(ActionEvent e) {
serverAddress = serverAddressField.getText();
username = usernameField.getText();
useSsl = useSslCheckBox.isSelected();
ConnectDialog.this.dispose();
}
});
JButton cancelButton = new JButton();
cancelButton.setAction(new AbstractAction("Cancel") {
private static final long serialVersionUID = 6122393546173723305L;
public void actionPerformed(ActionEvent e) {
cancelled = true;
ConnectDialog.this.dispose();
}
});
JPanel buttons = new JPanel();
buttons.add(okButton);
buttons.add(cancelButton);
getContentPane().add(content, BorderLayout.CENTER);
getContentPane().add(buttons, BorderLayout.SOUTH);
}
public boolean isCancelled() {
return cancelled;
}
public String getServerAddress() {
return serverAddress;
}
public String getUsername() {
return username;
}
public boolean isUseSsl() {
return useSsl;
}
}
|