private JPanel getJPanel1() {
   if (jPanel1 == null) {
     jPanel1 = new JPanel();
     GridLayout jPanel1Layout = new GridLayout(7, 2);
     jPanel1Layout.setColumns(2);
     jPanel1Layout.setHgap(5);
     jPanel1Layout.setVgap(5);
     jPanel1Layout.setRows(7);
     jPanel1.setLayout(jPanel1Layout);
     jPanel1.add(getJLabel1());
     jPanel1.add(getJTextField1());
     jPanel1.add(getJLabel2());
     jPanel1.add(getJTextField2());
     jPanel1.add(getJLabel3());
     jPanel1.add(getJTextField3());
     jPanel1.add(getJLabel4());
     jPanel1.add(getJTextField4());
     jPanel1.add(getJLabel5());
     jPanel1.add(getJTextField5());
     jPanel1.add(getJLabel6());
     jPanel1.add(getJTextField6());
     jPanel1.add(getJLabel7());
     jPanel1.add(getJTextField7());
   }
   return jPanel1;
 }
  private JPanel createParametersPanel() {
    JPanel parametersPanel = new JPanel();
    parametersPanel.setBorder(BorderFactory.createTitledBorder(dataLayer.getString("PARAMETERS")));

    GridLayout parametersPanelLayout = new GridLayout(0, 3);
    parametersPanelLayout.setHgap(10);
    parametersPanelLayout.setVgap(5);
    parametersPanel.setLayout(parametersPanelLayout);
    //
    // -- DELAY ------------------------------------------------------------
    JLabel delayName = new JLabel(dataLayer.getString("DELAY") + ":");
    delayName.setFont(fontBold);
    parametersPanel.add(delayName);

    // create formatter
    RegexFormatter delayFormatter = new RegexFormatter(Validator.DELAY_PATTERN);
    delayFormatter.setAllowsInvalid(true); // allow to enter invalid value for short time
    delayFormatter.setCommitsOnValidEdit(true); // value is immedeatly published to textField
    delayFormatter.setOverwriteMode(false); // do not overwrite charracters

    jTextFieldDelay = new JFormattedTextField(delayFormatter);
    jTextFieldDelay.setText("" + cable.getDelay());
    jTextFieldDelay.setToolTipText(dataLayer.getString("REQUIRED_FORMAT_IS") + " 1-99");
    // add decorator that paints wrong input icon
    parametersPanel.add(new JLayer<JFormattedTextField>(jTextFieldDelay, layerUI));

    JLabel delayTip = new JLabel("1-99");
    parametersPanel.add(delayTip);

    // --  ------------------------------------------------------------
    return parametersPanel;
  }
  /**
   * This method initializes jPanel
   *
   * @return JPanel
   */
  private JPanel getJPanel() {
    if (jPanel == null) {
      jPanel = new JPanel();
      java.awt.GridLayout layGridLayout7 = new java.awt.GridLayout();
      layGridLayout7.setRows(4);
      layGridLayout7.setColumns(4);
      layGridLayout7.setHgap(10);
      layGridLayout7.setVgap(10);
      jPanel.setLayout(layGridLayout7);

      // Another way to do this, but wouldn't
      // have a visual in the editor.
      //  for (int i = 1; i <= 16; i++) {
      //      String label = String.valueOf(i);
      //      JButton b = new JButton(label);
      //      b.addMouseListener(buttonEvents);
      //      b.addMouseMotionListener(buttonEvents);
      //      jPanel.add(b);
      //  }

      for (int i = 0; i < jButtons.length; i++) {
        jButtons[i] = createButton(String.valueOf(i + 1));
        jPanel.add(jButtons[i], null);
      }

      jPanel.setBackground(java.awt.Color.white);
      jPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
    }
    return jPanel;
  }
  private void addContinFilter(final Container pane) {

    GridLayout layout = new GridLayout(0, 2);

    layout.setVgap(GAP);

    final JPanel panel = new JPanel();
    pane.add(panel, BorderLayout.NORTH);

    panel.setLayout(layout);
    layout.layoutContainer(panel);

    panel.setBorder(BorderFactory.createTitledBorder("Show contin(s):"));

    add(
        "with number (ex. 2, 4-9, 30)",
        Display2DOptions.ContinFilterType.custom_number,
        continNumberInput,
        panel);

    add(
        "with name (ex. ContinA, ContinB)",
        Display2DOptions.ContinFilterType.custom_name,
        continNameInput,
        panel);

    add(
        "with color code (ex. blue-10, green-5)",
        Display2DOptions.ContinFilterType.custom_color_code,
        continColorInput,
        panel);
  }
 private void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20);
   contentPane.setBorder(border1);
   contentPane.setLayout(borderLayout1);
   controlsPane.setLayout(gridLayout1);
   gridLayout1.setColumns(1);
   gridLayout1.setHgap(10);
   gridLayout1.setRows(0);
   gridLayout1.setVgap(10);
   okButton.setVerifyInputWhenFocusTarget(true);
   okButton.setMnemonic('O');
   okButton.setText("OK");
   buttonsPane.setLayout(flowLayout1);
   flowLayout1.setAlignment(FlowLayout.CENTER);
   messagePane.setEditable(false);
   messagePane.setText("");
   borderLayout1.setHgap(10);
   borderLayout1.setVgap(10);
   this.setTitle("Subscription Authorization");
   this.getContentPane().add(contentPane, BorderLayout.CENTER);
   contentPane.add(controlsPane, BorderLayout.SOUTH);
   controlsPane.add(responsesComboBox, null);
   controlsPane.add(buttonsPane, null);
   buttonsPane.add(okButton, null);
   contentPane.add(messageScrollPane, BorderLayout.CENTER);
   messageScrollPane.getViewport().add(messagePane, null);
 }
  private JPanel createInfoPanel() {
    JPanel infoPanel = new JPanel();
    infoPanel.setBorder(BorderFactory.createTitledBorder(dataLayer.getString("INFO")));

    GridLayout infoPanelLayout = new GridLayout(0, 2);
    infoPanelLayout.setHgap(10);
    infoPanelLayout.setVgap(5);
    infoPanel.setLayout(infoPanelLayout);
    //
    // -- TYPE -------------------------------------------------------------
    JLabel typeName = new JLabel(dataLayer.getString("TYPE") + ":");
    fontBold = new Font(typeName.getFont().getName(), Font.BOLD, typeName.getFont().getSize());
    typeName.setFont(fontBold);
    infoPanel.add(typeName);

    JLabel typeValue = new JLabel(cable.getHwType().toString());
    infoPanel.add(typeValue);
    //
    // -- DEVICE 1 name and interface --------------------------------------
    JLabel device1Name = new JLabel(dataLayer.getString("COMPONENT") + " 1:");
    device1Name.setFont(fontBold);
    infoPanel.add(device1Name);

    JLabel device1Value = new JLabel(cable.getComponent1().getDeviceName());
    infoPanel.add(device1Value);
    //
    JLabel interface1Name = new JLabel(dataLayer.getString("INTERFACE") + " 1:");
    interface1Name.setFont(fontBold);
    infoPanel.add(interface1Name);

    JLabel interface1Value = new JLabel(cable.getEth1().getName());
    infoPanel.add(interface1Value);
    //
    // -- DEVICE 2 name and interface --------------------------------------
    JLabel device2Name = new JLabel(dataLayer.getString("COMPONENT") + " 2:");
    device2Name.setFont(fontBold);
    infoPanel.add(device2Name);

    JLabel device2Value = new JLabel(cable.getComponent2().getDeviceName());
    infoPanel.add(device2Value);
    //
    JLabel interface2Name = new JLabel(dataLayer.getString("INTERFACE") + " 2:");
    interface2Name.setFont(fontBold);
    infoPanel.add(interface2Name);

    JLabel interface2Value = new JLabel(cable.getEth2().getName());
    infoPanel.add(interface2Value);
    //
    // -- UNIQUE ID --------------------------------------------------------
    if (viewUniqueId) {
      JLabel deviceIdName = new JLabel(dataLayer.getString("DEVICE_UNIQUE_ID") + ":");
      deviceIdName.setFont(fontBold);
      infoPanel.add(deviceIdName);

      JLabel deviceIdValue = new JLabel("" + cable.getId().toString());
      infoPanel.add(deviceIdValue);
    }

    return infoPanel;
  }
示例#7
0
 private GridLayout createButtonPanelLayout() {
   GridLayout buttonPanelLayout = new GridLayout(2, 2);
   buttonPanelLayout.setColumns(2);
   buttonPanelLayout.setHgap(5);
   buttonPanelLayout.setVgap(5);
   buttonPanelLayout.setRows(2);
   return buttonPanelLayout;
 }
示例#8
0
  public void buildGUI() {
    theFrame = new JFrame("Cyber BeatBox");
    theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    BorderLayout layout = new BorderLayout();
    JPanel background = new JPanel(layout);
    background.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    checkboxList = new ArrayList<JCheckBox>();
    Box buttonBox = new Box(BoxLayout.Y_AXIS);

    JButton start = new JButton("Start");
    start.addActionListener(new MyStartListener());
    buttonBox.add(start);

    JButton stop = new JButton("Stop");
    stop.addActionListener(new MyStopListener());
    buttonBox.add(stop);

    JButton upTempo = new JButton("Tempo Up");
    upTempo.addActionListener(new MyUpTempoListener());
    buttonBox.add(upTempo);

    JButton downTempo = new JButton("Tempo Down");
    downTempo.addActionListener(new MyDownTempoListener());
    buttonBox.add(downTempo);

    Box nameBox = new Box(BoxLayout.Y_AXIS);
    for (int i = 0; i < 16; i++) {
      nameBox.add(new Label(instrumentNames[i]));
    }

    background.add(BorderLayout.EAST, buttonBox);
    background.add(BorderLayout.WEST, nameBox);

    theFrame.getContentPane().add(background);

    GridLayout grid = new GridLayout(16, 16);
    grid.setVgap(1);
    grid.setHgap(2);
    mainPanel = new JPanel(grid);
    background.add(BorderLayout.CENTER, mainPanel);

    for (int i = 0; i < 256; i++) {
      JCheckBox c = new JCheckBox();
      c.setSelected(false);
      checkboxList.add(c);
      mainPanel.add(c);
    } // end loop

    setUpMidi();

    theFrame.setBounds(50, 50, 300, 300);
    theFrame.pack();
    theFrame.setVisible(true);
  } // close method
示例#9
0
  public ListarHisClientes(Frame padre) {

    super((Frame) padre, true);
    try {
      // this.cod_cli=cod_cli;
      lblNombre = new JLabel();
      lblNombre.setText("Nombre:");
      lblNombre.setBounds(17, 15, 48, 16);
      txtNombre = new JTextField();
      txtNombre.setBounds(77, 13, 323, 20);

      pnlArriba = new JPanel();

      pnlAbajo = new JPanel();
      GridLayout pnlAbajoLayout = new GridLayout(1, 1);
      pnlAbajoLayout.setHgap(5);
      pnlAbajoLayout.setVgap(5);
      pnlAbajoLayout.setColumns(1);
      pnlAbajo.setLayout(pnlAbajoLayout);
      getContentPane().add(pnlAbajo, BorderLayout.CENTER);
      pnlAbajo.setPreferredSize(new java.awt.Dimension(859, 429));

      getContentPane().add(pnlArriba, BorderLayout.NORTH);
      pnlArriba.setPreferredSize(new java.awt.Dimension(892, 42));
      pnlArriba.setLayout(null);
      pnlArriba.add(lblNombre);
      pnlArriba.add(txtNombre);

      btnBuscar = new JButton();
      pnlArriba.add(btnBuscar);
      btnBuscar.setText("Buscar");
      btnBuscar.setBounds(325, 10, 81, 26);
      btnBuscar.setVisible(false);
      btnBuscar.addActionListener(this);

      jPanel1 = new JPanel();
      getContentPane().add(jPanel1, BorderLayout.SOUTH);
      jPanel1.setPreferredSize(new java.awt.Dimension(412, 5));

      jScrollPane1 = new JScrollPane();
      pnlAbajo.add(jScrollPane1);
      jScrollPane1.setPreferredSize(new java.awt.Dimension(859, 467));

      jTable1 = new JTable();
      jScrollPane1.setViewportView(jTable1);
      jTable1.setModel(modelo2);
      jTable1.addMouseListener(this);

      this.setSize(428, 266);
      getNombre(ConfigurarCuentas.cod_cli);
      listarXcod(ConfigurarCuentas.cod_cli);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
示例#10
0
 protected JComponent createButtonPanel() {
   GridLayout gridLayout = new GridLayout();
   JPanel jPanelButtons = new JPanel();
   jPanelButtons.setLayout(gridLayout);
   gridLayout.setRows(1);
   gridLayout.setHgap(10);
   gridLayout.setVgap(5);
   gridLayout.setColumns(buttons.length);
   for (int i = 0; i < buttons.length; i++) {
     jPanelButtons.add(buttons[i]);
   }
   return jPanelButtons;
 }
  private void addImageOptions(final Container pane) {

    GridLayout layout = new GridLayout(0, 2);

    layout.setVgap(GAP);

    final JPanel panel = new JPanel();
    pane.add(panel, BorderLayout.NORTH);

    panel.setLayout(layout);
    layout.layoutContainer(panel);

    panel.setBorder(BorderFactory.createTitledBorder("Image Options:"));

    panel.add(new JLabel("Synapse Type:"));
    for (Display2DOptions.SynapseType type : Display2DOptions.SynapseType.getValues()) {
      synapsesCombo.addItem(type.getLabel());
    }
    synapsesCombo.setSelectedIndex(
        Display2DOptions.SynapseType.getIndex(Elegance.display2DOptions.getSynapseType()));

    panel.add(synapsesCombo);

    panel.add(new JLabel("Display Type:"));
    for (String dtypeStr : ALL_D_TYPES) {
      dtypeCombo.addItem(dtypeStr);
    }
    panel.add(dtypeCombo);

    dtypeCombo.setSelectedIndex(
        Arrays.asList(ALL_D_TYPES).indexOf(Elegance.display2DOptions.getDtype()));

    panel.add(new JLabel("Zoom:"));
    for (String zoomStr : ALL_ZOOMS) {
      zoomCombo.addItem(zoomStr);
    }
    panel.add(zoomCombo);
    zoomCombo.setSelectedIndex(
        Arrays.asList(ALL_ZOOMS).indexOf(Elegance.display2DOptions.getZoom() + ""));

    panel.add(new JLabel("Neurons To Connect: (ex. 10:20, 21:35)"));
    panel.add(neurons2ConnectInput);

    if (Elegance.display2DOptions.getNeurons2Connect() != null) {
      List<String> str = new ArrayList<String>();
      for (Display2DOptions.NeuronPair pair : Elegance.display2DOptions.getNeurons2Connect()) {
        str.add(pair.getFromId() + ":" + pair.getToId());
      }
      neurons2ConnectInput.setText(EString.join(str, ","));
    }
  }
示例#12
0
  // table
  public void defineMiddlePanel() {
    middle = new JPanel();
    middle.setBackground(GuiControl.FILLER_COLOR);
    middle.setLayout(new FlowLayout(FlowLayout.CENTER));
    JPanel gridPanel = new JPanel();
    gridPanel.setBackground(GuiControl.SCREEN_BACKGROUND);
    middle.add(gridPanel);
    GridLayout gl = new GridLayout(5, 2);
    gl.setHgap(8);
    gl.setVgap(8);
    gridPanel.setLayout(gl);
    gridPanel.setBorder(new WindowBorder(GuiControl.WINDOW_BORDER));

    // add fields
    String[] fldNames = DefaultData.FIELD_NAMES;

    String labelName = fldNames[DefaultData.PRODUCT_NAME_INT];
    makeLabel(gridPanel, labelName);
    productNameField = new JTextField(10);
    productNameField.setText(fieldValues.getProperty(labelName));
    gridPanel.add(productNameField);

    // catalog group is different from the other fields
    // because it plays a different role in MaintainCatalog
    // so it is set differently
    labelName = "Catalog";
    makeLabel(gridPanel, labelName);
    catalogGroupField = new JComboBox();
    catalogGroupField.addItem(DefaultData.BOOKS);
    catalogGroupField.addItem(DefaultData.CLOTHES);
    catalogGroupField.setSelectedItem(catalogGroup);
    gridPanel.add(catalogGroupField);

    labelName = fldNames[DefaultData.PRICE_PER_UNIT_INT];
    makeLabel(gridPanel, labelName);
    pricePerUnitField = new JTextField(10);
    pricePerUnitField.setText(fieldValues.getProperty(labelName));
    gridPanel.add(pricePerUnitField);

    labelName = fldNames[DefaultData.MFG_DATE_INT];
    makeLabel(gridPanel, labelName);
    mfgDateField = new JTextField(10);
    mfgDateField.setText(fieldValues.getProperty(labelName));
    gridPanel.add(mfgDateField);

    labelName = fldNames[DefaultData.QUANTITY_INT];
    makeLabel(gridPanel, labelName);
    quantityField = new JTextField(10);
    quantityField.setText(fieldValues.getProperty(labelName));
    gridPanel.add(quantityField);
  }
 /**
  * This method initializes jPanel
  *
  * @return javax.swing.JPanel
  */
 private JPanel getJPanel() {
   if (jPanel == null) {
     GridLayout gridLayout = new GridLayout();
     gridLayout.setRows(1);
     gridLayout.setHgap(10);
     gridLayout.setVgap(10);
     gridLayout.setColumns(2);
     jPanel = new JPanel();
     jPanel.setLayout(gridLayout);
     jPanel.add(getJButton(), null);
     jPanel.add(getJButton1(), null);
   }
   return jPanel;
 }
  private void setUpTxtPanel() {
    // set up border for text panel
    TitledBorder border = BorderFactory.createTitledBorder("Total orders and costs");
    border.setTitleJustification(TitledBorder.CENTER);

    // set up layout for text panel
    GridLayout txtPanelLayout = new GridLayout(4, 2);
    txtPanelLayout.setHgap(5);
    txtPanelLayout.setVgap(5);
    txtPanel = new JPanel(txtPanelLayout);
    txtPanel.setBorder(border);

    setUpTxtPanelLabels();
  }
示例#15
0
 /**
  * This method initializes legendPanel
  *
  * @return javax.swing.JPanel
  */
 private JPanel getLegendPanel() {
   GridLayout gridLayout = new GridLayout();
   gridLayout.setRows(2);
   gridLayout.setHgap(3);
   gridLayout.setVgap(3);
   gridLayout.setColumns(2);
   JPanel legendPanel = new JPanel();
   legendPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3));
   legendPanel.setLayout(gridLayout);
   addToLegend(legendPanel, "Key was found in base and compare file", Color.white);
   addToLegend(legendPanel, "Key was found in compare but not in base", Color.red);
   addToLegend(legendPanel, "Text for this key was changed but not saved yet", Color.orange);
   addToLegend(legendPanel, "Key was not found in compare file", Color.yellow);
   return legendPanel;
 }
 /**
  * This method initializes jPanel_TitleArea
  *
  * @return javax.swing.JPanel
  */
 private JPanel getJPanel_TitleArea() {
   if (jPanel_TitleArea == null) {
     GridLayout gridLayout = new GridLayout();
     gridLayout.setRows(2);
     gridLayout.setHgap(0);
     gridLayout.setColumns(0);
     gridLayout.setVgap(10);
     jPanel_TitleArea = new JPanel();
     jPanel_TitleArea.setLayout(gridLayout);
     jPanel_TitleArea.setName("jPanel2");
     jPanel_TitleArea.add(jLabel_Title, null);
     jPanel_TitleArea.add(getJPanel_ExplArea1(), null);
   }
   return jPanel_TitleArea;
 }
示例#17
0
  public ServerFrontend() {
    GridLayout gl = new GridLayout(2, 2);
    gl.setVgap(4);
    panel.setLayout(gl);

    addWidgets();

    frame.getContentPane().add(panel, BorderLayout.CENTER);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);

    server = new ProviderServer(12111, 5000);
    startServer();
  }
    /** Initializes all the components of the panel. */
    private void init() {
      final int[] ctrls = my_controls.getControls();
      final String[] ctrl_labels = my_controls.getControlLabels();

      final GridLayout grid = new GridLayout(ctrl_labels.length, NUM_COLUMNS_PER_PLAYER);
      grid.setVgap(VERTICAL_GAP);
      grid.setHgap(HORIZONTAL_GAP);
      setLayout(grid);

      for (int i = 0; i < ctrl_labels.length; i++) {
        final JLabel label = new JLabel(ctrl_labels[i]);
        add(label);
        final JTextField tf = new JTextField(KeyEvent.getKeyText(ctrls[i]));
        setUpTextField(tf, i);
        add(tf);
      }
    }
  /**
   * Erstellt die grafische Oberfläche.
   *
   * @throws Exception
   */
  private void jbInit() throws Exception {
    contentPane = (JPanel) this.getContentPane();
    m_agentLabel.setBorder(BorderFactory.createEtchedBorder());
    m_agentLabel.setMaximumSize(new Dimension(150, 20));
    m_agentLabel.setMinimumSize(new Dimension(150, 20));
    m_agentLabel.setPreferredSize(new Dimension(150, 20));
    m_agentLabel.setToolTipText("Name des Agenten");
    m_agentLabel.setText("Agenten Name:");
    m_gridLayout.setColumns(3);
    m_gridLayout.setHgap(10);
    m_gridLayout.setRows(4);
    m_gridLayout.setVgap(10);
    contentPane.setLayout(m_gridLayout);
    this.setSize(new Dimension(581, 212));
    this.setTitle("Agentenanmeldung");
    contentPane.setMaximumSize(new Dimension(300, 32767));
    contentPane.setMinimumSize(new Dimension(300, 80));
    contentPane.setPreferredSize(new Dimension(300, 80));
    m_agentClass.setBorder(BorderFactory.createEtchedBorder());
    m_agentClass.setText("Klasse des Agenten:");
    m_serverLabel.setBorder(BorderFactory.createEtchedBorder());
    m_serverLabel.setText("Source-Server:");
    m_agentTF.setText("");
    m_roVButton.setBorder(BorderFactory.createRaisedBevelBorder());
    m_roVButton.setActionCommand("Registriere Agent ohne Visualisierung");
    m_roVButton.setText("Registriere Agent ohne Visualisierung");
    m_roVButton.addActionListener(new AgentRegistrationFrame_m_roVButton_actionAdapter(this));
    m_rwVAgentButton.setBorder(BorderFactory.createRaisedBevelBorder());
    m_rwVAgentButton.setText("Registriere Agent mit Visualisierung");
    m_rwVAgentButton.addActionListener(
        new AgentRegistrationFrame_m_rwVAgentButton_actionAdapter(this));

    m_rwVAgentButton.setVisible(false); // später auf true setzten

    m_agentClassCombo = new JComboBox(this.getAgentClasses());
    m_serverTF.setText("http://localhost:2003/");
    contentPane.add(m_agentLabel, null);
    contentPane.add(m_agentTF, null);
    contentPane.add(m_agentClass, null);
    contentPane.add(m_agentClassCombo, null);
    contentPane.add(m_serverLabel, null);
    contentPane.add(m_serverTF, null);
    contentPane.add(m_roVButton, null);
    contentPane.add(m_rwVAgentButton, null);
  }
示例#20
0
 private void preinitGUI() {
   try {
     setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
     this.setResizable(false);
     {
       titleLabel = new JLabel();
       getContentPane().add(titleLabel, BorderLayout.NORTH);
       titleLabel.setFont(new java.awt.Font("Segoe UI", 1, 20));
       titleLabel.setPreferredSize(new java.awt.Dimension(434, 62));
       titleLabel.setHorizontalTextPosition(SwingConstants.CENTER);
       titleLabel.setText("TITOLO");
     }
     {
       buttonContainer = new JPanel();
       FlowLayout buttonContainerLayout = new FlowLayout();
       buttonContainerLayout.setAlignment(FlowLayout.RIGHT);
       buttonContainer.setLayout(buttonContainerLayout);
       getContentPane().add(buttonContainer, BorderLayout.SOUTH);
       {
         cancelButton = new JButton();
         buttonContainer.add(cancelButton);
         cancelButton.setText("Annulla");
         cancelButton.addActionListener(this);
       }
       {
         okButton = new JButton();
         buttonContainer.add(okButton);
         okButton.setText("Ok");
         okButton.addActionListener(this);
       }
     }
     {
       contentPanel = new JPanel();
       GridLayout contentPanelLayout = new GridLayout(1, 1);
       contentPanelLayout.setColumns(1);
       contentPanelLayout.setHgap(5);
       contentPanelLayout.setVgap(5);
       contentPanel.setLayout(contentPanelLayout);
       getContentPane().add(contentPanel, BorderLayout.CENTER);
       contentPanel.setPreferredSize(new java.awt.Dimension(434, 236));
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
示例#21
0
  /**
   * Crée et renvoie le panneau de sprites
   *
   * @return Le panel contenant les sprites
   */
  public JPanel createSpritesPanel() {
    panneauSprites.setLayout(new GridBagLayout());
    panneauSprites.add(
        sprites,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));
    // Création de l'affichage des sprites

    // sprites.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    layoutSprites = new GridLayout();
    layoutSprites.setHgap(0);
    layoutSprites.setVgap(0);
    sprites.setLayout(layoutSprites);
    if (groupe.getButtonCount() <= 0) {
      System.err.println(
          "Erreur dans Selection.Selection(int lc, "
              + "int hc) : pas de dossiers dans le dossier images.");
    } else {
      ((JRadioButton) categories.getComponent(0)).setSelected(true);
      this.afficherSprites(
          new File("images/" + ((JRadioButton) categories.getComponent(0)).getText()));
    }

    // sprites.setLayout(new GridLayout(nbrSprites/nbrColonnes, nbrColonnes,
    // 0, 0));
    repaint();
    return panneauSprites;
  }
示例#22
0
  public CalculatorPanel() {

    result = 0;
    lastCommand = "+";
    ActionListener command = new CommandAction();

    GridLayout layout = new GridLayout(2, 5);
    layout.setHgap(5);
    layout.setVgap(5);

    panel = new JPanel();
    panel.setLayout(layout);
    panel.setPreferredSize(new Dimension(400, 200));

    // add display
    display = new JTextField();
    Command = new JTextField("+");
    firstNumber = new JTextField();
    secondNumber = new JTextField();
    JTextField equal = new JTextField("=");

    equal.setEnabled(false);
    display.setEnabled(false);
    Command.setEnabled(false);

    panel.add(firstNumber);
    panel.add(Command);
    panel.add(secondNumber);
    panel.add(equal);
    panel.add(display);

    addButton("+", command);
    addButton("-", command);
    addButton("*", command);
    addButton("/", command);
    addButton("OK", command);
    add(panel, BorderLayout.CENTER);
  }
示例#23
0
  public AddRaces(JFrame parentFrame, EditDatabase database)
      throws EmployeeDBException, SQLException {
    super(parentFrame);
    setTitle("Add Horse");
    List<Horse> horseName = database.getHorse();
    List<Rider> riderName = database.getRider();

    for (int i = 0; i < 24; i++) {
      strCombHour[i] = new Integer(i + 1).toString();
    }
    for (int i = 0; i < 60; i++) {
      strCombMinute[i] = new Integer(i + 1).toString();
    }

    for (int i = 0; i < 31; i++) {
      strCombDay[i] = new Integer(i + 1).toString();
    }
    for (int i = 0; i < 12; i++) {
      strCombMon[i] = new Integer(i + 1).toString();
    }
    for (int i = 0; i < 50; i++) {
      strCombYear[i] = new Integer(i + 2000).toString();
    }

    final List<JComboBox> listComb = new ArrayList<>();
    final List<JComboBox> riderComb = new ArrayList<>();
    final List<JComboBox> posComb = new ArrayList<>();

    for (int i = 0; i < 7; i++) {
      String[] tmp = {"-", "1", "2", "3", "4", "5", "6", "7"};
      posComb.add(new JComboBox(tmp));
    }

    String[] horse = new String[horseName.size()];
    List<JLabel> labels = new ArrayList<>();
    for (int i = 0; i < 7; i++) {
      labels.add(new JLabel("Kůň:"));
    }

    for (int i = 0; i < 7; i++) {
      JComboBox tmp = new JComboBox<>();
      JComboBox rider = new JComboBox<>();
      for (Horse h : horseName) {
        tmp.addItem(h);
      }
      for (Rider r : riderName) {
        rider.addItem(r);
      }

      listComb.add(tmp);
      riderComb.add(rider);
    }

    lbFirst = new JLabel("Den");
    combList = new JComboBox<String>(strCombDay);

    JLabel lbMonth = new JLabel("Měsíc");
    combListM = new JComboBox<String>(strCombMon);

    JLabel lbYear = new JLabel("Rok");
    combListY = new JComboBox<String>(strCombYear);

    JLabel lbHour = new JLabel("Hodina");
    combListH = new JComboBox<String>(strCombHour);

    JLabel lbMinute = new JLabel("Minuta");
    combListMin = new JComboBox<String>(strCombMinute);

    JLabel lbName = new JLabel("Jméno dostihu: ");
    JLabel lbPlace = new JLabel("Místo dostihu: ");

    lbSecond = new JLabel("Jméno Koně");
    txtFirst = new JTextField();
    txtFirst.setColumns(10);
    txtSecond = new JTextField();
    txtSecond.setColumns(10);

    GroupLayout layout = new GroupLayout(inputPanel);
    inputPanel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(lbMinute)
                    .addComponent(lbHour)
                    .addComponent(lbFirst)
                    .addComponent(lbMonth)
                    .addComponent(lbYear)
                    .addComponent(lbName)
                    .addComponent(lbPlace))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(combListMin)
                    .addComponent(combListH)
                    .addComponent(combList)
                    .addComponent(combListM)
                    .addComponent(combListY)
                    .addComponent(txtFirst)
                    .addComponent(txtSecond))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(labels.get(0))
                    .addComponent(labels.get(1))
                    .addComponent(labels.get(2))
                    .addComponent(labels.get(3))
                    .addComponent(labels.get(4))
                    .addComponent(labels.get(5))
                    .addComponent(labels.get(6)))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(listComb.get(0))
                    .addComponent(listComb.get(1))
                    .addComponent(listComb.get(2))
                    .addComponent(listComb.get(3))
                    .addComponent(listComb.get(4))
                    .addComponent(listComb.get(5))
                    .addComponent(listComb.get(6)))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(riderComb.get(0))
                    .addComponent(riderComb.get(1))
                    .addComponent(riderComb.get(2))
                    .addComponent(riderComb.get(3))
                    .addComponent(riderComb.get(4))
                    .addComponent(riderComb.get(5))
                    .addComponent(riderComb.get(6)))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(posComb.get(0))
                    .addComponent(posComb.get(1))
                    .addComponent(posComb.get(2))
                    .addComponent(posComb.get(3))
                    .addComponent(posComb.get(4))
                    .addComponent(posComb.get(5))
                    .addComponent(posComb.get(6))));

    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(labels.get(0))
                    .addComponent(listComb.get(0))
                    .addComponent(riderComb.get(0))
                    .addComponent(posComb.get(0))
                    .addComponent(lbMinute)
                    .addComponent(combListMin))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(labels.get(1))
                    .addComponent(listComb.get(1))
                    .addComponent(riderComb.get(1))
                    .addComponent(posComb.get(1))
                    .addComponent(lbHour)
                    .addComponent(
                        combListH,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(labels.get(2))
                    .addComponent(listComb.get(2))
                    .addComponent(riderComb.get(2))
                    .addComponent(posComb.get(2))
                    .addComponent(lbFirst)
                    .addComponent(
                        combList,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(labels.get(3))
                    .addComponent(riderComb.get(3))
                    .addComponent(listComb.get(3))
                    .addComponent(posComb.get(3))
                    .addComponent(lbMonth)
                    .addComponent(
                        combListM,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(labels.get(4))
                    .addComponent(riderComb.get(4))
                    .addComponent(listComb.get(4))
                    .addComponent(posComb.get(4))
                    .addComponent(lbYear)
                    .addComponent(
                        combListY,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(labels.get(5))
                    .addComponent(listComb.get(5))
                    .addComponent(riderComb.get(5))
                    .addComponent(posComb.get(5))
                    .addComponent(lbName)
                    .addComponent(
                        txtFirst,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE))
            .addGroup(
                layout
                    .createParallelGroup()
                    .addComponent(labels.get(6))
                    .addComponent(riderComb.get(6))
                    .addComponent(listComb.get(6))
                    .addComponent(posComb.get(6))
                    .addComponent(lbPlace)
                    .addComponent(
                        txtSecond,
                        GroupLayout.PREFERRED_SIZE,
                        GroupLayout.DEFAULT_SIZE,
                        GroupLayout.PREFERRED_SIZE)));

    inputPanel.add(combList);
    inputPanel.add(lbFirst);

    inputPanel.add(combListM);
    inputPanel.add(lbMonth);

    inputPanel.add(combListY);
    inputPanel.add(lbYear);

    inputPanel.add(combListH);
    inputPanel.add(lbHour);

    inputPanel.add(combListMin);
    inputPanel.add(lbMinute);

    inputPanel.add(lbName);
    inputPanel.add(txtFirst);
    inputPanel.add(lbPlace);
    inputPanel.add(txtSecond);

    GridLayout btnLayout = new GridLayout(1, 2);
    btnLayout.setHgap(5);
    btnLayout.setVgap(5);

    btnOk = new JButton("Ok");
    btnOk.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {

            myDate =
                new MyDate(
                    Integer.parseInt((String) combListY.getSelectedItem()),
                    Integer.parseInt((String) combListM.getSelectedItem()),
                    Integer.parseInt((String) combList.getSelectedItem()),
                    Integer.parseInt((String) combListH.getSelectedItem()),
                    Integer.parseInt((String) combListMin.getSelectedItem()));

            for (int i = 0; i < 7; i++) {
              resultHorse.add((Horse) listComb.get(i).getSelectedItem());
              resultRider.add((Rider) riderComb.get(i).getSelectedItem());
              resultPos.add((String) posComb.get(i).getSelectedItem());
            }

            try {
              result1 = txtFirst.getText();
              result2 = txtSecond.getText();
            } catch (Exception e1) {
              result2 = null;
              System.out.println(e1);
            }
            setVisible(false);
          }
        });

    btnCancel = new JButton("Cancel");
    btnCancel.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            result1 = null;
            result2 = null;
            setVisible(false);
          }
        });

    buttonPanel.setLayout(btnLayout);
    buttonPanel.add(btnOk);
    buttonPanel.add(btnCancel);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(inputPanel, BorderLayout.CENTER);
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    pack();
  }
  /**
   * Constructs a {@link MarvinPerformanceWindow}
   *
   * @param a_registry {@link MarvinPerformanceRegistry}
   */
  public MarvinPerformanceWindow(MarvinPerformanceRegistry a_registry) {
    super("Performance statistics");
    setSize(800, 580);
    // Panels
    mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());

    rightPanel = new JPanel();
    rightPanelLayout = new GridLayout(2, 1);
    rightPanelLayout.setVgap(30);
    rightPanel.setLayout(rightPanelLayout);
    tempPanel = new JPanel();
    tempPanel.setLayout(new FlowLayout());
    tempPanel.add(rightPanel);
    mainPanel.add(tempPanel, BorderLayout.EAST);

    leftPanel = new JPanel();
    leftPanelLayout = new GridLayout(0, 1);
    leftPanelLayout.setVgap(30);
    leftPanel.setLayout(leftPanelLayout);
    tempPanel = new JPanel();
    tempPanel.setLayout(new FlowLayout());
    tempPanel.add(leftPanel);
    mainPanel.add(tempPanel, BorderLayout.WEST);

    getContentPane().add(mainPanel);

    MarvinPerformanceEntry l_entry;
    MarvinPerformanceEvent l_event;

    tempTimeBarChart = new MarvinBarChart("Process time (milliseconds):");
    tempTimeBarChart.setBarsColor(MarvinBarChart.SEQUENTIAL_BAR_COLOR);

    tempStepsBarChart = new MarvinBarChart("Procedures:");
    tempStepsBarChart.setBarsColor(MarvinBarChart.SEQUENTIAL_BAR_COLOR);

    for (int i = 0; i < a_registry.size(); i++) {
      l_entry = a_registry.getEntry(i);

      leftPanelLayout.setRows(leftPanelLayout.getRows() + 1);

      tempPanel = new JPanel();
      tempPanel.setLayout(new GridLayout(3, 1));
      tempPanel.add(new JLabel(" Plugin name: " + l_entry.getName()));
      tempPanel.add(new JLabel(" Duration: " + l_entry.getTotalTime() + " ms."));
      tempPanel.add(new JLabel(" Procedures: " + l_entry.getCurrentStep()));
      leftPanel.add(tempPanel);

      for (int w = 0; w < l_entry.size(); w++) {
        l_event = l_entry.getEvent(w);
        leftPanelLayout.setRows(leftPanelLayout.getRows() + 1);

        tempTimeBarChart.addEntry(
            new MarvinBarChartEntry(l_event.getName(), l_event.getTotalTime(), Color.blue));
        tempStepsBarChart.addEntry(
            new MarvinBarChartEntry(l_event.getName(), l_event.getCurrentStep(), Color.blue));

        tempPanel = new JPanel();
        tempPanel.setLayout(new GridLayout(3, 1));
        tempPanel.add(new JLabel(" Step name: " + l_event.getName()));
        tempPanel.add(new JLabel(" Duration: " + l_event.getTotalTime() + " ms."));
        tempPanel.add(new JLabel(" Procedures: " + l_event.getCurrentStep()));
        leftPanel.add(tempPanel);
      }
    }

    rightPanel.add(new JLabel(new ImageIcon(tempTimeBarChart.getImage(500, 250))));
    rightPanel.add(new JLabel(new ImageIcon(tempStepsBarChart.getImage(500, 250))));

    setVisible(true);
  }
 public GraphPanel() {
   gridLayout.setHgap(2);
   gridLayout.setVgap(2);
   setLayout(gridLayout);
 }
示例#26
0
  /** @param parent Parent Frame of this panel */
  public AdminView(tester parent) {
    padre = parent;
    try { // Start Setting the look and feel to nimbus
      for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (Exception e) {
      // If Nimbus is not available, set gui to CrossPlatform
      try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
      } catch (ClassNotFoundException a) {
        // TODO Auto-generated catch block
      } catch (InstantiationException b) {
        // TODO Auto-generated catch block
      } catch (IllegalAccessException c) {
        // TODO Auto-generated catch block
      } catch (UnsupportedLookAndFeelException d) {
        // TODO Auto-generated catch block
      }
    }
    try { // start up the controller
      control = new Controller();
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
    } catch (IOException e) {
      // TODO Auto-generated catch block
    }
    // make the panels
    JPanel total = new JPanel(new BorderLayout());
    JPanel test = new JPanel();
    JPanel users = new JPanel();
    JPanel info = new JPanel();
    // set any gaps i want
    Buttons.setVgap(10);
    Info.setHgap(20);
    // set layouts for the panels
    users.setLayout(List);
    test.setLayout(Buttons);
    info.setLayout(Info);
    // Set up the list
    listModel = new DefaultListModel<String>();
    userList = new JList<String>(listModel);
    userList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // only one thing at a time
    userList.setVisibleRowCount(10);
    populateUsers();
    // userList.setPreferredSize(new Dimension(200,200));

    userList.setLayoutOrientation(JList.VERTICAL); // lists items vertically
    // put a scroll pane all up in
    JScrollPane userscroller =
        new JScrollPane(
            userList,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    userscroller.setPreferredSize(new Dimension(200, 200));

    // Initialize buttons
    add_user = new JButton("Add User");
    add_user.setPreferredSize(new Dimension(100, 20));
    delete_user = new JButton("Delete User");
    delete_user.setPreferredSize(new Dimension(100, 20));
    logout = new JButton("Logout");
    logout.setPreferredSize(new Dimension(100, 20));
    // add listeners
    add_user.addActionListener(this);
    add_user.setActionCommand("Add");
    delete_user.addActionListener(this);
    delete_user.setActionCommand("Delete");
    logout.addActionListener(this);
    logout.setActionCommand("Logout");
    // add to panels
    test.add(add_user);
    test.add(delete_user);
    test.add(logout);
    test.setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10)); // spacing!
    users.add(userscroller);
    users.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 10)); // spacing!

    total.add(users); // everything is contained in total
    total.add(test, BorderLayout.WEST);
    total.setBorder(BorderFactory.createRaisedSoftBevelBorder()); // nice border
    total.setBorder(BorderFactory.createTitledBorder("Welcome Admin"));
    add(total);
  }
示例#27
0
  /*
   * call in constructor only
   */
  private JPanel createTable() {

    JPanel outerPanel = new JPanel();
    outerPanel.setLayout(new BorderLayout());

    outerPanel.setOpaque(true);
    outerPanel.setBackground(Color.black);

    JLabel title = new JLabel("Geheugen");
    title.setOpaque(true);
    title.setForeground(Color.white);
    title.setBackground(Color.blue);
    title.setHorizontalAlignment(JLabel.CENTER);

    outerPanel.add(title, BorderLayout.NORTH);

    JPanel panel = new JPanel();
    GridLayout layout = new GridLayout(_realSize + 1, 3);
    layout.setHgap(3);
    layout.setVgap(3);
    panel.setLayout(layout);
    panel.setForeground(Color.white);
    panel.setBackground(Color.black);

    JLabel labelLabel = new JLabel("Label");
    JLabel addressLabel = new JLabel("Adres");
    JLabel contentLabel = new JLabel("Inhoud");
    labelLabel.setOpaque(true);
    labelLabel.setForeground(Color.white);
    labelLabel.setBackground(Color.blue);
    labelLabel.setHorizontalAlignment(JLabel.CENTER);
    addressLabel.setOpaque(true);
    addressLabel.setForeground(Color.white);
    addressLabel.setBackground(Color.blue);
    addressLabel.setHorizontalAlignment(JLabel.CENTER);
    contentLabel.setOpaque(true);
    contentLabel.setForeground(Color.white);
    contentLabel.setBackground(Color.blue);
    contentLabel.setHorizontalAlignment(JLabel.CENTER);
    panel.add(labelLabel);
    panel.add(addressLabel);
    panel.add(contentLabel);

    _labels = new JLabel[_realSize];
    _addresses = new JLabel[_realSize];
    _values = new JLabel[_realSize];

    for (int i = 0; i < _realSize; i++) {
      _labels[i] = new JLabel();
      _labels[i].setForeground(Color.white);
      _labels[i].setHorizontalAlignment(JLabel.CENTER);
      panel.add(_labels[i]);
      _addresses[i] = new JLabel("");
      // _addresses[i].setOpaque(true);
      // _addresses[i].setBackground(Color.gray);
      _addresses[i].setForeground(Color.white);
      _addresses[i].setHorizontalAlignment(JLabel.CENTER);
      panel.add(_addresses[i]);
      _values[i] = new JLabel("");
      _values[i].setOpaque(true);
      _values[i].setBackground(Color.gray);
      _values[i].setForeground(Color.white);
      _values[i].setHorizontalAlignment(JLabel.CENTER);
      panel.add(_values[i]);
    }

    outerPanel.add(panel, BorderLayout.CENTER);

    return outerPanel;
  }
示例#28
0
  private void buildDialog() {
    Window window = SwingUtilities.windowForComponent(target.getEditComponent());

    dialog = new JDialog(window, "Find / Replace");
    dialog.setModal(false);

    JPanel panel = new JPanel(new BorderLayout());
    findCombo = new JComboBox();
    findCombo.setEditable(true);
    replaceCombo = new JComboBox();
    replaceCombo.setEditable(true);

    // create inputs
    GridLayout gridLayout = new GridLayout(2, 2);
    gridLayout.setVgap(5);
    JPanel inputPanel = new JPanel(gridLayout);
    inputPanel.add(new JLabel("Find:"));
    inputPanel.add(findCombo);
    inputPanel.add(new JLabel("Replace with:"));
    inputPanel.add(replaceCombo);
    inputPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));

    // create direction panel
    ButtonGroup directionGroup = new ButtonGroup();
    forwardButton = new JRadioButton("Forward", true);
    forwardButton.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    directionGroup.add(forwardButton);
    backwardButton = new JRadioButton("Backward");
    backwardButton.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    directionGroup.add(backwardButton);

    JPanel directionPanel = new JPanel(new GridLayout(2, 1));
    directionPanel.add(forwardButton);
    directionPanel.add(backwardButton);
    directionPanel.setBorder(BorderFactory.createTitledBorder("Direction"));

    // create scope panel
    ButtonGroup scopeGroup = new ButtonGroup();
    allButton = new JRadioButton("All", true);
    allButton.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    selectedLinesButton = new JRadioButton("Selected Lines");
    selectedLinesButton.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    scopeGroup.add(allButton);
    scopeGroup.add(selectedLinesButton);

    JPanel scopePanel = new JPanel(new GridLayout(2, 1));
    scopePanel.add(allButton);
    scopePanel.add(selectedLinesButton);
    scopePanel.setBorder(BorderFactory.createTitledBorder("Scope"));

    // create options
    caseCheck = new JCheckBox("Case Sensitive");
    caseCheck.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    wholeWordCheck = new JCheckBox("Whole Word");
    wholeWordCheck.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    wrapCheck = new JCheckBox("Wrap Search");
    wrapCheck.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    JPanel optionsPanel = new JPanel(new GridLayout(3, 1));
    optionsPanel.add(caseCheck);
    optionsPanel.add(wholeWordCheck);
    optionsPanel.add(wrapCheck);
    optionsPanel.setBorder(BorderFactory.createTitledBorder("Options"));

    // create panel with options
    JPanel options = new JPanel(new GridLayout(1, 2));

    JPanel radios = new JPanel(new GridLayout(2, 1));
    radios.add(directionPanel);
    radios.add(scopePanel);

    options.add(optionsPanel);
    options.add(radios);
    options.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8));

    // create buttons
    ButtonBarBuilder builder = new ButtonBarBuilder();
    findButton = new JButton(new FindAction());
    builder.addFixed(findButton);
    builder.addRelatedGap();
    replaceButton = new JButton(new ReplaceAction());
    builder.addFixed(replaceButton);
    builder.addRelatedGap();
    replaceAllButton = new JButton(new ReplaceAllAction());
    builder.addFixed(replaceAllButton);
    builder.addUnrelatedGap();
    builder.addFixed(new JButton(new CloseAction()));
    builder.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));

    // tie it up!
    panel.add(inputPanel, BorderLayout.NORTH);
    panel.add(options, BorderLayout.CENTER);
    panel.add(builder.getPanel(), BorderLayout.SOUTH);

    dialog.getContentPane().add(panel);
    dialog.pack();
    UISupport.initDialogActions(dialog, null, findButton);
  }
  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
  public ImportDialog(boolean targetIsARow, String fileName) {
    Boolean targetIsARow1 = targetIsARow;
    contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout());
    setContentPane(contentPane);
    JPanel panel3 = new JPanel();
    panel3.setBackground(new Color(-1643275));
    JLabel labelHeadline = new JLabel(Localization.lang("Import_Metadata_from:"));
    labelHeadline.setFont(new Font(labelHeadline.getFont().getName(), Font.BOLD, 14));
    JLabel labelSubHeadline =
        new JLabel(Localization.lang("Choose_the_source_for_the_metadata_import"));
    labelSubHeadline.setFont(
        new Font(labelSubHeadline.getFont().getName(), labelSubHeadline.getFont().getStyle(), 13));
    JLabel labelFileName = new JLabel();
    labelFileName.setFont(new Font(labelHeadline.getFont().getName(), Font.BOLD, 14));
    JPanel headLinePanel = new JPanel();
    headLinePanel.add(labelHeadline);
    headLinePanel.add(labelFileName);
    headLinePanel.setBackground(new Color(-1643275));
    GridLayout gl = new GridLayout(2, 1);
    gl.setVgap(10);
    gl.setHgap(10);
    panel3.setLayout(gl);
    panel3.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    panel3.add(headLinePanel);
    panel3.add(labelSubHeadline);
    radioButtonNoMeta = new JRadioButton(Localization.lang("Create_blank_entry_linking_the_PDF"));
    radioButtonXmp = new JRadioButton(Localization.lang("Create_entry_based_on_XMP_data"));
    radioButtonPDFcontent = new JRadioButton(Localization.lang("Create_entry_based_on_content"));
    radioButtononlyAttachPDF = new JRadioButton(Localization.lang("Only_attach_PDF"));
    JButton buttonOK = new JButton(Localization.lang("Ok"));
    JButton buttonCancel = new JButton(Localization.lang("Cancel"));
    checkBoxDoNotShowAgain =
        new JCheckBox(Localization.lang("Do not show this box again for this import"));
    useDefaultPDFImportStyle =
        new JCheckBox(
            Localization.lang("Always use this PDF import style (and do not ask for each import)"));
    DefaultFormBuilder b =
        new DefaultFormBuilder(new FormLayout("left:pref, 5dlu, left:pref:grow", ""));
    b.appendSeparator(Localization.lang("Create New Entry"));
    b.append(radioButtonNoMeta, 3);
    b.append(radioButtonXmp, 3);
    b.append(radioButtonPDFcontent, 3);
    b.appendSeparator(Localization.lang("Update_Existing_Entry"));
    b.append(radioButtononlyAttachPDF, 3);
    b.nextLine();
    b.append(checkBoxDoNotShowAgain);
    b.append(useDefaultPDFImportStyle);
    b.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    ButtonBarBuilder bb = new ButtonBarBuilder();
    bb.addGlue();
    bb.addButton(buttonOK);
    bb.addButton(buttonCancel);
    bb.addGlue();
    bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    contentPane.add(panel3, BorderLayout.NORTH);
    contentPane.add(b.getPanel(), BorderLayout.CENTER);
    contentPane.add(bb.getPanel(), BorderLayout.SOUTH);

    if (!targetIsARow1) {
      this.radioButtononlyAttachPDF.setEnabled(false);
    }
    String name = new File(fileName).getName();
    if (name.length() < 34) {
      labelFileName.setText(name);
    } else {
      labelFileName.setText(new File(fileName).getName().substring(0, 33) + "...");
    }
    this.setTitle(Localization.lang("Import_Metadata_From_PDF"));

    setModal(true);
    getRootPane().setDefaultButton(buttonOK);

    // only one of the radio buttons may be selected.
    ButtonGroup bg = new ButtonGroup();
    bg.add(radioButtonNoMeta);
    bg.add(radioButtonXmp);
    bg.add(radioButtonPDFcontent);
    bg.add(radioButtononlyAttachPDF);

    buttonOK.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            onOK();
          }
        });

    buttonCancel.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            onCancel();
          }
        });

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(
        new WindowAdapter() {

          @Override
          public void windowClosing(WindowEvent e) {
            onCancel();
          }
        });

    contentPane.registerKeyboardAction(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            onCancel();
          }
        },
        KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
        JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    switch (Globals.prefs.getInt(ImportSettingsTab.PREF_IMPORT_DEFAULT_PDF_IMPORT_STYLE)) {
      case NOMETA:
        radioButtonNoMeta.setSelected(true);
        break;
      case XMP:
        radioButtonXmp.setSelected(true);
        break;
      case CONTENT:
        radioButtonPDFcontent.setSelected(true);
        break;
      case ONLYATTACH:
        radioButtononlyAttachPDF.setSelected(true);
        break;
      default:
        // fallback
        radioButtonPDFcontent.setSelected(true);
        break;
    }

    this.setSize(555, 371);
  }