private void setToDefault(JTextField lFunction, JLabel edit, JLabel cancel, boolean isToDefault) {
   if (!isToDefault) {
     lFunction.requestFocus();
     lFunction.setOpaque(true);
     lFunction.setEnabled(true);
     edit.setText("Update");
     cancel.setEnabled(true);
   } else {
     lFunction.setOpaque(false);
     lFunction.setEnabled(false);
     edit.setText("Edit");
     cancel.setEnabled(false);
   }
 }
Example #2
0
  public void refreshSupplier(boolean remove) {

    if (remove) panel.remove(supplierCombo);

    try {
      model =
          new DefaultComboBoxModel(
              Manager.getInstance().getSupplierManager().getSuppliers().toArray());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    supplierCombo = new JComboBox(model);
    supplierCombo.setUI(ColorArrowUI.createUI(this));
    supplierCombo.setEditable(true);
    supplierComboField = (JTextField) supplierCombo.getEditor().getEditorComponent();
    supplierComboField.setText("");
    supplierComboField.setOpaque(false);
    supplierComboField.setBorder(BorderFactory.createEmptyBorder());
    supplierComboField.addKeyListener(new ComboKeyHandler(supplierCombo));

    supplierCombo.setFont(new Font("Arial Narrow", Font.PLAIN, 14));
    supplierCombo.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK));
    supplierCombo.setOpaque(false);

    supplierCombo.setSelectedIndex(-1);

    supplierCombo.setVisible(supplierLabel.isVisible());

    supplierCombo.setBounds(85, 56, 220, 20);

    panel.add(supplierCombo);
  }
  public void init() {
    this.setPreferredSize(new Dimension(500, 500));
    this.setMinimumSize(new Dimension(500, 500));

    this.setLocationRelativeTo(null);
    this.setUndecorated(true);

    this.pack();
    this.toFront();
    this.setLayout(new GridLayout(2, 1, 0, 0));

    panelSuperior = new JPanel(new GridLayout(4, 1, 0, 0));

    usuario = new JLabel(accion);
    usuario.setHorizontalAlignment(JLabel.CENTER);
    usuario.setFont(new Font("Arial", 0, 20));
    usuario.setOpaque(true);
    usuario.setBackground(Color.BLACK);
    usuario.setForeground(Color.white);

    this.cargo = new JLabel("SESION " + puesto);
    cargo.setHorizontalAlignment(JLabel.CENTER);
    cargo.setFont(new Font("Arial", 0, 36));
    cargo.setOpaque(true);
    cargo.setBackground(Color.BLACK);
    cargo.setForeground(Color.white);

    this.cargo = new JLabel("CARGO");
    cargo.setHorizontalAlignment(JLabel.CENTER);
    cargo.setFont(new Font("Arial", 0, 36));
    cargo.setOpaque(true);
    cargo.setBackground(Color.BLACK);
    cargo.setForeground(Color.white);

    this.usuarioIn = new JTextField();
    usuarioIn.setEditable(false);
    usuarioIn.setFont(new Font("Arial", 0, 36));
    usuarioIn.setOpaque(true);
    usuarioIn.setBackground(Color.GREEN);
    usuarioIn.setText("");

    String[] puestos = {"Cajero", "Supervisor", "Gerente", "Admin"};
    cargoIn = new JComboBox<>(puestos);
    cargoIn.setFont(new Font("Arial", 0, 20));

    this.teclado = new TecladoPass();

    this.panelSuperior.add(cargo);
    this.panelSuperior.add(usuario);
    this.panelSuperior.add(usuarioIn);
    this.panelSuperior.add(cargo);
    this.panelSuperior.add(cargoIn);
    this.add(panelSuperior);
    this.add(teclado);

    this.setVisible(true);
  }
 private void setupPanel() {
   this.setLayout(baseLayout);
   this.add(submitButton);
   this.add(userInputField);
   this.add(textPane);
   this.setSize(500, 400);
   chatArea.setEditable(false);
   chatArea.setLineWrap(true);
   chatArea.setWrapStyleWord(true);
   userInputField.setOpaque(false);
 }
Example #5
0
 public AliasEditor(JCheckBox checkBox) {
   super(checkBox);
   button = new JTextField();
   button.setOpaque(true);
   button.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           fireEditingStopped();
         }
       });
 }
Example #6
0
  // ----------------------------------------------------------------------------
  private JPanel createTextField() {
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(new TitledBorder(new EtchedBorder(), "Text"));
    text_field_ = new JTextField("Preview Font");
    text_field_.setBackground(Color.white);
    text_field_.setForeground(Color.black);
    text_field_.setOpaque(true);
    text_field_.setBorder(new LineBorder(Color.black));
    text_field_.setPreferredSize(new Dimension(120, 40));
    panel.add(text_field_, BorderLayout.CENTER);

    return panel;
  }
Example #7
0
  public static void main(String[] args) {
    JFrame frame = new JFrame("Test");
    frame.addWindowListener(
        new WindowAdapter() {
          /** @see java.awt.event.WindowAdapter#windowClosing(WindowEvent) */
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }

          /** @see java.awt.event.WindowListener#windowClosed(WindowEvent) */
          public void windowClosed(WindowEvent e) {
            System.exit(0);
          }
        });
    frame.getContentPane().setLayout(new BorderLayout());
    ImagePanel pan =
        new ImagePanel(
            new ImageIcon("/home/calum/images/content2.jpg"), 0, 0, 0.5, ImagePanel.NONE);
    pan.setLayout(new BorderLayout());
    JPanel panel2 = new JPanel();
    panel2.setLayout(new GridLayout(2, 2));
    pan.setAllComponentsOpaque(false);
    panel2.setOpaque(false);
    pan.add(panel2, BorderLayout.CENTER);
    panel2.add(new JLabel("Name"));
    JTextField thru = new JTextField("");

    thru.setOpaque(false);
    JTextField thru2 = new JTextField("");
    thru2.setOpaque(false);
    panel2.add(thru);
    panel2.add(new JLabel("Email Address"));
    panel2.add(thru2);
    frame.getContentPane().add(pan, BorderLayout.CENTER);
    frame.setSize(600, 600);
    frame.show();
  }
  /**
   * Constructeur de la classe
   *
   * @param numJoueur rang du joueur dans la liste des joueurs
   */
  public CadranSaisieInfo(int numJoueur) {

    this.setOpaque(false);
    this.setLayout(null);

    imageCadran.setIcon(
        new ImageIcon(getClass().getResource("/CadranJoueur" + numJoueur + ".png")));
    this.add(imageCadran);
    imageCadran.setBounds(0, 0, 160, 150);

    pseudo.setOpaque(false);
    pseudo.setFont(new java.awt.Font("Wawati SC", 0, 13));
    pseudo.setText("Joueur" + numJoueur);
    pseudo.setHorizontalAlignment(JLabel.CENTER);
    pseudo.setBounds(3, 112, 150, 33);
    this.add(pseudo, 0);
  }
Example #9
0
  /** Constructor for allocating memory and simple initializing. */
  public GameBoard() {
    dealerPanel = new JPanel();
    playerPanel = new JPanel();
    controlPanel = new JPanel();
    money = new JLabel();
    record = new JLabel();
    inputImage = new JLabel(new ImageIcon("res/INPUT.gif"));
    moneyLabel = new JLabel(new ImageIcon("res/MONEY.gif"));
    betLabel = new JLabel(new ImageIcon("res/MAKE_YOUR_BET.gif"));
    recordLabel = new JLabel(new ImageIcon("res/BEST_SCORE.gif"));
    betButton = new JButton(new ImageIcon("res/BET.gif"));
    resultButton = new JButton(new ImageIcon("res/RESULT.gif"));
    betInput = new JTextField();

    try {
      recordReader = new BufferedReader(new FileReader("res/record"));
      bestScore = Integer.parseInt(recordReader.readLine());
      recordReader.close();
    } catch (Exception e) {
      e.printStackTrace();
    }

    inputImage.setLayout(new BorderLayout());
    controlPanel.setLayout(new FlowLayout());

    betInput.setHorizontalAlignment(JTextField.CENTER);
    betButton.setBorder(BorderFactory.createEmptyBorder());
    betButton.setContentAreaFilled(false);
    resultButton.setBorder(BorderFactory.createEmptyBorder());
    resultButton.setContentAreaFilled(false);
    resultButton.setEnabled(false);
    betButton.addMouseListener(new BetListener());
    resultButton.addMouseListener(new ResultListener());
    betInput.setOpaque(false);
    betInput.setBorder(BorderFactory.createEmptyBorder());
    money.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 30));
    record.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 30));
    setOpaque(false);

    initGame();
    initRound();
  }
  public TextComponent(Column column, DataBaseExplorerModel explorerModel) {
    super(column, explorerModel);
    this.column = column;

    JTextField textField =
        new JTextField(20) {
          /** */
          private static final long serialVersionUID = 1L;

          // Unleash Your Creativity with Swing and the Java 2D API!
          // http://java.sun.com/products/jfc/tsc/articles/swing2d/index.html
          @Override
          protected void paintComponent(Graphics g) {
            if (!isOpaque()) {
              int w = getWidth();
              int h = getHeight();
              Graphics2D g2 = (Graphics2D) g.create();
              g2.setRenderingHint(
                  RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
              g2.setColor(UIManager.getColor("TextField.background"));
              g2.fillRoundRect(0, 0, w - 1, h - 1, h, h);
              g2.setColor(Color.GRAY);
              g2.drawRoundRect(0, 0, w - 1, h - 1, h, h);
              g2.dispose();
            }
            super.paintComponent(g);
          }
        };
    textField.setOpaque(false);
    textField.setBackground(new Color(0, 0, 0, 0));
    textField.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8));
    super.comp = textField;

    if (super.col.isPrimary()) {
      this.setEnable(false);
    }

    addComponents();
  }
Example #11
0
  public MyTextField(int type) {
    this.type = type;

    field = new JTextField();

    if (type == 0 || type == -1) {
      width = 112;
      field.setBounds(28, 0, (int) (width * 0.55), height);
    } else {
      width = 200;
      field.setBounds(30, 0, (int) (width * 0.7), height);
    }
    this.setPreferredSize(new Dimension(width, height));
    this.setOpaque(false);
    this.setLayout(null);
    p = this;

    field.setFont(new Font("黑体", Font.PLAIN, 18));
    field.setForeground(new Color(44, 62, 80));
    field.setOpaque(false);
    field.setBorder(new EmptyBorder(0, 0, 0, 0));
    this.add(field);

    field.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseEntered(MouseEvent e) {
            state = 2;
            p.repaint();
          }

          @Override
          public void mouseExited(MouseEvent e) {
            state = 1;
            p.repaint();
          }
        });
  }
Example #12
0
    /**
     * Vytvori dotazovaci dialog s prednastavenym layoutem, nastavi jeho pozici a vykresli jej na
     * obrazovku.
     *
     * @param owner Nadrazene okno {@code java.awt.Frame}.
     * @param title Jmeno dialogoveho okna.
     */
    CheckDialog(Frame owner, String title) {
      this.setTitle(title);
      this.setPreferredSize(new Dimension(200, 200));

      jdCont = new JPanel();
      jdCont.setPreferredSize(new Dimension(200, 200));

      bg = new ButtonGroup();

      ActionListener change =
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
              chngInfo(evt);
            }
          };

      opt1 = new JRadioButton("Sidlo");
      opt1.setBounds(10, 5, 10, 10);
      opt1.setSize(10, 10);
      opt1.setLocation(10, 5);
      opt1.setSelected(true);
      opt1.setOpaque(true);
      opt1.setActionCommand("settle");
      opt1.addActionListener(change);

      opt2 = new JRadioButton("Vrtulnik");
      opt2.setBounds(30, 5, 10, 10);
      opt2.setOpaque(true);
      opt2.setActionCommand("helicop");
      opt2.addActionListener(change);

      opt3 = new JRadioButton("Auto");
      opt3.setBounds(50, 5, 10, 10);
      opt3.setOpaque(true);
      opt3.setActionCommand("car");
      opt3.addActionListener(change);

      bg.add(opt1);
      bg.add(opt2);
      bg.add(opt3);

      info = new JLabel("ID musi byt v danem rozmezi!", JLabel.CENTER);

      line = new JTextField(10);
      // line.setBounds(10,20,100,20);
      // line.setSize(100, 20);
      // line.setAlignmentX(100);
      line.setEnabled(true);
      line.setOpaque(true);

      sender = new JButton();
      sender.setBounds(50, 50, 100, 20);
      sender.setBackground(new Color(200, 200, 200));
      sender.setEnabled(true);
      sender.setFont(new Font("sansserif", 0, 12));
      sender.setText("Zjistit!");
      sender.setVisible(true);
      sender.setOpaque(true);
      sender.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              send();
            }
          });

      jdCont.add(opt1);
      jdCont.add(opt2);
      jdCont.add(opt3);
      jdCont.add(info);
      jdCont.add(line);
      jdCont.add(sender);

      this.setContentPane(jdCont);
      // this.setPreferredSize(new Dimension(200,200));
      this.setLocationRelativeTo(owner);
      this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      this.pack();
      this.setVisible(true);
    }
Example #13
0
 @Override
 public void setOpaque(boolean isOpaque) {
   super.setOpaque(isOpaque);
   label.setOpaque(isOpaque);
   field.setOpaque(isOpaque);
 }
  public void createDataEditPanelCourse(String CourseNo, String CourseName, String CourseCredit) {

    this.CourseNo = CourseNo;
    this.CourseName = CourseName;
    this.CourseCredit = CourseCredit;

    Credit = Float.parseFloat(CourseCredit);

    if (Credit == 0.75) CreditIndex = 0;
    else if (Credit == 1.50) CreditIndex = 1;
    else if (Credit == 3.00) CreditIndex = 2;
    else CreditIndex = 3;

    DEPC = new JDialog();
    DEPC.setTitle("Course Edit Dialog");

    Panel =
        new JPanel() {
          protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.drawImage(
                new ImageIcon(getClass().getResource("/Icons/8.jpg")).getImage(),
                0,
                0,
                600,
                230,
                null);
            ButtonBorder.paintBorder(this, g, 172, 136, 130, 25);
          }
        };
    Panel.setForeground(Color.WHITE);
    Panel.setLayout(null);

    CourseNoLabel1 = new JLabel("Course No.          : ");
    CourseNoLabel1.setForeground(Color.WHITE);
    CourseNoLabel1.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12));
    CourseNoLabel1.setBounds(77, 29, 139, 27);
    Panel.add(CourseNoLabel1);

    CourseNoLabel2 = new JLabel(this.CourseNo);
    CourseNoLabel2.setForeground(Color.WHITE);
    CourseNoLabel2.setFont(new Font("Rockwell Extra Bold", Font.BOLD, 12));
    CourseNoLabel2.setBounds(213, 29, 200, 27);
    Panel.add(CourseNoLabel2);

    CourseNameLabel = new JLabel("Course Title       :");
    CourseNameLabel.setForeground(Color.WHITE);
    CourseNameLabel.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12));
    CourseNameLabel.setBounds(77, 56, 139, 26);
    Panel.add(CourseNameLabel);

    CourseNameField = new JTextField(this.CourseName);
    CourseNameField.setForeground(Color.WHITE);
    CourseNameField.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 10));
    CourseNameField.setBounds(213, 60, 200, 20);
    CourseNameField.setOpaque(false);
    CourseNameField.setHorizontalAlignment(SwingConstants.CENTER);
    Panel.add(CourseNameField);

    CourseCreditLabel = new JLabel("Course Credit   :");
    CourseCreditLabel.setForeground(Color.WHITE);
    CourseCreditLabel.setBounds(77, 87, 139, 26);
    CourseCreditLabel.setFont(new Font("Rockwell Extra Bold", Font.PLAIN, 12));
    Panel.add(CourseCreditLabel);

    CourseCreditBox = new JComboBox<String>();
    CourseCreditBox.setBackground(Color.GRAY);
    CourseCreditBox.setForeground(new Color(28, 0, 0));
    CourseCreditBox.setBounds(213, 91, 103, 20);
    CourseCreditBox.setBorder(ButtonBorder);
    CourseCreditBox.addItem("0.75");
    CourseCreditBox.addItem("1.50");
    CourseCreditBox.addItem("3.00");
    CourseCreditBox.addItem("4.00");
    CourseCreditBox.setMaximumRowCount(3);
    CourseCreditBox.setSelectedIndex(CreditIndex);
    Panel.add(CourseCreditBox);

    UpdateButton = new JButton("Update");
    UpdateButton.setForeground(Color.WHITE);
    UpdateButton.setFont(new Font("Rockwell Extra Bold", Font.BOLD, 10));
    UpdateButton.setBounds(173, 137, 128, 23);
    UpdateButton.setContentAreaFilled(false);
    UpdateButton.addActionListener(this);
    Panel.add(UpdateButton);

    DEPC.getContentPane().add(Panel);
    DEPC.setSize(500, 230);
    DEPC.setLocation(500, 200);
    DEPC.setResizable(false);
    DEPC.setVisible(true);
    DEPC.setModal(true);
  }
  /** Create the dialog. */
  public ImportProfileGroupDialog() {
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setModal(true);
    setResizable(false);
    setModalityType(ModalityType.APPLICATION_MODAL);
    setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
    setTitle("Import Profile Group");
    setBounds(100, 100, 450, 158);
    getContentPane().setLayout(new BorderLayout());
    mycontentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(mycontentPanel, BorderLayout.CENTER);
    GridBagLayout gbl_contentPanel = new GridBagLayout();
    gbl_contentPanel.columnWidths = new int[] {0, 0, 0, 0};
    gbl_contentPanel.rowHeights = new int[] {0, 0, 0};
    gbl_contentPanel.columnWeights = new double[] {0.0, 1.0, 0.0, Double.MIN_VALUE};
    gbl_contentPanel.rowWeights = new double[] {0.0, 0.0, Double.MIN_VALUE};
    mycontentPanel.setLayout(gbl_contentPanel);
    {
      myFileRadioButton = new JRadioButton("File:");
      myFileRadioButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              updateOk();
            }
          });
      fileOrUrlButtonGroup.add(myFileRadioButton);
      GridBagConstraints gbc_myFileRadioButton = new GridBagConstraints();
      gbc_myFileRadioButton.insets = new Insets(0, 0, 5, 5);
      gbc_myFileRadioButton.gridx = 0;
      gbc_myFileRadioButton.gridy = 0;
      mycontentPanel.add(myFileRadioButton, gbc_myFileRadioButton);
    }
    {
      myFileTextField = new JTextField();
      myFileTextField.setOpaque(true);
      myFileTextField
          .getDocument()
          .addDocumentListener(
              new SimpleDocumentListener() {
                @Override
                public void update(DocumentEvent theE) {
                  myFileRadioButton.setSelected(true);
                  updateOk();
                }
              });
      GridBagConstraints gbc_FileTextField = new GridBagConstraints();
      gbc_FileTextField.insets = new Insets(0, 0, 5, 5);
      gbc_FileTextField.fill = GridBagConstraints.HORIZONTAL;
      gbc_FileTextField.gridx = 1;
      gbc_FileTextField.gridy = 0;
      mycontentPanel.add(myFileTextField, gbc_FileTextField);
      myFileTextField.setColumns(10);
    }
    {
      JButton btnBrowse = new JButton("Browse...");
      btnBrowse.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              File importProfileGroupDir = Prefs.getInstance().getImportProfileGroupDirectory();
              JFileChooser chooser = new JFileChooser(importProfileGroupDir);
              ConformanceEditorController.createFileSelectionExtentionFolder(chooser);
              int result = chooser.showDialog(ImportProfileGroupDialog.this, "Select");
              if (result == JFileChooser.APPROVE_OPTION) {
                myFileTextField.setText(chooser.getSelectedFile().getAbsolutePath());
              }
            }
          });
      GridBagConstraints gbc_btnBrowse = new GridBagConstraints();
      gbc_btnBrowse.insets = new Insets(0, 0, 5, 0);
      gbc_btnBrowse.gridx = 2;
      gbc_btnBrowse.gridy = 0;
      mycontentPanel.add(btnBrowse, gbc_btnBrowse);
    }
    {
      myUrlRadioButton = new JRadioButton("URL:");
      myUrlRadioButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              updateOk();
            }
          });
      fileOrUrlButtonGroup.add(myUrlRadioButton);
      GridBagConstraints gbc_myUrlRadioButton = new GridBagConstraints();
      gbc_myUrlRadioButton.insets = new Insets(0, 0, 0, 5);
      gbc_myUrlRadioButton.gridx = 0;
      gbc_myUrlRadioButton.gridy = 1;
      mycontentPanel.add(myUrlRadioButton, gbc_myUrlRadioButton);
    }
    {
      myUrlTextField = new JTextField();
      myUrlTextField
          .getDocument()
          .addDocumentListener(
              new SimpleDocumentListener() {
                @Override
                public void update(DocumentEvent theE) {
                  myUrlRadioButton.setSelected(true);
                  updateOk();
                }
              });
      myUrlTextField.setOpaque(true);
      GridBagConstraints gbc_UrlTextField = new GridBagConstraints();
      gbc_UrlTextField.insets = new Insets(0, 0, 0, 5);
      gbc_UrlTextField.fill = GridBagConstraints.HORIZONTAL;
      gbc_UrlTextField.gridx = 1;
      gbc_UrlTextField.gridy = 1;
      mycontentPanel.add(myUrlTextField, gbc_UrlTextField);
      myUrlTextField.setColumns(10);
    }
    {
      JPanel buttonPane = new JPanel();
      buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
      getContentPane().add(buttonPane, BorderLayout.SOUTH);
      {
        myOkButton = new JButton("OK");
        myOkButton.setActionCommand("OK");
        myOkButton.addActionListener(
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent theE) {
                updateOk();
                dispose();
              }
            });
        buttonPane.add(myOkButton);
        getRootPane().setDefaultButton(myOkButton);
      }
      {
        JButton cancelButton = new JButton("Cancel");
        cancelButton.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                myFileString = null;
                myUrlString = null;
                dispose();
              }
            });
        cancelButton.setActionCommand("Cancel");
        buttonPane.add(cancelButton);
      }
    }

    updateOk();
  }
Example #16
0
  public void mainview() {
    scrollPane.setVisible(false);
    //		p500.setVisible(true);
    //		p510.setVisible(false);

    ImageIcon icon = new ImageIcon("src/frameM 成本、经营表.png"); // 定义图片并初始化,写上图片的绝对路径
    j = new JLabel(); // 把图片放在标签上
    j.setIcon(icon);
    p500.add(j);
    j.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());

    p500.setOpaque(false); // 让他透明
    p500.setBounds(235, 0, 510, 560);
    p500.setLayout(null);

    // 输入起始日期
    final JTextField num0 = new JTextField();
    num0.setBounds(123, 80, 250, 25);
    num0.setOpaque(false);
    num0.setBorder(new EmptyBorder(0, 0, 0, 0));
    j.add(num0);

    // 输入结束日期
    final JTextField num10 = new JTextField();
    num10.setBounds(123, 122, 250, 25);
    num10.setOpaque(false);
    num10.setBorder(new EmptyBorder(0, 0, 0, 0));
    j.add(num10);

    // 查询
    JButton change = new JButton();
    change.setBounds(390, 97, 80, 33);
    change.setContentAreaFilled(false);
    change.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    change.setBorder(null);
    j.add(change);
    change.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            String data1 = num0.getText();
            String data2 = num10.getText();
            JudgeStart_End se = new JudgeStart_End(data1, data2);
            String message = se.getMessage();
            if (!message.equals("保存成功")) {
              JOptionPane.showMessageDialog(null, message, "", JOptionPane.ERROR_MESSAGE);
              return;
            }
            try {
              view(data1, data2, "财务人员");
            } catch (RemoteException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            } catch (MalformedURLException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            } catch (NotBoundException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });
    j.add(change);
    p500.setVisible(true);
    jFrame.add(p500);
  }
Example #17
0
    public ChatPanel(final Client client) {
        this.client = client;

        input = new JTextField();
        //prevent unintended focus (by window activate etc. - allow focus just on direct click)
        input.setFocusable(false);
        input.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                activateChat();
            }
        });
        input.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                    clean();
                }
            }
        });
        input.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                String msg = input.getText();
                if (!"".equals(msg)) {
                    forceFocus = true; //prevent panel flashing
                    client.getConnection().send(createPostChatMessage(msg));
                }
                clean();
            }
        });
        input.addFocusListener(new FocusListener() {
            @Override
            public void focusLost(FocusEvent e) {
                updateMessaagesVisibility();
            }

            @Override
            public void focusGained(FocusEvent e) {
                updateMessaagesVisibility();
            }
        });

        input.setOpaque(false);
        input.setBackground(client.getTheme().getTransparentInputBg());
        Color textColor = client.getTheme().getTextColor();
        if (textColor != null) {
            input.setForeground(client.getTheme().getTextColor());
            input.setCaretColor(client.getTheme().getTextColor());
        }
        TextPrompt tp = new TextPrompt(_("Type to chat"), input);
        tp.setShow(Show.FOCUS_LOST);
        tp.changeStyle(Font.ITALIC);
        tp.changeAlpha(0.4f);

        messagesPane = new JTextPane();
        messagesPane.setEditorKit(new WrapEditorKit());
        messagesPane.setFocusable(false);
        messagesPane.setOpaque(false);

        setBackground(client.getTheme().getTransparentPanelBg());
        setLayout(new MigLayout(""));
        add(messagesPane, "pos 10 n (100%-10) (100%-35)");
        add(input, "pos 10 (100%-35) (100%-10) (100%-10)");
    }
  public void addnew() {
    p40.setVisible(false);

    p41 = new JPanel();

    ImageIcon icon = new ImageIcon("src/frameB receive add.png"); // 定义图片并初始化,写上图片的绝对路径
    JLabel j = new JLabel(); // 把图片放在标签上
    j.setIcon(icon);
    p41.add(j);
    j.setBounds(0, 0, 500, 600);

    p41.setOpaque(false); // 让他透明
    p41.setBounds(235, 20, 520, 560);
    p41.setLayout(null);

    // 订单条形码号
    final JTextField orderNumberField = new JTextField();
    orderNumberField.setBounds(140, 80, 330, 25);
    orderNumberField.setOpaque(false);
    orderNumberField.setBorder(new EmptyBorder(0, 0, 0, 0));
    j.add(orderNumberField);

    // 到达日期
    final JTextField dateField = new JTextField();
    dateField.setBounds(140, 123, 330, 25);
    dateField.setOpaque(false);
    dateField.setBorder(new EmptyBorder(0, 0, 0, 0));
    j.add(dateField);
    GetDate dt = new GetDate();
    String d = dt.getDate2();
    dateField.setText(d);

    // 中转单编号
    final JTextField transitNumberField = new JTextField();
    transitNumberField.setBounds(140, 168, 330, 25);
    transitNumberField.setOpaque(false);
    transitNumberField.setBorder(new EmptyBorder(0, 0, 0, 0));
    TransitNumber tn = new TransitNumber(operator);
    String t = tn.getCarNumber();
    j.add(transitNumberField);
    transitNumberField.setText(t);

    // 出发地
    final JTextField departPlaceField = new JTextField();
    departPlaceField.setBounds(140, 215, 330, 25);
    departPlaceField.setOpaque(false);
    departPlaceField.setBorder(new EmptyBorder(0, 0, 0, 0));
    City ci = new City(operator);
    String c = ci.getCarNumber();
    j.add(departPlaceField);
    departPlaceField.setText(c);

    // 到达状态
    final JTextField arrivalStateField = new JTextField();
    arrivalStateField.setBounds(140, 256, 330, 25);
    arrivalStateField.setOpaque(false);
    arrivalStateField.setBorder(new EmptyBorder(0, 0, 0, 0));
    j.add(arrivalStateField);

    // 清空
    JButton clear = new JButton();
    clear.setBounds(65, 325, 80, 35);
    clear.setContentAreaFilled(false);
    clear.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    clear.setBorder(null);

    clear.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            orderNumberField.setText("");
            dateField.setText("");
            transitNumberField.setText("");
            departPlaceField.setText("");
            arrivalStateField.setText("");
          }
        });

    // 保存并提交
    JButton save = new JButton();
    save.setBounds(210, 325, 80, 35);
    save.setContentAreaFilled(false);
    save.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    save.setBorder(null);

    save.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            String orderNumber = orderNumberField.getText();
            String date = dateField.getText();
            String transitNumber = transitNumberField.getText();
            String departPlace = departPlaceField.getText();
            String arrivalState = arrivalStateField.getText();
            JudgeHallPackageReceive j =
                new JudgeHallPackageReceive(
                    orderNumber, date, transitNumber, departPlace, arrivalState, "未核对");
            String message = j.getMessage();

            if (message.equals("保存成功")) {
              JOptionPane.showMessageDialog(null, message, "", JOptionPane.INFORMATION_MESSAGE);

              HallPackageReceiveVO item =
                  bl.addItem(orderNumber, date, transitNumber, departPlace, arrivalState, "未核对");
              try {
                bl.submit(item);
              } catch (RemoteException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (MalformedURLException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (NotBoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              }

              // 清空输入框
              orderNumberField.setText("");
              dateField.setText("");
              transitNumberField.setText("");
              departPlaceField.setText("");
              arrivalStateField.setText("");

              // 物流信息更新
              GetState getState = new GetState(operator);
              GetDate getDate = new GetDate();
              String number = orderNumber;
              String add_time = getDate.getDate();
              String place = getState.GetPlace();
              String note = "快递已被营业厅接收";
              LogisticsListVO vo = new LogisticsListVO(number, add_time, place, note);
              try {
                bl.updateLogistics(vo);
              } catch (RemoteException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (MalformedURLException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (NotBoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              }

              // 单据列表更新
              GetDate geda = new GetDate();
              String type0 = "C";
              String date0 = geda.getDate();
              String orderNumber0 = orderNumber;
              JudgeListVO vv = new JudgeListVO(type0, date0, orderNumber0);
              JudgeList jl = new JudgeList();
              try {
                jl.updateJudge(vv);
              } catch (RemoteException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (MalformedURLException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (NotBoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              }
            } else {
              JOptionPane.showMessageDialog(null, message, "", JOptionPane.ERROR_MESSAGE);
            }
          }
        });

    // 返回
    JButton retur = new JButton();
    retur.setBounds(360, 325, 80, 35);
    retur.setContentAreaFilled(false);
    retur.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    retur.setBorder(null);

    retur.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            p40 = new JPanel();
            HallPackageReceiveView h = new HallPackageReceiveView(operator);
            try {
              h.view();
            } catch (RemoteException | MalformedURLException | NotBoundException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
            p41.setVisible(false);
          }
        });
    j.add(clear);
    j.add(save);
    j.add(retur);

    jFrame.add(p41);
  }
Example #19
0
  private void init() throws RemoteException {
    TransportationController transportationController = new TransportationController();

    Font big = new Font("幼圆", Font.BOLD, 35);
    Font small = new Font("幼圆", Font.BOLD, 25);

    daBiaoTi = new JLabel("请输入新的成本常量");
    daBiaoTi.setForeground(Color.WHITE);
    daBiaoTi.setFont(big);
    daBiaoTi.setBounds(50, 112, 550, 45);
    this.add(daBiaoTi);

    qiChe = new JLabel("*汽车:");
    qiChe.setForeground(Color.WHITE);
    qiChe.setFont(small);
    qiChe.setBounds(130, 240, 120, 43);
    this.add(qiChe);

    qiCheF = new JTextField(String.valueOf(transportationController.getCost(1)));
    qiCheF.setFont(small);
    qiCheF.setOpaque(false);
    qiCheF.setForeground(Color.WHITE);
    qiCheF.setBounds(240, 240, 150, 40);
    qiCheF.addKeyListener(new KeyListenerOfDouble());
    this.add(qiCheF);

    qiCheDanwei = new JLabel("元/(千克*100公里)");
    qiCheDanwei.setForeground(Color.WHITE);
    qiCheDanwei.setFont(small);
    qiCheDanwei.setBounds(410, 240, 230, 43);
    this.add(qiCheDanwei);

    huoChe = new JLabel("*火车:");
    huoChe.setForeground(Color.WHITE);
    huoChe.setFont(small);
    huoChe.setBounds(130, 310, 120, 43);
    this.add(huoChe);

    huoCheF = new JTextField(String.valueOf(transportationController.getCost(2)));
    huoCheF.setFont(small);
    huoCheF.setOpaque(false);
    huoCheF.setForeground(Color.WHITE);
    huoCheF.setBounds(240, 310, 150, 40);
    huoCheF.addKeyListener(new KeyListenerOfDouble());
    this.add(huoCheF);

    huoCheDanWei = new JLabel("元/(千克*100公里)");
    huoCheDanWei.setForeground(Color.WHITE);
    huoCheDanWei.setFont(small);
    huoCheDanWei.setBounds(410, 310, 230, 43);
    this.add(huoCheDanWei);

    feiJi = new JLabel("*飞机:");
    feiJi.setForeground(Color.WHITE);
    feiJi.setFont(small);
    feiJi.setBounds(130, 380, 120, 43);
    this.add(feiJi);

    feiJiF = new JTextField(String.valueOf(transportationController.getCost(3)));
    feiJiF.setFont(small);
    feiJiF.setOpaque(false);
    feiJiF.setForeground(Color.WHITE);
    feiJiF.setBounds(240, 380, 150, 40);
    feiJiF.addKeyListener(new KeyListenerOfDouble());
    this.add(feiJiF);

    feiJiDanWei = new JLabel("元/(千克*100公里)");
    feiJiDanWei.setForeground(Color.WHITE);
    feiJiDanWei.setFont(small);
    feiJiDanWei.setBounds(410, 380, 230, 43);
    this.add(feiJiDanWei);

    yesButton = new JButton(yesIcon);
    yesButton.setBounds(602, 575, 48, 48);
    yesButton.setContentAreaFilled(false);
    this.add(yesButton);

    returnButton = new JButton(returnIcon);
    returnButton.setBounds(662, 575, 48, 48);
    returnButton.setContentAreaFilled(false);
    this.add(returnButton);

    this.setBounds(260, 60, 730, 650);
    this.setOpaque(false);
    this.setLayout(null);
  }
    public NavigateBar() {
      setLayout(new BorderLayout());
      homeButton = new JButton();
      homeButton.setOpaque(false);
      homeButton.setContentAreaFilled(false);
      homeButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              JWebBrowser webBrowser = (JWebBrowser) tabPane.getSelectedComponent();
              webBrowser.navigate(home);
              webBrowser.getNativeComponent().requestFocus();
            }
          });
      homeButton.setIcon(new ImageIcon(this.getClass().getResource("/ICON-INF/home.gif")));
      backButton = new JButton();
      backButton.setOpaque(false);
      backButton.setContentAreaFilled(false);
      backButton.setIcon(new ImageIcon(this.getClass().getResource("/ICON-INF/back.gif")));
      backButton.setEnabled(false);
      backButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              JWebBrowser webBrowser = (JWebBrowser) tabPane.getSelectedComponent();
              webBrowser.navigateBack();
              webBrowser.getNativeComponent().requestFocus();
            }
          });
      forwardButton = new JButton();
      forwardButton.setOpaque(false);
      forwardButton.setContentAreaFilled(false);
      forwardButton.setIcon(new ImageIcon(this.getClass().getResource("/ICON-INF/forward.gif")));
      forwardButton.setEnabled(false);
      forwardButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              JWebBrowser webBrowser = (JWebBrowser) tabPane.getSelectedComponent();
              webBrowser.navigateForward();
              webBrowser.getNativeComponent().requestFocus();
            }
          });

      JPanel navigatePanel = new JPanel();
      FlowLayout navigateLayout = new FlowLayout();
      navigateLayout.setHgap(0);
      navigateLayout.setVgap(0);
      navigatePanel.setLayout(navigateLayout);
      navigatePanel.add(homeButton);
      navigatePanel.add(backButton);
      navigatePanel.add(forwardButton);

      add(navigatePanel, BorderLayout.WEST);

      locationField = new JTextField(40);
      locationField.setOpaque(false);
      locationField.addKeyListener(
          new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
              if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                locationField.selectAll();
              } else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                JWebBrowser webBrowser = (JWebBrowser) tabPane.getSelectedComponent();
                webBrowser.navigate(locationField.getText());
                webBrowser.getNativeComponent().requestFocus();
              }
            }
          });
      locationField.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              JWebBrowser webBrowser = (JWebBrowser) tabPane.getSelectedComponent();
              webBrowser.navigate(locationField.getText());
              webBrowser.getNativeComponent().requestFocus();
            }
          });
      add(locationField, BorderLayout.CENTER);

      JPanel controllPanel = new JPanel();
      FlowLayout controllLayout = new FlowLayout();
      controllLayout.setHgap(0);
      controllLayout.setVgap(0);
      controllPanel.setLayout(controllLayout);
      reloadButton = new JButton();
      reloadButton.setOpaque(false);
      reloadButton.setContentAreaFilled(false);
      reloadButton.setIcon(new ImageIcon(this.getClass().getResource("/ICON-INF/reload.gif")));
      reloadButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              JWebBrowser webBrowser = (JWebBrowser) tabPane.getSelectedComponent();
              webBrowser.reloadPage();
              webBrowser.getNativeComponent().requestFocus();
            }
          });
      stopButton = new JButton();
      stopButton.setOpaque(false);
      stopButton.setContentAreaFilled(false);
      stopButton.setIcon(new ImageIcon(this.getClass().getResource("/ICON-INF/stop.gif")));
      stopButton.setEnabled(false);
      stopButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              JWebBrowser webBrowser = (JWebBrowser) tabPane.getSelectedComponent();
              webBrowser.stopLoading();
            }
          });

      fullButton = new JButton();
      fullButton.setOpaque(false);
      fullButton.setContentAreaFilled(false);
      fullButton.setIcon(new ImageIcon(this.getClass().getResource("/ICON-INF/fullscreen.gif")));
      fullButton.setEnabled(true);
      fullButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              ActionListener action =
                  (ActionListener) getThis().getClientProperty("fullscreen.action");
              action.actionPerformed(e);
            }
          });
      fullButton.getClientProperty("full");
      controllPanel.add(reloadButton);
      controllPanel.add(stopButton);
      controllPanel.add(fullButton);
      add(controllPanel, BorderLayout.EAST);
    }
Example #21
0
  ShutdownFrame(CryoBay cb) {
    super("CryoBay Monitor");
    cryoB = cb;

    cmdClose =
        new JButton("Close") {
          public JToolTip createToolTip() {
            return new JToolTip();
          }
        };

    cmdClose.setToolTipText("Close program");

    cmdClose.addActionListener(this);
    addWindowListener(this);

    GridBagConstraints gbc = new GridBagConstraints();
    Border loweredbevel = BorderFactory.createLoweredBevelBorder();

    lblBStatus = new JLabel("Status: ");
    lblBHeater = new JLabel("Heater: ");
    lblBTemp = new JLabel("  Temp: ");
    lblBCli = new JLabel("   CLI: ");

    lblStatus = new JTextField(17);
    lblStatus.setEditable(false);
    lblStatus.setOpaque(true);
    lblStatus.setBorder(loweredbevel);

    lblHeater = new JTextField(17);
    lblHeater.setEditable(false);
    lblHeater.setOpaque(true);
    lblHeater.setBorder(loweredbevel);

    lblTemp = new JTextField(17);
    lblTemp.setEditable(false);
    lblTemp.setOpaque(true);
    lblTemp.setBorder(loweredbevel);

    lblCli = new JTextField(17);
    lblCli.setEditable(false);
    lblCli.setOpaque(true);
    lblCli.setBorder(loweredbevel);

    JPanel lblPanel = new JPanel();
    lblPanel.setLayout(new GridBagLayout());
    gbc.insets = new Insets(2, 5, 2, 5);
    setGbc(gbc, 0, 0, 1, 1);
    lblPanel.add(lblBStatus, gbc);
    setGbc(gbc, 0, 1, 1, 1);
    lblPanel.add(lblBHeater, gbc);
    setGbc(gbc, 0, 2, 1, 1);
    lblPanel.add(lblBTemp, gbc);
    setGbc(gbc, 0, 3, 1, 1);
    lblPanel.add(lblBCli, gbc);

    JPanel valPanel = new JPanel();
    valPanel.setLayout(new GridBagLayout());
    gbc.insets = new Insets(2, 5, 2, 5);
    setGbc(gbc, 0, 0, 1, 1);
    valPanel.add(lblStatus, gbc);
    setGbc(gbc, 0, 1, 1, 1);
    valPanel.add(lblHeater, gbc);
    setGbc(gbc, 0, 2, 1, 1);
    valPanel.add(lblTemp, gbc);
    setGbc(gbc, 0, 3, 1, 1);
    valPanel.add(lblCli, gbc);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridBagLayout());
    gbc.anchor = GridBagConstraints.CENTER;
    setGbc(gbc, 0, 5, 1, 1);
    buttonPanel.add(cmdClose, gbc);

    // finally, add the panels to the content pane
    getContentPane().setLayout(new GridBagLayout());
    gbc.insets = new Insets(10, 10, 10, 10);
    gbc.anchor = GridBagConstraints.CENTER;
    setGbc(gbc, 0, 0, 1, 4);
    getContentPane().add(lblPanel, gbc);
    setGbc(gbc, 1, 0, 1, 4);
    getContentPane().add(valPanel, gbc);
    setGbc(gbc, 0, 5, 0, 0);
    getContentPane().add(buttonPanel, gbc);

    setSize(300, 220);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation(screenSize.width / 2 - 300, screenSize.height / 2 - 220);
    setResizable(true);
  }
  @SuppressWarnings("static-access")
  public editSalary(SalaryVO vo, JFrame main, LoginPO loginPO) {
    editSalary editSalary = this;
    setBounds(100, 100, 750, 600);
    setLayout(null);
    this.setVisible(true);
    // first
    rdbtnNewRadioButton = new JRadioButton("\u6309\u6708");
    rdbtnNewRadioButton.setOpaque(false);
    rdbtnNewRadioButton.setBorder(null);
    rdbtnNewRadioButton.setBounds(371, 290, 83, 23);
    rdbtnNewRadioButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = SalaryModel.ByMonth;
          }
        });
    add(rdbtnNewRadioButton);

    // second
    radioButton = new JRadioButton("\u6309\u6B21");
    radioButton.setBounds(371, 326, 83, 23);
    radioButton.setOpaque(false);
    radioButton.setBorder(null);
    radioButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = salaryModel.ByTimes;
          }
        });
    add(radioButton);

    // third
    radioButton_1 = new JRadioButton("\u6309\u63D0\u6210");
    radioButton_1.setBounds(371, 366, 100, 23);
    radioButton_1.setOpaque(false);
    radioButton_1.setBorder(null);
    radioButton_1.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            salaryModel = salaryModel.ByBenefit;
          }
        });
    add(radioButton_1);

    buttonGroup = new ButtonGroup();
    buttonGroup.add(rdbtnNewRadioButton);
    buttonGroup.add(radioButton);
    buttonGroup.add(radioButton_1);

    if (vo.getTypeOfStrategy() == SalaryModel.ByMonth) {
      rdbtnNewRadioButton.setSelected(true);
      salaryModel = SalaryModel.ByMonth;
    } else if (vo.getTypeOfStrategy() == salaryModel.ByTimes) {
      radioButton.setSelected(true);
      salaryModel = salaryModel.ByTimes;
    } else {
      radioButton_1.setSelected(true);
      salaryModel = salaryModel.ByBenefit;
    }

    JButton btnNewButton = new JButton("\u786E\u5B9A");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int n = JOptionPane.showConfirmDialog(null, "确认修改?", "no", JOptionPane.YES_NO_OPTION);
            if (n == JOptionPane.YES_OPTION) {
              if (textField_1.getText().equals("")) {
                label_4.setText("请输入价格");
                Thread thread = new Thread(editSalary);
                thread.start();
              } else {
                SalaryVO salaryVO =
                    new SalaryVO(
                        textField.getText(),
                        Double.parseDouble(textField_1.getText()),
                        salaryModel);
                SalaryPolicybl salaryPolicybl = new SalaryPolicybl();
                salaryPolicybl.editSalary(salaryVO);
                Salary salary = new Salary(salaryVO, main, loginPO);
                main.remove(editSalary);
                main.getContentPane().add(salary);
                main.invalidate();
                main.repaint();
                main.setVisible(true);
              }
            }
          }
        });
    btnNewButton.setBounds(283, 419, 52, 52);
    ImageIcon image1 = new ImageIcon("image/transparent_circle.png");
    Image temp1 =
        image1
            .getImage()
            .getScaledInstance(
                btnNewButton.getWidth(), btnNewButton.getHeight(), image1.getImage().SCALE_DEFAULT);
    image1 = new ImageIcon(temp1);
    btnNewButton.setIcon(image1);
    btnNewButton.setContentAreaFilled(false);
    btnNewButton.setBorderPainted(false);
    add(btnNewButton);

    JButton button = new JButton("");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Salary salary = new Salary(vo, main, loginPO);
            main.remove(editSalary);
            main.getContentPane().add(salary);
            main.invalidate();
            main.repaint();
            main.setVisible(true);
          }
        });
    button.setBounds(13, -9, 63, 63);
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setIcon(new ImageIcon("image/transparent_circle.png"));
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            button.setIcon(new ImageIcon("image/mask_circle.png"));
          }
        });

    add(button);

    textField = new JTextField();
    textField.setColumns(10);
    textField.setBounds(373, 189, 108, 21);
    textField.setText(vo.getTypeOfStaff());
    textField.setEnabled(false);
    textField.setForeground(new Color(88, 93, 103));
    textField.setCaretColor(new Color(88, 93, 103));
    textField.setOpaque(false);
    textField.setBorder(null);
    add(textField);

    textField_1 = new JTextField();
    textField_1.setColumns(10);
    textField_1.setDocument(new JTextFieldLimit(7));
    textField_1.setBounds(373, 239, 108, 21);
    textField_1.addKeyListener(new InputNumber());
    textField_1.setText(vo.getSalary() + "");
    textField_1.setForeground(new Color(88, 93, 103));
    textField_1.setCaretColor(new Color(88, 93, 103));
    textField_1.setOpaque(false);
    textField_1.setBorder(null);
    add(textField_1);

    JToolBar toolBar = new JToolBar();
    toolBar.setBounds(8, 541, 750, 35);
    toolBar.setOpaque(false);
    toolBar.setBorder(null);
    add(toolBar);

    label_4 = new JLabel("\u72B6\u6001\u680F");
    label_4.setForeground(Color.WHITE);
    toolBar.add(label_4);

    JButton button2 = new JButton("取消");
    button2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            editSalary neweditSalary = new editSalary(vo, main, loginPO);
            main.remove(editSalary);
            main.getContentPane().add(neweditSalary);
            main.invalidate();
            main.repaint();
            main.setVisible(true);
          }
        });

    button2.setBounds(416, 418, 52, 52);
    ImageIcon image2 = new ImageIcon("image/transparent_circle.png");
    Image temp2 =
        image2
            .getImage()
            .getScaledInstance(
                button2.getWidth(), button2.getHeight(), image2.getImage().SCALE_DEFAULT);
    image2 = new ImageIcon(temp2);
    button2.setIcon(image2);
    button2.setContentAreaFilled(false);
    button2.setBorderPainted(false);
    add(button2);
  }
  void createGUI() {
    // create username field info
    Box fields = Box.createVerticalBox();
    fields.add(Box.createVerticalStrut(10));
    fields.setOpaque(false);

    JPanel userNameCont = new JPanel(new GridLayout(1, 2));
    JLabel usernameLabel = new JLabel("username ");
    usernameLabel.setFont(UIHelper.VER_12_BOLD);
    usernameLabel.setForeground(UIHelper.DARK_GREEN_COLOR);
    userNameCont.add(usernameLabel);

    username = new RoundedJTextField(10, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR);
    username.setOpaque(false);

    UIHelper.renderComponent(username, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false);

    userNameCont.add(username);
    userNameCont.setOpaque(false);

    JPanel passwordCont = new JPanel(new GridLayout(1, 2));
    JLabel passwordLabel = new JLabel("password ");
    passwordLabel.setFont(UIHelper.VER_12_BOLD);
    passwordLabel.setForeground(UIHelper.DARK_GREEN_COLOR);
    passwordCont.add(passwordLabel);
    password = new RoundedJPasswordField(10, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR);
    UIHelper.renderComponent(password, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false);

    passwordCont.add(password);
    passwordCont.setOpaque(false);

    fields.add(userNameCont);
    fields.add(Box.createVerticalStrut(10));
    fields.add(passwordCont);

    JPanel northPanel = new JPanel();
    northPanel.add(new JLabel(pleaseLogin, JLabel.RIGHT), BorderLayout.NORTH);
    northPanel.add(fields, BorderLayout.CENTER);

    JPanel southPanel = new JPanel(new GridLayout(4, 1));
    southPanel.setOpaque(false);

    JPanel buttonContainer = new JPanel(new GridLayout(1, 2));
    buttonContainer.setOpaque(false);

    createProfile = new JLabel(createProfileButton, JLabel.LEFT);
    createProfile.addMouseListener(
        new MouseAdapter() {

          public void mousePressed(MouseEvent event) {
            createProfile.setIcon(createProfileButton);

            clearFields();

            confirmExitPanel.setVisible(false);

            menu.changeView(menu.getCreateProfileGUI());
          }

          public void mouseEntered(MouseEvent event) {
            createProfile.setIcon(createProfileButtonOver);
          }

          public void mouseExited(MouseEvent event) {
            createProfile.setIcon(createProfileButton);
          }
        });

    buttonContainer.add(createProfile);

    login = new JLabel(loginButton, JLabel.RIGHT);
    login.addMouseListener(
        new MouseAdapter() {

          public void mousePressed(MouseEvent event) {
            login.setIcon(Authentication.this.loginButton);
            confirmExitPanel.setVisible(false);
            login();
          }

          public void mouseEntered(MouseEvent event) {
            login.setIcon(loginButtonOver);
          }

          public void mouseExited(MouseEvent event) {
            login.setIcon(Authentication.this.loginButton);
          }
        });

    Action loginAction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            login();
          }
        };

    password.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "LOGIN");
    password.getActionMap().put("LOGIN", loginAction);
    username.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "LOGIN");
    username.getActionMap().put("LOGIN", loginAction);

    buttonContainer.add(login);

    southPanel.add(status);
    southPanel.add(buttonContainer);

    exit = new JLabel(exitButtonSml, JLabel.CENTER);
    exit.addMouseListener(
        new MouseAdapter() {

          public void mousePressed(MouseEvent event) {
            exit.setIcon(exitButtonSml);
            confirmExitPanel.setVisible(true);
            confirmExitPanel.getParent().validate();
          }

          public void mouseEntered(MouseEvent event) {
            exit.setIcon(exitButtonSmlOver);
          }

          public void mouseExited(MouseEvent event) {
            exit.setIcon(exitButtonSml);
          }
        });

    JPanel exitCont = new JPanel(new GridLayout(1, 1));
    exitCont.setOpaque(false);

    exitCont.add(exit);

    southPanel.add(exitCont);

    southPanel.add(confirmExitPanel);

    northPanel.add(southPanel, BorderLayout.SOUTH);
    northPanel.setOpaque(false);

    add(northPanel, BorderLayout.CENTER);
  }
Example #24
0
  /**
   * Inicializa los componentes
   *
   * @throws Exception
   */
  void jbInit() throws Exception {
    border1 = BorderFactory.createEmptyBorder(10, 10, 10, 10);
    this.setLayout(gridBagLayout1);
    srsLabel.setText("Coordinate Reference System:");
    this.setBorder(border1);
    this.setToolTipText("");
    srsComboBox.setMinimumSize(new Dimension(125, 21));
    srsComboBox.setToolTipText("");
    srsComboBox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            srsComboBoxActionPerformed(evt);
          }
        });

    transparencyLabel.setText("Transparency:");
    urlLabel.setText("URL:");
    urlTextField.setBorder(null);
    urlTextField.setOpaque(false);
    urlTextField.setEditable(false);

    jpTopSettings = new JPanel();
    FlowLayout fl = new FlowLayout();
    fl.setAlignment(FlowLayout.LEFT);
    jpTopSettings.setLayout(fl);
    jpDownSettings = new JPanel();
    FlowLayout fl1 = new FlowLayout();
    fl1.setAlignment(FlowLayout.LEFT);
    jpDownSettings.setLayout(fl1);
    jpStyle = new JPanel();
    jpStyle.setPreferredSize(new Dimension(300, 100));
    TitledBorder tbStyle = BorderFactory.createTitledBorder("Estilo de la capa seleccionada");
    jpStyle.setBorder(tbStyle);

    jlStyle = new JLabel(AppContext.getApplicationContext().getI18nString("estilo") + ":");
    jcbStyle = new JComboBox(jcbStyleModel);
    jlStyle.setLabelFor(jcbStyle);
    jcbStyle.setEnabled(false);
    jlStyle.setEnabled(false);
    jlFormat =
        new JLabel(AppContext.getApplicationContext().getI18nString("getFeatureInfo.formatString"));
    jcbFormat = new JComboBox(service.getCapabilities().getMapFormats());
    jcbFormat.setSelectedItem(format);
    jcbFormat.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jcbFormatActionPerformed(evt);
          }
        });

    jlFormat.setLabelFor(jcbFormat);

    jpTopSettings.add(srsLabel);
    jpTopSettings.add(srsComboBox);
    jpTopSettings.add(transparencyLabel);
    jpTopSettings.add(transparencyPanel);
    jpDownSettings.add(jlFormat);
    jpDownSettings.add(jcbFormat);
    jpDownSettings.add(jpStyle);
    jpStyle.add(jlStyle, BorderLayout.CENTER);
    jpStyle.add(jcbStyle, BorderLayout.CENTER);
    jpStylesButtons = new JPanel();
    GridLayout gb = new GridLayout(2, 1);
    jpStylesButtons.setLayout(gb);
    jbEditStyle = new JButton(AppContext.getApplicationContext().getI18nString("style.edit"));
    jbSaveStyle = new JButton(AppContext.getApplicationContext().getI18nString("style.save"));
    jbEditStyle.setEnabled(false);
    jbSaveStyle.setEnabled(false);
    jpStylesButtons.add(jbEditStyle);
    jpStylesButtons.add(jbSaveStyle);
    jpStyle.add(jpStylesButtons, BorderLayout.EAST);

    jbEditStyle.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbEditStyleActionPerformed(evt);
          }
        });
    jbSaveStyle.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbSaveStyleActionPerformed(evt);
          }
        });

    this.add(
        mapLayerPanel,
        new GridBagConstraints(
            1,
            2,
            3,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(10, 0, 10, 0),
            0,
            0));

    this.add(
        jpTopSettings,
        new GridBagConstraints(
            1,
            3,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 10, 5),
            0,
            0));
    this.add(
        jpDownSettings,
        new GridBagConstraints(
            1,
            6,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 10, 5),
            0,
            0));

    this.add(
        urlLabel,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            0,
            0));
    this.add(
        urlTextField,
        new GridBagConstraints(
            2,
            0,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));
  } // fin del método jbInit
Example #25
0
  @SuppressWarnings("deprecation")
  public void init() {
    int w = frame.getWidth() / 851;
    int h = frame.getHeight() / 576;
    AllImage.welcome.setImage(
        AllImage.welcome
            .getImage()
            .getScaledInstance(panel.getWidth(), panel.getHeight(), Image.SCALE_DEFAULT));
    AllImage.welcome_version.setImage(
        AllImage.welcome_version
            .getImage()
            .getScaledInstance(panel.getWidth(), panel.getHeight(), Image.SCALE_DEFAULT));
    AllImage.welcome_login.setImage(
        AllImage.welcome_login
            .getImage()
            .getScaledInstance(panel.getWidth(), panel.getHeight(), Image.SCALE_DEFAULT));
    AllImage.welcome_input2.setImage(
        AllImage.welcome_input2
            .getImage()
            .getScaledInstance(panel.getWidth(), panel.getHeight(), Image.SCALE_DEFAULT));
    AllImage.welcome_input1.setImage(
        AllImage.welcome_input1
            .getImage()
            .getScaledInstance(panel.getWidth(), panel.getHeight(), Image.SCALE_DEFAULT));
    AllImage.welcome_aboutus.setImage(
        AllImage.welcome_aboutus
            .getImage()
            .getScaledInstance(panel.getWidth(), panel.getHeight(), Image.SCALE_DEFAULT));
    AllImage.welcome_none.setImage(
        AllImage.welcome_none
            .getImage()
            .getScaledInstance(panel.getWidth(), panel.getHeight(), Image.SCALE_DEFAULT));

    welcome = new JLabel(AllImage.welcome);
    welcome.setSize(panel.getWidth(), panel.getHeight());
    welcome.setLocation(0, 0);

    welcome_none = new JLabel(AllImage.welcome_none);
    welcome_none.setSize(panel.getWidth(), panel.getHeight());
    welcome_none.setLocation(0, 0);
    welcome_none.setVisible(false);

    aboutusPane.setSize(508 * w, 346 * h);
    aboutusPane.setLocation(176 * w, 122 * h);
    aboutusPane.setVisible(false);
    searchField.setOpaque(false);
    searchField.setBorder(null);
    searchField.setFont(new Font("ºÚÌå", Font.PLAIN, 18));
    searchField.setForeground(Color.BLACK);
    searchField.setSize(w * 290, h * 54);
    searchField.setLocation(w * 240, h * 221);
    searchField.addMouseListener(
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            welcome.setIcon(AllImage.welcome_input1);
            panel.repaint();
          }

          public void mouseClicked(MouseEvent e) {
            welcome.setIcon(AllImage.welcome_input2);
            panel.repaint();
          }

          public void mouseExited(MouseEvent e) {
            welcome.setIcon(AllImage.welcome);
            panel.repaint();
          }
        });

    panel.setLayout(null);
    welComeLabel.setSize(frame.getWidth() / 4, frame.getHeight() / 10);
    welComeLabel.setLocation(
        frame.getWidth() / 8 * 3, frame.getHeight() / 5 * 2 - welComeLabel.getHeight());
    welComeLabel.setFont(new Font("ºÚÌå", 0, 30));

    search.setOpaque(false);
    search.setBorder(null);
    search.setSize(58 * w, 62 * h);
    search.setLocation(565 * w, 236 * h);

    aboutUs.setOpaque(false);
    aboutUs.setBorder(null);
    aboutUs.setSize(54 * w, 15 * h);
    aboutUs.setLocation(432 * w, 470 * h);

    version.setOpaque(false);
    version.setBorder(null);
    version.setSize(50 * w, 11 * h);
    version.setLocation(350 * w, 470 * h);

    aboutusClose.setOpaque(false);
    aboutusClose.setBorder(null);
    aboutusClose.setSize(18 * w, 18 * h);
    aboutusClose.setLocation(648 * w, 132 * h);

    login.setOpaque(false);
    login.setBorder(null);
    login.setSize(75 * w, 13 * h);
    login.setLocation(768 * w, 54 * h);

    panel.add(aboutusClose);
    panel.add(aboutusPane);
    panel.add(login);
    panel.add(search);
    panel.add(welComeLabel);
    panel.add(searchField);
    panel.add(aboutUs);
    panel.add(version);
    panel.add(welcome);
    panel.add(welcome_none);
    search.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {}

          public void mouseEntered(MouseEvent e) {
            welcome.setIcon(AllImage.welcome_input2);
            panel.repaint();
          }

          public void mouseExited(MouseEvent e) {
            welcome.setIcon(AllImage.welcome);
            panel.repaint();
          }
        });

    aboutusClose.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            aboutusPane.setVisible(false);
            welcome_none.setVisible(false);
            welcome.setVisible(true);
            panel.add(searchField);
            panel.add(search);
            panel.repaint();
          }
        });

    aboutUs.addMouseListener(
        new MouseAdapter() {

          public void mouseEntered(MouseEvent e) {
            welcome.setIcon(AllImage.welcome_aboutus);
            panel.repaint();
          }

          public void mouseExited(MouseEvent e) {
            welcome.setIcon(AllImage.welcome);
            panel.repaint();
          }

          public void mouseClicked(MouseEvent e) {
            panel.remove(searchField);
            panel.remove(search);
            welcome.setVisible(false);
            welcome_none.setVisible(true);
            aboutusPane.setVisible(true);
            panel.repaint();
          }
        });
    version.addMouseListener(
        new MouseAdapter() {

          public void mouseEntered(MouseEvent e) {
            welcome.setIcon(AllImage.welcome_version);
            panel.repaint();
          }

          public void mouseExited(MouseEvent e) {
            welcome.setIcon(AllImage.welcome);
            panel.repaint();
          }

          public void mouseClicked(MouseEvent e) {
            panel.remove(searchField);
            panel.remove(search);
            welcome.setVisible(false);
            welcome_none.setVisible(true);
            aboutusPane.setVisible(true);
            panel.repaint();
          }
        });
    login.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            removeA();
            panel.repaint();
            MainController.jumpToRightui(Rightui.Login);
          }

          public void mouseEntered(MouseEvent e) {
            welcome.setIcon(AllImage.welcome_login);
            panel.repaint();
          }

          public void mouseExited(MouseEvent e) {
            welcome.setIcon(AllImage.welcome);
            panel.repaint();
          }
        });
    panel.repaint();
  }
  /** Create the panel. */
  public Receiveui(JFrame m, JPanel jp, LoginPO loginPO) {
    main = m;
    JPanel lastui = jp;
    Receiveui nowPanel = this;
    setLayout(null);
    ImageIcon image1 = new ImageIcon("image/transparent_circle.png");

    JButton button = new JButton("");
    button.setBounds(13, -9, 63, 63);
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.setIcon(image1);
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mousePressed(MouseEvent e) {
            button.setIcon(new ImageIcon("image/mask_circle.png"));
          }
        });
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            main.remove(nowPanel);
            main.getContentPane().add(lastui);
            main.invalidate();
            main.repaint();
            main.setVisible(true);
          }
        });
    add(button);

    JLabel lblHello = new JLabel("Hello! " + loginPO.getName());
    lblHello.setForeground(Color.WHITE);
    lblHello.setBounds(655, 12, 100, 15);
    add(lblHello);

    JToolBar toolBar = new JToolBar();
    toolBar.setEnabled(false);
    toolBar.setBounds(8, 540, 750, 35);
    toolBar.setOpaque(false);
    toolBar.setBorder(null);
    add(toolBar);

    JLabel label_4 = new JLabel("״̬À¸");
    label_4.setForeground(Color.WHITE);
    toolBar.add(label_4);

    textField = new JTextField("ÊäÈë×°Ô˵¥±àºÅ");
    textField.setOpaque(false);
    textField.setBorder(null);
    textField.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 18));
    textField.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent e) {
            label_4.setText("״̬À¸");
            if (!(Character.isDigit(e.getKeyChar()))) {
              e.consume();
            }
          }
        });
    textField.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            textField.setText("");
          }
        });
    textField.setBounds(205, 244, 347, 44);
    textField.setForeground(new Color(255, 255, 255, 200));
    textField.setCaretColor(new Color(248, 179, 28));
    add(textField);
    textField.setColumns(10);

    JButton button_1 = new JButton("");
    button_1.setContentAreaFilled(false);
    button_1.setBorderPainted(false);
    button_1.setBounds(349, 316, 52, 52);
    ImageIcon image2 = new ImageIcon("image/transparent_circle.png");
    @SuppressWarnings("static-access")
    Image temp1 =
        image2
            .getImage()
            .getScaledInstance(
                button_1.getWidth(), button_1.getHeight(), image2.getImage().SCALE_DEFAULT);
    image2 = new ImageIcon(temp1);
    button_1.setIcon(image2);
    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (textField.getText().length() != 10) {
              label_4.setText("ÇëÊäÈëÕýÈ·×°Ô˵¥ºÅ");
            } else {
              ReceiveBLService rbs = new ReceiveBL();
              LoadorderVO lv = rbs.checkUnreceive_loadorderPO(textField.getText());
              if (lv == null) {
                label_4.setText("δ¼ì²âµ½¸Ã×°Ô˵¥");
              } else {
                Arriverorder a = new Arriverorder(main, nowPanel, lv, loginPO);
                main.remove(nowPanel);
                main.getContentPane().add(a);
                main.invalidate();
                main.repaint();
                main.setVisible(true);
              }
            }
          }
        });
    add(button_1);
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    frmSignIn = new JFrame("Login");
    frmSignIn.setTitle("Sign in");
    frmSignIn.setResizable(false);
    frmSignIn.setBounds(100, 100, 450, 357);
    frmSignIn.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frmSignIn.setLocationRelativeTo(null);

    JLabel lblEmail = new JLabel("Email:");
    lblEmail.setBounds(73, 108, 56, 18);

    JLabel lblPassword = new JLabel("Password:"******"Show Password");
    chckbxShowPassword.setBounds(130, 176, 128, 23);
    frmSignIn.getContentPane().add(chckbxShowPassword);

    chckbxShowPassword.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              passwordField.setEchoChar((char) 0);
            } else {
              passwordField.setEchoChar(a);
            }
          }
        });

    JButton btnNewButton = new JButton("Sign in");
    btnNewButton.setBounds(325, 106, 72, 62);
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            username = textField.getText();
            String password = String.valueOf(passwordField.getPassword()); // getText()
            // is
            // deprecated;
            // changed
            // to
            // getPassword()
            // password.toLowerCase();  Do we want case sensitive email?
            /*
             * SHA implementation to validate password
             */

            VaultController v = new VaultController();
            int result = 0;
            try {
              result = v.loginCheck(username, password);
            } catch (NoSuchAlgorithmException e1) {

              e1.printStackTrace();
            }
            if (result == 1) {
              failedattempt = 0;
              frmSignIn.dispose();

            } else {
              txtWarning.setText("The Email and/or Password is incorrect. Please try again.");
              failedattempt++;
            }
            // TODO migrate failcheck to Vault controller!
            if (failedattempt > 1 && failedattempt < 5) {
              try {
                VaultController.Send(
                    "sentineldatavault",
                    "SENTINELDATA",
                    username,
                    "Security Warning",
                    "Dear user,\n\nYou have multiple failed login attempts for your account.\n"
                        + "If it is not you, please change your password immediately.\n\n"
                        + "Sincerely,\nSentinel Data Vault Team");
              } catch (AddressException e1) {
                e1.printStackTrace();
              } catch (MessagingException e1) {
                e1.printStackTrace();
              }
            } else if (failedattempt == 5) {
              DatabaseManager d = new DatabaseManager("vault_database");
              User u = d.retrieveUserFromDatabase(username);
              d.deleteAllEntriesFromDatabase(u);
              d.deleteUserFromDatabase(u);
              try {
                JOptionPane.showMessageDialog(
                    null,
                    "Your account data has been deleted due to multiple failed login attempts");
                VaultController.Send(
                    "sentineldatavault",
                    "SENTINELDATA",
                    username,
                    "Security Warning",
                    "Dear user,\n\nWe have deleted your account.\n"
                        + "Have a nice day.\n\n"
                        + "Sincerely,\nSentinel Data Vault Team");
              } catch (AddressException e1) {
                e1.printStackTrace();
              } catch (MessagingException e1) {
                e1.printStackTrace();
              }
            }
          }
        });
    frmSignIn.getContentPane().setLayout(null);

    btnSignUp = new JButton("Create new account");
    btnSignUp.setToolTipText("Click here to create a new Sentinel Data Vault account!");
    btnSignUp.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            SignupView signup = new SignupView();
            signup.setVisible(true);
          }
        });
    btnSignUp.setBounds(57, 264, 158, 27);
    frmSignIn.getContentPane().add(btnSignUp);
    frmSignIn.getContentPane().add(btnNewButton);
    frmSignIn.getContentPane().add(lblPassword);
    frmSignIn.getContentPane().add(lblEmail);
    frmSignIn.getContentPane().add(textField);
    frmSignIn.getContentPane().add(passwordField);

    btnForgotPassword = new JButton("I forgot my password");
    btnForgotPassword.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            frmSignIn.setVisible(false);
            PasswordRecoveryView p = new PasswordRecoveryView(frmSignIn);
          }
        });
    btnForgotPassword.setToolTipText("Click here to reset your account password");
    btnForgotPassword.setBounds(227, 264, 170, 27);
    frmSignIn.getContentPane().add(btnForgotPassword);

    lblSentinelDataVault = new JLabel("Sentinel Data Vault");
    lblSentinelDataVault.setFont(new Font("Dialog", Font.PLAIN, 22));
    lblSentinelDataVault.setBounds(119, 33, 206, 27);
    frmSignIn.getContentPane().add(lblSentinelDataVault);

    txtWarning = new JTextField();
    txtWarning.setForeground(new Color(220, 20, 60));
    txtWarning.setBorder(null);
    txtWarning.setOpaque(false);
    txtWarning.setFocusable(false);
    txtWarning.setEditable(false);
    txtWarning.setFont(new Font("Tahoma", Font.ITALIC, 12));
    txtWarning.setBackground(SystemColor.window);
    txtWarning.setBounds(57, 196, 340, 26);
    frmSignIn.getContentPane().add(txtWarning);
    txtWarning.setColumns(10);

    frmSignIn
        .getContentPane()
        .setFocusTraversalPolicy(
            new FocusTraversalOnArray(new Component[] {textField, passwordField, btnNewButton}));
    frmSignIn.setFocusTraversalPolicy(
        new FocusTraversalOnArray(new Component[] {textField, passwordField, btnNewButton}));
  }
Example #28
0
  // 생성자
  public Login() {
    // 레이아웃 설정
    layeredPane = new JLayeredPane();
    layeredPane.setBounds(0, 0, Value.width, Value.height);
    layeredPane.setLayout(null);

    // 패널1
    // 이미지 받아오기
    try {
      img = ImageIO.read(new File("C:/Users/clown/Desktop/kicom_logo_w.png"));
    } catch (IOException e) {
      System.out.println("이미지 불러오기 실패");
      System.exit(0);
    }

    MyPanel panel = new MyPanel();
    panel.setBounds(0, 0, Value.width, Value.height);

    // 로그인 필드
    id = new JLabel("아이디");
    id.setBounds(Value.width / 12 * 5, Value.height / 2 - 10, 100, 30);
    layeredPane.add(id);
    id.setVisible(true);

    loginTextField = new JTextField(30);
    loginTextField.setBounds(Value.width / 12 * 5, Value.height / 2 + 20, 320, 30);
    loginTextField.setOpaque(false);
    layeredPane.add(loginTextField);
    loginTextField.setForeground(Color.black);
    loginTextField.setVisible(true);

    // 패스워드
    pwd = new JLabel("비밀번호");
    pwd.setBounds(Value.width / 12 * 5, Value.height / 2 + 70, 100, 30);
    layeredPane.add(pwd);
    pwd.setVisible(true);

    passwordField = new JPasswordField(15);
    passwordField.setBounds(Value.width / 12 * 5, Value.height / 2 + 100, 320, 30);
    passwordField.setOpaque(false);
    passwordField.setForeground(Color.black);
    layeredPane.add(passwordField);

    // 체크박스
    check = new JCheckBox();
    check.setBounds(Value.width / 7 * 3, Value.height / 2 + 130, 30, 30);
    layeredPane.add(check);

    // 아이디저장
    reg = new JLabel("아이디 저장");
    reg.setBounds(Value.width / 7 * 3 + 30, Value.height / 2 + 130, 70, 30);
    layeredPane.add(reg);

    // 체크박스 리스너(아이디 저장)
    check.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            ID = loginTextField.getText();
            if (e.getStateChange() == 1) {
              pref.put("ID", ID);
              pref.putInt("ch", 1);
            } else {
              pref.put("ID", "");
              pref.putInt("ch", 0);
            }
          }
        });

    if (pref.getInt("ch", ch) == 1) {
      loginTextField.setText(pref.get("ID", ID));
      check.setSelected(true);
    }

    // 로그인버튼 추가
    bt = new JButton("Login");
    bt.setBounds(Value.width / 2 - 50, Value.height / 2 + 170, 100, 30);

    // 버튼 투명처리
    bt.setBorderPainted(false);
    bt.setFocusPainted(false);
    layeredPane.add(bt);

    // 버튼 이벤트
    bt.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            control.removePane(layeredPane);
            control.addPane(tab.getPane());
            Value.layeredPane = layeredPane;
          }
        });

    layeredPane.add(panel);
  }