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 Welcome() { c.setLayout(null); c.add(welcome); welcome.setBounds(250, 100, 600, 50); welcome.setFont(font1); welcome.setForeground(Color.black); c.add(hotel); hotel.setBounds(350, 170, 700, 50); hotel.setFont(font2); hotel.setForeground(Color.black); c.add(check); check.setBounds(450, 350, 250, 50); check.addActionListener(this); c.add(order); order.setBounds(150, 350, 250, 50); order.addActionListener(this); c.add(bill); bill.setBounds(750, 350, 250, 50); bill.addActionListener(this); c.add(exit); exit.setBounds(40, 600, 130, 20); exit.addActionListener(this); c.add(back).setBounds(0, 0, 1800, 1000); }
public CFFreeSwitchSwingAuditActionAttrJPanel( ICFFreeSwitchSwingSchema argSchema, ICFSecurityAuditActionObj argFocus) { super(); JLabel label; JComponent compo; CFJReferenceEditor reference; final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; setSwingFocusAsAuditAction(argFocus); final int spacing = 5; int y = spacing; final int height = 25; final int textheight = 80; final int vspacing = height + spacing; final int textvspacing = textheight + spacing; final int labelx = spacing; final int labelwidth = 200; final int fieldx = labelx + labelwidth + spacing; final int fieldwidth = 785; final int panelwidth = fieldx + fieldwidth + spacing; // temporary -- I think you have to have a panel bigger than the coordinates initially setSize(panelwidth, 100000); label = getSwingLabelAuditActionId(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorAuditActionId(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelDescription(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorDescription(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; // Now we can set the proper size based on the fields and references populated setSize(panelwidth, y); Dimension pfsz = new Dimension(panelwidth, y); setPreferredSize(pfsz); Dimension min = new Dimension(400, y); setMinimumSize(min); populateFields(); adjustComponentEnableStates(); swingIsInitializing = false; }
public void doLayout() { JLabel label; JComponent compo; CFJReferenceEditor reference; Dimension dim; final int spacing = 5; int y = spacing; final int height = 25; final int textheight = 80; final int vspacing = height + spacing; final int textvspacing = textheight + spacing; final int labelx = spacing; final int labelwidth = 200; final int fieldx = labelx + labelwidth + spacing; final int fieldwidth = 1024; Dimension jpsz = getSize(); int usefieldwidth = jpsz.width - 215; label = getSwingLabelId(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorId(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelFullDomainName(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorFullDomainName(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelDescription(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorDescription(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; }
public void tampilan_GUI() { this.getContentPane().setBackground(Color.yellow); this.getContentPane().setLayout(null); jLabel1.setFont(new java.awt.Font("Dialog", 1, 16)); jLabel1.setText("Please Waiting..."); jLabel1.setBounds(new Rectangle(14, 5, 187, 30)); prosesBar.setBounds(new Rectangle(14, 40, 311, 16)); prosesBar.setStringPainted(true); statusProses.setText(""); statusProses.setBounds(new Rectangle(14, 60, 311, 16)); this.getContentPane().add(jLabel1); this.getContentPane().add(prosesBar); this.getContentPane().add(statusProses); }
Jf() { j.setBounds(500, 40, 500, 500); j.setVisible(true); j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); j.setLayout(null); ImageIcon image = new ImageIcon("im1.jpg"); JLabel l = new JLabel(image); int m = image.getIconWidth(); int m1 = image.getIconHeight(); j.setResizable(false); // frame resize nahi hoga l.setBounds(0, 0, m, m1); j.add(l); l.add(linfo); l.add(lid); l.add(fid); l.add(lpass); l.add(fpass); fpass.setEchoChar('*'); l.add(blogin); l.add(bnewaccount); l.add(bforget); ImageIcon image1 = new ImageIcon("logo1.png"); JLabel limage = new JLabel(image1); l.add(limage); limage.setBounds(10, 50, 190, 130); Font f = new Font("ALGERIAN", Font.BOLD, 20); linfo.setFont(f); linfo.setBounds(40, 10, 420, 30); lid.setBounds(210, 50, 70, 30); fid.setBounds(290, 50, 150, 30); lpass.setBounds(210, 90, 70, 30); fpass.setBounds(290, 90, 150, 30); blogin.setBounds(210, 130, 100, 50); bnewaccount.setBounds(320, 130, 160, 20); bforget.setBounds(320, 160, 160, 20); blogin.setBackground(Color.green); bnewaccount.setBackground(Color.cyan); bforget.setBackground(Color.pink); blogin.addActionListener(new Login()); bnewaccount.addActionListener(new Account()); bforget.addActionListener(new Forget()); }
public void doLayout() { JLabel label; JComponent compo; CFJReferenceEditor reference; Dimension dim; final int spacing = 5; int y = spacing; final int height = 25; final int textheight = 80; final int vspacing = height + spacing; final int textvspacing = textheight + spacing; final int labelx = spacing; final int labelwidth = 200; final int fieldx = labelx + labelwidth + spacing; final int fieldwidth = 1024; Dimension jpsz = getSize(); int usefieldwidth = jpsz.width - 215; label = getSwingLabelContainerTenant(); label.setBounds(labelx, y, labelwidth, height); reference = getSwingReferenceContainerTenant(); reference.setBounds(fieldx, y, usefieldwidth, height); y = y + vspacing; label = getSwingLabelTSecGroupId(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorTSecGroupId(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelName(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorName(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; }
/** Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setVisible(true); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JButton btnCustomer = new JButton("Customer"); btnCustomer.setFont(new Font("Tahoma", Font.BOLD, 16)); btnCustomer.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { JOptionPane.showMessageDialog(null, "Welcome to Coffee Kiosk "); // Coffee1 nw = new Coffee1(); // nw.NewScreen(); cust = cust + 1; Customer cs = new Customer(); cs.CustomerScreen(); } }); btnCustomer.setBounds(83, 94, 117, 86); frame.getContentPane().add(btnCustomer); JButton btnAdmin = new JButton("Admin"); btnAdmin.setFont(new Font("Tahoma", Font.BOLD, 16)); btnAdmin.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "Welcome Admin "); Login ls = new Login(); ls.LoginScreen(); } }); btnAdmin.setBounds(229, 94, 117, 86); frame.getContentPane().add(btnAdmin); JButton btnExit = new JButton("EXIT"); btnExit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { JOptionPane.showMessageDialog(null, "Thank You for using Coffee Kiosk"); System.exit(0); } }); btnExit.setBounds(168, 207, 89, 23); frame.getContentPane().add(btnExit); JLabel lblLeedsCoffeeKiosk = new JLabel("LEEDS COFFEE KIOSK"); lblLeedsCoffeeKiosk.setHorizontalAlignment(SwingConstants.CENTER); lblLeedsCoffeeKiosk.setFont(new Font("Times New Roman", Font.BOLD | Font.ITALIC, 30)); lblLeedsCoffeeKiosk.setForeground(new Color(148, 0, 211)); lblLeedsCoffeeKiosk.setBounds(36, 11, 366, 72); frame.getContentPane().add(lblLeedsCoffeeKiosk); }
public void actionPerformed(ActionEvent e) { JButton b = (JButton) e.getSource(); if (b == bu) { j14 = new JLabel("NEW IMAGE"); j14.setBounds(840, 200, 300, 300); q.add(j14); JFileChooser filechooser = new JFileChooser(); int result = filechooser.showOpenDialog(this); f = filechooser.getSelectedFile(); try { String dir1 = f.getAbsolutePath(); // setText(dir); str = dir1; // ResizeImage.resize(dir); f = new File(dir1); } catch (Exception e1) { } repaint(); // b=(JButton)e.getSource(); } if (b == ba) { try { read(); patient.add(tadd.getText(), tsym.getText(), f, str); JOptionPane.showMessageDialog(null, "Patient ID: " + patient.pid + " Record Added"); } catch (Exception e4) { System.out.println("" + e4); } } if (b == bm) { try { setVisible(false); } catch (Exception e4) { System.out.println("" + e4); } } }
public Design() throws Exception { super.setBackground(Color.BLACK); this.setTitle(""); con = getContentPane(); con.setLayout(null); dim = tk.getDefaultToolkit().getScreenSize(); this.setTitle("Customer Peer Login"); l1 = new JLabel(new ImageIcon("plain.jpg")); l1.setBounds(0, 0, 400, 400); con.add(l1); l1.setBorder(BorderFactory.createEtchedBorder(5, Color.black, Color.black)); title = new JLabel("CUSTOMER PEER LOGIN "); title.setFont(new Font("Bookman Old Style", Font.ROMAN_BASELINE, 20)); title.setForeground(Color.red); title.setBounds(80, 30, 300, 30); l1.add(title); l4 = new JLabel("CMACHINE NAME"); l4.setFont(new Font("Bookman Old Style", Font.BOLD, 16)); l4.setForeground(Color.BLUE); l4.setBounds(70, 100, 160, 20); // l4.setBorder(BorderFactory.createEtchedBorder(5,Color.green,Color.green)); l1.add(l4); jtf2 = new JTextField(); jtf2.setBounds(250, 100, 100, 20); jtf2.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green)); l1.add(jtf2); l2 = new JLabel("CUSER LOGIN"); l2.setFont(new Font("Bookman Old Style", Font.BOLD, 16)); l2.setForeground(Color.blue); l2.setBounds(70, 150, 120, 20); l1.add(l2); jtf1 = new JTextField(); jtf1.setBounds(250, 150, 100, 20); jtf1.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green)); l1.add(jtf1); l3 = new JLabel("CPASSWORD"); l3.setFont(new Font("Bookman Old Style", Font.BOLD, 16)); l3.setForeground(Color.blue); l3.setBounds(70, 200, 120, 20); l1.add(l3); jptf1 = new JPasswordField(); jptf1.setBounds(250, 200, 100, 20); jptf1.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green)); l1.add(jptf1); JLabel l4 = new JLabel("DAgent"); l4.setFont(new Font("Bookman Old Style", Font.BOLD, 16)); l4.setForeground(Color.blue); l4.setBounds(70, 250, 120, 20); l1.add(l4); box = new JComboBox(); box.setBounds(250, 250, 100, 20); box.setBorder(BorderFactory.createEtchedBorder(5, Color.green, Color.green)); l1.add(box); b2 = new JButton("Register"); b2.setBounds(50, 300, 100, 20); l1.add(b2); b2.setBorder(BorderFactory.createEtchedBorder(10, Color.BLUE, Color.BLUE)); b3 = new JButton("Login"); b3.setBounds(150, 300, 100, 20); b3.setBorder(BorderFactory.createEtchedBorder(10, Color.BLUE, Color.BLUE)); l1.add(b3); b1 = new JButton("Cancel"); b1.setBounds(250, 300, 100, 20); b1.setBorder(BorderFactory.createEtchedBorder(10, Color.BLUE, Color.BLUE)); l1.add(b1); b1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent we) { dispose(); } }); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); conn = DriverManager.getConnection("jdbc:odbc:agent"); } catch (Exception exp) { } try { Statement satem = conn.createStatement(); ResultSet rsatem = satem.executeQuery("select * from Dagent"); while (rsatem.next()) { String namem = rsatem.getString("uname"); box.addItem(namem); } } catch (Exception expo1) { } b2.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent we) { String username = jtf1.getText().trim(); String password = jptf1.getText().trim(); String mechine = jtf2.getText().trim(); String dname = box.getSelectedItem().toString(); int porte = 0; try { Statement sate = conn.createStatement(); ResultSet rsate = sate.executeQuery("select * from Dagent where uname='" + dname + "'"); if (rsate.next()) { servermachine = rsate.getString("umechine"); porte = rsate.getInt("ulistport"); System.out.println(servermachine); } System.out.println(servermachine); } catch (Exception exp) { exp.printStackTrace(); } try { packet p = new packet(); p.setaction("Creg"); p.setCuser(username); p.setCpass(password); p.setCmname(mechine); p.setCDpeer(dname); Socket soc = new Socket(servermachine, porte); ObjectOutputStream out = new ObjectOutputStream(soc.getOutputStream()); out.writeObject(p); ObjectInputStream in = new ObjectInputStream(soc.getInputStream()); packet rpac = (packet) in.readObject(); if (rpac.getaction().equals("ok")) { JOptionPane.showMessageDialog(null, "Sucessfully Registered"); jtf2.setText(""); jtf1.setText(""); jptf1.setText(""); } else { JOptionPane.showMessageDialog(null, "Already Registered"); jtf2.setText(""); jtf1.setText(""); jptf1.setText(""); } } catch (Exception exp) { } } }); b3.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent we) { String username = jtf1.getText().trim(); String password = jptf1.getText().trim(); String mechine = jtf2.getText().trim(); String Dname = box.getSelectedItem().toString(); int porte = 0; try { Statement sate = conn.createStatement(); ResultSet rsate = sate.executeQuery("select * from Dagent where uname='" + Dname + "'"); if (rsate.next()) { servermachine = rsate.getString("umechine"); porte = rsate.getInt("ulistport"); System.out.println(servermachine); } System.out.println(servermachine); } catch (Exception exp) { } try { packet p1 = new packet(); p1.setaction("clogin"); p1.setCuser(username); p1.setCpass(password); p1.setCmname(mechine); p1.setCDpeer(Dname); Socket soc1 = new Socket(servermachine, porte); ObjectOutputStream out1 = new ObjectOutputStream(soc1.getOutputStream()); out1.writeObject(p1); ObjectInputStream in1 = new ObjectInputStream(soc1.getInputStream()); packet rpac1 = (packet) in1.readObject(); if (rpac1.getaction().equals("ok")) { int port1 = 0; try { int portm = rpac1.getCport(); System.out.println("XXXXXXX" + portm); // JOptionPane.showMessageDialog(null,"Sucessfully Started"); new Listen(portm); new process(username, portm); dispose(); } catch (Exception exp) { } } else { JOptionPane.showMessageDialog( null, "Enter valid username and password", "Server reply", 2); jtf1.setText(""); jtf2.setText(""); jptf1.setText(""); } } catch (Exception exp) { } } }); setSize(400, 400); show(); setLocation(150, 100); setResizable(false); }
/** Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.getContentPane().setBackground(new Color(153, 50, 204)); frame.setBounds(100, 100, 725, 547); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JLabel lblNewLabel = new JLabel("Username"); lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 18)); lblNewLabel.setBounds(119, 113, 146, 36); frame.getContentPane().add(lblNewLabel); textField = new JTextField(); textField.setBounds(355, 122, 153, 22); frame.getContentPane().add(textField); textField.setColumns(10); JLabel lblNewLabel_1 = new JLabel("Password"); lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 18)); lblNewLabel_1.setBounds(119, 213, 87, 22); frame.getContentPane().add(lblNewLabel_1); JButton btnNewButton = new JButton("Back"); btnNewButton.setFont(new Font("Tahoma", Font.PLAIN, 22)); btnNewButton.setBounds(124, 313, 121, 36); frame.getContentPane().add(btnNewButton); JButton btnNewButton_1 = new JButton("Login"); btnNewButton_1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { String query = "select * from logindetails where UserName=? and Password=?"; PreparedStatement pst = connect.prepareStatement(query); pst.setString(1, textField.getText()); pst.setString(2, passwordField.getText()); ResultSet rs = pst.executeQuery(); if (rs.next()) { // JOptionPane.showMessageDialog(null, "connection successfull"); ah.setVisible(true); frame.dispose(); } else { JOptionPane.showMessageDialog( null, "user credentials are wrong.Try again with correct credentials"); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } } }); btnNewButton_1.setFont(new Font("Tahoma", Font.PLAIN, 22)); btnNewButton_1.setBounds(424, 314, 97, 35); frame.getContentPane().add(btnNewButton_1); passwordField = new JPasswordField(); passwordField.setBounds(355, 215, 166, 22); frame.getContentPane().add(passwordField); JLabel lblNewLabel_2 = new JLabel("Administrator Login"); lblNewLabel_2.setForeground(new Color(128, 128, 128)); lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 28)); lblNewLabel_2.setBounds(199, 48, 309, 34); frame.getContentPane().add(lblNewLabel_2); }
/** Create the frame. */ public SotrudnikDialog() { setTitle( "\u041D\u043E\u0432\u044B\u0439 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A"); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setBounds(100, 100, 450, 330); contentPane = new JPanel(); contentPane.setBackground(new Color(255, 204, 255)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel label_familiya = new JLabel("\u0424\u0430\u043C\u0438\u043B\u0438\u044F"); label_familiya.setBounds(10, 37, 110, 14); contentPane.add(label_familiya); JLabel label_imya = new JLabel("\u0418\u043C\u044F"); label_imya.setBounds(10, 62, 110, 14); contentPane.add(label_imya); JLabel label_otchestvo = new JLabel("\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E"); label_otchestvo.setBounds(10, 87, 110, 14); contentPane.add(label_otchestvo); textField_otchestvo = new JTextField(); textField_otchestvo.setBounds(167, 84, 186, 20); contentPane.add(textField_otchestvo); textField_otchestvo.setColumns(10); textField_imya = new JTextField(); textField_imya.setBounds(167, 58, 186, 20); contentPane.add(textField_imya); textField_imya.setColumns(10); textField_familiya = new JTextField(); textField_familiya.setBounds(167, 33, 186, 20); contentPane.add(textField_familiya); textField_familiya.setColumns(10); JLabel label_data_priema = new JLabel( "\u0414\u0430\u0442\u0430 \u043F\u0440\u0438\u0435\u043C\u0430 \u043D\u0430 \u0440\u0430\u0431\u043E\u0442\u0443"); label_data_priema.setBounds(10, 112, 147, 14); contentPane.add(label_data_priema); JLabel label_phone = new JLabel("\u0422\u0435\u043B\u0435\u0444\u043E\u043D"); label_phone.setBounds(10, 137, 134, 14); contentPane.add(label_phone); JLabel label_doljnost = new JLabel("\u0414\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C"); label_doljnost.setBounds(10, 162, 140, 14); contentPane.add(label_doljnost); JLabel label_kvalification = new JLabel("\u041A\u0432\u0430\u043B\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F"); label_kvalification.setBounds(10, 190, 147, 14); contentPane.add(label_kvalification); textField_phone = new JTextField(); textField_phone.setBounds(167, 134, 186, 20); contentPane.add(textField_phone); textField_phone.setColumns(10); textField_date.setBounds(167, 109, 186, 20); contentPane.add(textField_date); label_id_hidden.setFont(new Font("Tahoma", Font.BOLD, 12)); label_id_hidden.setBounds(143, 11, 122, 14); contentPane.add(label_id_hidden); button_insert.setBounds(83, 230, 160, 23); contentPane.add(button_insert); button_cancel.setBounds(264, 230, 104, 23); contentPane.add(button_cancel); button_update.setBounds(83, 230, 160, 23); contentPane.add(button_update); JButton button_plus_doljnost = new JButton("+"); button_plus_doljnost.addActionListener( new ActionListener() { @SuppressWarnings("deprecation") public void actionPerformed(ActionEvent arg0) { DoljnostDialog d = new DoljnostDialog(); d.setTitle("Добавление должности"); d.show(); } }); button_plus_doljnost.setBounds(359, 159, 41, 23); contentPane.add(button_plus_doljnost); JButton button_plus_kvalification = new JButton("+"); button_plus_kvalification.addActionListener( new ActionListener() { @SuppressWarnings("deprecation") public void actionPerformed(ActionEvent arg0) { KvalificationDialog d = new KvalificationDialog(); d.setTitle("Добавление квалификации"); d.show(); } }); button_plus_kvalification.setBounds(359, 184, 41, 23); contentPane.add(button_plus_kvalification); JLabel label = new JLabel( "\u041F\u043E\u043B\u044F, \u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043D\u044B\u0435 "); label.setBounds(60, 264, 122, 14); contentPane.add(label); JLabel label_3 = new JLabel("*"); label_3.setForeground(Color.RED); label_3.setFont(new Font("Tahoma", Font.BOLD, 11)); label_3.setBounds(186, 264, 12, 14); contentPane.add(label_3); JLabel label_4 = new JLabel( "\u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B \u0434\u043B\u044F \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F!"); label_4.setBounds(197, 264, 203, 14); contentPane.add(label_4); JLabel label_5 = new JLabel("*"); label_5.setForeground(Color.RED); label_5.setFont(new Font("Tahoma", Font.BOLD, 11)); label_5.setBounds(356, 37, 12, 14); contentPane.add(label_5); JLabel label_1 = new JLabel("*"); label_1.setForeground(Color.RED); label_1.setFont(new Font("Tahoma", Font.BOLD, 11)); label_1.setBounds(356, 62, 12, 14); contentPane.add(label_1); comboBox_doljnost.setBounds(167, 159, 186, 20); contentPane.add(comboBox_doljnost); comboBox_kvalification.setBounds(167, 187, 186, 20); contentPane.add(comboBox_kvalification); // Actions for button "Добавить" button_insert.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (!textField_familiya.getText().equals("") && !textField_imya.getText().equals("")) { try { Sotrudnik s = new Sotrudnik(); s.setFamiliya(textField_familiya.getText()); s.setImya(textField_imya.getText()); s.setOtchestvo(textField_otchestvo.getText()); s.setData_priema(Date.valueOf(textField_date.getText())); s.setPhone(textField_phone.getText()); Doljnost d = (Doljnost) comboBox_doljnost.getSelectedItem(); s.setId_doljnosti(d.getId_doljnosti()); Kvalification k = (Kvalification) comboBox_kvalification.getSelectedItem(); s.setId_kvalification(k.getId_kvalification()); DBClass db = new DBClass(); db.sotrudnikUpsert(s, "INSERT"); MyFrame.updateList(); ZakazDialog.updateSotrudnik(); } catch (SQLException e) { e.printStackTrace(); JOptionPane.showMessageDialog(panelException, e.getMessage()); } catch (ClassNotFoundException ee) { ee.printStackTrace(); JOptionPane.showMessageDialog(panelException, ee.getMessage()); } finally { dispose(); } } else JOptionPane.showMessageDialog(null, "Введите обязательные параметры!"); } }); // Actions for button "Отмена" button_cancel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { dispose(); } }); // Actions for button "Сохранить изменения" button_update.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (!textField_familiya.getText().equals("") && !textField_imya.getText().equals("") && !textField_date.getText().equals("")) { if (textField_date.getText().length() == 10) { try { Integer.parseInt((textField_date.getText().substring(0, 3))); Integer.parseInt((textField_date.getText().substring(5, 6))); Integer.parseInt((textField_date.getText().substring(8, 9))); Sotrudnik s = new Sotrudnik(); s.setId_sotrudnika(Integer.parseInt(label_id_hidden.getText())); s.setFamiliya(textField_familiya.getText()); s.setImya(textField_imya.getText()); s.setOtchestvo(textField_otchestvo.getText()); s.setPhone(textField_phone.getText()); Doljnost d = (Doljnost) comboBox_doljnost.getSelectedItem(); s.setId_doljnosti(d.getId_doljnosti()); Kvalification k = (Kvalification) comboBox_kvalification.getSelectedItem(); s.setId_kvalification(k.getId_kvalification()); DBClass db = new DBClass(); db.sotrudnikUpsert(s, "UPDATE"); MyFrame.updateList(); dispose(); } catch (NumberFormatException e) { JOptionPane.showMessageDialog(panelException, e.getMessage()); } catch (SQLException e) { // e.printStackTrace(); JOptionPane.showMessageDialog(panelException, e.getMessage()); } catch (ClassNotFoundException ee) { // ee.printStackTrace(); JOptionPane.showMessageDialog(panelException, ee.getMessage()); } } else JOptionPane.showMessageDialog(null, "Введите дату в правильном формате!"); } else JOptionPane.showMessageDialog(null, "Введите обязательные параметры!"); } }); }
public void focusLost(FocusEvent e) { int id = 0; boolean res = false; JTextField t = (JTextField) e.getSource(); if (t == tpid) { try { id = Integer.parseInt(tpid.getText()); res = patient.psearch(id); } catch (Exception e1) { } if (res) { int no, ag = 0, fee = 0; String pfn = "", bg = "", pmn = "", dt1 = "", pln = "", add = "", sym = "", dn = "", dig = "", cn = "", gender = "", wgt = ""; try { dt1 = patient.rs.getString(1); no = patient.rs.getInt(2); pfn = patient.rs.getString(3); pmn = patient.rs.getString(4); pln = patient.rs.getString(5); gender = patient.rs.getString(6); ag = patient.rs.getInt(7); wgt = patient.rs.getString(8); add = patient.rs.getString(9); cn = patient.rs.getString(10); dn = patient.rs.getString(11); sym = patient.rs.getString(12); dig = patient.rs.getString(13); fee = patient.rs.getInt(14); bg = patient.rs.getString(15); dir = patient.rs.getString(17); s = dir; repaint(); j13 = new JLabel("OLD IMAGE"); j13.setBounds(840, 5, 300, 300); JLabel j12 = new JLabel("OLD PHOTO") { public void paint(Graphics g) { ImageIcon ic = new ImageIcon(s); Image img = ic.getImage(); g.drawImage(img, 0, 0, 150, 150, this); } }; // q.flushAll() /*ImageIcon ic=new ImageIcon(dir); JLabel j12=new JLabel("",ic,JLabel.CENTER);*/ j12.setBounds(670, 70, 300, 300); // image.setBounds(700,300,100,100); q.add(j12); q.add(j13); repaint(); System.out.println("8743t32874" + dir); } catch (Exception e2) { } if (gender.equals("Male")) cm.setState(true); else cf.setState(true); tdt.setText(dt1); tpfnm.setText(pfn); tpmnm.setText(pmn); tplnm.setText(pln); tage.setText("" + ag); tfee.setText("" + fee); tadd.setText(add); tdig.setText(dig); tdnm.setText(dn); tsym.setText(sym); tcno.setText(cn); twt.setText(wgt); tbg.setText(bg); // cm.setState(set1State()); // cf.setSelectedCheckbox(gender); ba.setEnabled(false); bm.setEnabled(true); bd.setEnabled(true); } else { if (id == 0) { bl.setEnabled(true); ba.setEnabled(false); } else ba.setEnabled(true); bm.setEnabled(false); bd.setEnabled(false); } } }
public patientAdd(String s) { super(s); image = new JLabel() { public void paint(Graphics g) { ImageIcon ic = new ImageIcon(str); Image img = ic.getImage(); g.drawImage(img, 0, 0, 150, 150, this); } }; image.setBounds(670, 270, 300, 300); bu = new JButton("UPLOAD"); bu.setBounds(700, 230, 100, 20); bu.addActionListener(this); // q.add(bu); ldt = new JLabel("Date"); lpid = new JLabel("Patient ID"); lpnm = new JLabel("Patient Name"); lgen = new JLabel("Gender"); lbg = new JLabel("Blood Group"); lage = new JLabel("Age"); lwt = new JLabel("Weight Kg"); ladd = new JLabel("Address"); lcno = new JLabel("Cont. no."); ldnm = new JLabel("Doctor Name Dr."); lsym = new JLabel("Symptoms"); ldig = new JLabel("Diagnosis"); lfee = new JLabel("Fee Rs."); cbg = new CheckboxGroup(); cm = new Checkbox("Male", cbg, false); cm.addItemListener(this); cf = new Checkbox("Female", cbg, false); cf.setState(true); cf.addItemListener(this); tdt = new JTextField(15); tpid = new JTextField(6); tpid.addFocusListener(this); tpfnm = new JTextField("first"); tpmnm = new JTextField("middle"); tplnm = new JTextField("last"); tage = new JTextField(4); tage.addFocusListener(this); tbg = new JTextField(6); twt = new JTextField(5); tadd = new TextArea(patient.addr); tcno = new JTextField(20); tdnm = new JTextField(20); tsym = new TextArea(); tdig = new JTextField(20); tfee = new JTextField(6); tfee.addFocusListener(this); ba = new JButton("ADD"); ba.addActionListener(this); bm = new JButton("CANCEL"); bm.addActionListener(this); bd = new JButton("DELETE"); bd.addActionListener(this); bl = new JButton("DISPLAY"); bl.addActionListener(this); bs = new JButton("SEARCH"); bs.addActionListener(this); JPanel p = new JPanel(); p.add(ba); p.add(bm); // p.add(bd); // p.add(bl); // p.add(bs); add(p, BorderLayout.SOUTH); q = new JPanel(); q.setLayout(null); ldt.setBounds(1015, 20, 60, 20); q.add(ldt); tdt.setBounds(1060, 20, 170, 20); q.add(tdt); lpid.setBounds(70, 60, 80, 20); q.add(lpid); tpid.setBounds(200, 60, 60, 20); q.add(tpid); lpnm.setBounds(70, 100, 80, 20); q.add(lpnm); tpfnm.setBounds(200, 100, 100, 20); q.add(tpfnm); tpmnm.setBounds(320, 100, 100, 20); q.add(tpmnm); tplnm.setBounds(440, 100, 100, 20); q.add(tplnm); lgen.setBounds(70, 140, 60, 20); q.add(lgen); lbg.setBounds(370, 140, 80, 20); q.add(lbg); tbg.setBounds(470, 140, 60, 20); q.add(tbg); cm.setBounds(200, 140, 60, 20); cf.setBounds(280, 140, 60, 20); lage.setBounds(70, 180, 40, 20); q.add(lage); tage.setBounds(200, 180, 50, 20); q.add(tage); lwt.setBounds(370, 180, 200, 20); q.add(lwt); twt.setBounds(470, 180, 60, 20); q.add(twt); ladd.setBounds(70, 220, 60, 20); q.add(ladd); tadd.setBounds(200, 220, 350, 50); q.add(tadd); lcno.setBounds(70, 310, 60, 20); q.add(lcno); tcno.setBounds(200, 310, 120, 20); q.add(tcno); ldnm.setBounds(70, 350, 200, 20); q.add(ldnm); tdnm.setBounds(200, 350, 150, 20); q.add(tdnm); lsym.setBounds(70, 390, 100, 20); q.add(lsym); tsym.setBounds(200, 390, 300, 70); q.add(tsym); ldig.setBounds(70, 480, 60, 20); q.add(ldig); tdig.setBounds(200, 480, 100, 20); q.add(tdig); lfee.setBounds(70, 520, 200, 20); q.add(lfee); tfee.setBounds(200, 520, 40, 20); q.add(tfee); q.add(cm); q.add(cf); q.add(image); q.add(bu); add(q, BorderLayout.CENTER); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { try { patient.con.close(); System.exit(0); } catch (Exception e8) { } } }); System.out.println(tadd.getText()); setSize(1330, 740); setVisible(true); }
public vehicle() { message = new JLabel("VEHICLE DETAILS"); mname = new JLabel("Model Name"); cap = new JLabel("Capacity"); cc = new JLabel("CC"); eng = new JLabel("Engine"); stroke = new JLabel("Stroke"); bhp = new JLabel("BHP"); volt = new JLabel("Volts"); rpm = new JLabel("RPM"); weight = new JLabel("Weight"); kg = new JLabel("Kg"); gear = new JLabel("Gears"); color = new JLabel("Color"); jcmname = new JComboBox(); tfcap = new JTextField(30); tfeng = new JTextField(20); tfbhp = new JTextField(10); tfvolt = new JTextField(20); tfrpm = new JTextField(20); tfweight = new JTextField(20); tfgear = new JTextField(30); jccolor = new JComboBox(); ok = new JButton("OK"); can = new JButton("CANCEL"); can.addActionListener(this); can.setActionCommand("can"); ok.addActionListener(this); ok.setActionCommand("Ok"); Container c = getContentPane(); setSize(800, 600); setTitle("Vehicle Details"); c.setLayout(null); setVisible(true); c.add(message); c.add(mname); c.add(cap); c.add(cc); c.add(eng); c.add(stroke); c.add(bhp); c.add(volt); c.add(rpm); c.add(weight); c.add(kg); c.add(gear); c.add(color); c.add(jcmname); c.add(tfcap); c.add(tfeng); c.add(tfbhp); c.add(tfvolt); c.add(tfrpm); c.add(tfweight); c.add(tfgear); c.add(jccolor); c.add(ok); c.add(can); c.setBackground(Color.pink); message.setBounds(300, 40, 200, 50); mname.setBounds(50, 100, 100, 30); cap.setBounds(50, 150, 100, 30); cc.setBounds(275, 150, 50, 30); eng.setBounds(50, 200, 50, 30); stroke.setBounds(275, 200, 100, 30); bhp.setBounds(50, 250, 100, 30); volt.setBounds(50, 300, 100, 30); rpm.setBounds(50, 350, 100, 30); weight.setBounds(50, 400, 50, 30); kg.setBounds(275, 400, 100, 30); gear.setBounds(450, 150, 150, 30); color.setBounds(450, 200, 100, 30); jcmname.setBounds(200, 100, 100, 30); jcmname.addItem(" -- Select --"); jcmname.addItem("Pulsar"); jcmname.addItem("CT 100"); jcmname.addItem("Discover DTS-i"); jcmname.addItem("Wave DTS-i"); tfcap.setBounds(200, 150, 70, 30); tfeng.setBounds(200, 200, 70, 30); tfbhp.setBounds(200, 250, 70, 30); tfvolt.setBounds(200, 300, 70, 30); tfrpm.setBounds(200, 350, 70, 30); tfweight.setBounds(200, 400, 70, 30); tfgear.setBounds(500, 150, 70, 30); jccolor.setBounds(500, 200, 100, 30); jccolor.addItem("Black"); jccolor.addItem("Blue"); jccolor.addItem("Red"); jccolor.addItem("Grey"); ok.setBounds(270, 480, 85, 30); can.setBounds(370, 480, 85, 30); }
Usermaster() { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); x = dim.width; y = dim.height; setSize(x, y); setUndecorated(true); Container c = getContentPane(); center = new JPanel() { public void paintComponent(Graphics g) { Toolkit kit = Toolkit.getDefaultToolkit(); Image img = kit.getImage("Image/user.jpg"); MediaTracker t = new MediaTracker(this); t.addImage(img, 0); while (true) { try { t.waitForAll(); break; } catch (Exception ee) { } } g.drawImage(img, 0, 0, x, y, null); } }; c.add(center); center.setLayout(null); titleLb = new JLabel( "<html><body ><font size='5'><b><i> User Name </b></i></font></body></html>"); titleLb.setForeground(new Color(10, 110, 255)); titleLb.setBounds(x / 2 + 50, x / 4, 150, 50); center.add(titleLb); output = new JLabel( "<html><body ><font size='5'><b><i> OUTPUT </b></i></font></body></html>"); output.setForeground(Color.white); output.setBounds(x / 2 - 250, x / 6, 150, 50); center.add(output); login = new JButton(new ImageIcon("Image/logBut.gif")); login.setBorder(BorderFactory.createRaisedBevelBorder()); login.setBounds(x / 2 + 100, x / 2 - 70, 100, 100); login.setBackground(Color.white); pass = new JPasswordField(); pass.setToolTipText("Enter The Password To Payroll System"); login.requestFocus(); pass.setBorder(BorderFactory.createRaisedBevelBorder()); pass.setForeground(new Color(10, 110, 255)); pass.setFont(new Font("Arial", Font.BOLD, 22)); pass.setCaretColor(Color.red); pass.setBounds(x / 2 + 50, x / 3, 200, 35); center.add(pass); center.add(login); pass.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { output.setText( "<html><body ><font size='5'><b><i> OUTPUT </b></i></font></body></html>"); output.setForeground(Color.white); } }); try { clsConnection connect = new clsConnection(); conn = connect.setConnection(conn, "", ""); } catch (Exception e) { } login.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { st = conn.createStatement(); rs = st.executeQuery("select * from img"); while (rs.next()) { if (pass.getText().equals(rs.getString(3))) { setVisible(false); URL url = closeSystem.class.getResource("spacemusic.au"); click = Applet.newAudioClip(url); click.play(); paro.setVisible(true); } else { pass.setText(""); pass.requestFocus(); output.setText("Fell"); output.setFont(new Font("Arial", Font.BOLD, 36)); output.setForeground(Color.red); } } } catch (Exception er) { System.out.println("Sorry\n" + er); } } }); }
Head() { setTitle("Head Office"); setLocation(440, 80); f1.setLayout(null); Toolkit kit = Toolkit.getDefaultToolkit(); Dimension screenSize = kit.getScreenSize(); int screenHeight = screenSize.height - 30; // int screenWidth = screenSize.width; setSize(800, 738); // System.out.println(screenHeight); setResizable(false); // setSize(800,800); lno = new JLabel("Head office Number :"); lname = new JLabel(" Name :"); contact = new JLabel(" Contact :"); address = new JLabel(" Address :"); state = new JLabel(" State :"); startdate = new JLabel(" Start Date :"); howmany = new JLabel(" Total Employee :"); t1 = new JTextField(10); t2 = new JTextField(10); t3 = new JTextField(10); t4 = new JTextField(10); t5 = new JTextField(10); t6 = new JTextField(10); t7 = new JTextField(10); add = new JButton(" Add"); ok = new JButton("OK"); ok.addActionListener(this); add.addActionListener(this); taddress = new JTextArea(15, 20); scrpn = new JScrollPane(taddress); f1.add(lno); f1.add(t1); f1.add(lname); f1.add(t2); f1.add(contact); f1.add(t3); f1.add(t4); f1.add(add); f1.add(t5); f1.add(address); f1.add(scrpn); f1.add(state); f1.add(t6); f1.add(t7); f1.add(howmany); f1.add(startdate); b6 = new JButton( "Exit"); // , new ImageIcon(ClassLoader.getSystemResource("Images/update.png"))); b7 = new JButton("View"); b6.setBounds(180, 370, 100, 30); b7.setBounds(50, 370, 100, 30); add(b6); add(b7); b6.addActionListener(this); b7.addActionListener(this); lno.setBounds(10, 25, 150, 25); t1.setBounds(150, 23, 125, 25); lname.setBounds(10, 67, 150, 25); t2.setBounds(150, 67, 150, 25); contact.setBounds(10, 110, 150, 25); t3.setBounds(150, 110, 125, 25); state.setBounds(10, 153, 150, 25); t4.setBounds(150, 153, 125, 25); startdate.setBounds(10, 196, 150, 25); t5.setBounds(150, 196, 125, 25); address.setBounds(10, 239, 150, 25); t7.setBounds(150, 239, 250, 25); // scrpn.setBounds(150,239,200,50); howmany.setBounds(10, 310, 150, 25); t6.setBounds(150, 310, 125, 25); ok.setBounds(190, 420, 90, 25); setSize(445, 500); add(f1, BorderLayout.CENTER); setVisible(true); try { Class.forName("com.mysql.jdbc.Driver"); System.out.println("Driver loaded Succesfull"); cn = DriverManager.getConnection("jdbc:mysql://127.0.0.1/payroll", "root", "root"); System.out.println("Connection Succesfull"); st = cn.createStatement(); } catch (Exception e) { JOptionPane.showMessageDialog(this, "Error is" + e); } }
DoctorInfomodify() { super("Doctor Information"); setSize(1200, 750); setLocationRelativeTo(null); setLayout(null); lmain = new JLabel("Doctor Information"); lmain.setBounds(440, 35, 107, 15); add(lmain); ldi = new JLabel("Doctor Information"); ldi.setBounds(40, 70, 120, 15); add(ldi); lname = new JLabel("Name :"); lname.setBounds(104, 97, 70, 25); add(lname); tfname = new JTextField(30); tfname.setBounds(270, 97, 250, 20); add(tfname); ladd = new JLabel("Address :"); ladd.setBounds(104, 138, 70, 15); add(ladd); taadd = new TextArea(); taadd.setBounds(270, 138, 250, 100); add(taadd); ltel = new JLabel("Contact :"); ltel.setBounds(575, 138, 50, 25); add(ltel); ldid = new JLabel("Doctor ID:"); ldid.setBounds(570, 97, 70, 25); add(ldid); tfdid = new JTextField(30); tfdid.setBounds(643, 97, 50, 20); add(tfdid); tftel = new JTextField(30); tftel.setBounds(640, 138, 200, 20); add(tftel); settings.Numvalidator(tftel); ldspec = new JLabel("Specialization :"); ldspec.setBounds(104, 310, 100, 25); add(ldspec); taspecial = new TextArea(); taspecial.setBounds(270, 310, 250, 100); add(taspecial); lwork = new JLabel("Working hours :"); lwork.setBounds(570, 310, 100, 15); add(lwork); lworkfrom = new JLabel("From :"); lworkfrom.setBounds(670, 305, 37, 25); add(lworkfrom); tfworkf = new JTextField(30); tfworkf.setBounds(710, 310, 30, 20); add(tfworkf); settings.Numvalidator(tfworkf); lworkto = new JLabel("to :"); lworkto.setBounds(747, 305, 20, 25); add(lworkto); tfworkt = new JTextField(30); tfworkt.setBounds(775, 310, 30, 20); add(tfworkt); settings.Numvalidator(tfworkt); bsub = new JButton("SEARCH", new ImageIcon("images/search.png")); bsub.setBounds(250, 643, 110, 30); add(bsub); bclr = new JButton("CLEAR", new ImageIcon("images/LOGGOFF.PNG")); bclr.setBounds(390, 643, 100, 30); add(bclr); bmod = new JButton("MODIFY", new ImageIcon("images/modify.png")); bmod.setBounds(530, 643, 100, 30); add(bmod); bback = new JButton("BACK", new ImageIcon("images/restore.png")); bback.setBounds(700, 643, 100, 30); add(bback); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); cn = DriverManager.getConnection("Jdbc:Odbc:doc"); } catch (Exception e) { System.out.println(e); } bclr.addActionListener(new clear()); bsub.addActionListener(new submit()); bmod.addActionListener(new modify()); bback.addActionListener(new back()); setVisible(true); }
public void doLayout() { JLabel label; JComponent compo; CFJReferenceEditor reference; Dimension dim; final int spacing = 5; int y = spacing; final int height = 25; final int textheight = 80; final int vspacing = height + spacing; final int textvspacing = textheight + spacing; final int labelx = spacing; final int labelwidth = 200; final int fieldx = labelx + labelwidth + spacing; final int fieldwidth = 1024; Dimension jpsz = getSize(); int usefieldwidth = jpsz.width - 215; label = getSwingLabelContainerTenant(); label.setBounds(labelx, y, labelwidth, height); reference = getSwingReferenceContainerTenant(); reference.setBounds(fieldx, y, usefieldwidth, height); y = y + vspacing; label = getSwingLabelMenuId(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMenuId(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelName(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorName(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelGreetLong(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetLong(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelGreetShort(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetShort(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelInvalidSound(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInvalidSound(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelExitSound(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorExitSound(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelTimeout(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorTimeout(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelInterDigitTimeout(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInterDigitTimeout(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelMaxFailures(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxFailures(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelMaxTimeouts(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxTimeouts(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; label = getSwingLabelDigitLen(); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorDigitLen(); dim = compo.getMaximumSize(); if (dim.width < usefieldwidth) { compo.setBounds(fieldx, y, dim.width, height); } else { compo.setBounds(fieldx, y, fieldwidth, height); } y = y + vspacing; }
public CFFreeSwitchSwingPbxIvrMenuAttrJPanel( ICFFreeSwitchSwingSchema argSchema, ICFFreeSwitchPbxIvrMenuObj argFocus) { super(); JLabel label; JComponent compo; CFJReferenceEditor reference; final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; setSwingFocusAsPbxIvrMenu(argFocus); final int spacing = 5; int y = spacing; final int height = 25; final int textheight = 80; final int vspacing = height + spacing; final int textvspacing = textheight + spacing; final int labelx = spacing; final int labelwidth = 200; final int fieldx = labelx + labelwidth + spacing; final int fieldwidth = 785; final int panelwidth = fieldx + fieldwidth + spacing; // temporary -- I think you have to have a panel bigger than the coordinates initially setSize(panelwidth, 100000); label = getSwingLabelContainerTenant(); add(label); label.setBounds(labelx, y, labelwidth, height); reference = getSwingReferenceContainerTenant(); add(reference); reference.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelMenuId(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMenuId(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelName(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorName(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelGreetLong(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetLong(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelGreetShort(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorGreetShort(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelInvalidSound(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInvalidSound(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelExitSound(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorExitSound(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelTimeout(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorTimeout(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelInterDigitTimeout(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorInterDigitTimeout(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelMaxFailures(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxFailures(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelMaxTimeouts(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorMaxTimeouts(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; label = getSwingLabelDigitLen(); add(label); label.setBounds(labelx, y, labelwidth, height); compo = getSwingEditorDigitLen(); add(compo); compo.setBounds(fieldx, y, fieldwidth, height); y = y + vspacing; // Now we can set the proper size based on the fields and references populated setSize(panelwidth, y); Dimension pfsz = new Dimension(panelwidth, y); setPreferredSize(pfsz); Dimension min = new Dimension(400, y); setMinimumSize(min); populateFields(); adjustComponentEnableStates(); swingIsInitializing = false; }