AddMenu1

package logSFTP;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JTextField;

public class AddMenu1 extends JFrame
{
 private JTextField url = new JTextField();     //SFTP服务器地址
 private JTextField port = new JTextField();     //SFTP服务器端口
 private JTextField username = new JTextField();    //用户名
 private JPasswordField password = new JPasswordField();  //密码
 private JComboBox<String> select = new JComboBox<String>();
 
 JScrollPane fileScrollPane;
 
 private Dimension faceSize = new Dimension(300, 300);  //框架大小
 
 private String[] str = {"portal debug", "portal interface", "portal error", "portal warning"};
 
 public AddMenu1()
 { 
  init();
  
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //添加框架的关闭事件处理
  this.pack();
              
  this.setSize(faceSize);         //设置框架的大小
  //设置运行时窗口的位置
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  this.setLocation( (int)(screenSize.width - faceSize.getWidth()) / 2,
    (int)(screenSize.height - faceSize.getHeight()) / 2);
  this.setResizable(true);

  this.setTitle("SFTP服务端");         //设置标题

  setVisible(true);
  
  this.addWindowListener(         //关闭程序时的操作
    new WindowAdapter()
    {
     public void windowClosing(WindowEvent e)
     {
      System.exit(0);
     }
    }
   );
 }
 
 void init ()
 {
  Container contentPane = getContentPane();  //获取面板
  contentPane.setLayout(new BorderLayout());  //设置布局 
  
  JPanel up = new JPanel();      //设置面板上方控件布局
  up.setLayout(new GridLayout(5,2,10,8));
  
  JPanel no1 = new JPanel();      
  no1.setLayout(new BorderLayout());
  no1.add(new JLabel("服务器:"),BorderLayout.WEST);
  no1.add(url,BorderLayout.CENTER);
  no1.setSize(10, 20);
  
  JPanel no2 = new JPanel();      
  no2.setLayout(new BorderLayout());
  no2.add(new JLabel("端口号:"),BorderLayout.WEST);
  no2.add(port,BorderLayout.CENTER);
  
  JPanel no3 = new JPanel();      
  no3.setLayout(new BorderLayout());
  no3.add(new JLabel("用户名:"),BorderLayout.WEST);
  no3.add(username,BorderLayout.CENTER);

  JPanel no4 = new JPanel();      
  no4.setLayout(new BorderLayout());
  no4.add(new JLabel("密    码:"),BorderLayout.WEST);
  no4.add(password,BorderLayout.CENTER);
  
  JPanel no5 = new JPanel();      
  no5.setLayout(new BorderLayout());
  
  for (String s : str)
  {
   select.addItem(s);
  }
  
  no5.add(new JLabel("日志文件:"),BorderLayout.WEST);
  no5.add(select,BorderLayout.CENTER);
  
  up.add(no1);
  up.add(no2);
  up.add(no3);
  up.add(no4);
  up.add(no5);
  this.add(up,BorderLayout.NORTH);    
  
 }
 
 public static void main(String[] args) {
  new AddMenu1();
 }
 
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值