Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * https://www.youtube.com/watch?v=MNV2FyA96XM&list=PL53A7C2BE1F8D780C&index=32
- * @author Sahaj Khan
- */
- import javax.swing.*;
- import java.awt.*;
- import java.awt.event.ActionListener;
- public class Psych extends JFrame implements ActionListener{
- JFrame jf = new JFrame();
- JPanel panelName = new JPanel();
- JLabel labelName;
- public Psych() {
- setTitle("FoilMaker");
- setSize(400,400);
- setVisible(true);
- setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- //setResizable(false);
- labelName = new JLabel("FoilMaker");
- panelName.add(labelName);
- add(panelName, BorderLayout.NORTH);
- JPanel userNamePassword = new JPanel();
- JTextField inputUserName = new JTextField(10);
- JPasswordField inputPassword = new JPasswordField(10); //I changed it from JPasswordField to inputPassword
- //inputPassword.setActionCommand(OK);
- //inputPassword.addActionListener(this);
- userNamePassword.add(new JLabel("Username"));
- userNamePassword.add(inputUserName);
- userNamePassword.add(new JLabel("Password"));
- userNamePassword.add(inputPassword);
- add(userNamePassword, BorderLayout.CENTER);
- JPanel loginRegisterButtons = new JPanel();
- loginRegisterButtons.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 200)); // The numbers in the FlowLayout control the (X, gap between buttons, and Y)
- loginRegisterButtons.add(new JButton("Login"));
- loginRegisterButtons.add(new JButton("Register"));
- add(loginRegisterButtons, BorderLayout.SOUTH);
- }
- public void drawRectangle(Graphics g) {
- g.setColor(Color.ORANGE);
- g.fillRect(240,240, 400, 500);
- }
- public static void main(String[] args) {
- Psych p = new Psych();
- //p.drawRectangle(null);
- //JOptionPane.showInputDialog(null, "Some sort of question here", "Also perhaps title");
- // int temp = JOptionPane.showOptionDialog(null, "Do you have valid residency status?", "Residency Status",
- // JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement