📄 remoteclient.java
字号:
package RemoteAccess.RemoteClient;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
class MyHandler implements ActionListener{
private RemoteClient ref;
public MyHandler(RemoteClient ref){
this.ref=ref;
}
public void actionPerformed(ActionEvent e) {
JButton temp=(JButton)e.getSource();
if(temp==this.ref.connect){
System.out.println("е硉硈絬");
new MyThread(this.ref).start();
}else if(temp==this.ref.disconnect){
System.out.println("瞒絬");
}
}
}
class MyThread extends Thread{
private RemoteClient ref;
public MyThread(RemoteClient ref){
this.ref=ref;
}
public void run(){
try{
this.ref.add(new Connect(this.ref),BorderLayout.CENTER);
this.ref.validate();
}catch(Throwable t){
t.printStackTrace();
}
}
}
public class RemoteClient extends JPanel{
public JToolBar menu=new JToolBar();
public JTabbedPane content=new JTabbedPane();
public JMenu menu1=new JMenu("硈絬");
public JMenu menu2=new JMenu("瞒絬");
public JButton connect=new JButton("е硉硈絬");
public JButton disconnect=new JButton("瞒絬");
public JLabel statusBar=new JLabel("ready.");
public RemoteClient(){
super(new BorderLayout());
try{
this.menu.add(this.connect);
this.menu.add(this.disconnect);
MyHandler handler=new MyHandler(this);
this.connect.addActionListener(handler);
this.disconnect.addActionListener(handler);
add(this.menu,BorderLayout.NORTH);
add(this.statusBar,BorderLayout.SOUTH);
validate();
setVisible(true);
}catch(Throwable t){
t.printStackTrace();
}
}
public static void createGUI(){
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame main=new JFrame("The Client Controller for Remote Access.");
main.getContentPane().add(new RemoteClient());
main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
main.validate();
main.setSize(new Dimension(500,500));
main.setVisible(true);
}
public static void main(String[] args){
RemoteClient.createGUI();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -