📄 mainscreen.java
字号:
package edu.uiuc.cs.cs327.linuxwifi.gui;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.util.Vector;
/**
* Class that contains all information pertaining to the Download Screen
*/
class MainScreen extends JPanel implements ActionListener{
private static final boolean DEBUG = false;
private MainGUI mainGUI;
MainScreen(MainGUI mainGUI ) {
this.mainGUI = mainGUI;
JPanel panel1 = this;
panel1.setLayout(null);
panel1.setSize(new Dimension(800,600));
JLabel welcome = new JLabel("MAIN SCREEN");
welcome.setFont(new Font(welcome.getFont().getFontName(), welcome.getFont().getStyle(), 20));
welcome.setSize(welcome.getPreferredSize());
panel1.add(welcome);
welcome.setLocation((panel1.getWidth()-welcome.getWidth())/2, 100);
JLabel line = new JLabel("Please click status tab to see Peer Discovery");
line.setFont(new Font(line.getFont().getFontName(), line.getFont().getStyle(), 14));
line.setSize(line.getPreferredSize());
panel1.add(line);
line.setLocation((panel1.getWidth()-line.getWidth())/2, 175);
JButton submit = new JButton("Submit");
submit.addActionListener(this);
submit.setActionCommand("submit");
panel1.add(submit);
submit.setSize(submit.getPreferredSize());
submit.setLocation((this.getWidth() - submit.getWidth()+10)/2,225);
System.out.println("Window Shown");
show();
}
public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equals("submit")) {
// mainGUI.successfulLogin();
}
else if(e.getActionCommand().equals("logout")) {
mainGUI.logOut();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -