AdminMain() { l = new JLabel(); l.setBounds(10, 20, 1340, 1000); l.setBackground(Color.black); Font ft = new Font("Arial", Font.BOLD, 30); Font ft1 = new Font("Arial", Font.BOLD, 14); Font ft2 = new Font("Arial", Font.BOLD, 20); f1 = new Frame("Soft Test Management (Beta)"); f1.setLayout(null); l1 = new Label("Test Instructions", l1.CENTER); l1.setBounds(10, 20, 1300, 60); l1.setForeground(Color.blue); l1.setBackground(Color.white); l1.setFont(ft); l2 = new JLabel("Deletion of Faculty/Students"); l2.setBounds(20, 30, 1000, 500); l2.setBackground(Color.blue); l2.setFont(ft2); l3 = new JLabel("Test Pattern"); l3.setBounds(20, 90, 1300, 500); l3.setBackground(Color.green); l3.setFont(ft2); b1 = new JButton("Go !"); b1.setBounds(300, 220, 120, 30); b1.setBackground(Color.white); b1.setForeground(Color.blue); b1.setFont(ft2); b2 = new JButton("Go"); b2.setBounds(300, 240, 120, 30); b2.setBackground(Color.white); b2.setForeground(Color.blue); b2.setFont(ft2); f1.add(l); l.add(l1); l2.add(b1); l.add(l2); l3.add(b2); l.add(l3); b1.addActionListener(this); b2.addActionListener(this); f1.setVisible(true); f1.setSize(1800, 800); }
public Deta_Ventas_r() { setBackground(Color.gray); setLayout(null); setSize(400, 400); l1 = new Label(" clave "); t1 = new TextField(36); l2 = new Label("Vendedor"); t2 = new TextField(20); l3 = new Label("Cliente"); t3 = new TextField(20); l4 = new Label("Fechas"); t4 = new TextField(5); l5 = new Label("monto_final"); t5 = new TextField(5); t4.setEditable(false); t5.setEditable(false); b = new Button("Registrar"); add(l1); add(t1); add(l2); add(t2); add(l3); add(t3); add(l4); add(t4); add(l5); add(t5); add(b); l1.setBounds(24, 75, 71, 23); l2.setBounds(24, 103, 90, 23); l3.setBounds(24, 131, 90, 23); l4.setBounds(24, 159, 90, 23); l5.setBounds(24, 185, 90, 23); t1.setBounds(114, 75, 270, 23); t2.setBounds(114, 103, 270, 23); t3.setBounds(114, 131, 270, 23); t4.setBounds(114, 159, 270, 23); t5.setBounds(114, 185, 270, 23); b.setBounds(167, 215, 65, 23); b.addActionListener(this); setUndecorated(true); setLocation((Toolkit.getDefaultToolkit().getScreenSize().width / 2) - 200, 50); start(); }
public LoginScreen(final Home hm) { setSize(600, 550); setLayout(null); this.hm = hm; name = new Label("Username : "******"Password :"******"login"); login.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { if (isValidUser()) { hm.removeAll(); hm.userId = nameText.getText(); hm.p2 = new BaseApplet(hm); hm.p2.setBounds(0, 50, 600, 550); hm.add(hm.p2); hm.revalidate(); } else { JOptionPane.showMessageDialog( null, "Invalid Credentials", "Alert", JOptionPane.OK_OPTION); } } catch (Exception e1) { System.out.println("Error"); } } }); login.setBounds(200, 150, 100, 30); add(login); }
public p2() throws Exception { // setBorder(BorderFactory.createEtchedBorder(Color.lightGray, Color.DARK_GRAY)); p = new JPanel(); // setBackground(Color.white); p.setLayout(new GridLayout(11, 3)); p.setBounds(0, 20, 309, 130); un = new JLabel("* Username"); ps1 = new JLabel("* Password"); ps2 = new JLabel("* Confirm Password"); fn = new JLabel("* First Name"); ln = new JLabel(" Last Name"); eid = new JLabel("* Email ID"); mb = new JLabel("* Mobile"); cct = new JLabel("* Current City"); hquali = new JLabel("* Highest Qualification"); dob = new JLabel(" DOB"); dober = new JLabel(); dd = new JLabel("DD"); mm = new JLabel("MM"); yy = new JLabel("YY"); member = new Label(" already a member?"); member.addMouseListener(this); er1 = new Label(""); er2 = new Label(""); er3 = new Label(""); er4 = new Label(""); er5 = new Label(""); er6 = new Label(""); er7 = new Label(""); er8 = new Label(""); er9 = new Label(""); er10 = new Label(""); un1 = new JTextField(15); ps11 = new JPasswordField(15); ps21 = new JPasswordField(15); fn1 = new JTextField(15); ln1 = new JTextField(15); eid1 = new JTextField(15); mb1 = new JTextField(15); cct1 = new JTextField(15); hquali1 = new JTextField(15); dober1 = new JTextField(2); dober2 = new JTextField(2); dober3 = new JTextField(2); sub = new JButton("Sign up"); sub.setBorderPainted(false); sub.setFocusable(true); sub.addActionListener(this); dober.setLayout(new FlowLayout()); dober.add(dober1); dober.add(dd); dober.add(dober2); dober.add(mm); dober.add(dober3); dober.add(yy); p.add(fn); p.add(fn1); p.add(er1); p.add(ln); p.add(ln1); p.add(er2); p.add(un); p.add(un1); p.add(er3); p.add(ps1); p.add(ps11); p.add(er4); p.add(ps2); p.add(ps21); p.add(er5); p.add(eid); p.add(eid1); p.add(er6); p.add(mb); p.add(mb1); p.add(er7); p.add(cct); p.add(cct1); p.add(er8); p.add(hquali); p.add(hquali1); p.add(er9); p.add(dob); p.add(dober); p.add(er10); p.add(sub); p.add(member); add(p); }
public void actionPerformed(ActionEvent e) { p2.str1 = fn1.getText(); p2.str2 = ln1.getText(); p2.str3 = un1.getText(); p2.str4 = ps11.getText(); p2.str5 = eid1.getText(); p2.str6 = ps21.getText(); p2.str7 = mb1.getText(); p2.str8 = cct1.getText(); p2.str9 = hquali1.getText(); p2.str10 = dober1.getText(); p2.str11 = dober2.getText(); p2.str12 = dober3.getText(); p2.str13 = p2.str10 + "/" + p2.str11 + "/" + p2.str12; boolean bl1, bl2, bl3, bl4, bl5, bl6, bl7, bl8, bl9; bl1 = false; bl2 = false; bl3 = false; bl4 = false; bl5 = false; bl6 = false; bl7 = false; bl8 = false; if (str1.length() > 0) { // er1.setForeground(null); er1.setText(""); fn1.setBorder(BorderFactory.createLineBorder(Color.GRAY)); bl1 = true; repaint(); } else { er1.setForeground(Color.red); er1.setText("(First name can't be null)"); fn1.setBorder(BorderFactory.createLineBorder(Color.red)); repaint(); } if (str3.length() > 0) { er3.setText(""); un1.setBorder(BorderFactory.createLineBorder(Color.GRAY)); bl2 = true; repaint(); } else { er3.setForeground(Color.red); er3.setText("(Username can't be null)"); un1.setBorder(BorderFactory.createLineBorder(Color.red)); repaint(); } if (str5.length() > 0) { er6.setText(""); eid1.setBorder(BorderFactory.createLineBorder(Color.GRAY)); bl3 = true; repaint(); } else { er6.setForeground(Color.red); er6.setText("(email id can't be null)"); eid1.setBorder(BorderFactory.createLineBorder(Color.red)); repaint(); } if (str4.length() > 0) { er4.setText(""); ps11.setBorder(BorderFactory.createLineBorder(Color.GRAY)); bl4 = true; repaint(); } else { er4.setForeground(Color.red); er4.setText("(Password can't be null)"); ps11.setBorder(BorderFactory.createLineBorder(Color.red)); repaint(); } if ((str4.equals(str6))) { str6 = str4; er5.setForeground(null); er5.setText(""); ps21.setBorder(BorderFactory.createLineBorder(Color.GRAY)); bl5 = true; repaint(); } else { er5.setForeground(Color.red); er5.setText("(both pwd should be same)"); ps21.setBorder(BorderFactory.createLineBorder(Color.red)); repaint(); } if (str7.length() == 10) { er7.setText(""); mb1.setBorder(BorderFactory.createLineBorder(Color.GRAY)); bl6 = true; repaint(); } else { er7.setForeground(Color.red); er7.setText("(number should be of 10 digit)"); mb1.setBorder(BorderFactory.createLineBorder(Color.red)); repaint(); } if (str8.length() > 0) { er8.setText(""); cct1.setBorder(BorderFactory.createLineBorder(Color.GRAY)); bl7 = true; repaint(); } else { er8.setForeground(Color.red); er8.setText("(Current City can't be null)"); cct1.setBorder(BorderFactory.createLineBorder(Color.red)); repaint(); } if (str9.length() > 0) { er9.setText(""); hquali1.setBorder(BorderFactory.createLineBorder(Color.GRAY)); bl8 = true; repaint(); } else { er9.setForeground(Color.red); er9.setText("(Highest Qualif. can't be null)"); hquali1.setBorder(BorderFactory.createLineBorder(Color.red)); repaint(); } try { if ((bl1 && bl2 && bl3 && bl4 && bl5 && bl6 && bl7 && bl8) == true) { JOptionPane.showMessageDialog(null, "Data submitting "); p2.goer(); } } catch (Exception e3) { } }
mupdate() { f = new JFrame("POS"); p = new Panel(); l1 = new Label("Welcome:Admin"); l2 = new Label("POINT OF SALE"); l14 = new Label("Enter Manager_Id"); l3 = new Label("Name"); l4 = new Label("Father's_Name"); l5 = new Label("Manager_Id"); l6 = new Label("Password"); l7 = new Label("Gender"); l9 = new Label("Address"); l8 = new Label("D.O.B."); l10 = new Label("Contact_No."); l11 = new Label("E-Mail_Id"); l12 = new Label("Location"); l13 = new Label( "_______________________________________________________________________________________________"); l15 = new Label( "_______________________________________________________________________________________________________________________"); cbg = new CheckboxGroup(); c1 = new Checkbox("Male", cbg, false); c2 = new Checkbox("Female", cbg, false); t11 = new TextField(); t2 = new TextField(); t3 = new TextField(); t4 = new TextField(); t5 = new TextField(); t6 = new TextField(); t7 = new TextField(); t8 = new TextField(); t9 = new TextField(); t10 = new TextField(); try { t1 = new Choice(); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:raman1"); Statement stm = con.createStatement(); ResultSet rs = stm.executeQuery("select * from mprofile"); while (rs.next()) { String a2 = rs.getString(3); t1.add(a2); } } catch (Exception e) { System.out.println(e); } b1 = new Button("Search"); b2 = new Button("Update"); b3 = new Button("Calendar"); b4 = new Button("Close"); b5 = new Button("Back"); b6 = new Button("Logout"); f1 = new Font("sherif", Font.BOLD | Font.ITALIC, 45); f2 = new Font("sherif", Font.BOLD | Font.ITALIC, 30); f3 = new Font("sherif", Font.BOLD | Font.ITALIC, 35); f4 = new Font("sherif", Font.BOLD, 20); f5 = new Font("sherif", Font.BOLD | Font.ITALIC, 15); f6 = new Font("sherif", Font.BOLD | Font.ITALIC, 20); l1.setFont(f5); l2.setFont(f1); l3.setFont(f6); l4.setFont(f6); l5.setFont(f6); l6.setFont(f6); l7.setFont(f6); l8.setFont(f6); l9.setFont(f6); l10.setFont(f6); l11.setFont(f6); l12.setFont(f6); l13.setFont(f6); l14.setFont(f6); b1.setFont(f6); b2.setFont(f6); b3.setFont(f6); b4.setFont(f6); b5.setFont(f6); b6.setFont(f6); }
void launch() { f.setSize(800, 800); p.setLayout(null); l1.setBounds(600, 10, 150, 36); l2.setBounds(100, 30, 400, 70); l13.setBounds(2, 90, 1200, 20); l14.setBounds(80, 150, 250, 30); t1.setBounds(330, 150, 150, 30); b1.setBounds(500, 150, 100, 30); l15.setBounds(2, 200, 1200, 20); b6.setBounds(600, 50, 100, 30); l3.setBounds(100, 250, 100, 30); t2.setBounds(300, 250, 150, 30); l4.setBounds(100, 300, 150, 30); t3.setBounds(300, 300, 150, 30); l5.setBounds(100, 350, 150, 30); t4.setBounds(300, 350, 150, 30); l6.setBounds(100, 400, 100, 30); t5.setBounds(300, 400, 150, 30); l7.setBounds(100, 450, 100, 30); c1.setBounds(300, 450, 60, 30); c2.setBounds(400, 450, 60, 30); l8.setBounds(100, 500, 100, 30); t6.setBounds(300, 500, 150, 30); l9.setBounds(100, 550, 100, 30); t7.setBounds(300, 550, 150, 30); l10.setBounds(100, 600, 120, 30); t8.setBounds(300, 600, 150, 30); l11.setBounds(100, 650, 100, 30); t9.setBounds(300, 650, 150, 30); l12.setBounds(100, 700, 150, 30); t10.setBounds(300, 700, 150, 30); b2.setBounds(500, 400, 100, 30); b3.setBounds(500, 500, 100, 30); b4.setBounds(500, 600, 100, 30); b5.setBounds(650, 150, 100, 30); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); b5.addActionListener(this); b6.addActionListener(this); c1.addItemListener(this); c2.addItemListener(this); p.add(l1); p.add(l2); p.add(l13); p.add(l14); p.add(t1); p.add(b1); p.add(l15); p.add(b5); p.add(b6); f.add(p); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
public void start(Stage primaryStage) throws Exception { // Connecting to Access DB connect(); // Declaration of variable window as primaryStage window = primaryStage; window.setTitle("Icooköp"); primaryStage.setTitle("Icooköp"); // Calls method closeProgram() also when terminating the program window.setOnCloseRequest(e -> closeProgram()); // ---------------------SCENE1-------------------------- // Scene 1 Welcome Label Label labelScene1 = new Label(); labelScene1.setText("Välkommen till Icooköp beta v0.2!"); labelScene1.setFont(Font.font("Verdana", 20)); // Scene 1 left menu with spacing VBox scene1leftMenu = new VBox(15); scene1leftMenu.setPadding(new Insets(20, 20, 20, 20)); // Calls closeProgram() Button s1q1 = new Button("Avsluta"); s1q1.setOnAction(e -> closeProgram()); // Displays all available product types Button s1b1 = new Button("Visa produkttyper"); s1b1.setOnAction(e -> createStatement()); // TableView object for displaying database data. tableview = new TableView(); // TextField for user input of a selected product. Label s1l1 = new Label(); s1l1.setText("Visa märken till produktgrupp"); // Calls preparedStatement with product parameter choiceBox1 = new ChoiceBox<>(); getProductTypes(); choiceBox1 .getSelectionModel() .selectedItemProperty() .addListener((v, oldValue, newValue) -> preparedStatement(newValue)); // Button for switching to scene 2 (insertStamkund) Button s1b3 = new Button("Lägg till stamkund"); s1b3.setOnAction(e -> window.setScene(scene2)); // Label for drop down menu Label s1l2 = new Label(); s1l2.setText("Se butiksaldo"); // Creating ChoiceBox (drop down) with all the stores. // When choosing a store, storeStock() method is called for that store. choiceBox2 = new ChoiceBox<>(); getStores(); choiceBox2 .getSelectionModel() .selectedItemProperty() .addListener((v, oldValue, newValue) -> storeStock(newValue)); // Adding buttons, labels, text fields and choicebox (drop down) to left menu scene1leftMenu .getChildren() .addAll(labelScene1, s1q1, s1b1, s1l1, choiceBox1, s1b3, s1l2, choiceBox2); // Creating BorderPane object and aligning left and center content BorderPane Borderpane1 = new BorderPane(); Borderpane1.setLeft(scene1leftMenu); Borderpane1.setCenter(tableview); // Setting scene 1 using BorderPane1. Both scenes have identical dimensions. scene1 = new Scene(Borderpane1, 700, 500); // ------------------- SCENE2 (insert Stamkund) -------------------- // HBox for scene 2 created and a Label for it. HBox scene2topMenu = new HBox(); Label labelScene2 = new Label(); labelScene2.setText("Lägg till stamkund"); labelScene2.setFont(Font.font("Verdana", 20)); // Left menu VBox created. VBox scene2leftMenu = new VBox(15); // Scene 2 Main manu and Quit Button created Button s2b1 = new Button("Huvudmeny"); s2b1.setOnAction(e -> window.setScene(scene1)); Button s2q1 = new Button("Avsluta"); s2q1.setOnAction(e -> closeProgram()); // GridPane for scene 2 created with spacing GridPane s2grid = new GridPane(); s2grid.setPadding(new Insets(10, 10, 10, 10)); s2grid.setVgap(15); s2grid.setHgap(10); // Label displaying required input fields Label oblLabel = new Label("* = Obligatoriskt fält"); GridPane.setConstraints(oblLabel, 0, 0); // Label for prnParam Label pnrLabel = new Label("*Personnummer:"); GridPane.setConstraints(pnrLabel, 0, 1); // pnrParam is forced by regular expression to "6 digits"-"dash"-"4 digits" FormattedTextField pnrParam = new FormattedTextField("^\\d{6}-\\d{4}$"); pnrParam.setPromptText("XXXXXX-XXXX"); GridPane.setConstraints(pnrParam, 1, 1); // Label for fnameParam Label fnameLabel = new Label("*Förnamn:"); GridPane.setConstraints(fnameLabel, 0, 2); // First name TextField TextField fnameParam = new TextField(); fnameParam.setPromptText("t.ex. Arne"); GridPane.setConstraints(fnameParam, 1, 2); // Label for snameParam Label snameLabel = new Label("*Efternamn:"); GridPane.setConstraints(snameLabel, 0, 3); // Surname TextField TextField snameParam = new TextField(); snameParam.setPromptText("t.ex. Andersson"); GridPane.setConstraints(snameParam, 1, 3); // Label for addrParam Label addrLabel = new Label("*Adress:"); GridPane.setConstraints(addrLabel, 0, 4); // Address TextField TextField addrParam = new TextField(); addrParam.setPromptText("t.ex. Storgatan 1"); GridPane.setConstraints(addrParam, 1, 4); // Label for mailParam Label mailLabel = new Label("E-post:"); GridPane.setConstraints(mailLabel, 0, 5); // Mail TextField TextField mailParam = new TextField(); mailParam.setPromptText("*****@*****.**"); GridPane.setConstraints(mailParam, 1, 5); // Label for cellParam Label cellLabel = new Label("Mobilnummer:"); GridPane.setConstraints(cellLabel, 0, 6); // cellParam is forced by regular expression to "3 digits"-"dash"-"7 digits" FormattedTextField cellParam = new FormattedTextField("^\\d{3}-\\d{7}$"); cellParam.setPromptText("XXX-XXXXXXX"); GridPane.setConstraints(cellParam, 1, 6); // This Label displays user information such as errors and confirmations. Label executeLabel = new Label(); GridPane.setConstraints(executeLabel, 1, 8); // Adding Button "Registrera" with a lot of functionality Button s2b2 = new Button("Registrera"); GridPane.setConstraints(s2b2, 1, 7); s2b2.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { // First if-statement checks for data in required fields. // Required: pnrParam, fnameParam, lnameParam and addrParam. if ((pnrParam.getText() != null && !pnrParam.getText().isEmpty()) && (fnameParam.getText() != null && !fnameParam.getText().isEmpty()) && (snameParam.getText() != null && !snameParam.getText().isEmpty()) && (addrParam.getText() != null && !addrParam.getText().isEmpty())) { // Second if-statement calls checkPnr() to see if pnrParam (Personnummer) // is unique in database. If unique, checkPnr() returns False. // If !checkPnr = True, all data is valid and we run insertStamkund if (!checkPnr(pnrParam.getText())) { // Calls insertStamkund() with data from all TextFields. // Saves card number to integer cardParam. int cardParam = insertStamkund( pnrParam.getText(), fnameParam.getText(), snameParam.getText(), addrParam.getText(), mailParam.getText(), cellParam.getText()); // Converts cardParam value to String c. // Prints a welcoming and customer card number. String c = String.valueOf(cardParam); executeLabel.setText( "Välkommen som stamkund hos Icooköp!\n" + "Ditt kortnummer är: " + c); // Clear TextFields pnrParam.clear(); fnameParam.clear(); snameParam.clear(); addrParam.clear(); mailParam.clear(); cellParam.clear(); } // If !checkPnr = False, pnrParam is already in database and user is notified. else { executeLabel.setText( "Personnumret finns redan registrerat!\n" + "Välj ett annat tack."); } } // If any required fields are empty, user is notified. else { executeLabel.setText("Fyll i alla obligatoriska fält!"); } } }); // Button for clearing data in all TextFields and executeLabel Button s2b3 = new Button("Rensa fält"); GridPane.setConstraints(s2b3, 0, 7); s2b3.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { pnrParam.clear(); fnameParam.clear(); snameParam.clear(); addrParam.clear(); mailParam.clear(); cellParam.clear(); executeLabel.setText(null); } }); // Adding buttons to left and top menus scene2leftMenu.getChildren().addAll(s2b1, s2q1); scene2topMenu.getChildren().add(labelScene2); // Adding Labels and TextFields to scene 2 center grid s2grid .getChildren() .addAll( oblLabel, pnrLabel, pnrParam, fnameLabel, fnameParam, snameLabel, snameParam, addrLabel, addrParam, mailLabel, mailParam, cellLabel, cellParam, s2b2, s2b3, executeLabel); // Creating BorderPane object and aligning left, top and center content BorderPane Borderpane2 = new BorderPane(); Borderpane2.setLeft(scene2leftMenu); Borderpane2.setTop(scene2topMenu); Borderpane2.setCenter(s2grid); // Setting scene 2 using BorderPane2. Both scenes have identical dimensions. scene2 = new Scene(Borderpane2, 700, 500); // Setting primary scene and display window window.setScene(scene1); window.show(); }