📄 configscreen.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 ConfigScreen extends JPanel implements ActionListener{
private static final boolean DEBUG = false;
private MainGUI mainGUI;
private JTextField nodeNameEntry;
ConfigScreen(MainGUI mainGUI ) {
this.mainGUI = mainGUI;
JPanel panel1 = this;
panel1.setLayout(null);
panel1.setSize(new Dimension(800,600));
JLabel welcome = new JLabel("CONFIG 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 nodeName = new JLabel("Node Name: ");
nodeName.setSize(nodeName.getPreferredSize());
nodeNameEntry = new JTextField(8);
nodeNameEntry.setSize(nodeNameEntry.getPreferredSize());
panel1.add(nodeName);
nodeName.setLocation((panel1.getWidth()-(nodeName.getWidth() + 5 + nodeNameEntry.getWidth()))/2, 150);
panel1.add(nodeNameEntry);
nodeNameEntry.setLocation((panel1.getWidth()-(nodeNameEntry.getWidth()+ 5 + nodeName.getWidth()))/2 + nodeName.getWidth(), 150);
JButton submit = new JButton("Submit");
submit.addActionListener(this);
submit.setActionCommand("submit");
panel1.add(submit);
submit.setSize(submit.getPreferredSize());
// System.out.println("panel width: " + panel1.getWidth() + "quit width: " + quit.getWidth() +
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 + -