package main;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Paint;
import java.awt.event.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.swing.*;
public class Panels {
static Calendar time;
JPanel Login, Join, Create, Friends, Account, Settings;
JLabel Label1, Label2, Label3, Label4, Label5, Label6, Label7, Time;
JButton Button1, Button2;
JTextField TextField1;
JPasswordField PasswordField1;
static JMenuBar menuBar;
static JMenu menu1, menu2, menu3;
static JMenuItem item1, item2, item3, item4, item5, item6, item7, item8, item9;
static String String1 = "Komitet Gosudarstevenno Bezopasnosti";
static String String2 = "KGB - Instant Messaging";
static String String3 = "Dedicated to Julia the Russian";
static Color red = new Color(176, 23, 31);
static Color yellow = new Color(205, 173, 0);
static Paint Graphics;
public JPanel Login(){
Login = new JPanel();
Login.setBackground(red);
Login.setLayout(null);
Login.setOpaque(true);
Login.setSize(400, 400);
//Labels
Label1 = new JLabel(String1);
Label1.setForeground(yellow);
Label1.setBounds(75, 10, 250, 20);
Login.add(Label1);
Label2 = new JLabel(String2);
Label2.setForeground(yellow);
Label2.setBounds(125, 30, 200, 20);
Login.add(Label2);
Label3 = new JLabel(String3);
Label3.setForeground(yellow);
Label3.setBounds(110, 50, 200, 20);
Login.add(Label3);
Label4 = new JLabel("Username:");
Label4.setForeground(yellow);
Label4.setBounds(30, 90, 100, 20);
Login.add(Label4);
Label5 = new JLabel("Password:");
Label5.setForeground(yellow);
Label5.setBounds(160, 90, 100, 20);
Login.add(Label5);
Label6 = new JLabel("By -- v1.0");
Label6.setForeground(yellow);
Label6.setBounds(10, 320, 160, 20);
Login.add(Label6);
Label7 = new JLabel("News:");
Label7.setForeground(yellow);
Label7.setBounds(180, 180, 50, 20);
Login.add(Label7);
Time = new JLabel();
Time.setForeground(yellow);
Time.setBounds(340, 320, 50, 20);
Login.add(Time);
//Buttons
UIManager.put("Button.select", red);
UIManager.put("Button.border", BorderFactory.createLineBorder(yellow, 3));
Button1 = new JButton("Login");
Button1.setBackground(yellow);
Button1.setForeground(red);
Button1.setFocusPainted(false);
Button1.setBounds(290, 110, 75, 20);
Login.add(Button1);
Button2 = new JButton("Check For Updates");
Button2.setBackground(yellow);
Button2.setForeground(red);
Button2.setFocusPainted(false);
Button2.setBounds(30, 140, 335, 30);
Login.add(Button2);
//TextField
UIManager.put("TextField.border", BorderFactory.createLineBorder(yellow, 3));
TextField1 = new JTextField();
TextField1.setBackground(yellow);
TextField1.setForeground(red);
TextField1.setFocusable(true);
TextField1.setBounds(30, 110, 100, 20);
Login.add(TextField1);
//PasswordField
UIManager.put("PasswordField.border", BorderFactory.createLineBorder(yellow, 3));
PasswordField1 = new JPasswordField();
PasswordField1.setBackground(yellow);
PasswordField1.setForeground(red);
PasswordField1.setBounds(160, 110, 100, 20);
Login.add(PasswordField1);
//drawTest();
return Login;
}
public JPanel Join(){
Join = new JPanel();
Join.setBackground(red);
Join.setLayout(null);
Join.setOpaque(true);
Join.setSize(400, 400);
//Labels
Label1 = new JLabel("Search (Server Name, Friends, Settings, Topic, etc...");
Label1.setForeground(yellow);
Label1.setBounds(10, 10, 300, 20);
Join.add(Label1);
return Join;
}
public JPanel Create(){
Create = new JPanel();
return Create;
}
public JPanel Friends(){
Friends = new JPanel();
return Friends;
}
public JPanel Account(){
Account = new JPanel();
return Account;
}
public JPanel Settings(){
Settings = new JPanel();
return Settings;
}
// Add This After Logging In
public JMenuBar Menu(){
menuBar = new JMenuBar();
UIManager.put("PopupMenu.border", BorderFactory.createLineBorder(yellow, 3));
UIManager.put("MenuItem.selectionBackground", yellow);
UIManager.put("MenuItem.selectionForeground", red);
UIManager.put("MenuItem.acceleratorForeground", yellow);
UIManager.put("MenuItem.acceleratorSelectionForeground", red);
UIManager.put("Menu.selectionBackground", yellow);
UIManager.put("Menu.selectionForeground", red);
menu1 = new JMenu("Server");
menu1.setForeground(yellow);
menuBar.add(menu1);
item1 = new JMenuItem("Join");
item1.setForeground(yellow);
item1.setBackground(red);
item1.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
}
});
item1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, ActionEvent.ALT_MASK));
item1.getAccessibleContext().setAccessibleDescription("Join");
menu1.add(item1);
item2 = new JMenuItem("Create");
item2.setForeground(yellow);
item2.setBackground(red);
item2.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
}
});
item2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK));
menu1.add(item2);
item3 = new JMenuItem("Friends");
item3.setForeground(yellow);
item3.setBackground(red);
item3.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
}
});
item3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.ALT_MASK));
menu1.add(item3);
menu2 = new JMenu("Options");
menu2.setForeground(yellow);
menuBar.add(menu2);
item4 = new JMenuItem("Account");
item4.setForeground(yellow);
item4.setBackground(red);
item4.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
}
});
item4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.ALT_MASK));
menu2.add(item4);
item5 = new JMenuItem("Settings");
item5.setForeground(yellow);
item5.setBackground(red);
item5.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
}
});
item5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.ALT_MASK));
menu2.add(item5);
item6 = new JMenuItem("Updates");
item6.setForeground(yellow);
item6.setBackground(red);
item6.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
}
});
item6.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, ActionEvent.ALT_MASK));
menu2.add(item6);
//Specialize Based on Login
menu3 = new JMenu("Admin");
menu3.setForeground(yellow);
menuBar.add(menu3);
item7 = new JMenuItem("Members");
item7.setForeground(yellow);
item7.setBackground(red);
item7.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
}
});
item7.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK));
menu3.add(item7);
item8 = new JMenuItem("Servers");
item8.setForeground(yellow);
item8.setBackground(red);
item8.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
}
});
item8.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
menu3.add(item8);
item9 = new JMenuItem("Options");
item9.setForeground(yellow);
item9.setBackground(red);
item9.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
}
});
item9.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
menu3.add(item9);
menuBar.setBackground(red);
menuBar.setBorderPainted(false);
return menuBar;
}
public void Time(){
time = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
Time.setText(sdf.format(time.getTime()));
}
public void drawTest(){
Graphics g = Login.getGraphics();
g.setColor(yellow);
g.fillRect(10, 300, 32, 32);
Login.paint(g);
}
}