在线等!帮我修改下JAVA图形界面,就改个窗口布局,拜托了!!高分追赏!
图形界面程序如下:(只要改得跟原先不一样,都给分!改得好的,比如窗口布局不一样的追加100分,甚至更高!)importjavax.swing.*;importjava.u...
图形界面程序如下:(只要改得跟原先不一样,都给分!改得好的,比如窗口布局不一样的 追加100分,甚至更高!)
import javax.swing.*;
import java.util.Date;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.*;
import java.util.Scanner;
public class LoginSystem extends JFrame {
private JButton Reset_button = new JButton("Reset");
private JButton LogIn_button = new JButton("Login");
private JTextArea Info1;
private JTextArea Info2;
private JTextField userName = new JTextField(20);
private JPasswordField psswd = new JPasswordField(20);
private static User userList[] = new User[20];
public LoginSystem() {
setLayout(new GridLayout(0, 2, 2, 2));
JLabel userName_label = new JLabel(" User Name :");
userName_label.setOpaque(true);
userName_label.setFont(new Font("Dialog", 1, 17));
userName_label.setBackground(Color.ORANGE);
Info1 = new JTextArea("Login Student:" + "\n"
+ "Time Teacher:" + "\n"
+ " Adminstrator:");
Info1.setEditable(false);
Info1.setFont(new Font("Dialog", 1, 13));
add(Info1);
Info2 = new JTextArea(" 22:00 ~ 6:00 " + "\n" + " 17:00 ~ 8:00 "
+ "\n" + " 0:00 ~ 24:00");
Info2.setEditable(false);
add(Info2);
add(userName_label);
userName.setOpaque(true);
userName.setFont(new Font("Dialog", 0, 18));
userName.setBackground(Color.WHITE);
add(userName);
JLabel psswd_label = new JLabel(" Password :");
psswd_label.setOpaque(true);
psswd_label.setFont(new Font("Dialog", 1, 17));
psswd_label.setBackground(Color.ORANGE);
add(psswd_label);
psswd.setOpaque(true);
psswd.setFont(new Font("Dialog", 0, 18));
psswd.setBackground(Color.WHITE);
add(psswd);
add(LogIn_button);
add(Reset_button);
// Register listeners
ListenerClass listener1 = new ListenerClass();
LogIn_button.setOpaque(true);
LogIn_button.setFont(new Font("Dialog", 1, 16));
LogIn_button.setBackground(Color.GREEN);
Reset_button.setOpaque(true);
Reset_button.setFont(new Font("Dialog", 1, 16));
Reset_button.setBackground(Color.GRAY);
LogIn_button.addActionListener(listener1);
Reset_button.addActionListener(listener1);
} 展开
import javax.swing.*;
import java.util.Date;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.*;
import java.util.Scanner;
public class LoginSystem extends JFrame {
private JButton Reset_button = new JButton("Reset");
private JButton LogIn_button = new JButton("Login");
private JTextArea Info1;
private JTextArea Info2;
private JTextField userName = new JTextField(20);
private JPasswordField psswd = new JPasswordField(20);
private static User userList[] = new User[20];
public LoginSystem() {
setLayout(new GridLayout(0, 2, 2, 2));
JLabel userName_label = new JLabel(" User Name :");
userName_label.setOpaque(true);
userName_label.setFont(new Font("Dialog", 1, 17));
userName_label.setBackground(Color.ORANGE);
Info1 = new JTextArea("Login Student:" + "\n"
+ "Time Teacher:" + "\n"
+ " Adminstrator:");
Info1.setEditable(false);
Info1.setFont(new Font("Dialog", 1, 13));
add(Info1);
Info2 = new JTextArea(" 22:00 ~ 6:00 " + "\n" + " 17:00 ~ 8:00 "
+ "\n" + " 0:00 ~ 24:00");
Info2.setEditable(false);
add(Info2);
add(userName_label);
userName.setOpaque(true);
userName.setFont(new Font("Dialog", 0, 18));
userName.setBackground(Color.WHITE);
add(userName);
JLabel psswd_label = new JLabel(" Password :");
psswd_label.setOpaque(true);
psswd_label.setFont(new Font("Dialog", 1, 17));
psswd_label.setBackground(Color.ORANGE);
add(psswd_label);
psswd.setOpaque(true);
psswd.setFont(new Font("Dialog", 0, 18));
psswd.setBackground(Color.WHITE);
add(psswd);
add(LogIn_button);
add(Reset_button);
// Register listeners
ListenerClass listener1 = new ListenerClass();
LogIn_button.setOpaque(true);
LogIn_button.setFont(new Font("Dialog", 1, 16));
LogIn_button.setBackground(Color.GREEN);
Reset_button.setOpaque(true);
Reset_button.setFont(new Font("Dialog", 1, 16));
Reset_button.setBackground(Color.GRAY);
LogIn_button.addActionListener(listener1);
Reset_button.addActionListener(listener1);
} 展开
4个回答
展开全部
把这个构造函数换下就好. 另外颜色想换的话 你直接换换颜色就好.这个直接Color.xxxx 随便用
public LoginSystem() {
setLayout(new BorderLayout());
JLabel userName_label = new JLabel(" User Name :");
userName_label.setOpaque(true);
userName_label.setFont(new Font("Dialog", 1, 17));
userName_label.setBackground(Color.ORANGE);
Info1 = new JTextArea("Login Student:" + "\n" +
"Time Teacher:" + "\n" +
" Adminstrator:");
Info1.setEditable(false);
Info1.setFont(new Font("Dialog", 1, 13));
Info2 = new JTextArea(" 22:00 ~ 6:00 " + "\n" +
" 17:00 ~ 8:00 " + "\n" +
" 0:00 ~ 24:00");
Info2.setEditable(false);
JPanel nPanel = new JPanel();
nPanel.add(Info1);
nPanel.add(Info2);
JPanel userPanel = new JPanel(new GridLayout(2,2));
userName.setOpaque(true);
userName.setFont(new Font("Dialog", 0, 18));
userName.setBackground(Color.WHITE);
JLabel psswd_label = new JLabel(" Password :");
psswd_label.setOpaque(true);
psswd_label.setFont(new Font("Dialog", 1, 17));
psswd_label.setBackground(Color.ORANGE);
add(psswd_label);
psswd.setOpaque(true);
psswd.setFont(new Font("Dialog", 0, 18));
psswd.setBackground(Color.WHITE);
userPanel.add(userName_label);
userPanel.add(userName);
userPanel.add(psswd_label);
userPanel.add(psswd);
JPanel sPanel = new JPanel();
sPanel.add(LogIn_button);
sPanel.add(Reset_button);
this.add(sPanel,BorderLayout.SOUTH);
this.add(userPanel,BorderLayout.CENTER);
this.add(nPanel,BorderLayout.NORTH);
// Register listeners
ListenerClass listener1 = new ListenerClass();
LogIn_button.setOpaque(true);
LogIn_button.setFont(new Font("Dialog", 1, 16));
LogIn_button.setBackground(Color.GREEN);
Reset_button.setOpaque(true);
Reset_button.setFont(new Font("Dialog", 1, 16));
Reset_button.setBackground(Color.GRAY);
LogIn_button.addActionListener(listener1);
Reset_button.addActionListener(listener1);
}
展开全部
你这程序不完整吧?
这俩个定义在哪?
private static User userList[] = new User[20];
ListenerClass
这俩个定义在哪?
private static User userList[] = new User[20];
ListenerClass
追问
我这个是截取的一部分,图形界面那部分,你能帮我改吗?比如帮我把窗口布局修改下等等
追答
没问题,但是你得等一等
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询