java 子窗口 swt_java在线聊天项目 swt可视化窗口Design 重新设计聊天窗口

packagecom.swift;importjava.awt.BorderLayout;importjava.awt.Dimension;importjava.awt.EventQueue;importjava.awt.FlowLayout;importjavax.swing.ImageIcon;importjavax.swing.JButton;importjavax.swing.JDialog;importjavax.swing.JFrame;importjavax.swing.JLabel;importjavax.swing.JPanel;importjavax.swing.JScrollPane;importjavax.swing.JSplitPane;importjavax.swing.JTextArea;importjavax.swing.UIManager;importjavax.swing.UnsupportedLookAndFeelException;public class ChatFrame extendsJFrame {privateJTextArea textArea_1;privateJTextArea textArea;public static voidmain(String args[]) {

JFrame.setDefaultLookAndFeelDecorated(true);

JDialog.setDefaultLookAndFeelDecorated(true);try{

UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");

}catch(ClassNotFoundException e1) {//TODO Auto-generated catch block

e1.printStackTrace();

}catch(InstantiationException e1) {//TODO Auto-generated catch block

e1.printStackTrace();

}catch(IllegalAccessException e1) {//TODO Auto-generated catch block

e1.printStackTrace();

}catch(UnsupportedLookAndFeelException e1) {//TODO Auto-generated catch block

e1.printStackTrace();

}

EventQueue.invokeLater(newRunnable() {public voidrun() {try{

ChatFrame frame= newChatFrame();

frame.setVisible(true);

}catch(Exception e) {

e.printStackTrace();

}

}

});

}publicChatFrame() {super();

setTitle("飞燕—聊天窗");

setBounds(100, 100, 558, 576);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);final JPanel panel = newJPanel();

panel.setLayout(new BorderLayout(5,5));

getContentPane().add(panel, BorderLayout.NORTH);final JLabel label = new JLabel(new ImageIcon("Images/logo.jpg"));

panel.add(label, BorderLayout.WEST);

label.setText("New JLabel");

label.setPreferredSize(new Dimension(74,74));final JPanel panel_1 = newJPanel();

panel_1.setLayout(newBorderLayout());

panel.add(panel_1, BorderLayout.CENTER);final JLabel advancingSwiftLabel = newJLabel();

advancingSwiftLabel.setText("Advancing Swift");

panel_1.add(advancingSwiftLabel, BorderLayout.CENTER);final JLabel neverWasteTimeLabel = newJLabel();

neverWasteTimeLabel.setText("Never waste time any more");

panel_1.add(neverWasteTimeLabel, BorderLayout.SOUTH);final JSplitPane splitPane = newJSplitPane();

splitPane.setDividerLocation(300);

splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);

getContentPane().add(splitPane, BorderLayout.CENTER);final JPanel panel_2 = newJPanel();

panel_2.setLayout(newBorderLayout());

splitPane.setRightComponent(panel_2);final JPanel panel_3 = newJPanel();final FlowLayout flowLayout = newFlowLayout();

flowLayout.setAlignment(FlowLayout.LEFT);

panel_3.setLayout(flowLayout);

panel_2.add(panel_3, BorderLayout.NORTH);final JButton button = newJButton();

button.setText("字体");

panel_3.add(button);final JPanel panel_4 = newJPanel();final FlowLayout flowLayout_1 = newFlowLayout();

flowLayout_1.setAlignment(FlowLayout.RIGHT);

panel_4.setLayout(flowLayout_1);

panel_2.add(panel_4, BorderLayout.SOUTH);final JButton button_1 = newJButton();

button_1.setText("关闭");

panel_4.add(button_1);final JButton button_2 = newJButton();

button_2.setText("发送");

panel_4.add(button_2);final JScrollPane scrollPane = newJScrollPane();

panel_2.add(scrollPane, BorderLayout.CENTER);

textArea_1= newJTextArea();

scrollPane.setViewportView(textArea_1);final JScrollPane scrollPane_1 = newJScrollPane();

splitPane.setLeftComponent(scrollPane_1);

textArea= newJTextArea();

scrollPane_1.setViewportView(textArea);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值