Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • `Discardedx2`: ?
      September 21, 2018, 12:24:09 PM
    • Pookey71: ARE YOU HERE TO RECEIVE MY LIMP PENIS!?
      September 20, 2018, 11:55:24 PM
    • Pookey71: THIS IS DEMOCRACY MANIFESTO
      September 20, 2018, 11:55:07 PM
    • Vasi28: Гранд
      September 03, 2018, 07:06:22 PM
    • Rash: test
      August 30, 2018, 09:09:18 PM
    • Guruu:[link]
      August 30, 2018, 12:04:45 AM
    • Guruu: am i allowed to post links shoutbox?
      August 30, 2018, 12:03:46 AM
    • drubrkletern:[link] feedback wanted
      August 28, 2018, 03:55:17 PM
    • bugz000: Anyone got a link for the old ass silab client and cache.zip? from mopar 3.2 era :) 317
      August 25, 2018, 12:48:15 AM
    • cholland2015: Does anyone know where I can download the old moparscape client/server?
      August 24, 2018, 02:30:51 PM
    • hexedss1: Anyone would like to help on client side got a variable declartion Error
      August 15, 2018, 09:06:30 PM
    • SOUPSOUP: just get a vpn
      August 13, 2018, 06:44:28 PM
    • jme: _^_ will answer all of your javascript questions
      August 12, 2018, 07:11:00 PM
    • doomsale: and where is boxman?
      August 10, 2018, 03:16:59 AM
    • doomsale: Where can i play the Moparscape MMORPG with the Metallica instrumentals?
      August 10, 2018, 03:16:47 AM
    • doomsale: no longer clicking on doors and dummies at east bank
      August 10, 2018, 03:16:07 AM
    • doomsale: were all grown up now huh?
      August 10, 2018, 03:15:58 AM
    • _^_: hey everyone look at my graphs [link]
      August 06, 2018, 01:52:16 PM
    • braedyn: Someone pl0x help me out with PI Lottery!!
      August 03, 2018, 02:12:25 AM
    • Travas: p3n1s
      July 26, 2018, 09:46:33 PM

    Author Topic: create file and read file  (Read 1076 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineDidthathurt22

    • Member
    • **
    • Posts: 17
    • Thanks: +0/-0
      • View Profile
    create file and read file
    « on: August 30, 2015, 05:10:17 PM »
    I'm trying to create an interface the will create an account information file and than a button to read to see if the account information is available.. a classic login method nothing too fancy at this point.. but i've created two interfaces and one interface button click leads to the other interface that part was easy but i was just curious about the whole creating an account profile with what i have as of now..


    my log in window code:

    Code: [Select]
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;



    public class loginInterface extends JFrame {
    public loginInterface() {
    initComponents();
    }

    private void button1ActionPerformed(ActionEvent e) {

    dispose();
    new LetsDoThis();

    }

    private void button2ActionPerformed(ActionEvent e) {

    dispose();
    new registerButton();
    }

    private void initComponents() {

    label3 = new JLabel();
    label1 = new JLabel();
    textField1 = new JTextField();
    label2 = new JLabel();
    passwordField1 = new JPasswordField();
    button1 = new JButton();
    button2 = new JButton();


    setMinimumSize(new Dimension(800, 600));
    Container contentPane = getContentPane();
    contentPane.setLayout(new GridBagLayout());
    ((GridBagLayout)contentPane.getLayout()).columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    ((GridBagLayout)contentPane.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    ((GridBagLayout)contentPane.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
    ((GridBagLayout)contentPane.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};


    label3.setText("Project v1");
    label3.setFont(label3.getFont().deriveFont(label3.getFont().getSize() + 38f));
    contentPane.add(label3, new GridBagConstraints(11, 4, 13, 5, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 4, 5), 0, 0));


    label1.setText("Username: ");
    contentPane.add(label1, new GridBagConstraints(10, 9, 3, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 4, 5), 0, 0));
    contentPane.add(textField1, new GridBagConstraints(13, 9, 8, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 4, 5), 0, 0));


    label2.setText("Password:");
    contentPane.add(label2, new GridBagConstraints(10, 11, 3, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 4, 5), 0, 0));
    contentPane.add(passwordField1, new GridBagConstraints(13, 11, 8, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 4, 5), 0, 0));


    button1.setText("Login");
    button1.addActionListener(e -> button1ActionPerformed(e));
    contentPane.add(button1, new GridBagConstraints(11, 13, 5, 2, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 4, 5), 0, 0));


    button2.setText("Register");
    button2.setActionCommand("Register");
    button2.addActionListener(e -> button2ActionPerformed(e));
    contentPane.add(button2, new GridBagConstraints(17, 13, 5, 2, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 4, 5), 0, 0));
    pack();
    setLocationRelativeTo(getOwner());
    setVisible(true);
                    setResizable(false);
    }

    private JLabel label3;
    private JLabel label1;
    private JTextField textField1;
    private JLabel label2;
    private JPasswordField passwordField1;
    private JButton button1;
    private JButton button2;


    public static void main(String[] args) {
    new loginInterface();
    }
    }

    my register interface

    Code: [Select]
    import java.awt.*;
    import javax.swing.*;



    public class registerButton extends JFrame {
    public registerButton() {
    initComponents();
    }

    private void initComponents() {

    label1 = new JLabel();
    textField1 = new JTextField(10);
    label2 = new JLabel();
    passwordField1 = new JPasswordField(10);
    label3 = new JLabel();
    passwordField2 = new JPasswordField(10);
    label4 = new JLabel();
    textField3 = new JTextField(20);
    label5 = new JLabel();
    textField4 = new JTextField(20);
    JButton button = new JButton();



    setName("Register Screen");
    Container contentPane = getContentPane();
    contentPane.setLayout(new GridBagLayout());
    ((GridBagLayout)contentPane.getLayout()).columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    ((GridBagLayout)contentPane.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    ((GridBagLayout)contentPane.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0E-4};
    ((GridBagLayout)contentPane.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0E-4};


    label1.setText("Username:");
    contentPane.add(label1, new GridBagConstraints(1, 2, 4, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(textField1, new GridBagConstraints(5, 2, 8, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));


    label2.setText("Password:");
    contentPane.add(label2, new GridBagConstraints(1, 4, 4, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(passwordField1, new GridBagConstraints(6, 4, 8, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));


    label3.setText("Confirm Password:");
    contentPane.add(label3, new GridBagConstraints(1, 6, 7, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(passwordField2, new GridBagConstraints(8, 6, 7, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));


    label4.setText("E-Mail:");
    contentPane.add(label4, new GridBagConstraints(1, 8, 3, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(textField3, new GridBagConstraints(4, 8, 10, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));


    label5.setText("Confirm E-Mail:");
    contentPane.add(label5, new GridBagConstraints(1, 10, 5, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));
    contentPane.add(textField4, new GridBagConstraints(7, 10, 9, 1, 0.0, 0.0,
    GridBagConstraints.CENTER, GridBagConstraints.BOTH,
    new Insets(0, 0, 0, 0), 0, 0));

    button.setName("Register");
    button.setVisible(true);
    setTitle("Register");
    setSize(300,400);
    setVisible(true);
    pack();
    setLocationRelativeTo(getOwner());

    }

    private JLabel label1;
    private JTextField textField1;
    private JLabel label2;
    private JPasswordField passwordField1;
    private JLabel label3;
    private JPasswordField passwordField2;
    private JLabel label4;
    private JTextField textField3;
    private JLabel label5;
    private JTextField textField4;

    }


    I'm not sure what else you may need to help me so if anything let me know and i'll give you what I have
    Runescape Gambling

    Runescape Gambling

    OfflineDidthathurt22

    • Member
    • **
    • Posts: 17
    • Thanks: +0/-0
      • View Profile
    Re: create file and read file
    « Reply #2 on: August 30, 2015, 05:38:15 PM »
    Thanks sk8r that does give me some basic idea of what I can do to make this happen, I'm pushing myself through all these walls that keep popping up on me the best that I can, But I'm starting to think this "Into the Fire" approach on this is a bit much.. defiantly starting to feel overwhelmed.. Thinking i should have started with a simpler project lol.
    Runescape Gambling


    OfflineDidthathurt22

    • Member
    • **
    • Posts: 17
    • Thanks: +0/-0
      • View Profile
    Re: create file and read file
    « Reply #4 on: August 30, 2015, 09:39:07 PM »
    Thanks again I think I'm going to start taking it slower and go for a bit simpler projects until i get used to it.

    OfflineRodgerwilco

    • Member
    • ****
    • Posts: 3,743
    • Thanks: +0/-0
      • View Profile
    Re: create file and read file
    « Reply #5 on: August 30, 2015, 10:24:26 PM »
    You probably should not name your class "Interface", might confuse people...

    https://docs.oracle.com/javase/tutorial/java/concepts/interface.html
    RSC Update: JMods still lack interest. Lots and lots of debating.
    Another Update: Jagex still doesn't a fk. GG Community

    OfflinePwnd

    • pround player of moparscape.org
    • Member
    • ****
    • *
    • *
    • Posts: 8,553
    • Thanks: +0/-0
      • View Profile
    Re: create file and read file
    « Reply #6 on: September 01, 2015, 08:56:00 AM »
    Class naming conventions say to NameShitLikeThis as well.
    [ +lawl ] web dev more like pleb dev

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal