예제 #1
0
  /** @param model */
  private void build(CalendarModel model) {
    this._support = new CalendarSupport(model, new ModelListener());

    FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT);
    flowLayout.setHgap(3);
    flowLayout.setVgap(0);

    JPanel p = this._fieldPanel;
    JTextField hf = this._hourField;
    JTextField mf = this._minuteField;
    JTextField sf = this._secondField;

    p.setLayout(flowLayout);
    p.add(hf);
    p.add(this._hmSeparator);
    p.add(mf);
    p.add(this._msSeparator);
    p.add(sf);

    hf.setHorizontalAlignment(RIGHT);
    mf.setHorizontalAlignment(RIGHT);
    sf.setHorizontalAlignment(RIGHT);

    hf.setDocument(IntegerRangeLimitedDocument.decorate(hf.getDocument(), 0, 23));
    mf.setDocument(IntegerRangeLimitedDocument.decorate(mf.getDocument(), 0, 59));
    sf.setDocument(IntegerRangeLimitedDocument.decorate(sf.getDocument(), 0, 59));

    setLayout(new BorderLayout());
    this.add(p, BorderLayout.CENTER);
    updateUI();

    this._changedUI = true;
  }
예제 #2
0
 private JTextField createColorField(boolean hex) {
   final NumberDocument doc = new NumberDocument(hex);
   int lafFix = UIUtil.isUnderWindowsLookAndFeel() || UIUtil.isUnderDarcula() ? 1 : 0;
   UIManager.LookAndFeelInfo info = LafManager.getInstance().getCurrentLookAndFeel();
   if (info != null
       && (info.getName().startsWith("IDEA") || info.getName().equals("Windows Classic")))
     lafFix = 1;
   final JTextField field;
   if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) {
     field = new JTextField("");
     field.setDocument(doc);
     field.setPreferredSize(new Dimension(hex ? 60 : 40, 26));
   } else {
     field = new JTextField(doc, "", (hex ? 5 : 2) + lafFix);
     field.setSize(50, -1);
   }
   doc.setSource(field);
   field.getDocument().addDocumentListener(this);
   field.addFocusListener(
       new FocusAdapter() {
         @Override
         public void focusGained(final FocusEvent e) {
           field.selectAll();
         }
       });
   return field;
 }
예제 #3
0
  void jbInit() throws Exception {

    setLayout(new AlignLayout(2, 5, 5));

    all = new JRadioButton("All");

    all.setSelected(true);

    select = new JRadioButton("User Data");
    select.setSelected(false);
    select.addItemListener(
        new java.awt.event.ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            select_itemStateChanged(e);
          }
        });

    userData = new JTextField(15);
    //      userData.setEnabled(false);
    ToggleDocument td = new ToggleDocument();
    td.addToggleDocumentListener(this);
    userData.setDocument(td);

    ButtonGroup bg = new ButtonGroup();
    bg.add(all);
    bg.add(select);

    add(all);
    add(new JLabel(""));
    add(select);
    add(userData);

    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  }
  private JTextField buildReferenceNameTextField() {
    JTextField textField = new JTextField();
    Document document = new RegexpDocument(RegexpDocument.RE_SQL_RELATED);
    document.addDocumentListener(buildReferenceNameDocumentListener());
    textField.setDocument(document);

    return textField;
  }
예제 #5
0
    public Component getTableCellEditorComponent(
        JTable table, Object value, boolean isSelected, int row, int column) {
      // TODO Auto-generated method stub
      Document autoCompleteDocument = new AutoCompleteDocument(nameService, field);
      nameService.setCurrentField(features.get(column - 1));
      field.setDocument(autoCompleteDocument);

      return field;
    }
 public JTextField getLoginField() {
   if (loginField == null) {
     loginField = new JTextField();
     int strSize = 50;
     loginField.setDocument(new TextDocument(strSize));
     loginField.setToolTipText("Informe o login do usuário");
     loginField.setColumns(10);
   }
   return loginField;
 }
 public JTextField getNomeField() {
   if (nomeField == null) {
     nomeField = new JTextField();
     int strSize = 50;
     nomeField.setDocument(new TextDocument(strSize));
     nomeField.setToolTipText("Informe nome do usuário");
     nomeField.setColumns(15);
   }
   return nomeField;
 }
 public TextFields() {
   t1.setDocument(ucd);
   ucd.addDocumentListener(new T1());
   b1.addActionListener(new B1());
   b2.addActionListener(new B2());
   t1.addActionListener(new T1A());
   setLayout(new FlowLayout());
   add(b1);
   add(b2);
   add(t1);
   add(t2);
   add(t3);
 }
  public PerceptronMain() {

    setPreferredSize(new java.awt.Dimension(250, 200));
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation(screenSize.width / 2, screenSize.height / 2);
    // Establecemos el tipo de layout
    setLayout(new BorderLayout());

    // Etiqueta de informacion
    labelInfo = new JLabel("Elija una de las dos opciones a ejecutar");
    erreTrabajo.setDocument(new controlarLontigud(2, true));

    // Crea el panel de botones
    buttonPanel = createButtonPanel();

    /* Creamos un layout propio para los controles anteriores */
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    // Establecemos la rejilla
    textControlsPane.setLayout(gridbag);

    // Por comodidad, creamos una funcion que aniada los controles a la rejilla
    // y al panel que la contiene...
    c.gridwidth = GridBagConstraints.REMAINDER; // last
    c.anchor = GridBagConstraints.EAST;
    c.weightx = 10.0;

    // Agregamos la etiqueta labelInfo al panel.
    textControlsPane.add(labelInfo, c);

    JLabel[] labels = {erreTrabajoLbl};
    JTextField[] textFields = {erreTrabajo};
    // Colocamos en el panel las etiquetas y los textfields.
    addLabelTextRows(labels, textFields, gridbag, textControlsPane);

    // Agregamos al panel los botones.
    textControlsPane.add(buttonPanel, c);

    // Situados los demas elementos, colocamos la etiqueta informativa

    textControlsPane.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("RNAG - Perceptrón | Adaline"),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    // A�adimos el panel en la zona "LINE_START" al principio...
    add(textControlsPane, BorderLayout.LINE_START);
  } // fin_MiLogin()
예제 #10
0
  /**
   * @param t - id turnieju
   * @param db - baza danych
   */
  public TournamentPanel(Tournament t, Database db) {
    this.turniej = t;
    this.DB = db;
    nameL = new JLabel("Nazwa turnieju: ");
    yearL = new JLabel("Rok: ");
    sgTimeL = new JLabel(Strings.sgTimeT + "10 min");
    groupsL = new JLabel(Strings.groupsT + "2");
    boardsL = new JLabel(Strings.boardsT);
    stats1L = new JLabel(Strings.gamesT);
    stats2L = new JLabel(Strings.timeRRET);
    nameTF = new JTextField();
    yearTF = new JTextField();
    groupsSB = new Scrollbar(Scrollbar.HORIZONTAL, 2, 1, 2, 9 + 1);
    sgTimeSB = new Scrollbar(Scrollbar.HORIZONTAL, 20, 4, 2, 40 + 4);
    boardsSB = new Scrollbar(Scrollbar.HORIZONTAL, 8, 1, 2, 20 + 1);

    setLayout(new BorderLayout());
    setBorder(new EmptyBorder(10, 10, 10, 10));
    panel.setLayout(new GridLayout(0, 2, 10, 20));
    add(panel, BorderLayout.NORTH);
    nameTF.setDocument(new MyPlainDocument());
    yearTF.setDocument(new MyPlainDocument());

    setComponentsActions();

    Component[] cs = {
      nameL, nameTF, yearL, yearTF, sgTimeL, sgTimeSB, groupsL, groupsSB, boardsL, boardsSB,
      stats1L, stats2L
    };
    for (Component c : cs) panel.add(c);

    nameTF.setText(turniej.getName());
    yearTF.setText(turniej.getYear());
    setSBBounds();
    recalcStats();
  }
예제 #11
0
 /**
  * Initialises this dialog's fields in accordance with a given JDBCAuthenticator object. In
  * general, this will call {@link uk.ac.starlink.table.jdbc.JDBCAuthenticator#authenticate} and
  * fill the user and password fields with the result. However, if <code>auth</code> is a {@link
  * uk.ac.starlink.table.jdbc.TextModelsAuthenticator}, it will actually use its models in the user
  * and password fields.
  *
  * @param auth authenticator object to configure from
  */
 public void useAuthenticator(JDBCAuthenticator auth) {
   if (auth instanceof TextModelsAuthenticator) {
     TextModelsAuthenticator tAuth = (TextModelsAuthenticator) auth;
     userField.setDocument(tAuth.getUserDocument());
     passField.setDocument(tAuth.getPasswordDocument());
   } else {
     if (auth instanceof SwingAuthenticator) {
       ((SwingAuthenticator) auth).setParentComponent(this);
     }
     try {
       String[] up = auth.authenticate();
       userField.setText(up[0]);
       passField.setText(up[1]);
     } catch (IOException e) {
       logger_.log(Level.WARNING, "Authentication attempt failed", e);
     }
   }
 }
    public MyValidatableComponent() {
      myNameLabel.setLabelFor(myNameText);
      myNameText.setDocument(myNameDocument);

      getEditor()
          .addSettingsEditorListener(
              new SettingsEditorListener() {
                public void stateChanged(SettingsEditor settingsEditor) {
                  updateWarning();
                }
              });

      myWarningLabel.setIcon(IconLoader.getIcon("/runConfigurations/configurationWarning.png"));

      myComponentPlace.setLayout(new GridBagLayout());
      myComponentPlace.add(
          getEditorComponent(),
          new GridBagConstraints(
              0,
              0,
              1,
              1,
              1.0,
              1.0,
              GridBagConstraints.NORTHWEST,
              GridBagConstraints.BOTH,
              new Insets(0, 0, 0, 0),
              0,
              0));
      myComponentPlace.doLayout();
      myFixButton.setIcon(IconLoader.getIcon("/actions/quickfixBulb.png"));
      updateWarning();
      myFixButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(final ActionEvent e) {
              if (myQuickFix == null) {
                return;
              }
              myQuickFix.run();
              myValidationResultValid = false;
              updateWarning();
            }
          });
    }
  /**
   * Create the _view.
   *
   * @throws SQLException
   */
  public RemoveReaderInternalFrame(ILibrary library) throws SQLException {
    _model = library;

    setTitle("Remove Reader");
    int textFieldCharactersLimit = 25;
    setClosable(true);
    setBounds(100, 100, 600, 300);
    getContentPane().setLayout(null);

    _textFieldSearch = new JTextField();
    _textFieldSearch.setBounds(170, 236, 244, 23);
    _textFieldSearch.setToolTipText("Search Field");
    _textFieldSearch.setColumns(10);
    _textFieldSearch.setDocument(new JTextFieldLimit(textFieldCharactersLimit));
    getContentPane().add(_textFieldSearch);

    _readerModel = new DefaultListModel<Reader>();
    _filteredListModel = new FilteredListModel(_readerModel);

    _readersList = new JList<Reader>(_filteredListModel);
    _readersList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            setEnabledBtnRemoveReader(true);
          }
        });
    _readersList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    _readersList.setBounds(10, 52, 414, 173);

    _btnRemoveReader = new JButton("Remove Reader");
    _btnRemoveReader.setEnabled(false);
    _btnRemoveReader.setBounds(10, 236, 150, 23);
    getContentPane().add(_btnRemoveReader);

    _btnCancel = new JButton("Cancel");
    _btnCancel.setBounds(424, 236, 150, 23);
    getContentPane().add(_btnCancel);

    JScrollPane scrollPane = new JScrollPane(_readersList);
    scrollPane.setBounds(10, 11, 564, 214);
    getContentPane().add(scrollPane);
  }
예제 #14
0
 public JComponent getJComponent() {
   if (jp == null) {
     jp = new JPanel();
     jp.setLayout(new BorderLayout());
     jp.add(new JLabel(getDescription()), BorderLayout.WEST);
     jtf = new JTextField(10);
     updateGUI();
     jtf.setDocument(
         new PlainDocument() {
           public void insertString(int offs, String str, AttributeSet a)
               throws BadLocationException {
             if (str == null) {
               return;
             }
             for (int i = 0; i < str.length(); i++) {
               char c = str.charAt(i);
               if (c < '0' || c > '9') {
                 Toolkit.getDefaultToolkit().beep();
                 return;
               }
             }
             String oldstr = jtf.getText();
             super.insertString(offs, str, a);
             str = jtf.getText();
             if (setValueFromString(str) == null) {
               if (J2DBench.verbose.isEnabled()) {
                 System.out.println(getOptionString());
               }
             } else {
               super.remove(0, super.getLength());
               super.insertString(0, oldstr, null);
               Toolkit.getDefaultToolkit().beep();
             }
           }
         });
     jtf.setText(getValString());
     jp.add(jtf, BorderLayout.EAST);
   }
   return jp;
 }
예제 #15
0
  /** @return */
  private JTextField getJTextFieldKomm() {
    if (jTextFieldKomm == null) {
      jTextFieldKomm = new JTextField();
      jTextFieldKomm.setBounds(20, 30, 400, 25);
      jTextFieldKomm.setFont(getFontA());
      PlainDocument docTitel = new PlainDocument();
      jTextFieldKomm.setDocument(docTitel);
      docTitel.addDocumentListener(
          new DocumentListener() {
            public void insertUpdate(DocumentEvent e) {
              handleTextChange();
            }

            public void removeUpdate(DocumentEvent e) {
              handleTextChange();
            }

            public void changedUpdate(DocumentEvent e) {}
          });
    }
    return jTextFieldKomm;
  }
예제 #16
0
  private void initializeComponent(final Frame owner) {
    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            if (owner == null) {
              System.exit(0);
            }
            owner.setEnabled(true);
            dispose();
          }
        });

    serverLabel = new JLabel("Server name");
    serverField = new JTextField(ClientGameConfiguration.get("DEFAULT_SERVER"));
    serverField.setEditable(true);
    serverPortLabel = new JLabel("Server port");
    serverPortField = new JTextField(ClientGameConfiguration.get("DEFAULT_PORT"));

    usernameLabel = new JLabel("Choose a username");
    usernameField = new JTextField();
    usernameField.setDocument(new LowerCaseLetterDocument());

    passwordLabel = new JLabel("Choose a password");
    passwordField = new JPasswordField();

    passwordretypeLabel = new JLabel("Retype password");
    passwordretypeField = new JPasswordField();

    emailLabel = new JLabel("E-mail address (optional)");
    emailField = new JTextField();

    // createAccountButton
    //
    createAccountButton = new JButton();
    createAccountButton.setText("Create Account");
    createAccountButton.setMnemonic(KeyEvent.VK_C);
    this.rootPane.setDefaultButton(createAccountButton);
    createAccountButton.addActionListener(
        new ActionListener() {

          public void actionPerformed(final ActionEvent e) {
            createAccountButton_actionPerformed(e, false);
          }
        });

    //
    // contentPane
    //
    int padding = SBoxLayout.COMMON_PADDING;
    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(new SBoxLayout(SBoxLayout.VERTICAL, padding));
    contentPane.setBorder(BorderFactory.createEmptyBorder(padding, padding, padding, padding));

    JComponent grid =
        new JComponent() {
          private static final long serialVersionUID = 1L;
        };
    grid.setLayout(new GridLayout(6, 2, padding, padding));
    contentPane.add(grid, SBoxLayout.constraint(SLayout.EXPAND_X, SLayout.EXPAND_Y));

    // row 0
    grid.add(serverLabel);
    grid.add(serverField);

    // row 1
    grid.add(serverPortLabel);
    grid.add(serverPortField);

    // row 2
    grid.add(usernameLabel);
    grid.add(usernameField);

    // row 3
    grid.add(passwordLabel);
    grid.add(passwordField);

    // row 4
    grid.add(passwordretypeLabel);
    grid.add(passwordretypeField);

    // row 5
    grid.add(emailLabel);
    grid.add(emailField);

    // Warning label
    JLabel logLabel =
        new JLabel(
            "<html><body><p><font size=\"-2\">On login information which identifies your computer on <br>the internet will be logged to prevent abuse (like many <br>attempts to guess a password in order to hack an <br>account or creation of many accounts to cause trouble). <br>Furthermore all events and actions that happen within <br>the game-world (like solving quests, attacking monsters) <br>are logged. This information is used to analyse bugs and <br>in rare cases for abuse handling.</font></p></body></html>");
    // Add a bit more empty space around it
    logLabel.setBorder(BorderFactory.createEmptyBorder(padding, padding, padding, padding));
    logLabel.setAlignmentX(CENTER_ALIGNMENT);
    contentPane.add(logLabel, SBoxLayout.constraint(SLayout.EXPAND_X, SLayout.EXPAND_Y));

    createAccountButton.setAlignmentX(RIGHT_ALIGNMENT);
    contentPane.add(createAccountButton);

    // CreateAccountDialog
    this.setTitle("Create New Account");
    this.setResizable(false);
    // required on Compiz
    this.pack();

    usernameField.requestFocusInWindow();
    if (owner != null) {
      owner.setEnabled(false);
      this.setLocationRelativeTo(owner);
    }
  }
  /**
   * Creates a separator panel.
   *
   * @return The panel.
   */
  private JPanel createSeparatorPanel() {
    // separator panel
    final JPanel separatorPanel = new JPanel();
    separatorPanel.setLayout(new GridBagLayout());

    final TitledBorder tb =
        new TitledBorder(getResources().getString("csvexportdialog.separatorchar")); // $NON-NLS-1$
    separatorPanel.setBorder(tb);

    rbSeparatorTab =
        new JRadioButton(getResources().getString("csvexportdialog.separator.tab")); // $NON-NLS-1$
    rbSeparatorColon =
        new JRadioButton(
            getResources().getString("csvexportdialog.separator.colon")); // $NON-NLS-1$
    rbSeparatorSemicolon =
        new JRadioButton(
            getResources().getString("csvexportdialog.separator.semicolon")); // $NON-NLS-1$
    rbSeparatorOther =
        new JRadioButton(
            getResources().getString("csvexportdialog.separator.other")); // $NON-NLS-1$

    getFormValidator().registerButton(rbSeparatorColon);
    getFormValidator().registerButton(rbSeparatorOther);
    getFormValidator().registerButton(rbSeparatorSemicolon);
    getFormValidator().registerButton(rbSeparatorTab);

    final ButtonGroup btg = new ButtonGroup();
    btg.add(rbSeparatorTab);
    btg.add(rbSeparatorColon);
    btg.add(rbSeparatorSemicolon);
    btg.add(rbSeparatorOther);

    final Action selectAction = new ActionSelectSeparator();
    rbSeparatorTab.addActionListener(selectAction);
    rbSeparatorColon.addActionListener(selectAction);
    rbSeparatorSemicolon.addActionListener(selectAction);
    rbSeparatorOther.addActionListener(selectAction);

    final LengthLimitingDocument ldoc = new LengthLimitingDocument(1);
    txSeparatorOther = new JTextField();
    txSeparatorOther.setDocument(ldoc);
    txSeparatorOther.setColumns(5);
    getFormValidator().registerTextField(txSeparatorOther);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.insets = new Insets(1, 1, 1, 1);
    separatorPanel.add(rbSeparatorTab, gbc);

    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.insets = new Insets(1, 1, 1, 1);
    separatorPanel.add(rbSeparatorColon, gbc);

    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.insets = new Insets(1, 1, 1, 1);
    separatorPanel.add(rbSeparatorSemicolon, gbc);

    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.insets = new Insets(1, 1, 1, 1);
    separatorPanel.add(rbSeparatorOther, gbc);

    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 1;
    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.insets = new Insets(1, 1, 1, 1);
    separatorPanel.add(txSeparatorOther, gbc);

    return separatorPanel;
  }
예제 #18
0
  private void initConfig() throws MissingResourceException {

    setLayout(new MigLayout("", "[::523.00px]", "[][5px:n][][5px:n][]"));

    panelPreprocess = new JPanel();
    panelPreprocess.setBorder(
        new TitledBorder(
            null,
            BUNDLE.getString("EpaSoftPanel.panelPreprocess.borderTitle"),
            TitledBorder.LEADING,
            TitledBorder.TOP,
            FONT_PANEL_TITLE,
            null));
    add(panelPreprocess, "cell 0 0,grow");
    panelPreprocess.setLayout(new MigLayout("", "[118px:n][118px:n][118px:n][118px:n]", "[]"));

    btnSectorSelection =
        new JButton(BUNDLE.getString("EpaSoftPanel.btnSectorSelection.text")); // $NON-NLS-1$
    btnSectorSelection.setEnabled(false);
    btnSectorSelection.setActionCommand("showSectorSelection");
    panelPreprocess.add(btnSectorSelection, "cell 0 0,growx");

    btnStateSelection = new JButton(BUNDLE.getString("EpaSoftPanel.btnStateSelection.text"));
    btnStateSelection.setEnabled(false);
    btnStateSelection.setActionCommand(
        BUNDLE.getString("EpaSoftPanel.btnStateSelection.actionCommand")); // $NON-NLS-1$
    panelPreprocess.add(btnStateSelection, "cell 1 0,growx");

    btnOptions = new JButton(BUNDLE.getString("EpaSoftPanel.btnDesign.text")); // $NON-NLS-1$
    btnOptions.setEnabled(false);
    btnOptions.setActionCommand("showOptions");
    panelPreprocess.add(btnOptions, "flowx,cell 2 0,growx");

    btnDesign = new JButton(BUNDLE.getString("EpaSoftPanel.btnRaingage.text")); // $NON-NLS-1$
    btnDesign.setEnabled(false);
    btnDesign.setActionCommand("showRaingage");
    panelPreprocess.add(btnDesign, "cell 3 0,growx");

    panelFileManager = new JPanel();
    panelFileManager.setBorder(
        new TitledBorder(
            null,
            BUNDLE.getString("EpaSoftPanel.panelFileManager.borderTitle"),
            TitledBorder.LEADING,
            TitledBorder.TOP,
            FONT_PANEL_TITLE,
            null));
    add(panelFileManager, "cell 0 2,grow");
    panelFileManager.setLayout(
        new MigLayout(
            "",
            "[][108.00][::3px][:238.00px:250px][::3px][:65px:65px]",
            "[::22px][34px:n][20][34px:n][20][][]"));

    chkExport = new JCheckBox();
    chkExport.setToolTipText(BUNDLE.getString("EpaSoftPanel.chkExport.toolTipText")); // $NON-NLS-1$
    chkExport.setActionCommand("exportSelected");
    chkExport.setText(BUNDLE.getString("EpaSoftPanel.chkExport.text"));
    panelFileManager.add(chkExport, "cell 0 0 2 1,aligny bottom");

    chkSubcatchments = new JCheckBox();
    chkSubcatchments.setToolTipText(
        BUNDLE.getString("EpaSoftPanel.chkSubcatchments.toolTipText")); // $NON-NLS-1$
    chkSubcatchments.setVisible(false);
    chkSubcatchments.setText(BUNDLE.getString("EpaSoftPanel.chkSubcatchments.text")); // $NON-NLS-1$
    panelFileManager.add(chkSubcatchments, "cell 3 0");

    JLabel label = new JLabel();
    label.setText(BUNDLE.getString("Form.label.text"));
    panelFileManager.add(label, "cell 1 1,alignx right");

    scrollPane_2 = new JScrollPane();
    panelFileManager.add(scrollPane_2, "cell 3 1,grow");

    txtFileInp = new JTextArea();
    scrollPane_2.setViewportView(txtFileInp);
    txtFileInp.setFont(new Font("Tahoma", Font.PLAIN, 11));
    txtFileInp.setLineWrap(true);

    btnFileInp = new JButton();
    btnFileInp.setMinimumSize(new Dimension(65, 9));
    btnFileInp.setActionCommand("chooseFileInp");
    btnFileInp.setText("...");
    btnFileInp.setFont(new Font("Tahoma", Font.BOLD, 12));
    panelFileManager.add(btnFileInp, "cell 5 1,growx");

    chkExec = new JCheckBox();
    chkExec.setToolTipText(BUNDLE.getString("EpaSoftPanel.chkExec.toolTipText")); // $NON-NLS-1$
    chkExec.setText(BUNDLE.getString("EpaSoftPanel.chkExec.text")); // $NON-NLS-1$
    chkExec.setName("chk_exec");
    panelFileManager.add(chkExec, "cell 0 2 3 1,alignx left,aligny bottom");

    lblFileRpt = new JLabel();
    lblFileRpt.setText(BUNDLE.getString("Form.label_1.text"));
    panelFileManager.add(lblFileRpt, "cell 1 3,alignx right");

    scrollPane_3 = new JScrollPane();
    panelFileManager.add(scrollPane_3, "cell 3 3,grow");

    txtFileRpt = new JTextArea();
    scrollPane_3.setViewportView(txtFileRpt);
    txtFileRpt.setFont(new Font("Tahoma", Font.PLAIN, 11));
    txtFileRpt.setLineWrap(true);

    btnFileRpt = new JButton();
    btnFileRpt.setMinimumSize(new Dimension(65, 9));
    btnFileRpt.setActionCommand("chooseFileRpt");
    btnFileRpt.setText("...");
    btnFileRpt.setFont(new Font("Tahoma", Font.BOLD, 12));
    panelFileManager.add(btnFileRpt, "cell 5 3,growx");

    chkImport = new JCheckBox();
    chkImport.setToolTipText(BUNDLE.getString("EpaSoftPanel.chkImport.toolTipText")); // $NON-NLS-1$
    chkImport.setText(BUNDLE.getString("EpaSoftPanel.chkImport.text"));
    chkImport.setName("chk_import");
    panelFileManager.add(chkImport, "cell 0 4 2 1,aligny bottom");

    lblResultName = new JLabel();
    lblResultName.setText(BUNDLE.getString("Form.label_2.text"));
    lblResultName.setName("lbl_project");
    panelFileManager.add(lblResultName, "cell 1 5,alignx right");

    txtResultName = new JTextField();
    txtResultName.setName("txt_project");
    MaxLengthTextDocument maxLength = new MaxLengthTextDocument(16);
    txtResultName.setDocument(maxLength);
    panelFileManager.add(txtResultName, "cell 3 5,growx,aligny top");

    btnAccept = new JButton();
    btnAccept.setMinimumSize(new Dimension(65, 23));
    btnAccept.setEnabled(false);
    btnAccept.setText(BUNDLE.getString("Generic.btnAccept.text"));
    btnAccept.setName("btn_accept_postgis");
    btnAccept.setActionCommand("execute");
    panelFileManager.add(btnAccept, "flowx,cell 5 6,alignx right");

    btnProjectPreferences = new JButton("Project Preferences");
    btnProjectPreferences.setMinimumSize(new Dimension(130, 23));
    btnProjectPreferences.setPreferredSize(new Dimension(115, 23));
    btnProjectPreferences.setActionCommand("openProjectPreferences");
    add(btnProjectPreferences, "flowx,cell 0 4,alignx right");

    setupListeners();
  }
예제 #19
0
파일: FrmGrupos.java 프로젝트: jpretel/sys
  public FrmGrupos() {
    super("Familia de Productos");
    setBounds(100, 100, 600, 353);
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setAlignmentY(Component.TOP_ALIGNMENT);
    scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);

    tblLista = new JTable(new MaestroTableModel());
    scrollPane.setViewportView(tblLista);
    tblLista.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JLabel lblCodigo = new JLabel("Codigo");

    txtCodigo = new JTextField();
    txtCodigo.setColumns(10);
    txtCodigo.setDocument(new JTextFieldLimit(3, true));

    JLabel lblDescripcion = new JLabel("Descripcion");

    txtDescripcion = new JTextField();
    txtDescripcion.setColumns(10);
    txtDescripcion.setDocument(new JTextFieldLimit(75, true));

    JLabel lblDescCorta = new JLabel("Descripcion corta");

    txtDescCorta = new JTextField();
    txtDescCorta.setColumns(10);
    txtDescCorta.setDocument(new JTextFieldLimit(50, true));

    JLabel lblSubgrupos = new JLabel("SubGrupos");

    scrollPane_SubGrupo = new JScrollPane();
    tblSubGrupo =
        new JTable(
            new DSGTableModel(new String[] {"Código", "Descripción"}) {
              private static final long serialVersionUID = 1L;

              @Override
              public boolean evaluaEdicion(int row, int column) {
                return getEditar();
              }

              @Override
              public void addRow() {
                addRow(new Object[] {"", ""});
              }
            });
    scrollPane_SubGrupo.setViewportView(tblSubGrupo);
    tblSubGrupo.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    getSubgrupoTM().setNombre_detalle("Código");
    getSubgrupoTM().setObligatorios(0, 1);
    getSubgrupoTM().setRepetidos(0);
    getSubgrupoTM().setScrollAndTable(scrollPane_SubGrupo, tblSubGrupo);

    TableColumnModel cModel = tblSubGrupo.getColumnModel();
    cModel.getColumn(0).setCellEditor(new TableTextEditor(3, true));
    GroupLayout groupLayout = new GroupLayout(pnlContenido);
    groupLayout.setHorizontalGroup(
        groupLayout
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                groupLayout
                    .createSequentialGroup()
                    .addGap(10)
                    .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
                    .addGap(10)
                    .addGroup(
                        groupLayout
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(
                                groupLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        scrollPane_SubGrupo,
                                        GroupLayout.DEFAULT_SIZE,
                                        378,
                                        Short.MAX_VALUE)
                                    .addContainerGap())
                            .addGroup(
                                groupLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        lblCodigo,
                                        GroupLayout.PREFERRED_SIZE,
                                        46,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(50)
                                    .addComponent(txtCodigo, 108, 108, 108)
                                    .addGap(130))
                            .addGroup(
                                groupLayout
                                    .createSequentialGroup()
                                    .addComponent(
                                        lblDescripcion,
                                        GroupLayout.PREFERRED_SIZE,
                                        63,
                                        GroupLayout.PREFERRED_SIZE)
                                    .addGap(33)
                                    .addComponent(
                                        txtDescripcion,
                                        GroupLayout.DEFAULT_SIZE,
                                        282,
                                        Short.MAX_VALUE)
                                    .addGap(10))
                            .addGroup(
                                groupLayout
                                    .createSequentialGroup()
                                    .addGroup(
                                        groupLayout
                                            .createParallelGroup(Alignment.LEADING)
                                            .addGroup(
                                                groupLayout
                                                    .createSequentialGroup()
                                                    .addComponent(
                                                        lblDescCorta,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        86,
                                                        GroupLayout.PREFERRED_SIZE)
                                                    .addGap(10)
                                                    .addComponent(
                                                        txtDescCorta,
                                                        GroupLayout.DEFAULT_SIZE,
                                                        185,
                                                        Short.MAX_VALUE))
                                            .addGroup(
                                                groupLayout
                                                    .createSequentialGroup()
                                                    .addComponent(
                                                        lblSubgrupos,
                                                        GroupLayout.PREFERRED_SIZE,
                                                        86,
                                                        GroupLayout.PREFERRED_SIZE)
                                                    .addGap(147)))
                                    .addGap(107)))));
    groupLayout.setVerticalGroup(
        groupLayout
            .createParallelGroup(Alignment.LEADING)
            .addGroup(
                groupLayout
                    .createSequentialGroup()
                    .addGap(10)
                    .addGroup(
                        groupLayout
                            .createParallelGroup(Alignment.LEADING)
                            .addComponent(
                                scrollPane, GroupLayout.DEFAULT_SIZE, 269, Short.MAX_VALUE)
                            .addGroup(
                                groupLayout
                                    .createSequentialGroup()
                                    .addGroup(
                                        groupLayout
                                            .createParallelGroup(Alignment.LEADING, false)
                                            .addGroup(
                                                groupLayout
                                                    .createSequentialGroup()
                                                    .addGap(1)
                                                    .addComponent(lblCodigo))
                                            .addComponent(
                                                txtCodigo,
                                                GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.PREFERRED_SIZE))
                                    .addGap(6)
                                    .addGroup(
                                        groupLayout
                                            .createParallelGroup(Alignment.LEADING)
                                            .addGroup(
                                                groupLayout
                                                    .createSequentialGroup()
                                                    .addGap(3)
                                                    .addComponent(lblDescripcion))
                                            .addComponent(
                                                txtDescripcion,
                                                GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.PREFERRED_SIZE))
                                    .addGap(7)
                                    .addGroup(
                                        groupLayout
                                            .createParallelGroup(Alignment.LEADING)
                                            .addGroup(
                                                groupLayout
                                                    .createSequentialGroup()
                                                    .addGap(3)
                                                    .addComponent(lblDescCorta))
                                            .addComponent(
                                                txtDescCorta,
                                                GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE,
                                                GroupLayout.PREFERRED_SIZE))
                                    .addGap(8)
                                    .addComponent(lblSubgrupos)
                                    .addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addComponent(
                                        scrollPane_SubGrupo,
                                        GroupLayout.DEFAULT_SIZE,
                                        163,
                                        Short.MAX_VALUE)
                                    .addPreferredGap(ComponentPlacement.RELATED)))
                    .addGap(6)));
    pnlContenido.setLayout(groupLayout);

    tblLista
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              @Override
              public void valueChanged(ListSelectionEvent arg0) {
                int selectedRow = tblLista.getSelectedRow();
                if (selectedRow >= 0) setGrupo(getGrupos().get(selectedRow));
                else setGrupo(null);
                llenar_datos();
              }
            });
    iniciar();
  }
  /** Add the components to the panel. */
  private void addComponents() {
    JPanel topPanel = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();

    JPanel servers = new NamedBorderPanel(Translator.R("APSServersPanel"));
    servers.setLayout(new GridBagLayout());

    JLabel type = new JLabel(Translator.R("APSProxyTypeLabel"));
    JLabel proxyAddress = new JLabel(Translator.R("APSProxyAddressLabel"));
    JLabel port = new JLabel(Translator.R("APSProxyPortLabel"));

    // This addresses the HTTP proxy settings.
    JLabel http = new JLabel(Translator.R("APSLabelHTTP") + ":");
    final JTextField httpAddressField = new JTextField(fields[0]);
    final JTextField httpPortField = new JTextField();
    httpPortField.setDocument(NetworkSettingsPanel.getPortNumberDocument());
    httpAddressField.getDocument().addDocumentListener(new DocumentAdapter(fields, 0));
    httpPortField.getDocument().addDocumentListener(new DocumentAdapter(fields, 1));
    httpPortField.setText(fields[1]);

    // This addresses the HTTPS proxy settings.
    JLabel secure = new JLabel(Translator.R("APSLabelSecure") + ":");
    final JTextField secureAddressField = new JTextField(fields[2]);
    final JTextField securePortField = new JTextField();
    securePortField.setDocument(NetworkSettingsPanel.getPortNumberDocument());
    secureAddressField.getDocument().addDocumentListener(new DocumentAdapter(fields, 2));
    securePortField.getDocument().addDocumentListener(new DocumentAdapter(fields, 3));
    securePortField.setText(fields[3]);

    // This addresses the FTP proxy settings.
    JLabel ftp = new JLabel(Translator.R("APSLabelFTP") + ":");
    final JTextField ftpAddressField = new JTextField(fields[4]);
    final JTextField ftpPortField = new JTextField();
    ftpPortField.setDocument(NetworkSettingsPanel.getPortNumberDocument());
    ftpAddressField.getDocument().addDocumentListener(new DocumentAdapter(fields, 4));
    ftpPortField.getDocument().addDocumentListener(new DocumentAdapter(fields, 5));
    ftpPortField.setText(fields[5]);

    // This addresses the Socks proxy settings.
    JLabel socks = new JLabel(Translator.R("APSLabelSocks") + ":");
    final JTextField socksAddressField = new JTextField(fields[6]);
    final JTextField socksPortField = new JTextField();
    socksPortField.setDocument(NetworkSettingsPanel.getPortNumberDocument());
    socksAddressField.getDocument().addDocumentListener(new DocumentAdapter(fields, 6));
    socksPortField.getDocument().addDocumentListener(new DocumentAdapter(fields, 7));
    socksPortField.setText(fields[7]);

    JCheckBox sameProxyForAll =
        new JCheckBox(Translator.R("APSSameProxyForAllProtocols"), Boolean.parseBoolean(fields[8]));
    sameProxyForAll.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            fields[8] = String.valueOf(e.getStateChange() == ItemEvent.SELECTED);
          }
        });

    JPanel p = new JPanel();
    BoxLayout bl = new BoxLayout(p, BoxLayout.Y_AXIS);
    p.setLayout(bl);
    p.add(sameProxyForAll);

    c.fill = GridBagConstraints.BOTH;
    c.gridheight = 1;
    c.gridy = 0;
    c.gridwidth = 1;
    c.weightx = 0;
    c.gridx = 0;
    servers.add(type, c);
    c.gridwidth = 2;
    c.weightx = 1;
    c.gridx = 1;
    servers.add(proxyAddress, c);
    c.gridwidth = 1;
    c.weightx = 1;
    c.gridx = 4;
    servers.add(port, c);

    plant(1, http, httpAddressField, httpPortField, servers, c);
    plant(2, secure, secureAddressField, securePortField, servers, c);
    plant(3, ftp, ftpAddressField, ftpPortField, servers, c);
    plant(4, socks, socksAddressField, socksPortField, servers, c);
    c.gridwidth = 5;
    c.gridx = 0;
    c.gridy = 5;
    servers.add(p, c);

    JPanel exceptions = new NamedBorderPanel(Translator.R("APSExceptionsLabel"));
    exceptions.setLayout(new BorderLayout());
    JLabel exceptionDescription = new JLabel(Translator.R("APSExceptionsDescription"));
    final JTextArea exceptionListArea = new JTextArea();
    exceptionListArea.setLineWrap(true);
    exceptionListArea.setText(fields[9]);
    exceptionListArea.getDocument().addDocumentListener(new DocumentAdapter(fields, 9));

    JLabel exceptionFormat = new JLabel(Translator.R("APSExceptionInstruction"));
    JScrollPane exceptionScroll =
        new JScrollPane(
            exceptionListArea,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    exceptions.add(exceptionDescription, BorderLayout.NORTH);
    exceptions.add(exceptionScroll, BorderLayout.CENTER);
    exceptions.add(exceptionFormat, BorderLayout.SOUTH);

    c.gridx = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridy = 0;
    topPanel.add(servers, c);
    c.weighty = 1;
    c.gridy = 1;
    topPanel.add(exceptions, c);

    this.add(topPanel);
    this.add(createButtonPanel(), BorderLayout.SOUTH);
  }
예제 #21
0
  @SuppressWarnings({})
  protected void buildBookFrame() {
    setLayout(new GridBagLayout());

    codigoCatalogoLabel = new JLabel("** Código ISBN :");
    codigoCatalogoLabel.setToolTipText("Codigo ISBN Obrigatorio");
    codigoCatalogoLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    add(codigoCatalogoLabel, new GBC(0, 0).insets(15, 10, 10, 10).left());
    codigoCatalogoField = new JTextField(18);
    codigoCatalogoField.setToolTipText("Informe o codigo e digite <ENTER>");
    add(codigoCatalogoField, new GBC(1, 0).insets(5, 0, 0, 10).left());

    codigoCatalogoField.addKeyListener(
        new KeyAdapter() {

          @Override
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {

              if (codigoCatalogoField.getText() == null
                  || codigoCatalogoField.getText().trim().isEmpty()) {
                JOptionPane.showMessageDialog(DelBookFrame.this, "Codigo ISBN  é obrigatorio.");
              } else {

                String codigoCatalogo = (String) codigoCatalogoField.getText().trim();

                AcervoBook acervoBook = ConsultBookDAO.consult(codigoCatalogo);

                if (acervoBook == null) {
                  JOptionPane.showMessageDialog(
                      codigoCatalogoField, "Codigo ISBN " + codigoCatalogo + " não existente !!!");
                } else {

                  importDadosTela(acervoBook);
                  ImageIcon imageIcon = null;
                  imageIcon = TrataArquvoCapa.trataArquvoCapa(acervoBook.getCapa());
                  incluiCapaNaTela(imageIcon);

                  List<AcervoBookItem> allAcervoBookItens =
                      ConsultBookItemDAO.consult(codigoCatalogo);
                  if (allAcervoBookItens != null) {
                    importDadosTabela(allAcervoBookItens);
                  }
                  pack();
                }
              }
            }
          }
        });

    add(
        new JSeparator(SwingConstants.HORIZONTAL),
        new GBC(0, 1).gridwh(2, 1).insets(5, 10, 0, 10).horizontal());

    tituloLabel = new JLabel("Titulo : ");
    tituloLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    tituloField = new JTextField(28);

    tituloOriginalLabel = new JLabel("Titulo Original : ");
    tituloOriginalLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    tituloOriginalField = new JTextField(28);

    panel = new JPanel();
    panel.add(tituloLabel);
    panel.add(tituloField);
    panel.add(tituloOriginalLabel);
    panel.add(tituloOriginalField);
    getContentPane().add(panel, new GBC(0, 2).gridwh(2, 1).left().insets(5, 5, 5, 5));

    escritorLabel = new JLabel("Escritor :");
    escritorLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    escritorField = new JTextField(28);

    tradutorLabel = new JLabel("  Tradutor :");
    tradutorLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    tradutorField = new JTextField(28);

    panel2 = new JPanel();
    panel2.add(escritorLabel);
    panel2.add(escritorField);
    panel2.add(tradutorLabel);
    panel2.add(tradutorField);
    getContentPane().add(panel2, new GBC(0, 3).gridwh(2, 1).left().insets(5, 5, 5, 5));

    anoLancamentoLabel = new JLabel("Ano Lançamento : ");
    anoLancamentoLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    anoLancamentoField = new JTextField(3);
    anoLancamentoField.setDocument(new LimetedNoCharacters(4));
    anoLancamentoField.setToolTipText("Informe o ano no formato YYYY");

    anoPrimEdicaoLabel = new JLabel("   Ano Primeira Edição : ");
    anoPrimEdicaoLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    anoPrimEdicaoField = new JTextField(3);
    anoPrimEdicaoField.setDocument(new LimetedNoCharacters(4));
    anoPrimEdicaoField.setToolTipText("Informe o ano no formato YYYY");

    edicaoLabel = new JLabel("   Edicao : ");
    edicaoLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    edicaoField = new JTextField(2);
    edicaoField.setDocument(new LimetedNoCharacters(2));
    edicaoField.setToolTipText("Informe a edicao fr 01 a 99");

    qtdPageLabel = new JLabel("   Qtd. Paginas : ");
    qtdPageLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    qtdPageField = new JTextField(3);
    qtdPageField.setDocument(new LimetedNoCharacters(4));
    qtdPageField.setToolTipText("Informe a qtd, de 0000 a 9999");

    panel3 = new JPanel();
    panel3.add(anoLancamentoLabel);
    panel3.add(anoLancamentoField);
    panel3.add(anoPrimEdicaoLabel);
    panel3.add(anoPrimEdicaoField);
    panel3.add(edicaoLabel);
    panel3.add(edicaoField);
    panel3.add(qtdPageLabel);
    panel3.add(qtdPageField);
    getContentPane().add(panel3, new GBC(0, 4).gridwh(4, 1).left().insets(5, 5, 5, 5));

    linguagemLabel = new JLabel("Lingua : ");
    linguagemLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    linguagemField = new JTextField(10);

    generoLabel = new JLabel("   Genero : ");
    generoLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    generoField = new JTextField(10);

    categoriaLabel = new JLabel("   Categoria : ");
    categoriaLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    categoriaField = new JTextField(10);

    panel4 = new JPanel();
    panel4.add(linguagemLabel);
    panel4.add(linguagemField);
    panel4.add(generoLabel);
    panel4.add(generoField);
    panel4.add(categoriaLabel);
    panel4.add(categoriaField);
    getContentPane().add(panel4, new GBC(0, 5).gridwh(3, 1).left().insets(5, 5, 5, 5));

    formatoLabel = new JLabel("Formato : ");
    formatoLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    formatoField = new JTextField(10);

    editoraLabel = new JLabel("   Editora : ");
    editoraLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    editoraField = new JTextField(10);

    paisLabel = new JLabel("   Pais Lançamento : ");
    paisLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    paisLancamentoField = new JTextField(10);

    panel5 = new JPanel();
    panel5.add(formatoLabel);
    panel5.add(formatoField);
    panel5.add(editoraLabel);
    panel5.add(editoraField);
    panel5.add(paisLabel);
    panel5.add(paisLancamentoField);
    getContentPane().add(panel5, new GBC(0, 6).gridwh(3, 1).left().insets(5, 5, 5, 5));

    codigoBarraLabel = new JLabel("Código de Barra : ");
    codigoBarraLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    codigoBarraField = new JTextField(15);

    codigoCDDLabel = new JLabel(" Código CDD : ");
    codigoCDDLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    codigoCDDField = new JTextField(10);

    codigoCDULabel = new JLabel(" Código CDU : ");
    codigoCDULabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    codigoCDUField = new JTextField(10);

    panel6 = new JPanel();
    panel6.add(codigoBarraLabel);
    panel6.add(codigoBarraField);
    panel6.add(codigoCDDLabel);
    panel6.add(codigoCDDField);
    panel6.add(codigoCDULabel);
    panel6.add(codigoCDUField);
    getContentPane().add(panel6, new GBC(0, 7).gridwh(3, 1).left().insets(5, 5, 5, 5));

    sinopseLabel = new JLabel(" Sinopse : ");
    sinopseLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    sinopseArea = new JTextArea(4, 15);
    sinopseArea.setLineWrap(true);
    sinopseArea.setWrapStyleWord(true);
    sinopseArea.setFont(new Font("Serif", Font.ITALIC, 14));
    scrollPane1 = new JScrollPane(sinopseArea); // Adiciona Scroll no TextArea
    scrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane1.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLUE));

    seriesLabel = new JLabel(" Series : ");
    seriesLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    seriesArea = new JTextArea(4, 15);
    seriesArea.setLineWrap(true);
    seriesArea.setWrapStyleWord(true);
    seriesArea.setFont(new Font("Serif", Font.ITALIC, 14));
    scrollPane2 = new JScrollPane(seriesArea); // Adiciona Scroll no TextArea
    scrollPane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane2.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLUE));

    obsLabel = new JLabel(" Observação : ");
    obsLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    obsArea = new JTextArea(4, 15);
    obsArea.setLineWrap(true);
    obsArea.setWrapStyleWord(true);
    obsArea.setFont(new Font("Serif", Font.ITALIC, 14));
    scrollPane3 = new JScrollPane(obsArea); // Adiciona Scroll no TextArea
    scrollPane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane3.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLUE));

    panel7 = new JPanel();
    panel7.add(sinopseLabel);
    panel7.add(scrollPane1);
    panel7.add(seriesLabel);
    panel7.add(scrollPane2);
    panel7.add(obsLabel);
    panel7.add(scrollPane3);
    getContentPane().add(panel7, new GBC(0, 8).gridwh(3, 1).left().insets(5, 5, 5, 5));

    capaLabel = new JLabel(" Local da Capa : ");
    capaLabel.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    add(capaLabel, new GBC(0, 9).insets(5, 5, 5, 5).left());
    capaField = new JTextField(27);
    add(capaField, new GBC(1, 9).insets(5, 0, 0, 5).left());

    montaTabela();

    ImageIcon remover = new ImageIcon("imagens/remover.png");
    cadButton = new JButton(remover);
    cadButton.setForeground(Color.BLUE);
    cadButton.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    cadButton.setBorder(new SoftBevelBorder(SoftBevelBorder.RAISED));

    ImageIcon cancelar = new ImageIcon("imagens/cancelar.png");
    cancelButton = new JButton(cancelar);
    cancelButton.setForeground(Color.RED);
    cancelButton.setFont(new Font("Lucida Fax", Font.BOLD, 14));
    cancelButton.setBorder(new SoftBevelBorder(SoftBevelBorder.RAISED));

    panel4 = new JPanel();
    panel4.add(cadButton);
    panel4.add(cancelButton);
    getContentPane().add(panel4, new GBC(1, 10).gridwh(2, 1).right().insets(5, 10, 10, 10));

    trataBotoes();
  }
예제 #22
0
  // Methode erstellt die Lobby
  public static void serverLobby() {
    inServer = true;

    server_frame = new JFrame("Multiplayer Lobby");
    server_frame.setLayout(new BorderLayout(5, 5));
    server_frame.setSize(600, 350);
    server_frame.setVisible(true);
    server_frame.setLocation(100, 175);
    server_frame.setResizable(false);

    // center panel
    server_field = new JTextField();
    server_field.setDocument(new JTextFieldLimit(47));
    server_field.setText("Write a Message");
    SendButtonS = new JButton("Send");
    SettingsButtonS = new JButton("Settings");
    StartButton = new JButton("Start Game");
    StartButton.setBackground(Color.RED);
    JPanel message_panelS = new JPanel();
    message_panelS.setLayout(new BorderLayout());
    message_panelS.add(SettingsButtonS, BorderLayout.LINE_START);
    message_panelS.add(server_field, BorderLayout.CENTER);
    message_panelS.add(SendButtonS, BorderLayout.LINE_END);

    show_areaS = new JTextArea();
    show_areaS.setEditable(false);
    scrollTextS = new JScrollPane(show_areaS);
    JPanel center_panel = new JPanel();
    center_panel.setLayout(new BorderLayout());
    center_panel.add(scrollTextS, BorderLayout.CENTER);
    center_panel.add(message_panelS, BorderLayout.PAGE_END);

    // right panel
    show_partiesS = new JTextArea("User in Lobby: " + "\n" + user_name);
    show_partiesS.setEditable(false);

    JPanel right_panel = new JPanel();
    right_panel.setLayout(new BorderLayout());
    right_panel.add(show_partiesS, BorderLayout.CENTER);
    right_panel.add(StartButton, BorderLayout.PAGE_END);

    StartButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            if (ServerGUI.cReady == false) // Wenn der Client nicht ready ist, information ausgeben
            {
              show_areaS.append("Spiel: Der Spielleiter möchte das Spiel starten" + "\n");
              Server.sendMessage(
                  new Message(0, "Der Spielleiter möchte das Spiel starten", "Spiel", 0));
            }
            if (ServerGUI.cReady == true) // Wenn Client ready ist, Spiel starten
            {
              Server.sendMessage(new Message(0, "", "", 4));

              inServer = false;
              Server.inGame = true;
              Multiplayer.inMulti = true;
              server_frame.setVisible(false);
              // MUltiplayer startet jetzt.
              try {
                if (ServerGUI.selectedDifficulty.equals("easy")) {
                  Main.map.loadMap("maps/multiplayermap.txt"); // Karte laden
                }
                if (ServerGUI.selectedDifficulty.equals("medium")) {
                  Main.map.loadMap("maps/multiplayer2.txt"); // Karte laden
                }
                if (ServerGUI.selectedDifficulty.equals("hard")) {
                  Main.map.loadMap("maps/multiplayer3.txt"); // Karte laden
                }
              } catch (Exception io) {

              }
              Main.fenster.setTitle("Multiplayer - Run to the Exit!");
              Main.inMenue = false;
            }
          }
        });

    server_frame.add(center_panel, BorderLayout.CENTER);
    server_frame.add(right_panel, BorderLayout.LINE_END);

    SendButtonS.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (!server_field.getText().trim().equals("")) {
              if (Server.connected == true) {
                Server.sendMessage(new Message(0, server_field.getText(), user_name, 0));
              }

              show_areaS.append(user_name + ": " + server_field.getText() + "\n");
              show_areaS.selectAll();
              server_field.setText("");
            }
          }
        });

    SettingsButtonS.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setThings();
          }
        });
  }
예제 #23
0
  /** Add ui controls */
  private void addControls() {
    unitizeCheckBox = new JCheckBox("Unitize");
    unitizeCheckBox.addActionListener(buttonComboListener);
    uqcCheckBox = new JCheckBox("Unitize QC");
    uqcCheckBox.addActionListener(buttonComboListener);
    codingCheckBox = new JCheckBox("Coding");
    codingCheckBox.addActionListener(buttonComboListener);
    codingqcCheckBox = new JCheckBox("Coding QC");
    codingqcCheckBox.addActionListener(buttonComboListener);
    qaCheckBox = new JCheckBox("QA");
    qaCheckBox.addActionListener(buttonComboListener);
    listingCheckBox = new JCheckBox("Listing");
    listingCheckBox.addActionListener(buttonComboListener);
    tallyCheckBox = new JCheckBox("Tally");
    tallyCheckBox.addActionListener(buttonComboListener);
    tlCheckBox = new JCheckBox("Team Leader");
    tlCheckBox.addActionListener(buttonComboListener);
    adminCheckBox = new JCheckBox("Admin");
    adminCheckBox.addActionListener(buttonComboListener);
    teamsCombo.addActionListener(buttonComboListener);

    adminUsersCheckBox = new JCheckBox("Users");
    adminUsersCheckBox.addActionListener(buttonComboListener);
    adminProjectCheckBox = new JCheckBox("Project");
    adminProjectCheckBox.addActionListener(buttonComboListener);
    adminBatchCheckBox = new JCheckBox("Batch");
    adminBatchCheckBox.addActionListener(buttonComboListener);
    adminEditCheckBox = new JCheckBox("Global Edit");
    adminEditCheckBox.addActionListener(buttonComboListener);
    adminImportCheckBox = new JCheckBox("Import");
    adminImportCheckBox.addActionListener(buttonComboListener);
    adminExportCheckBox = new JCheckBox("Export");
    adminExportCheckBox.addActionListener(buttonComboListener);
    adminProfitCheckBox = new JCheckBox("Profit");
    adminProfitCheckBox.addActionListener(buttonComboListener);

    userName = new LTextField(40);
    fname = new LTextField(40);
    lname = new LTextField(40);
    team = new LTextField(40);
    userName.setDocument(getUpperPlainDocument());
    userName.setToolTipText("User Id may contain only letters and digits.");
    fname.setDocument(getPlainDocument());
    lname.setDocument(getPlainDocument());

    JLabel seperator_lbl_1 = new JLabel("    ");
    JLabel seperator_lbl_2 = new JLabel("    ");
    JLabel seperator_lbl_3 = new JLabel("    ");

    password = new JPasswordField(32);
    confirmPassword = new JPasswordField(32);
    password.setDocument(getPlainDocument());
    confirmPassword.setDocument(getPlainDocument());

    dateField.getComponent(1).setMaximumSize(new Dimension(50, 20));
    field = (JTextField) dateField.getComponent(0);
    field.setColumns(10);
    dateField.addPropertyChangeListener(
        new java.beans.PropertyChangeListener() {

          public void propertyChange(java.beans.PropertyChangeEvent evt) {
            // dateFieldPropertyChange(evt);
          }
        });

    // internal_volume_namePanel.add(dateField);

    rolePane.add(unitizeCheckBox);
    rolePane.add(uqcCheckBox);
    rolePane.add(codingCheckBox);
    rolePane.add(codingqcCheckBox);
    rolePane.add(listingCheckBox);
    rolePane.add(tallyCheckBox);
    rolePane.add(qaCheckBox);
    rolePane.add(tlCheckBox);
    rolePane.add(adminCheckBox);

    namePane.add(0, 0, "User Id:", userName);
    namePane.add(0, 1, "", new Label());
    namePane.add(0, 2, "First Name:", fname);
    namePane.add(0, 3, "", new Label());
    namePane.add(0, 4, "Last Name:", lname);
    namePane.add(0, 5, "", new Label());
    namePane.add(0, 6, "Join Date:", dateField);
    namePane.add(0, 7, "Roles:", rolePane);
    namePane.add(0, 8, "Admin:", adminPrivPane);
    namePane.add(0, 9, "Team:", teamsCombo);
    namePane.add(0, 10, "", seperator_lbl_1);
    namePane.add(0, 11, "Password:"******"", seperator_lbl_2);
    namePane.add(0, 13, "Confirm Password:"******"", seperator_lbl_3);

    adminPrivPane.add(adminUsersCheckBox);
    adminPrivPane.add(adminProjectCheckBox);
    adminPrivPane.add(adminBatchCheckBox);
    adminPrivPane.add(adminEditCheckBox);
    adminPrivPane.add(adminImportCheckBox);
    adminPrivPane.add(adminExportCheckBox);
    adminPrivPane.add(adminProfitCheckBox);

    selectPanel.add(namePane, BorderLayout.CENTER);
    pack();
  }
예제 #24
0
 private void establecerRestricciones() {
   jTextFieldReferencia.setDocument(
       new LimitadorCaracteres(jTextFieldReferencia, 25, false, false));
 }
  /* (non-Javadoc)
   * @see edu.ku.brc.ui.forms.formatters.DataObjFieldFormatPanelBuilder#buildUI()
   */
  protected void buildUI() {
    CellConstraints cc = new CellConstraints();

    JLabel currentFieldsLbl = createI18NLabel("DOF_DISPLAY_FORMAT");
    formatEditor = new JTextPane();
    // to make sure the component shrinks with the dialog
    formatEditor.setMinimumSize(new Dimension(200, 50));
    formatEditor.setPreferredSize(new Dimension(350, 100));

    formatEditor
        .getDocument()
        .addDocumentListener(
            new DocumentAdaptor() {
              @Override
              public void changed(DocumentEvent e) {
                updateUIEnabled();
              }
            });

    PanelBuilder addFieldPB = new PanelBuilder(new FormLayout("p,2px,p,f:p:g,r:m", "p,2px,p"));
    sepText = createTextField(4);
    addFieldBtn = createButton(getResourceString("DOF_ADD_FIELD"));
    sepLbl = createI18NFormLabel("DOF_SEP_TXT");

    addFieldPB.add(sepLbl, cc.xy(1, 1));
    addFieldPB.add(sepText, cc.xy(3, 1));
    addFieldPB.add(addFieldBtn, cc.xy(5, 1));

    sepText.setDocument(new FilteredDoc());

    addFieldBtn.setEnabled(false);
    sepLbl.setEnabled(false);
    sepText.setEnabled(false);

    // For when it is standalone
    if (AppPreferences.hasRemotePrefs()) {
      sepText.setText(AppPreferences.getRemote().get("DOF_SEP", ", "));

    } else {
      sepText.setText(", ");
    }

    PanelBuilder pb =
        new PanelBuilder(
            new FormLayout(
                "f:d:g",
                "10px,"
                    + // empty space on top of panel
                    "p,f:p:g,"
                    + // Label & format text editor
                    "2px,p,"
                    + // separator & add field
                    "10px,p,"
                    + // separator & label
                    "f:250px:g," // list box for available fields
                ),
            this);

    // layout components on main panel
    int y = 2; // leave first row blank

    pb.add(currentFieldsLbl, cc.xy(1, y));
    y += 1;
    pb.add(UIHelper.createScrollPane(formatEditor), cc.xy(1, y));
    y += 2;

    pb.add(addFieldPB.getPanel(), cc.xy(1, y));
    y += 2;

    JLabel availableFieldsLbl = createI18NFormLabel("DOF_AVAILABLE_FIELDS", SwingConstants.LEFT);
    pb.add(availableFieldsLbl, cc.xy(1, y));
    y += 1;

    // create field tree that will be re-used in all instances of single switch formatter editing
    // panel
    availableFieldsComp =
        new AvailableFieldsComponent(
            tableInfo, dataObjFieldFormatMgrCache, uiFieldFormatterMgrCache);

    pb.add(UIHelper.createScrollPane(availableFieldsComp.getTree()), cc.xy(1, y));
    y += 2;

    availableFieldsComp
        .getTree()
        .addTreeSelectionListener(
            new TreeSelectionListener() {
              @Override
              public void valueChanged(TreeSelectionEvent e) {
                boolean enable = availableFieldsComp.getTree().getSelectionCount() > 0;
                addFieldBtn.setEnabled(enable);
                sepText.setEnabled(enable);
                sepLbl.setEnabled(enable);
              }
            });

    this.mainPanelBuilder = pb;

    fillWithObjFormatter(formatContainer.getSelectedFormatter());

    addFormatTextListeners();

    // must be called after list of available fields has been created
    addFieldListeners();
  }
예제 #26
0
 /**
  * Configures the text field.
  *
  * @param text the text field.
  */
 private void configTextField(final JTextField text) {
   text.setDocument(new IntegerDocument());
   text.setPreferredSize(new Dimension(TXT_WIDTH, TXT_HEIGHT));
   text.setHorizontalAlignment(JTextField.RIGHT);
 }
예제 #27
0
 public XFInputDialogField(
     String fieldCaption, String inputType, String parmID, XFInputDialog dialog) {
   super();
   parmID_ = parmID;
   if (!inputType.equals("ALPHA")
       && !inputType.equals("KANJI")
       && !inputType.equals("NUMERIC")
       && !inputType.equals("DATE")
       && !inputType.equals("LISTBOX")
       && !inputType.equals("CHECKBOX")) {
     inputType_ = "ALPHA";
   }
   inputType_ = inputType;
   dialog_ = dialog;
   jLabelField.setText(fieldCaption + " ");
   jLabelField.setFocusable(false);
   jLabelField.setHorizontalAlignment(SwingConstants.RIGHT);
   jLabelField.setVerticalAlignment(SwingConstants.TOP);
   jLabelField.setFont(new java.awt.Font("Dialog", 0, 14));
   metrics = jLabelField.getFontMetrics(new java.awt.Font("Dialog", 0, 14));
   jLabelField.setPreferredSize(new Dimension(120, XFUtility.FIELD_UNIT_HEIGHT));
   if (metrics.stringWidth(fieldCaption) > 120) {
     jLabelField.setFont(new java.awt.Font("Dialog", 0, 12));
     metrics = jLabelField.getFontMetrics(new java.awt.Font("Dialog", 0, 12));
     if (metrics.stringWidth(fieldCaption) > 120) {
       jLabelField.setFont(new java.awt.Font("Dialog", 0, 10));
     }
   }
   if (inputType_.equals("ALPHA") || inputType_.equals("KANJI") || inputType_.equals("NUMERIC")) {
     JTextField field = new JTextField();
     field.addFocusListener(new ComponentFocusListener());
     if (inputType_.equals("NUMERIC")) {
       field.setHorizontalAlignment(SwingConstants.RIGHT);
       field.setDocument(new LimitedDocument(this));
     }
     component = field;
   }
   if (inputType_.equals("DATE")) {
     XFDateField field = new XFDateField(dialog_.getSession());
     component = field;
   }
   if (inputType_.equals("LISTBOX")) {
     JComboBox field = new JComboBox();
     component = field;
   }
   if (inputType_.equals("CHECKBOX")) {
     JCheckBox field = new JCheckBox();
     component = field;
   }
   component.setFont(new java.awt.Font("Monospaced", 0, 14));
   metrics = component.getFontMetrics(new java.awt.Font("Monospaced", 0, 14));
   this.setOpaque(false);
   if (inputType_.equals("DATE")) {
     int fieldWidth = XFUtility.getWidthOfDateValue(dialog_.getSession().getDateFormat(), 14);
     this.setBounds(
         this.getBounds().x, this.getBounds().y, 150 + fieldWidth, XFUtility.FIELD_UNIT_HEIGHT);
   } else {
     this.setBounds(this.getBounds().x, this.getBounds().y, 150, XFUtility.FIELD_UNIT_HEIGHT);
   }
   this.setLayout(new BorderLayout());
   this.add(jLabelField, BorderLayout.WEST);
   this.add(component, BorderLayout.CENTER);
 }
  public ChangePermissionsDialog(MainFrame mainFrame, FileSet files) {
    super(
        mainFrame,
        ActionProperties.getActionLabel(ChangePermissionsAction.Descriptor.ACTION_ID),
        files);

    YBoxPanel mainPanel = new YBoxPanel();

    mainPanel.add(
        new JLabel(
            ActionProperties.getActionLabel(ChangePermissionsAction.Descriptor.ACTION_ID) + " :"));
    mainPanel.addSpace(10);

    JPanel gridPanel = new JPanel(new GridLayout(4, 4));
    permCheckBoxes = new JCheckBox[5][5];
    JCheckBox permCheckBox;

    AbstractFile firstFile = files.elementAt(0);
    int permSetMask = firstFile.getChangeablePermissions().getIntValue();
    boolean canSetPermission = permSetMask != 0;
    int defaultPerms = firstFile.getPermissions().getIntValue();

    gridPanel.add(new JLabel());
    gridPanel.add(new JLabel(Translator.get("permissions.read")));
    gridPanel.add(new JLabel(Translator.get("permissions.write")));
    gridPanel.add(new JLabel(Translator.get("permissions.executable")));

    for (int a = USER_ACCESS; a >= OTHER_ACCESS; a--) {
      gridPanel.add(
          new JLabel(
              Translator.get(
                  a == USER_ACCESS
                      ? "permissions.user"
                      : a == GROUP_ACCESS ? "permissions.group" : "permissions.other")));

      for (int p = READ_PERMISSION; p >= EXECUTE_PERMISSION; p = p >> 1) {
        permCheckBox = new JCheckBox();
        permCheckBox.setSelected((defaultPerms & (p << a * 3)) != 0);

        // Enable the checkbox only if the permission can be set in the destination
        if ((permSetMask & (p << a * 3)) == 0) permCheckBox.setEnabled(false);
        else permCheckBox.addItemListener(this);

        gridPanel.add(permCheckBox);
        permCheckBoxes[a][p] = permCheckBox;
      }
    }

    mainPanel.add(gridPanel);

    octalPermTextField = new JTextField(3);
    // Constrains text field to 3 digits, from 0 to 7 (octal base)
    Document doc =
        new SizeConstrainedDocument(3) {
          @Override
          public void insertString(int offset, String str, AttributeSet attributeSet)
              throws BadLocationException {
            int strLen = str.length();
            char c;
            for (int i = 0; i < strLen; i++) {
              c = str.charAt(i);
              if (c < '0' || c > '7') return;
            }

            super.insertString(offset, str, attributeSet);
          }
        };
    octalPermTextField.setDocument(doc);
    // Initializes the field's value
    updateOctalPermTextField();

    if (canSetPermission) {
      doc.addDocumentListener(this);
    }
    // Disable text field if no permission bit can be set
    else {
      octalPermTextField.setEnabled(false);
    }

    mainPanel.addSpace(10);
    JPanel tempPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tempPanel.add(new JLabel(Translator.get("permissions.octal_notation")));
    tempPanel.add(octalPermTextField);
    mainPanel.add(tempPanel);

    mainPanel.addSpace(15);

    recurseDirCheckBox = new JCheckBox(Translator.get("recurse_directories"));
    // Disable check box if no permission bit can be set
    recurseDirCheckBox.setEnabled(
        canSetPermission && (files.size() > 1 || files.elementAt(0).isDirectory()));
    mainPanel.add(recurseDirCheckBox);

    // Create file details button and OK/cancel buttons and lay them out a single row
    JPanel fileDetailsPanel = createFileDetailsPanel();

    okButton = new JButton(Translator.get("change"));
    cancelButton = new JButton(Translator.get("cancel"));

    mainPanel.add(
        createButtonsPanel(
            createFileDetailsButton(fileDetailsPanel),
            DialogToolkit.createOKCancelPanel(okButton, cancelButton, getRootPane(), this)));
    mainPanel.add(fileDetailsPanel);

    getContentPane().add(mainPanel, BorderLayout.NORTH);

    if (!canSetPermission) {
      // Disable OK button if no permission bit can be set
      okButton.setEnabled(false);
    }

    getRootPane().setDefaultButton(canSetPermission ? okButton : cancelButton);
    setResizable(false);
  }
예제 #29
0
  public SalesmanModiAndDelIFrame() {
    super();
    setIconifiable(true);
    setClosable(true);
    setTitle("销售人员信息修改与删除");
    setBounds(100, 100, 600, 420);

    final JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.setPreferredSize(new Dimension(400, 80));
    getContentPane().add(panel, BorderLayout.NORTH);

    final JLabel logoLabel = new JLabel();
    ImageIcon readerModiAndDelIcon = CreatecdIcon.add("readerModiAndDel.jpg");
    logoLabel.setIcon(readerModiAndDelIcon);
    logoLabel.setBackground(Color.CYAN);
    logoLabel.setOpaque(true);
    logoLabel.setPreferredSize(new Dimension(400, 80));
    panel.add(logoLabel);
    logoLabel.setText("销售人员信息修改logo(400*80)");

    final JPanel panel_1 = new JPanel();
    panel_1.setLayout(new BorderLayout());
    getContentPane().add(panel_1);

    final JScrollPane scrollPane = new JScrollPane();
    scrollPane.setPreferredSize(new Dimension(0, 100));
    panel_1.add(scrollPane, BorderLayout.NORTH);

    final DefaultTableModel model = new DefaultTableModel();
    Object[][] results = getFileStates(Dao.selectSalesman());
    model.setDataVector(results, columnNames);

    table = new JTable();
    table.setModel(model);
    scrollPane.setViewportView(table);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    table.addMouseListener(new TableListener());

    final JPanel panel_2 = new JPanel();
    final GridLayout gridLayout = new GridLayout(0, 4);
    gridLayout.setVgap(9);
    panel_2.setLayout(gridLayout);
    panel_2.setPreferredSize(new Dimension(0, 200));
    panel_1.add(panel_2, BorderLayout.SOUTH);

    final JLabel label_1 = new JLabel();
    label_1.setText("  姓    名:");
    panel_2.add(label_1);

    readername = new JTextField();
    readername.setDocument(new MyDocument(10));
    panel_2.add(readername);

    final JLabel label_2 = new JLabel();
    label_2.setText("  性    别:");
    panel_2.add(label_2);

    final JPanel panel_3 = new JPanel();
    final FlowLayout flowLayout_1 = new FlowLayout();
    flowLayout_1.setVgap(0);
    panel_3.setLayout(flowLayout_1);
    panel_2.add(panel_3);

    JRadioButton1 = new JRadioButton();
    JRadioButton1.setSelected(true);
    buttonGroup.add(JRadioButton1);
    panel_3.add(JRadioButton1);
    JRadioButton1.setText("男");

    JRadioButton2 = new JRadioButton();
    buttonGroup.add(JRadioButton2);
    panel_3.add(JRadioButton2);
    JRadioButton2.setText("女");

    final JLabel label_3 = new JLabel();
    label_3.setText("  年    龄:");
    panel_2.add(label_3);

    age = new JTextField();
    age.setDocument(new MyDocument(2));
    age.addKeyListener(new NumberListener());
    panel_2.add(age);

    final JLabel label_5 = new JLabel();
    label_5.setText("  专    业:");
    panel_2.add(label_5);

    zy = new JTextField();
    zy.setDocument(new MyDocument(30));
    panel_2.add(zy);

    final JLabel label = new JLabel();
    label.setText("  有效证件:");
    panel_2.add(label);

    comboBox = new JComboBox();

    comboBox.setModel(new DefaultComboBoxModel(array));
    for (int i = 1; i < array.length; i++) {
      comboBox.setSelectedIndex(i);
      comboBox.setSelectedItem(array);
    }
    panel_2.add(comboBox);

    final JLabel label_6 = new JLabel();
    label_6.setText("  证件号码:");
    panel_2.add(label_6);

    zjnumber = new JTextField();
    zjnumber.setDocument(new MyDocument(13));
    zjnumber.addKeyListener(new NumberListener());
    panel_2.add(zjnumber);

    final JLabel label_7 = new JLabel();
    label_7.setText("  办证日期:");
    panel_2.add(label_7);

    SimpleDateFormat myfmt = new SimpleDateFormat("yyyy-MM-dd");

    bztime = new JFormattedTextField(myfmt.getDateInstance());

    panel_2.add(bztime);

    final JLabel label_9 = new JLabel();
    label_9.setText("  最大调货量:");
    panel_2.add(label_9);

    maxnumber = new JTextField();
    maxnumber.addKeyListener(new NumberListener());
    panel_2.add(maxnumber);

    final JLabel label_13 = new JLabel();
    label_13.setText("  证件有效日期:");
    panel_2.add(label_13);

    date = new JFormattedTextField(myfmt.getDateInstance());

    panel_2.add(date);

    final JLabel label_8 = new JLabel();
    label_8.setText("  电    话:");
    panel_2.add(label_8);

    tel = new JFormattedTextField();
    tel.addKeyListener(new TelListener());
    tel.setDocument(new MyDocument(11));
    panel_2.add(tel);

    final JLabel label_14 = new JLabel();
    label_14.setText("  工    资:");
    panel_2.add(label_14);

    keepmoney = new JTextField();
    keepmoney.addKeyListener(new KeepmoneyListener());
    panel_2.add(keepmoney);

    final JLabel label_4 = new JLabel();
    label_4.setText("  销售人员编号:");
    panel_2.add(label_4);

    ISBN = new JTextField();
    ISBN.setEditable(false);
    ISBN.setDocument(new MyDocument(13));
    panel_2.add(ISBN);

    final JPanel panel_4 = new JPanel();
    panel_4.setMaximumSize(new Dimension(0, 0));
    final FlowLayout flowLayout = new FlowLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(4);
    panel_4.setLayout(flowLayout);
    panel_2.add(panel_4);

    final JButton button = new JButton();
    button.setHorizontalTextPosition(SwingConstants.CENTER);
    panel_4.add(button);
    button.setText("修改");
    button.addActionListener(new ModiButtonListener(model));

    final JButton buttonDel = new JButton();
    panel_4.add(buttonDel);
    buttonDel.setText("删除");
    buttonDel.addActionListener(new DelButtonListener(model));
    setVisible(true);
    //
  }
예제 #30
0
  // Settings
  public static void setThings() {
    settings_frameS.dispose();

    settings_frameS = new JFrame();
    settings_frameS.setLayout(new BorderLayout());
    settings_frameS.setSize(250, 110);
    settings_frameS.setVisible(true);
    settings_frameS.setLocation(200, 350);
    settings_frameS.setResizable(false);

    // nickname panel
    nickname_panelS = new JPanel();
    nickname_panelS.setLayout(new BorderLayout());
    changeUsernameS = new JLabel("Change your Nickname: ");
    nickname_fieldS.setDocument(new JTextFieldLimit(12));
    nickname_fieldS.setText(user_name);

    nickname_panelS.add(changeUsernameS, BorderLayout.LINE_START);
    nickname_panelS.add(nickname_fieldS, BorderLayout.CENTER);

    // Difficulty panel
    difficulty_panelS = new JPanel();
    difficulty_panelS.setLayout(new BorderLayout());
    changeDifficulty = new JLabel("Set the Difficulty:              ");

    difficulty_panelS.add(changeDifficulty, BorderLayout.LINE_START);
    difficulty_panelS.add(difficultychoice, BorderLayout.CENTER);

    difficulty_vec.add(0, easy);
    difficulty_vec.add(1, medium);
    difficulty_vec.add(2, hard);

    // Center Panel
    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(2, 1));
    panel.add(nickname_panelS);
    panel.add(difficulty_panelS);

    settings_frameS.add(panel, BorderLayout.CENTER);

    SaveSettingsS = new JButton("Save Settings");
    settings_frameS.add(SaveSettingsS, BorderLayout.PAGE_END);

    difficultychoice.addItemListener(
        new java.awt.event.ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() != e.DESELECTED) {
              selectedDifficulty = (String) difficultymodel.getSelectedItem();
              selectedDifficultyb = true;
            }
          }
        });

    SaveSettingsS.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            user_name = nickname_fieldS.getText();
            settings_frameS.dispose();
            settings_frameS = new JFrame();
            refreshUserNames();
            Server.sendMessage(new Message(0, "", user_name, 2));

            // Wenn der Schwierigkeitsgrad geaendert wird, wird dies zugeschickt
            if (selectedDifficultyb == true) {
              Server.sendMessage(new Message(0, selectedDifficulty, user_name, 3));
            }
            selectedDifficultyb = false;
          }
        });
  }